[polari] room: Reset :channel property when channel is invalidated
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] room: Reset :channel property when channel is invalidated
- Date: Thu, 12 Dec 2013 11:32:13 +0000 (UTC)
commit 45f83eaa6b5f075f222b05b45677974dd7c97ab0
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Dec 10 00:59:47 2013 +0100
room: Reset :channel property when channel is invalidated
We will soon stop to automatically destroying a room when the
associated channels is invalidated. In order to not require
users to check for the validity of :channel in addition to its
existance, just unset the property when the channel becomes
invalid.
https://bugzilla.gnome.org/show_bug.cgi?id=710271
src/lib/polari-room.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/lib/polari-room.c b/src/lib/polari-room.c
index c21f877..8bce8e7 100644
--- a/src/lib/polari-room.c
+++ b/src/lib/polari-room.c
@@ -34,6 +34,7 @@ struct _PolariRoomPrivate {
TpHandleType type;
guint self_contact_notify_id;
+ guint invalidated_id;
guint group_contacts_changed_id;
TpProxySignalConnection *properties_changed_id;
@@ -82,6 +83,9 @@ G_DEFINE_TYPE_WITH_PRIVATE (PolariRoom, polari_room, G_TYPE_OBJECT)
#define tp_properties_get_all_cb \
tp_cli_dbus_properties_callback_for_get_all
+static void polari_room_set_channel (PolariRoom *room, TpChannel *channel);
+
+
static char *
polari_create_room_id (TpAccount *account,
const char *name,
@@ -352,6 +356,16 @@ on_group_contacts_changed (TpChannel *channel,
}
static void
+on_channel_invalidated (TpProxy *channel,
+ guint domain,
+ int code,
+ char *message,
+ gpointer user_data)
+{
+ polari_room_set_channel (POLARI_ROOM (user_data), NULL);
+}
+
+static void
update_subject (PolariRoom *room,
GHashTable *properties)
{
@@ -470,6 +484,7 @@ polari_room_set_channel (PolariRoom *room,
if (priv->channel)
{
g_signal_handler_disconnect (priv->channel, priv->group_contacts_changed_id);
+ g_signal_handler_disconnect( priv->channel, priv->invalidated_id);
g_signal_handler_disconnect (tp_channel_get_connection (priv->channel),
priv->self_contact_notify_id);
@@ -503,6 +518,9 @@ polari_room_set_channel (PolariRoom *room,
priv->group_contacts_changed_id =
g_signal_connect (channel, "group-contacts-changed",
G_CALLBACK (on_group_contacts_changed), room);
+ priv->invalidated_id =
+ g_signal_connect (channel, "invalidated",
+ G_CALLBACK (on_channel_invalidated), room);
priv->properties_changed_id =
tp_cli_dbus_properties_connect_to_properties_changed (
channel,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]