[empathy] tp-chat: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES



commit 3f96f6d69d75bef18d372c26df40ab3bbd3628fe
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Aug 18 17:20:51 2011 +0200

    tp-chat: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656831

 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 fde1e70..2700356 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);
-}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]