client: Expand proxy_property_str_completion

This function now takes an extra argument 'extra_interface'.  When
non-NULL, the property match is furthered filtered by checking whether
the proxy_interface on the given path also contains an interface of type
'extra_interface'
This commit is contained in:
Denis Kenzior 2018-09-14 03:45:14 -05:00
parent 5aa5e2fef6
commit 48870d0911
5 changed files with 25 additions and 11 deletions

View File

@ -332,7 +332,7 @@ static char *family_arg_completion(const char *text, int state)
return proxy_property_str_completion(&adapter_interface_type,
match_by_partial_name, "Name",
text, state);
text, state, NULL);
}
static char *entity_arg_completion(const char *text, int state)

View File

@ -143,7 +143,8 @@ static void interface_update_properties(struct proxy_interface *proxy,
char *proxy_property_str_completion(const struct proxy_interface_type *type,
proxy_property_match_func_t function,
const char *property_name,
const void *value, int state)
const void *value, int state,
const char *extra_interface)
{
static struct l_queue *match;
static const struct l_queue_entry *entry;
@ -163,6 +164,15 @@ char *proxy_property_str_completion(const struct proxy_interface_type *type,
entry = entry->next;
if (extra_interface) {
const char *path = proxy_interface_get_path(proxy);
const struct proxy_interface *extra =
proxy_interface_find(extra_interface, path);
if (!extra)
continue;
}
str = proxy_interface_property_tostr(proxy, property_name);
if (!str)
return NULL;

View File

@ -93,7 +93,8 @@ void proxy_properties_display(const struct proxy_interface *proxy,
char *proxy_property_str_completion(const struct proxy_interface_type *type,
proxy_property_match_func_t function,
const char *property_name,
const void *value, int state);
const void *value, int state,
const char *extra_interface);
void *proxy_interface_get_data(const struct proxy_interface *proxy);
const char *proxy_interface_get_interface(const struct proxy_interface *proxy);

View File

@ -893,22 +893,25 @@ static const struct command device_commands[] = {
char *device_wsc_family_arg_completion(const char *text, int state)
{
return proxy_property_str_completion(&device_interface_type,
match_by_partial_name_and_wsc,
"Name", text, state);
match_by_partial_name,
"Name", text, state,
IWD_WSC_INTERFACE);
}
char *device_ap_family_arg_completion(const char *text, int state)
{
return proxy_property_str_completion(&device_interface_type,
match_by_partial_name_and_ap,
"Name", text, state);
match_by_partial_name,
"Name", text, state,
IWD_ACCESS_POINT_INTERFACE);
}
char *device_ad_hoc_family_arg_completion(const char *text, int state)
{
return proxy_property_str_completion(&device_interface_type,
match_by_partial_name_and_ad_hoc,
"Name", text, state);
match_by_partial_name,
"Name", text, state,
IWD_AD_HOC_INTERFACE);
}
static char *family_arg_completion(const char *text, int state)
@ -939,7 +942,7 @@ static char *family_arg_completion(const char *text, int state)
return proxy_property_str_completion(&device_interface_type,
match_by_partial_name, "Name",
text, state);
text, state, NULL);
}
static char *entity_arg_completion(const char *text, int state)

View File

@ -225,7 +225,7 @@ char *network_name_completion(const struct proxy_interface *device,
return proxy_property_str_completion(&network_interface_type,
match_by_partial_name, "Name",
&params, state);
&params, state, NULL);
}
struct network_search_parameters {