diff options
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-contact-list.c | 17 | ||||
-rw-r--r-- | libempathy/empathy-contact-list.h | 7 |
2 files changed, 24 insertions, 0 deletions
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c index d4859210a..65a1edeec 100644 --- a/libempathy/empathy-contact-list.c +++ b/libempathy/empathy-contact-list.c @@ -249,3 +249,20 @@ empathy_contact_list_get_flags (EmpathyContactList *list) return 0; } } + +/* XXX: this should be an EmpathyContact function, but it would likely require + * some awkward refactoring */ +gboolean +empathy_contact_list_contact_is_favourite (EmpathyContactList *list, + EmpathyContact *contact) +{ + GList *groups, *l; + + groups = empathy_contact_list_get_groups (list, contact); + for (l = groups; l; l = l->next) + if (!g_strcmp0 (l->data, EMPATHY_GROUP_FAVOURITES)) + return TRUE; + + return FALSE; +} + diff --git a/libempathy/empathy-contact-list.h b/libempathy/empathy-contact-list.h index 28238e44a..c3fff7271 100644 --- a/libempathy/empathy-contact-list.h +++ b/libempathy/empathy-contact-list.h @@ -34,6 +34,9 @@ G_BEGIN_DECLS #define EMPATHY_IS_CONTACT_LIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT_LIST)) #define EMPATHY_CONTACT_LIST_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), EMPATHY_TYPE_CONTACT_LIST, EmpathyContactListIface)) +/* The favourites are just in a specially-handled group */ +#define EMPATHY_GROUP_FAVOURITES "Favorites" + typedef enum { EMPATHY_CONTACT_LIST_CAN_ADD = 1 << 0, EMPATHY_CONTACT_LIST_CAN_REMOVE = 1 << 1, @@ -104,6 +107,10 @@ EmpathyContactMonitor * EmpathyContactListFlags empathy_contact_list_get_flags (EmpathyContactList *list); +gboolean empathy_contact_list_contact_is_favourite + (EmpathyContactList *list, + EmpathyContact *contact); + G_END_DECLS #endif /* __EMPATHY_CONTACT_LIST_H__ */ |