[telepathy-mission-control/master] _mcd_client_proxy_set_channel_filters: factor out most of McdDispatcher's get_channel_filter_cb

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


---
 src/mcd-client-priv.h |    4 ++--
 src/mcd-client.c      |   26 +++++++++++++++++++++++++-
 src/mcd-dispatcher.c  |   19 +++----------------
 3 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/src/mcd-client-priv.h b/src/mcd-client-priv.h
index 5aa5d9e..996454a 100644
--- a/src/mcd-client-priv.h
+++ b/src/mcd-client-priv.h
@@ -120,8 +120,8 @@ typedef enum
     MCD_CLIENT_OBSERVER
 } McdClientInterface;
 
-G_GNUC_INTERNAL void _mcd_client_proxy_set_filters (McdClientProxy *client,
-    McdClientInterface interface, GPtrArray *filters);
+G_GNUC_INTERNAL void _mcd_client_proxy_set_channel_filters (McdClientProxy *self,
+    const GValue *value, const GError *error, McdClientInterface iface);
 
 G_GNUC_INTERNAL gboolean _mcd_client_proxy_set_handler_properties (
     McdClientProxy *client, GHashTable *properties, const GError *error,
diff --git a/src/mcd-client.c b/src/mcd-client.c
index 50160ce..6d8b59c 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -352,7 +352,7 @@ parse_client_file (McdClientProxy *client,
     g_strfreev (cap_tokens);
 }
 
-void
+static void
 _mcd_client_proxy_set_filters (McdClientProxy *client,
                                McdClientInterface interface,
                                GPtrArray *filters)
@@ -590,6 +590,30 @@ _mcd_client_proxy_set_handler_properties (McdClientProxy *self,
     return TRUE;
 }
 
+void
+_mcd_client_proxy_set_channel_filters (McdClientProxy *self,
+                                       const GValue *value,
+                                       const GError *error,
+                                       McdClientInterface iface)
+{
+    if (error != NULL)
+    {
+        DEBUG ("error getting a filter list for client %s: %s #%d: %s",
+               tp_proxy_get_object_path (self),
+               g_quark_to_string (error->domain), error->code, error->message);
+        return;
+    }
+
+    if (!G_VALUE_HOLDS (value, TP_ARRAY_TYPE_STRING_VARIANT_MAP_LIST))
+    {
+        DEBUG ("wrong type for filter property on client %s: %s",
+               tp_proxy_get_object_path (self), G_VALUE_TYPE_NAME (value));
+        return;
+    }
+
+    _mcd_client_proxy_set_filters (self, iface, g_value_get_boxed (value));
+}
+
 gboolean
 _mcd_client_proxy_parse_client_file (McdClientProxy *self)
 {
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 427444a..c7c1360 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1793,23 +1793,10 @@ get_channel_filter_cb (TpProxy *proxy,
         goto finally;
     }
 
-    if (error != NULL)
-    {
-        DEBUG ("error getting a filter list for client %s: %s #%d: %s",
-               tp_proxy_get_object_path (proxy),
-               g_quark_to_string (error->domain), error->code, error->message);
-        goto finally;
-    }
-
-    if (!G_VALUE_HOLDS (value, TP_ARRAY_TYPE_STRING_VARIANT_MAP_LIST))
-    {
-        DEBUG ("wrong type for filter property on client %s: %s",
-               tp_proxy_get_object_path (proxy), G_VALUE_TYPE_NAME (value));
-        goto finally;
-    }
+    _mcd_client_proxy_set_channel_filters (MCD_CLIENT_PROXY (proxy),
+                                           value, error,
+                                           GPOINTER_TO_UINT (user_data));
 
-    _mcd_client_proxy_set_filters (client, GPOINTER_TO_UINT (user_data),
-                                   g_value_get_boxed (value));
 finally:
     mcd_dispatcher_release_startup_lock (self);
 }
-- 
1.5.6.5




More information about the telepathy-commits mailing list