summaryrefslogtreecommitdiff
path: root/telepathy-glib/room-list.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-17 17:42:10 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-30 11:47:19 +0200
commitfa2cbf7cb4153fa0f18ed2606cb9dfbca060bfc8 (patch)
tree379642404f22abd7229672e5f2fe058d52b22fde /telepathy-glib/room-list.c
parent55879d7e5bdb0ad2bc73ff1232fdc930c7c46d2f (diff)
downloadtelepathy-glib-fa2cbf7cb4153fa0f18ed2606cb9dfbca060bfc8.tar.gz
Fire the 'failed' signal when channel is invalidated
Diffstat (limited to 'telepathy-glib/room-list.c')
-rw-r--r--telepathy-glib/room-list.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/telepathy-glib/room-list.c b/telepathy-glib/room-list.c
index 080cb64ac..c6c7290b8 100644
--- a/telepathy-glib/room-list.c
+++ b/telepathy-glib/room-list.c
@@ -71,6 +71,7 @@ struct _TpRoomListPrivate
TpChannel *channel;
GSimpleAsyncResult *async_res;
+ gulong invalidated_id;
};
enum
@@ -195,6 +196,10 @@ tp_room_list_dispose (GObject *object)
void (*chain_up) (GObject *) =
((GObjectClass *) tp_room_list_parent_class)->dispose;
+ if (self->priv->channel != NULL)
+ g_signal_handler_disconnect (self->priv->channel,
+ self->priv->invalidated_id);
+
destroy_channel (self);
g_clear_object (&self->priv->account);
@@ -397,6 +402,22 @@ tp_room_list_start (TpRoomList *self)
}
static void
+chan_invalidated_cb (TpChannel *channel,
+ guint domain,
+ gint code,
+ gchar *message,
+ TpRoomList *self)
+{
+ GError *error = g_error_new_literal (domain, code, message);
+
+ DEBUG ("RoomList channel invalidated: %s", message);
+
+ g_signal_emit (self, signals[SIG_FAILED], 0, error);
+
+ g_error_free (error);
+}
+
+static void
create_channel_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
@@ -420,6 +441,9 @@ create_channel_cb (GObject *source_object,
DEBUG ("Got channel: %s", tp_proxy_get_object_path (self->priv->channel));
+ self->priv->invalidated_id = tp_g_signal_connect_object (self->priv->channel,
+ "invalidated", G_CALLBACK (chan_invalidated_cb), self, 0);
+
if (tp_cli_channel_type_room_list_connect_to_got_rooms (self->priv->channel,
got_rooms_cb, NULL, NULL, G_OBJECT (self), &error) == NULL)
{