[telepathy-mission-control/master] _mcd_client_proxy_add_cap_tokens: move mcd_client_add_cap_tokens to McdClientProxy

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Sep 22 06:07:31 PDT 2009


---
 src/mcd-client-priv.h |    2 ++
 src/mcd-client.c      |   23 +++++++++++++++++++++++
 src/mcd-dispatcher.c  |   32 ++++----------------------------
 3 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/src/mcd-client-priv.h b/src/mcd-client-priv.h
index 11c1339..d06ce6a 100644
--- a/src/mcd-client-priv.h
+++ b/src/mcd-client-priv.h
@@ -110,6 +110,8 @@ G_GNUC_INTERNAL void _mcd_client_proxy_take_handler_filters
 G_GNUC_INTERNAL void _mcd_client_proxy_set_bypass_approval
     (McdClientProxy *self, gboolean bypass);
 
+G_GNUC_INTERNAL void _mcd_client_proxy_add_cap_tokens (McdClientProxy *self,
+    const gchar * const *cap_tokens);
 G_GNUC_INTERNAL void _mcd_client_proxy_clear_capability_tokens
     (McdClientProxy *self);
 G_GNUC_INTERNAL TpHandleSet *_mcd_client_proxy_peek_capability_tokens
diff --git a/src/mcd-client.c b/src/mcd-client.c
index cefb368..3f88628 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -137,6 +137,29 @@ finish:
     return absolute_filepath;
 }
 
+/* This is NULL-safe for the last argument, for ease of use with
+ * tp_asv_get_boxed */
+void
+_mcd_client_proxy_add_cap_tokens (McdClientProxy *self,
+                                  const gchar * const *cap_tokens)
+{
+    guint i;
+
+    g_return_if_fail (MCD_IS_CLIENT_PROXY (self));
+
+    if (cap_tokens == NULL)
+        return;
+
+    for (i = 0; cap_tokens[i] != NULL; i++)
+    {
+        TpHandle handle = tp_handle_ensure (self->priv->string_pool,
+                                            cap_tokens[i], NULL, NULL);
+
+        tp_handle_set_add (self->priv->capability_tokens, handle);
+        tp_handle_unref (self->priv->string_pool, handle);
+    }
+}
+
 static void
 _mcd_client_proxy_init (McdClientProxy *self)
 {
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 2f907a1..cf1de64 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -2128,29 +2128,6 @@ finally:
     mcd_dispatcher_release_startup_lock (self);
 }
 
-/* This is NULL-safe for the last argument, for ease of use with
- * tp_asv_get_boxed */
-static void
-mcd_client_add_cap_tokens (McdClientProxy *client,
-                           TpHandleRepoIface *string_pool,
-                           const gchar * const *cap_tokens)
-{
-    guint i;
-
-    if (cap_tokens == NULL)
-        return;
-
-    for (i = 0; cap_tokens[i] != NULL; i++)
-    {
-        TpHandle handle = tp_handle_ensure (string_pool,
-                                            cap_tokens[i], NULL, NULL);
-
-        tp_handle_set_add (
-            _mcd_client_proxy_peek_capability_tokens (client), handle);
-        tp_handle_unref (string_pool, handle);
-    }
-}
-
 static void
 mcd_dispatcher_update_client_caps (McdDispatcher *self,
                                    McdClientProxy *client)
@@ -2236,9 +2213,8 @@ handler_get_all_cb (TpProxy *proxy,
     _mcd_client_proxy_set_bypass_approval (client, bypass);
     DEBUG ("%s has BypassApproval=%c", bus_name, bypass ? 'T' : 'F');
 
-    mcd_client_add_cap_tokens (client, self->priv->string_pool,
-                               tp_asv_get_boxed (properties, "Capabilities",
-                                                 G_TYPE_STRV));
+    _mcd_client_proxy_add_cap_tokens (client,
+        tp_asv_get_boxed (properties, "Capabilities", G_TYPE_STRV));
 
     channels = tp_asv_get_boxed (properties, "HandledChannels",
                                  TP_ARRAY_TYPE_OBJECT_PATH_LIST);
@@ -2481,8 +2457,8 @@ parse_client_file (McdClientProxy *client,
                                       TP_IFACE_CLIENT_HANDLER ".Capabilities",
                                       NULL,
                                       NULL);
-    mcd_client_add_cap_tokens (client, string_pool,
-                               (const gchar * const *) cap_tokens);
+    _mcd_client_proxy_add_cap_tokens (client,
+                                      (const gchar * const *) cap_tokens);
     g_strfreev (cap_tokens);
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list