From 1c08a3a0b5538cc4e1b97535efd66f6f0d5146d5 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 11 Aug 2010 17:05:33 +0200 Subject: dispatcher: use tp_proxy_prepare_async instead of tp_connection_call_when_ready --- libempathy/empathy-dispatcher.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 9dceebfa8..557d435ec 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -266,15 +266,19 @@ dispatcher_connection_got_all (TpProxy *proxy, } static void -connection_ready_cb (TpConnection *connection, - const GError *error, +connection_prepare_cb (GObject *source, + GAsyncResult *result, gpointer user_data) { EmpathyDispatcher *self = EMPATHY_DISPATCHER (user_data); + GError *error = NULL; + TpConnection *connection = (TpConnection *) source; - if (error != NULL) + if (!tp_proxy_prepare_finish (source, result, &error)) { DEBUG ("Error: %s", error->message); + + g_error_free (error); goto out; } @@ -291,6 +295,8 @@ dispatcher_init_connection_if_needed (EmpathyDispatcher *self, TpConnection *connection) { EmpathyDispatcherPriv *priv = GET_PRIV (self); + GQuark features[] = { TP_CONNECTION_FEATURE_CORE, + 0 }; if (g_hash_table_lookup (priv->connections, connection) != NULL) return; @@ -301,10 +307,10 @@ dispatcher_init_connection_if_needed (EmpathyDispatcher *self, g_signal_connect (connection, "invalidated", G_CALLBACK (dispatcher_connection_invalidated_cb), self); - /* Ensure to keep the self object alive while the call_when_ready is - * running */ + /* Ensure to keep the self object alive while preparing the connection */ g_object_ref (self); - tp_connection_call_when_ready (connection, connection_ready_cb, self); + + tp_proxy_prepare_async (connection, features, connection_prepare_cb, self); } static void -- cgit v1.2.3