diff options
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-contact-list.c | 41 | ||||
-rw-r--r-- | libempathy/empathy-contact-list.h | 3 |
2 files changed, 31 insertions, 13 deletions
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c index a46fc8db4..611a40fe5 100644 --- a/libempathy/empathy-contact-list.c +++ b/libempathy/empathy-contact-list.c @@ -250,21 +250,42 @@ empathy_contact_list_get_flags (EmpathyContactList *list) } } -/* 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) +empathy_contact_list_is_favourite (EmpathyContactList *list, + EmpathyContact *contact) { #if HAVE_FAVOURITE_CONTACTS - 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; + if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->is_favourite) { + return EMPATHY_CONTACT_LIST_GET_IFACE (list)->is_favourite ( + list, contact); + } #endif /* HAVE_FAVOURITE_CONTACTS */ return FALSE; } +void +empathy_contact_list_add_to_favourites (EmpathyContactList *list, + EmpathyContact *contact) +{ +#if HAVE_FAVOURITE_CONTACTS + if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->add_favourite) { + EMPATHY_CONTACT_LIST_GET_IFACE (list)->add_favourite (list, + contact); + } +#endif /* HAVE_FAVOURITE_CONTACTS */ +} + +void +empathy_contact_list_remove_from_favourites (EmpathyContactList *list, + EmpathyContact *contact) +{ +#if HAVE_FAVOURITE_CONTACTS + if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove_favourite) { + EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove_favourite (list, + contact); + } +#endif /* HAVE_FAVOURITE_CONTACTS */ +} + + diff --git a/libempathy/empathy-contact-list.h b/libempathy/empathy-contact-list.h index c3fff7271..080a89584 100644 --- a/libempathy/empathy-contact-list.h +++ b/libempathy/empathy-contact-list.h @@ -34,9 +34,6 @@ 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, |