[telepathy-mission-control/master] McdDispatcher: move get_interfaces_cb into McdClientProxy
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Sep 23 10:47:18 PDT 2009
---
src/mcd-client-priv.h | 3 ++
src/mcd-client.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++
src/mcd-dispatcher.c | 72 +-----------------------------------------------
3 files changed, 73 insertions(+), 70 deletions(-)
diff --git a/src/mcd-client-priv.h b/src/mcd-client-priv.h
index d86af94..9abee13 100644
--- a/src/mcd-client-priv.h
+++ b/src/mcd-client-priv.h
@@ -117,6 +117,9 @@ typedef enum
G_GNUC_INTERNAL void _mcd_client_proxy_get_channel_filter_cb (TpProxy *proxy,
const GValue *value, const GError *error, gpointer user_data, GObject *o);
+G_GNUC_INTERNAL void _mcd_client_proxy_get_interfaces_cb (TpProxy *proxy,
+ const GValue *out_Value, const GError *error,
+ gpointer user_data G_GNUC_UNUSED, GObject *weak_object G_GNUC_UNUSED);
G_GNUC_INTERNAL void _mcd_client_proxy_handler_get_all_cb (
TpProxy *proxy, GHashTable *properties, const GError *error,
diff --git a/src/mcd-client.c b/src/mcd-client.c
index 504317f..251a055 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -673,6 +673,74 @@ finally:
_mcd_client_proxy_dec_ready_lock (self);
}
+void
+_mcd_client_proxy_get_interfaces_cb (TpProxy *proxy,
+ const GValue *out_Value,
+ const GError *error,
+ gpointer user_data G_GNUC_UNUSED,
+ GObject *weak_object G_GNUC_UNUSED)
+{
+ McdClientProxy *self = MCD_CLIENT_PROXY (proxy);
+ const gchar *bus_name = tp_proxy_get_bus_name (proxy);
+
+ if (error != NULL)
+ {
+ DEBUG ("Error getting Interfaces for Client %s, assuming none: "
+ "%s %d %s", bus_name,
+ g_quark_to_string (error->domain), error->code, error->message);
+ goto finally;
+ }
+
+ if (!G_VALUE_HOLDS (out_Value, G_TYPE_STRV))
+ {
+ DEBUG ("Wrong type getting Interfaces for Client %s, assuming none: "
+ "%s", bus_name, G_VALUE_TYPE_NAME (out_Value));
+ goto finally;
+ }
+
+ _mcd_client_proxy_add_interfaces (self, g_value_get_boxed (out_Value));
+
+ DEBUG ("Client %s", bus_name);
+
+ if (tp_proxy_has_interface_by_id (proxy, TP_IFACE_QUARK_CLIENT_APPROVER))
+ {
+ _mcd_client_proxy_inc_ready_lock (self);
+
+ DEBUG ("%s is an Approver", bus_name);
+
+ tp_cli_dbus_properties_call_get
+ (self, -1, TP_IFACE_CLIENT_APPROVER,
+ "ApproverChannelFilter", _mcd_client_proxy_get_channel_filter_cb,
+ GUINT_TO_POINTER (MCD_CLIENT_APPROVER), NULL, NULL);
+ }
+
+ if (tp_proxy_has_interface_by_id (proxy, TP_IFACE_QUARK_CLIENT_HANDLER))
+ {
+ _mcd_client_proxy_inc_ready_lock (self);
+
+ DEBUG ("%s is a Handler", bus_name);
+
+ tp_cli_dbus_properties_call_get_all
+ (self, -1, TP_IFACE_CLIENT_HANDLER,
+ _mcd_client_proxy_handler_get_all_cb, NULL, NULL, NULL);
+ }
+
+ if (tp_proxy_has_interface_by_id (proxy, TP_IFACE_QUARK_CLIENT_OBSERVER))
+ {
+ _mcd_client_proxy_inc_ready_lock (self);
+
+ DEBUG ("%s is an Observer", bus_name);
+
+ tp_cli_dbus_properties_call_get
+ (self, -1, TP_IFACE_CLIENT_OBSERVER,
+ "ObserverChannelFilter", _mcd_client_proxy_get_channel_filter_cb,
+ GUINT_TO_POINTER (MCD_CLIENT_OBSERVER), NULL, NULL);
+ }
+
+finally:
+ _mcd_client_proxy_dec_ready_lock (self);
+}
+
gboolean
_mcd_client_proxy_parse_client_file (McdClientProxy *self)
{
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 3a77df3..d4b4189 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1897,74 +1897,6 @@ mcd_dispatcher_update_client_caps (McdDispatcher *self,
g_ptr_array_free (vas, TRUE);
}
-static void
-get_interfaces_cb (TpProxy *proxy,
- const GValue *out_Value,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
-{
- McdClientProxy *client = MCD_CLIENT_PROXY (proxy);
- const gchar *bus_name = tp_proxy_get_bus_name (proxy);
-
- if (error != NULL)
- {
- DEBUG ("Error getting Interfaces for Client %s, assuming none: "
- "%s %d %s", bus_name,
- g_quark_to_string (error->domain), error->code, error->message);
- goto finally;
- }
-
- if (!G_VALUE_HOLDS (out_Value, G_TYPE_STRV))
- {
- DEBUG ("Wrong type getting Interfaces for Client %s, assuming none: "
- "%s", bus_name, G_VALUE_TYPE_NAME (out_Value));
- goto finally;
- }
-
- _mcd_client_proxy_add_interfaces (client, g_value_get_boxed (out_Value));
-
- DEBUG ("Client %s", bus_name);
-
- if (tp_proxy_has_interface_by_id (proxy, TP_IFACE_QUARK_CLIENT_APPROVER))
- {
- _mcd_client_proxy_inc_ready_lock (client);
-
- DEBUG ("%s is an Approver", bus_name);
-
- tp_cli_dbus_properties_call_get
- (client, -1, TP_IFACE_CLIENT_APPROVER,
- "ApproverChannelFilter", _mcd_client_proxy_get_channel_filter_cb,
- GUINT_TO_POINTER (MCD_CLIENT_APPROVER), NULL, NULL);
- }
-
- if (tp_proxy_has_interface_by_id (proxy, TP_IFACE_QUARK_CLIENT_HANDLER))
- {
- _mcd_client_proxy_inc_ready_lock (client);
-
- DEBUG ("%s is a Handler", bus_name);
-
- tp_cli_dbus_properties_call_get_all
- (client, -1, TP_IFACE_CLIENT_HANDLER,
- _mcd_client_proxy_handler_get_all_cb, NULL, NULL, NULL);
- }
-
- if (tp_proxy_has_interface_by_id (proxy, TP_IFACE_QUARK_CLIENT_OBSERVER))
- {
- _mcd_client_proxy_inc_ready_lock (client);
-
- DEBUG ("%s is an Observer", bus_name);
-
- tp_cli_dbus_properties_call_get
- (client, -1, TP_IFACE_CLIENT_OBSERVER,
- "ObserverChannelFilter", _mcd_client_proxy_get_channel_filter_cb,
- GUINT_TO_POINTER (MCD_CLIENT_OBSERVER), NULL, NULL);
- }
-
-finally:
- _mcd_client_proxy_dec_ready_lock (client);
-}
-
/* FIXME: eventually this whole chain should move into McdClientProxy */
static void
mcd_client_start_introspection (McdClientProxy *client,
@@ -1990,8 +1922,8 @@ mcd_client_start_introspection (McdClientProxy *client,
_mcd_client_proxy_inc_ready_lock (client);
tp_cli_dbus_properties_call_get (client, -1,
- TP_IFACE_CLIENT, "Interfaces", get_interfaces_cb, NULL,
- NULL, NULL);
+ TP_IFACE_CLIENT, "Interfaces", _mcd_client_proxy_get_interfaces_cb,
+ NULL, NULL, NULL);
}
else
{
--
1.5.6.5
More information about the telepathy-commits
mailing list