From 2a5cbc3c1d4cb3532a4bb962d966f1f2d2645da7 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 10 May 2012 15:20:02 +0100 Subject: [PATCH 1/7] _mcd_client_proxy_add_cap_tokens: switch from "add" to "set" semantics In both the cases where it's called (when we get a reply to GetAll, and when we've parsed a .client file), we actually want to take the new set, not union it with an existing set. Also, this will be easier to deal with when we stop (ab)using handles for this. --- src/mcd-client.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mcd-client.c b/src/mcd-client.c index 90a08ba..1e1ec51 100644 --- a/src/mcd-client.c +++ b/src/mcd-client.c @@ -330,8 +330,8 @@ parse_client_filter (GKeyFile *file, const gchar *group) return filter; } -static void _mcd_client_proxy_add_cap_tokens (McdClientProxy *self, - const gchar * const *cap_tokens); +static void _mcd_client_proxy_set_cap_tokens (McdClientProxy *self, + GStrv cap_tokens); static void _mcd_client_proxy_add_interfaces (McdClientProxy *self, const gchar * const *interfaces); @@ -422,8 +422,7 @@ parse_client_file (McdClientProxy *client, TP_IFACE_CLIENT_HANDLER ".Capabilities", NULL, NULL); - _mcd_client_proxy_add_cap_tokens (client, - (const gchar * const *) cap_tokens); + _mcd_client_proxy_set_cap_tokens (client, cap_tokens); g_strfreev (cap_tokens); } @@ -522,11 +521,13 @@ _mcd_client_proxy_set_filters (McdClientProxy *client, /* This is NULL-safe for the last argument, for ease of use with * tp_asv_get_boxed */ static void -_mcd_client_proxy_add_cap_tokens (McdClientProxy *self, - const gchar * const *cap_tokens) +_mcd_client_proxy_set_cap_tokens (McdClientProxy *self, + GStrv cap_tokens) { guint i; + tp_handle_set_clear (self->priv->capability_tokens); + if (cap_tokens == NULL) return; @@ -691,7 +692,7 @@ _mcd_client_proxy_handler_get_all_cb (TpProxy *proxy, * any capabilities */ if (self->priv->unique_name[0] != '\0' || self->priv->activatable) { - _mcd_client_proxy_add_cap_tokens (self, + _mcd_client_proxy_set_cap_tokens (self, tp_asv_get_boxed (properties, "Capabilities", G_TYPE_STRV)); g_signal_emit (self, signals[S_HANDLER_CAPABILITIES_CHANGED], 0); } -- 1.7.10