aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-contact-manager.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-06-06 17:10:23 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-06-06 17:10:23 +0800
commit976d656a08ded1864324b6060ef035ffcb0b833b (patch)
treec852357f8832fc6acb3a355e2c9a3335195a3a09 /libempathy/empathy-contact-manager.c
parentc982f4d2eb903359a5083e9466669413d5eaf938 (diff)
downloadgsoc2013-empathy-976d656a08ded1864324b6060ef035ffcb0b833b.tar
gsoc2013-empathy-976d656a08ded1864324b6060ef035ffcb0b833b.tar.gz
gsoc2013-empathy-976d656a08ded1864324b6060ef035ffcb0b833b.tar.bz2
gsoc2013-empathy-976d656a08ded1864324b6060ef035ffcb0b833b.tar.lz
gsoc2013-empathy-976d656a08ded1864324b6060ef035ffcb0b833b.tar.xz
gsoc2013-empathy-976d656a08ded1864324b6060ef035ffcb0b833b.tar.zst
gsoc2013-empathy-976d656a08ded1864324b6060ef035ffcb0b833b.zip
Add support for blinking when there is an event. Make use of EmpathyIdle
2007-06-06 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-status-icon.c: Add support for blinking when there is an event. Make use of EmpathyIdle for presence handling. Add an event when a contact requets subscription. * libempathy-gtk/gossip-contact-list-store.c: * libempathy-gtk/gossip-contact-list-view.c: * libempathy/empathy-contact-manager.c: * libempathy/empathy-tp-contact-list.c: * libempathy/empathy-tp-chatroom.c: * libempathy/empathy-contact-list.c: * libempathy/empathy-contact-list.h: get_contacts() is renamed to get_members(). Adding a signal and a method for local-pending with contacts with the message. Rework completely the contact-list handling in EmpathyTpContactList to follow tp spec. * libempathy/empathy-idle.c: * libempathy/empathy-idle.h: Add properties for the state and the status message. EmpathyIdle is now a singleton to manager self presence. * TODO: Updated. svn path=/trunk/; revision=123
Diffstat (limited to 'libempathy/empathy-contact-manager.c')
-rw-r--r--libempathy/empathy-contact-manager.c78
1 files changed, 65 insertions, 13 deletions
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index fa62da98f..5e5f09a43 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -65,7 +65,8 @@ static void contact_manager_add (EmpathyContactList
static void contact_manager_remove (EmpathyContactList *manager,
GossipContact *contact,
const gchar *message);
-static GList * contact_manager_get_contacts (EmpathyContactList *manager);
+static GList * contact_manager_get_members (EmpathyContactList *manager);
+static GList * contact_manager_get_local_pending (EmpathyContactList *manager);
static void contact_manager_setup_foreach (McAccount *account,
EmpathyTpContactList *list,
EmpathyContactManager *manager);
@@ -80,6 +81,10 @@ static void contact_manager_added_cb (EmpathyTpContactList
static void contact_manager_removed_cb (EmpathyTpContactList *list,
GossipContact *contact,
EmpathyContactManager *manager);
+static void contact_manager_local_pending_cb (EmpathyTpContactList *list,
+ GossipContact *contact,
+ const gchar *message,
+ EmpathyContactManager *manager);
static void contact_manager_destroy_cb (EmpathyTpContactList *list,
EmpathyContactManager *manager);
static void contact_manager_rename_group_foreach (McAccount *account,
@@ -88,7 +93,10 @@ static void contact_manager_rename_group_foreach (McAccount
static void contact_manager_get_groups_foreach (McAccount *account,
EmpathyTpContactList *list,
GList **all_groups);
-static void contact_manager_get_contacts_foreach (McAccount *account,
+static void contact_manager_get_members_foreach (McAccount *account,
+ EmpathyTpContactList *list,
+ GList **contacts);
+static void contact_manager_get_local_pending_foreach (McAccount *account,
EmpathyTpContactList *list,
GList **contacts);
static void contact_manager_status_changed_cb (MissionControl *mc,
@@ -115,11 +123,12 @@ empathy_contact_manager_class_init (EmpathyContactManagerClass *klass)
static void
contact_manager_iface_init (EmpathyContactListIface *iface)
{
- iface->setup = contact_manager_setup;
- iface->find = contact_manager_find;
- iface->add = contact_manager_add;
- iface->remove = contact_manager_remove;
- iface->get_contacts = contact_manager_get_contacts;
+ iface->setup = contact_manager_setup;
+ iface->find = contact_manager_find;
+ iface->add = contact_manager_add;
+ iface->remove = contact_manager_remove;
+ iface->get_members = contact_manager_get_members;
+ iface->get_local_pending = contact_manager_get_local_pending;
}
static void
@@ -269,7 +278,7 @@ contact_manager_remove (EmpathyContactList *manager,
}
static GList *
-contact_manager_get_contacts (EmpathyContactList *manager)
+contact_manager_get_members (EmpathyContactList *manager)
{
EmpathyContactManagerPriv *priv;
GList *contacts = NULL;
@@ -279,12 +288,29 @@ contact_manager_get_contacts (EmpathyContactList *manager)
priv = GET_PRIV (manager);
g_hash_table_foreach (priv->lists,
- (GHFunc) contact_manager_get_contacts_foreach,
+ (GHFunc) contact_manager_get_members_foreach,
&contacts);
return contacts;
}
+static GList *
+contact_manager_get_local_pending (EmpathyContactList *manager)
+{
+ EmpathyContactManagerPriv *priv;
+ GList *pending = NULL;
+
+ g_return_val_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager), NULL);
+
+ priv = GET_PRIV (manager);
+
+ g_hash_table_foreach (priv->lists,
+ (GHFunc) contact_manager_get_local_pending_foreach,
+ &pending);
+
+ return pending;
+}
+
EmpathyTpContactList *
empathy_contact_manager_get_list (EmpathyContactManager *manager,
McAccount *account)
@@ -435,6 +461,9 @@ contact_manager_add_account (EmpathyContactManager *manager,
g_signal_connect (list, "contact-removed",
G_CALLBACK (contact_manager_removed_cb),
manager);
+ g_signal_connect (list, "local-pending",
+ G_CALLBACK (contact_manager_local_pending_cb),
+ manager);
g_signal_connect (list, "destroy",
G_CALLBACK (contact_manager_destroy_cb),
manager);
@@ -461,6 +490,15 @@ contact_manager_removed_cb (EmpathyTpContactList *list,
}
static void
+contact_manager_local_pending_cb (EmpathyTpContactList *list,
+ GossipContact *contact,
+ const gchar *message,
+ EmpathyContactManager *manager)
+{
+ g_signal_emit_by_name (manager, "local-pending", contact, message);
+}
+
+static void
contact_manager_destroy_cb (EmpathyTpContactList *list,
EmpathyContactManager *manager)
{
@@ -482,6 +520,9 @@ contact_manager_destroy_cb (EmpathyTpContactList *list,
contact_manager_removed_cb,
manager);
g_signal_handlers_disconnect_by_func (list,
+ contact_manager_local_pending_cb,
+ manager);
+ g_signal_handlers_disconnect_by_func (list,
contact_manager_destroy_cb,
manager);
@@ -520,13 +561,24 @@ contact_manager_get_groups_foreach (McAccount *account,
}
static void
-contact_manager_get_contacts_foreach (McAccount *account,
- EmpathyTpContactList *list,
- GList **contacts)
+contact_manager_get_members_foreach (McAccount *account,
+ EmpathyTpContactList *list,
+ GList **contacts)
+{
+ GList *l;
+
+ l = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (list));
+ *contacts = g_list_concat (*contacts, l);
+}
+
+static void
+contact_manager_get_local_pending_foreach (McAccount *account,
+ EmpathyTpContactList *list,
+ GList **contacts)
{
GList *l;
- l = empathy_contact_list_get_contacts (EMPATHY_CONTACT_LIST (list));
+ l = empathy_contact_list_get_local_pending (EMPATHY_CONTACT_LIST (list));
*contacts = g_list_concat (*contacts, l);
}