[empathy] Create a fake 'Favorites People' group



commit 1accacab8c375482d6bd16de400529e333c8078f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Mar 9 14:53:53 2010 +0100

    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 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index 2159393..b322ed7 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 75efa71..144113c 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]