diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-18 23:20:51 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-08-19 15:26:26 +0800 |
commit | 3f96f6d69d75bef18d372c26df40ab3bbd3628fe (patch) | |
tree | 3ed677971f62292511320d28f878648ffcc57eab | |
parent | c9b5bba619706d6b1a45654f845e7722870a25df (diff) | |
download | gsoc2013-empathy-3f96f6d69d75bef18d372c26df40ab3bbd3628fe.tar gsoc2013-empathy-3f96f6d69d75bef18d372c26df40ab3bbd3628fe.tar.gz gsoc2013-empathy-3f96f6d69d75bef18d372c26df40ab3bbd3628fe.tar.bz2 gsoc2013-empathy-3f96f6d69d75bef18d372c26df40ab3bbd3628fe.tar.lz gsoc2013-empathy-3f96f6d69d75bef18d372c26df40ab3bbd3628fe.tar.xz gsoc2013-empathy-3f96f6d69d75bef18d372c26df40ab3bbd3628fe.tar.zst gsoc2013-empathy-3f96f6d69d75bef18d372c26df40ab3bbd3628fe.zip |
tp-chat: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES
https://bugzilla.gnome.org/show_bug.cgi?id=656831
-rw-r--r-- | libempathy/empathy-tp-chat.c | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index fde1e70ba..27003561e 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -1614,28 +1614,26 @@ empathy_tp_chat_get_feature_ready (void) } static void -conn_prepared_cb (GObject *source, - GAsyncResult *result, +tp_chat_prepare_ready_async (TpProxy *proxy, + const TpProxyFeature *feature, + GAsyncReadyCallback callback, gpointer user_data) { - EmpathyTpChat *self = user_data; - TpChannel *channel = (TpChannel *) self; - GError *error = NULL; - TpHandle handle; - TpConnection *connection = (TpConnection *) source; + EmpathyTpChat *self = (EmpathyTpChat *) proxy; + TpChannel *channel = (TpChannel *) proxy; + TpConnection *connection; - if (!tp_proxy_prepare_finish (source, result, &error)) { - g_simple_async_result_set_from_error (self->priv->ready_result, error); - g_error_free (error); - g_simple_async_result_complete (self->priv->ready_result); - tp_clear_object (&self->priv->ready_result); - return; - } + g_assert (self->priv->ready_result == NULL); + self->priv->ready_result = g_simple_async_result_new (G_OBJECT (self), + callback, user_data, tp_chat_prepare_ready_async); + + connection = tp_channel_borrow_connection (channel); if (tp_proxy_has_interface_by_id (self, TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) { const TpIntSet *members; GArray *handles; + TpHandle handle; /* Get self contact from the group's self handle */ handle = tp_channel_group_get_self_handle (channel); @@ -1658,6 +1656,7 @@ conn_prepared_cb (GObject *source, TpCapabilities *caps; GPtrArray *classes; guint i; + TpHandle handle; /* Get the self contact from the connection's self handle */ handle = tp_connection_get_self_handle (connection); @@ -1704,24 +1703,3 @@ conn_prepared_cb (GObject *source, G_OBJECT (self), NULL); } } - -static void -tp_chat_prepare_ready_async (TpProxy *proxy, - const TpProxyFeature *feature, - GAsyncReadyCallback callback, - gpointer user_data) -{ - EmpathyTpChat *self = (EmpathyTpChat *) proxy; - TpChannel *channel = (TpChannel *) proxy; - TpConnection *connection; - GQuark conn_features[] = { TP_CONNECTION_FEATURE_CAPABILITIES, 0 }; - - g_assert (self->priv->ready_result == NULL); - self->priv->ready_result = g_simple_async_result_new (G_OBJECT (self), - callback, user_data, tp_chat_prepare_ready_async); - - connection = tp_channel_borrow_connection (channel); - - tp_proxy_prepare_async (connection, conn_features, - conn_prepared_cb, self); -} |