aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-24 18:49:18 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-30 18:09:44 +0800
commitc821e81c68acc1daba78899c9c844f916ea2c99e (patch)
tree1c61f929750ff4c851f3f6bba16f76029769a2fc /libempathy
parent7ba0f1046ada332737644ecbe1892911b81d6aef (diff)
downloadgsoc2013-empathy-c821e81c68acc1daba78899c9c844f916ea2c99e.tar
gsoc2013-empathy-c821e81c68acc1daba78899c9c844f916ea2c99e.tar.gz
gsoc2013-empathy-c821e81c68acc1daba78899c9c844f916ea2c99e.tar.bz2
gsoc2013-empathy-c821e81c68acc1daba78899c9c844f916ea2c99e.tar.lz
gsoc2013-empathy-c821e81c68acc1daba78899c9c844f916ea2c99e.tar.xz
gsoc2013-empathy-c821e81c68acc1daba78899c9c844f916ea2c99e.tar.zst
gsoc2013-empathy-c821e81c68acc1daba78899c9c844f916ea2c99e.zip
disconnect NewChannels signal once we got all the list channels we care about
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-contact-list.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index fd2cfaa38..9288baa4c 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -54,6 +54,8 @@ typedef struct {
GHashTable *add_to_group; /* group name -> GArray of handles */
EmpathyContactListFlags flags;
+
+ TpProxySignalConnection *new_channels_sig;
} EmpathyTpContactListPriv;
typedef enum {
@@ -697,6 +699,15 @@ tp_contact_list_finalize (GObject *object)
G_OBJECT_CLASS (empathy_tp_contact_list_parent_class)->finalize (object);
}
+static gboolean
+received_all_list_channels (EmpathyTpContactList *self)
+{
+ EmpathyTpContactListPriv *priv = GET_PRIV (self);
+
+ return (priv->stored != NULL && priv->publish != NULL &&
+ priv->subscribe != NULL);
+}
+
static void
got_list_channel (EmpathyTpContactList *list,
TpChannel *channel)
@@ -728,6 +739,12 @@ got_list_channel (EmpathyTpContactList *list,
G_CALLBACK (tp_contact_list_subscribe_group_members_changed_cb),
list);
}
+
+ if (received_all_list_channels (list) && priv->new_channels_sig != NULL) {
+ /* We don't need to watch NewChannels anymore */
+ tp_proxy_signal_connection_disconnect (priv->new_channels_sig);
+ priv->new_channels_sig = NULL;
+ }
}
static void
@@ -815,7 +832,8 @@ conn_ready_cb (TpConnection *connection,
/* Watch the NewChannels signal so if ensuring list channels fails (for
* example because the server is slow and the D-Bus call timeouts before CM
* fetches the roster), we have a chance to get them later. */
- tp_cli_connection_interface_requests_connect_to_new_channels (
+ priv->new_channels_sig =
+ tp_cli_connection_interface_requests_connect_to_new_channels (
priv->connection, new_channels_cb, NULL, NULL, G_OBJECT (list), NULL);
/* Request the 'stored' list. */