aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2010-05-23 19:09:20 +0800
committerXavier Claessens <xclaesse@gmail.com>2010-05-26 17:34:59 +0800
commita9b78b0a3a5fe71e3119016c9f438d3897509bf8 (patch)
treef0bca058aa583f2df5d573c416a5b0002b17d58c
parent58521ffc5dc4ca1b67ce3df25c16799237061f02 (diff)
downloadgsoc2013-empathy-a9b78b0a3a5fe71e3119016c9f438d3897509bf8.tar
gsoc2013-empathy-a9b78b0a3a5fe71e3119016c9f438d3897509bf8.tar.gz
gsoc2013-empathy-a9b78b0a3a5fe71e3119016c9f438d3897509bf8.tar.bz2
gsoc2013-empathy-a9b78b0a3a5fe71e3119016c9f438d3897509bf8.tar.lz
gsoc2013-empathy-a9b78b0a3a5fe71e3119016c9f438d3897509bf8.tar.xz
gsoc2013-empathy-a9b78b0a3a5fe71e3119016c9f438d3897509bf8.tar.zst
gsoc2013-empathy-a9b78b0a3a5fe71e3119016c9f438d3897509bf8.zip
Do not use EmpathyContactMonitor to know when a contact gets online/offline
-rw-r--r--src/empathy-event-manager.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 932164c10..08f490966 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -843,8 +843,7 @@ event_manager_pendings_changed_cb (EmpathyContactList *list,
}
static void
-event_manager_presence_changed_cb (EmpathyContactMonitor *monitor,
- EmpathyContact *contact,
+event_manager_presence_changed_cb (EmpathyContact *contact,
TpConnectionPresenceType current,
TpConnectionPresenceType previous,
EmpathyEventManager *manager)
@@ -911,6 +910,22 @@ out:
g_object_unref (idle);
}
+static void
+event_manager_members_changed_cb (EmpathyContactList *list,
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ gchar *message,
+ gboolean is_member,
+ EmpathyEventManager *manager)
+{
+ if (is_member)
+ g_signal_connect (contact, "presence-changed",
+ G_CALLBACK (event_manager_presence_changed_cb), manager);
+ else
+ g_signal_handlers_disconnect_by_func (contact,
+ event_manager_presence_changed_cb, manager);
+}
static GObject *
event_manager_constructor (GType type,
@@ -993,12 +1008,6 @@ empathy_event_manager_init (EmpathyEventManager *manager)
{
EmpathyEventManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
EMPATHY_TYPE_EVENT_MANAGER, EmpathyEventManagerPriv);
- EmpathyContactMonitor *monitor;
- EmpathyContactList *list_iface;
-
- list_iface = EMPATHY_CONTACT_LIST (empathy_contact_manager_dup_singleton ());
- monitor = empathy_contact_list_get_monitor (list_iface);
- g_object_unref (list_iface);
manager->priv = priv;
@@ -1008,8 +1017,8 @@ empathy_event_manager_init (EmpathyEventManager *manager)
G_CALLBACK (event_manager_approve_channel_cb), manager);
g_signal_connect (priv->contact_manager, "pendings-changed",
G_CALLBACK (event_manager_pendings_changed_cb), manager);
- g_signal_connect (monitor, "contact-presence-changed",
- G_CALLBACK (event_manager_presence_changed_cb), manager);
+ g_signal_connect (priv->contact_manager, "members-changed",
+ G_CALLBACK (event_manager_members_changed_cb), manager);
}
EmpathyEventManager *