[empathy] Do not use EmpathyContactMonitor to know when a contact gets online/offline
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Do not use EmpathyContactMonitor to know when a contact gets online/offline
- Date: Wed, 26 May 2010 09:43:33 +0000 (UTC)
commit a9b78b0a3a5fe71e3119016c9f438d3897509bf8
Author: Xavier Claessens <xclaesse gmail com>
Date: Sun May 23 13:09:20 2010 +0200
Do not use EmpathyContactMonitor to know when a contact gets online/offline
src/empathy-event-manager.c | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 932164c..08f4909 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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]