From 1b81df990ef44eb9aceee1752fe9d6c2c04d8c21 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 28 Apr 2009 10:59:39 +0100 Subject: tp-roomlist: use tp_channel_call_when_ready instead of tp_channel_run_until_ready --- libempathy/empathy-tp-roomlist.c | 42 +++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-tp-roomlist.c b/libempathy/empathy-tp-roomlist.c index fc2526fd0..5999663fb 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 -- cgit v1.2.3