From 50a0138f16ceabeecd1ee92f127684a9d50b3e70 Mon Sep 17 00:00:00 2001 From: Travis Reitter Date: Tue, 23 Feb 2010 10:08:05 -0800 Subject: Add a favorite contacts build option and make Moblin support automatically turn it on. --- libempathy-gtk/Makefile.am | 2 ++ libempathy-gtk/empathy-contact-list-store.c | 22 ++++++++++++++++++++++ libempathy-gtk/empathy-contact-list-view.c | 8 ++++++++ 3 files changed, 32 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index 6ec319e1c..2df400103 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -11,6 +11,7 @@ AM_CPPFLAGS = \ $(LIBNOTIFY_CFLAGS) \ $(ENCHANT_CFLAGS) \ $(LIBCHAMPLAIN_CFLAGS) \ + $(FAVOURITE_CONTACTS_CFLAGS) \ $(GEOCLUE_CFLAGS) \ $(MEEGO_CFLAGS) \ $(WEBKIT_CFLAGS) \ @@ -135,6 +136,7 @@ libempathy_gtk_la_LIBADD = \ $(TPL_LIBS) \ $(ENCHANT_LIBS) \ $(LIBCHAMPLAIN_LIBS) \ + $(FAVOURITE_CONTACTS_LIBS) \ $(GEOCLUE_LIBS) \ $(MEEGO_LIBS) \ $(WEBKIT_LIBS) \ diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index 8592fe96f..72ba74695 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -1446,6 +1446,7 @@ contact_list_store_get_group (EmpathyContactListStore *store, 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 @@ -1459,6 +1460,7 @@ contact_list_store_get_group (EmpathyContactListStore *store, EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, TRUE, -1); } +#endif /* HAVE_FAVOURITE_CONTACTS */ if (iter_separator_to_set) { *iter_separator_to_set = iter_separator; @@ -1513,6 +1515,7 @@ contact_list_store_state_sort_func (GtkTreeModel *model, /* 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)) { @@ -1520,19 +1523,28 @@ contact_list_store_state_sort_func (GtkTreeModel *model, } 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)) { ret_val = -1; } else if (!contact_b && !g_strcmp0 (name_b, EMPATHY_GROUP_FAVOURITES)) { ret_val = 1; +#endif /* HAVE_FAVOURITE_CONTACTS */ } else if (!contact_a && contact_b) { ret_val = 1; } else if (contact_a && !contact_b) { @@ -1599,6 +1611,7 @@ contact_list_store_name_sort_func (GtkTreeModel *model, 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)) { @@ -1606,19 +1619,28 @@ contact_list_store_name_sort_func (GtkTreeModel *model, } 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)) { ret_val = -1; } else if (!contact_b && !g_strcmp0 (name_b, EMPATHY_GROUP_FAVOURITES)) { ret_val = 1; +#endif /* HAVE_FAVOURITE_CONTACTS */ } else if (!contact_a && contact_b) { ret_val = 1; } else if (contact_a && !contact_b) { diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index c952bb8ae..bd432f261 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -816,6 +816,7 @@ contact_list_view_call_activated_cb ( g_object_unref (contact); } +#if HAVE_FAVOURITE_CONTACTS static void contact_list_view_favourite_toggled_cb ( EmpathyCellRendererActivatable *cell, @@ -850,6 +851,7 @@ contact_list_view_favourite_toggled_cb ( g_object_unref (contact); } +#endif /* HAVE_FAVOURITE_CONTACTS */ static void contact_list_view_cell_set_background (EmpathyContactListView *view, @@ -990,10 +992,12 @@ contact_list_view_text_cell_data_func (GtkTreeViewColumn *tree_column, EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name, -1); +#if HAVE_FAVOURITE_CONTACTS if (is_group && !g_strcmp0 (name, EMPATHY_GROUP_FAVOURITES)) { g_free (name); name = g_strdup (_(EMPATHY_GROUP_FAVOURITES)); } +#endif /* HAVE_FAVOURITE_CONTACTS */ g_object_set (cell, "show-status", show_status, @@ -1038,6 +1042,7 @@ contact_list_view_expander_cell_data_func (GtkTreeViewColumn *column, contact_list_view_cell_set_background (view, cell, is_group, is_active); } +#if HAVE_FAVOURITE_CONTACTS static void contact_list_view_favourite_cell_data_func ( GtkTreeViewColumn *tree_column, @@ -1070,6 +1075,7 @@ contact_list_view_favourite_cell_data_func ( contact_list_view_cell_set_background (view, cell, is_group, is_active); } +#endif /* HAVE_FAVOURITE_CONTACTS */ static void contact_list_view_row_expand_or_collapse_cb (EmpathyContactListView *view, @@ -1174,6 +1180,7 @@ contact_list_view_setup (EmpathyContactListView *view) col = gtk_tree_view_column_new (); +#if HAVE_FAVOURITE_CONTACTS /* Favourite Icon */ cell = empathy_cell_renderer_activatable_new (); gtk_tree_view_column_pack_start (col, cell, FALSE); @@ -1189,6 +1196,7 @@ contact_list_view_setup (EmpathyContactListView *view) g_signal_connect (cell, "path-activated", G_CALLBACK (contact_list_view_favourite_toggled_cb), view); +#endif /* State */ cell = gtk_cell_renderer_pixbuf_new (); -- cgit v1.2.3