[empathy] tp-roomlist: use tp_channel_call_when_ready instead of tp_channel_run_until_ready



commit 1b81df990ef44eb9aceee1752fe9d6c2c04d8c21
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Apr 28 10:59:39 2009 +0100

    tp-roomlist: use tp_channel_call_when_ready instead of tp_channel_run_until_ready
---
 libempathy/empathy-tp-roomlist.c |   42 ++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/libempathy/empathy-tp-roomlist.c b/libempathy/empathy-tp-roomlist.c
index fc2526f..5999663 100644
--- a/libempathy/empathy-tp-roomlist.c
+++ b/libempathy/empathy-tp-roomlist.c
@@ -236,25 +236,19 @@ tp_roomlist_invalidated_cb (TpChannel         *channel,
 }
 
 static void
-tp_roomlist_request_channel_cb (TpConnection *connection,
-				const gchar  *object_path,
-				const GError *error,
-				gpointer      user_data,
-				GObject      *list)
+channel_ready_cb (TpChannel *channel,
+		  const GError *error,
+		  gpointer user_data)
 {
+	EmpathyTpRoomlist *list = EMPATHY_TP_ROOMLIST (user_data);
 	EmpathyTpRoomlistPriv *priv = GET_PRIV (list);
 
-	if (error) {
-		DEBUG ("Error requesting channel: %s", error->message);
+	if (error != NULL) {
+		DEBUG ("Channel invalidated: %s", error->message);
+		g_signal_emit (list, signals[DESTROY], 0);
 		return;
 	}
 
-	priv->channel = tp_channel_new (priv->connection, object_path,
-					TP_IFACE_CHANNEL_TYPE_ROOM_LIST,
-					TP_HANDLE_TYPE_NONE,
-					0, NULL);
-	tp_channel_run_until_ready (priv->channel, NULL, NULL);
-
 	g_signal_connect (priv->channel, "invalidated",
 			  G_CALLBACK (tp_roomlist_invalidated_cb),
 			  list);
@@ -274,6 +268,28 @@ tp_roomlist_request_channel_cb (TpConnection *connection,
 							      tp_roomlist_get_listing_rooms_cb,
 							      NULL, NULL,
 							      G_OBJECT (list));
+
+}
+
+static void
+tp_roomlist_request_channel_cb (TpConnection *connection,
+				const gchar  *object_path,
+				const GError *error,
+				gpointer      user_data,
+				GObject      *list)
+{
+	EmpathyTpRoomlistPriv *priv = GET_PRIV (list);
+
+	if (error) {
+		DEBUG ("Error requesting channel: %s", error->message);
+		return;
+	}
+
+	priv->channel = tp_channel_new (priv->connection, object_path,
+					TP_IFACE_CHANNEL_TYPE_ROOM_LIST,
+					TP_HANDLE_TYPE_NONE,
+					0, NULL);
+	tp_channel_call_when_ready (priv->channel, channel_ready_cb, list);
 }
 
 static void



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