From 2d3fbe98ec0477190f3b7fa7ef23c99eed01045a Mon Sep 17 00:00:00 2001 From: Laurent Contzen Date: Sat, 4 Aug 2012 15:42:33 +0200 Subject: Moved the #define'd groups names from view to model empathy-roster-model: Added the groups names definitions empathy-roster-model-manager: Adapted functions to the new groups names empathy-roster-view: removed the groups names definitions and adapted functions to the new groups names --- libempathy-gtk/empathy-roster-model-manager.c | 5 ++--- libempathy-gtk/empathy-roster-model.h | 4 ++++ libempathy-gtk/empathy-roster-view.c | 30 +++++++++++++-------------- libempathy-gtk/empathy-roster-view.h | 4 ---- 4 files changed, 21 insertions(+), 22 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-roster-model-manager.c b/libempathy-gtk/empathy-roster-model-manager.c index ebf26935a..2859e6554 100644 --- a/libempathy-gtk/empathy-roster-model-manager.c +++ b/libempathy-gtk/empathy-roster-model-manager.c @@ -53,8 +53,6 @@ enum static guint signals[LAST_SIGNAL]; */ -#define PEOPLE_NEARBY _("People Nearby") - struct _EmpathyRosterModelManagerPriv { EmpathyIndividualManager *manager; @@ -286,7 +284,8 @@ empathy_roster_model_manager_get_groups_for_individual (EmpathyRosterModel *mode if (is_xmpp_local_contact (individual)) { - groups_list = g_list_prepend (groups_list, PEOPLE_NEARBY); + groups_list = g_list_prepend (groups_list, + EMPATHY_ROSTER_MODEL_GROUP_PEOPLE_NEARBY); return groups_list; } diff --git a/libempathy-gtk/empathy-roster-model.h b/libempathy-gtk/empathy-roster-model.h index c624ca427..7a83c0eb2 100644 --- a/libempathy-gtk/empathy-roster-model.h +++ b/libempathy-gtk/empathy-roster-model.h @@ -28,6 +28,10 @@ G_BEGIN_DECLS +#define EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP _("Top Contacts") +#define EMPATHY_ROSTER_MODEL_GROUP_PEOPLE_NEARBY _("People Nearby") +#define EMPATHY_ROSTER_MODEL_GROUP_UNGROUPED _("Ungrouped") + typedef struct _EmpathyRosterModel EmpathyRosterModel; typedef struct _EmpathyRosterModelInterface EmpathyRosterModelInterface; diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c index 84bd5d46a..e9b44af37 100644 --- a/libempathy-gtk/empathy-roster-view.c +++ b/libempathy-gtk/empathy-roster-view.c @@ -219,9 +219,9 @@ ensure_roster_group (EmpathyRosterView *self, if (roster_group != NULL) return EMPATHY_ROSTER_GROUP (roster_group); - if (!tp_strdiff (group, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP)) + if (!tp_strdiff (group, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP)) roster_group = empathy_roster_group_new (group, "emblem-favorite-symbolic"); - else if (!tp_strdiff (group, EMPATHY_ROSTER_VIEW_GROUP_PEOPLE_NEARBY)) + else if (!tp_strdiff (group, EMPATHY_ROSTER_MODEL_GROUP_PEOPLE_NEARBY)) roster_group = empathy_roster_group_new (group, "im-local-xmpp"); else roster_group = empathy_roster_group_new (group, NULL); @@ -312,7 +312,7 @@ individual_added (EmpathyRosterView *self, FOLKS_FAVOURITE_DETAILS (individual)) || g_list_index (tops, individual) != -1) { - add_to_group (self, individual, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP); + add_to_group (self, individual, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP); } groups = empathy_roster_model_get_groups_for_individual (self->priv->model, @@ -328,7 +328,7 @@ individual_added (EmpathyRosterView *self, else { /* No group, adds to Ungrouped */ - add_to_group (self, individual, EMPATHY_ROSTER_VIEW_GROUP_UNGROUPED); + add_to_group (self, individual, EMPATHY_ROSTER_MODEL_GROUP_UNGROUPED); } g_list_free (groups); @@ -534,15 +534,15 @@ static gint compare_group_names (const gchar *group_a, const gchar *group_b) { - if (!tp_strdiff (group_a, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP)) + if (!tp_strdiff (group_a, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP)) return -1; - if (!tp_strdiff (group_b, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP)) + if (!tp_strdiff (group_b, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP)) return 1; - if (!tp_strdiff (group_a, EMPATHY_ROSTER_VIEW_GROUP_UNGROUPED)) + if (!tp_strdiff (group_a, EMPATHY_ROSTER_MODEL_GROUP_UNGROUPED)) return 1; - else if (!tp_strdiff (group_b, EMPATHY_ROSTER_VIEW_GROUP_UNGROUPED)) + else if (!tp_strdiff (group_b, EMPATHY_ROSTER_MODEL_GROUP_UNGROUPED)) return -1; return g_ascii_strcasecmp (group_a, group_b); @@ -752,7 +752,7 @@ contact_should_be_displayed (EmpathyRosterView *self, group_name = empathy_roster_contact_get_group (contact); - if (!tp_strdiff (group_name, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP)) + if (!tp_strdiff (group_name, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP)) /* Always display favourite contact in group mode only in the * 'top group'*/ return TRUE; @@ -891,7 +891,7 @@ remove_from_group (EmpathyRosterView *self, if (g_hash_table_size (contacts) == 0) { - add_to_group (self, individual, EMPATHY_ROSTER_VIEW_GROUP_UNGROUPED); + add_to_group (self, individual, EMPATHY_ROSTER_MODEL_GROUP_UNGROUPED); } roster_group = lookup_roster_group (self, group); @@ -921,7 +921,7 @@ update_top_contacts (EmpathyRosterView *self) tops = empathy_roster_model_get_top_individuals (self->priv->model); group = g_hash_table_lookup (self->priv->roster_groups, - EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP); + EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP); if (group == NULL) { to_add = g_list_copy (tops); @@ -959,10 +959,10 @@ update_top_contacts (EmpathyRosterView *self) } for (l = to_add; l != NULL; l = g_list_next (l)) - add_to_group (self, l->data, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP); + add_to_group (self, l->data, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP); for (l = to_remove; l != NULL; l = g_list_next (l)) - remove_from_group (self, l->data, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP); + remove_from_group (self, l->data, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP); g_list_free (to_add); g_list_free (to_remove); @@ -1010,10 +1010,10 @@ favourites_changed_cb (EmpathyRosterModel *model, if (self->priv->show_groups) { if (favourite) - add_to_group (self, individual, EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP); + add_to_group (self, individual, EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP); else remove_from_group (self, individual, - EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP); + EMPATHY_ROSTER_MODEL_GROUP_TOP_GROUP); } else { diff --git a/libempathy-gtk/empathy-roster-view.h b/libempathy-gtk/empathy-roster-view.h index 6d5d760a3..0077b6843 100644 --- a/libempathy-gtk/empathy-roster-view.h +++ b/libempathy-gtk/empathy-roster-view.h @@ -9,10 +9,6 @@ G_BEGIN_DECLS -#define EMPATHY_ROSTER_VIEW_GROUP_UNGROUPED _("Ungrouped") -#define EMPATHY_ROSTER_VIEW_GROUP_TOP_GROUP _("Top Contacts") -#define EMPATHY_ROSTER_VIEW_GROUP_PEOPLE_NEARBY _("People Nearby") - typedef struct _EmpathyRosterView EmpathyRosterView; typedef struct _EmpathyRosterViewClass EmpathyRosterViewClass; typedef struct _EmpathyRosterViewPriv EmpathyRosterViewPriv; -- cgit v1.2.3