telepathy-mission-control: _mcd_client_proxy_add_cap_tokens: switch from " add" to "set" semantics

Simon McVittie smcv at kemper.freedesktop.org
Mon May 14 07:29:53 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 42f20c1472f0073b320b860e1f868817cb6c3bb5
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=42f20c1472f0073b320b860e1f868817cb6c3bb5

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu May 10 15:20:02 2012 +0100

_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.

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=49753

---

 src/mcd-client.c |   15 ++++++++-------
 1 files 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);
     }



More information about the telepathy-commits mailing list