mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-21 22:09:23 +01:00
client: separate property header and values into two functions
There are certain cases where we may not want to display the entire header for a given set of properties. For example displaying a list of proxy interfaces. Add finer control by separating out the header and the prop/value display into two functions.
This commit is contained in:
parent
b31e298df4
commit
a7d8b9a068
@ -47,10 +47,10 @@ static struct l_dbus *dbus;
|
|||||||
static struct l_queue *proxy_interfaces;
|
static struct l_queue *proxy_interfaces;
|
||||||
static struct l_queue *proxy_interface_types;
|
static struct l_queue *proxy_interface_types;
|
||||||
|
|
||||||
void proxy_properties_display(const struct proxy_interface *proxy,
|
void proxy_properties_display_inline(const struct proxy_interface *proxy,
|
||||||
const char *caption, const char *margin,
|
const char *margin,
|
||||||
unsigned int name_column_width,
|
unsigned int name_column_width,
|
||||||
unsigned int value_column_width)
|
unsigned int value_column_width)
|
||||||
{
|
{
|
||||||
const void *data;
|
const void *data;
|
||||||
const struct proxy_interface_property *properties;
|
const struct proxy_interface_property *properties;
|
||||||
@ -59,11 +59,6 @@ void proxy_properties_display(const struct proxy_interface *proxy,
|
|||||||
if (!proxy->type->properties)
|
if (!proxy->type->properties)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
display_table_header(caption, "%s%-*s %-*s %-*s", margin,
|
|
||||||
8, "Settable",
|
|
||||||
name_column_width, "Property",
|
|
||||||
value_column_width, "Value");
|
|
||||||
|
|
||||||
data = proxy_interface_get_data(proxy);
|
data = proxy_interface_get_data(proxy);
|
||||||
properties = proxy->type->properties;
|
properties = proxy->type->properties;
|
||||||
|
|
||||||
@ -82,6 +77,31 @@ void proxy_properties_display(const struct proxy_interface *proxy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void proxy_properties_display_header(const char *caption, const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width)
|
||||||
|
{
|
||||||
|
display_table_header(caption, "%s%-*s %-*s %-*s", margin,
|
||||||
|
8, "Settable",
|
||||||
|
name_column_width, "Property",
|
||||||
|
value_column_width, "Value");
|
||||||
|
}
|
||||||
|
|
||||||
|
void proxy_properties_display(const struct proxy_interface *proxy,
|
||||||
|
const char *caption, const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width)
|
||||||
|
{
|
||||||
|
if (!proxy->type->properties)
|
||||||
|
return;
|
||||||
|
|
||||||
|
proxy_properties_display_header(caption, margin, name_column_width,
|
||||||
|
value_column_width);
|
||||||
|
|
||||||
|
proxy_properties_display_inline(proxy, margin, name_column_width,
|
||||||
|
value_column_width);
|
||||||
|
}
|
||||||
|
|
||||||
static const void *proxy_interface_property_tostr(
|
static const void *proxy_interface_property_tostr(
|
||||||
const struct proxy_interface *proxy,
|
const struct proxy_interface *proxy,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
@ -95,6 +95,13 @@ void proxy_properties_display(const struct proxy_interface *proxy,
|
|||||||
const char *caption, const char *margin,
|
const char *caption, const char *margin,
|
||||||
unsigned int name_column_width,
|
unsigned int name_column_width,
|
||||||
unsigned int value_column_width);
|
unsigned int value_column_width);
|
||||||
|
void proxy_properties_display_inline(const struct proxy_interface *proxy,
|
||||||
|
const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width);
|
||||||
|
void proxy_properties_display_header(const char *caption, const char *margin,
|
||||||
|
unsigned int name_column_width,
|
||||||
|
unsigned int value_column_width);
|
||||||
|
|
||||||
char *proxy_property_str_completion(const struct proxy_interface_type *type,
|
char *proxy_property_str_completion(const struct proxy_interface_type *type,
|
||||||
proxy_property_match_func_t function,
|
proxy_property_match_func_t function,
|
||||||
|
Loading…
Reference in New Issue
Block a user