From 1accacab8c375482d6bd16de400529e333c8078f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 9 Mar 2010 14:53:53 +0100 Subject: Create a fake 'Favorites People' group --- libempathy-gtk/empathy-contact-list-store.c | 19 ++++++++++++++++++- libempathy-gtk/empathy-contact-list-store.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index 21593932f..b322ed7c1 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -965,6 +965,9 @@ contact_list_store_favourites_changed_cb (EmpathyContactList *list_iface, contact_list_store_change_contact_favourite_status (store, contact, is_favourite); + + contact_list_store_remove_contact (store, contact); + contact_list_store_add_contact (store, contact); } static void @@ -1115,8 +1118,22 @@ contact_list_store_add_contact (EmpathyContactListStore *store, } g_list_free (groups); - contact_list_store_contact_update (store, contact); +#ifdef HAVE_FAVOURITE_CONTACTS + if (empathy_contact_list_is_favourite (priv->list, contact)) { + /* Add contact to the fake 'Favorites' group */ + GtkTreeIter iter_group; + + contact_list_store_get_group (store, EMPATHY_CONTACT_LIST_STORE_FAVORITE, + &iter_group, NULL, NULL); + gtk_tree_store_insert_after (GTK_TREE_STORE (store), &iter, + &iter_group, NULL); + + add_contact_to_store (GTK_TREE_STORE (store), &iter, contact, flags); + } +#endif + + contact_list_store_contact_update (store, contact); } static void diff --git a/libempathy-gtk/empathy-contact-list-store.h b/libempathy-gtk/empathy-contact-list-store.h index 75efa71a0..144113cc1 100644 --- a/libempathy-gtk/empathy-contact-list-store.h +++ b/libempathy-gtk/empathy-contact-list-store.h @@ -68,6 +68,7 @@ typedef enum { } EmpathyContactListStoreCol; #define EMPATHY_CONTACT_LIST_STORE_UNGROUPED _("Ungrouped") +#define EMPATHY_CONTACT_LIST_STORE_FAVORITE _("Favorites People") struct _EmpathyContactListStore { GtkTreeStore parent; -- cgit v1.2.3