EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, TRUE,
-1);
-#if HAVE_FAVOURITE_CONTACTS
- /* add a second separator for the favourite contacts group, to
- * always be sorted at the end. This will provide a visual
- * distinction between the end of the favourites and the
- * beginning of the ungrouped contacts */
- if (!g_strcmp0 (name, EMPATHY_GROUP_FAVOURITES)) {
- gtk_tree_store_append (GTK_TREE_STORE (store),
- &iter_separator,
- &iter_group);
- gtk_tree_store_set (GTK_TREE_STORE (store), &iter_separator,
- EMPATHY_CONTACT_LIST_STORE_COL_NAME, EMPATHY_GROUP_FAVOURITES,
- EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, TRUE,
- -1);
- }
-#endif /* HAVE_FAVOURITE_CONTACTS */
-
if (iter_separator_to_set) {
*iter_separator_to_set = iter_separator;
}
/* Separator, favourites group, or other group? */
if (is_separator_a || is_separator_b) {
if (is_separator_a) {
-#if HAVE_FAVOURITE_CONTACTS
- /* sort the special favourites group 2nd separator at
- * the end */
- if (!g_strcmp0 (name_a, EMPATHY_GROUP_FAVOURITES)) {
- ret_val = 1;
- } else {
- ret_val = -1;
- }
-#else
ret_val = -1;
-#endif /* HAVE_FAVOURITE_CONTACTS */
} else if (is_separator_b) {
-#if HAVE_FAVOURITE_CONTACTS
- if (!g_strcmp0 (name_b, EMPATHY_GROUP_FAVOURITES)) {
- ret_val = -1;
- } else {
- ret_val = 1;
- }
-#else
ret_val = 1;
-#endif /* HAVE_FAVOURITE_CONTACTS */
}
#if HAVE_FAVOURITE_CONTACTS
} else if (!contact_a && !g_strcmp0 (name_a,
if (is_separator_a || is_separator_b) {
if (is_separator_a) {
-#if HAVE_FAVOURITE_CONTACTS
- /* sort the special favourites group 2nd separator at
- * the end */
- if (!g_strcmp0 (name_a, EMPATHY_GROUP_FAVOURITES)) {
- ret_val = 1;
- } else {
- ret_val = -1;
- }
-#else
ret_val = -1;
-#endif /* HAVE_FAVOURITE_CONTACTS */
} else if (is_separator_b) {
-#if HAVE_FAVOURITE_CONTACTS
- if (!g_strcmp0 (name_b, EMPATHY_GROUP_FAVOURITES)) {
- ret_val = -1;
- } else {
- ret_val = 1;
- }
-#else
ret_val = 1;
-#endif /* HAVE_FAVOURITE_CONTACTS */
}
-#if HAVE_FAVOURITE_CONTACTS
- } else if (!contact_a && !g_strcmp0 (name_a,
- EMPATHY_GROUP_FAVOURITES)) {
+ } else if (is_favourite_a && !is_favourite_b) {
ret_val = -1;
- } else if (!contact_b && !g_strcmp0 (name_b,
- EMPATHY_GROUP_FAVOURITES)) {
+ } else if (!is_favourite_a && is_favourite_b) {
ret_val = 1;
-#endif /* HAVE_FAVOURITE_CONTACTS */
} else if (!contact_a && contact_b) {
ret_val = 1;
} else if (contact_a && !contact_b) {
}
}
-/* 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 */
+}
+
+