commit 48870d091111947ce664b8043feec841e0d2febe
parent 5aa5e2fef606456e4e5ce3a6a9b5d826ba31e2d4
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 14 Sep 2018 03:45:14 -0500
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'
Diffstat:
5 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/client/adapter.c b/client/adapter.c
@@ -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)
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
@@ -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;
diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
@@ -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);
diff --git a/client/device.c b/client/device.c
@@ -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)
diff --git a/client/network.c b/client/network.c
@@ -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",
- ¶ms, state);
+ ¶ms, state, NULL);
}
struct network_search_parameters {