]> git.0d.be Git - empathy.git/commitdiff
tp-chat: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 18 Aug 2011 15:20:51 +0000 (17:20 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 19 Aug 2011 07:26:26 +0000 (09:26 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=656831

libempathy/empathy-tp-chat.c

index fde1e70ba7ccf60a62aa4699e8ccc1e082f270ec..27003561e7f28dd151cdd5808e03aa7cf152a613 100644 (file)
@@ -1614,28 +1614,26 @@ empathy_tp_chat_get_feature_ready (void)
 }
 
 static 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)
 {
        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;
 
        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);
 
                /* 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;
                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);
 
                /* 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);
        }
 }
                                                                               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);
-}