[empathy] Add a favorite contacts build option and make Moblin support automatically turn it on.
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Add a favorite contacts build option and make Moblin support automatically turn it on.
- Date: Mon, 15 Mar 2010 08:28:59 +0000 (UTC)
commit 50a0138f16ceabeecd1ee92f127684a9d50b3e70
Author: Travis Reitter <treitter gmail com>
Date: Tue Feb 23 10:08:05 2010 -0800
Add a favorite contacts build option and make Moblin support automatically turn it on.
configure.ac | 32 +++++++++++++++++++++++++++
libempathy-gtk/Makefile.am | 2 +
libempathy-gtk/empathy-contact-list-store.c | 22 ++++++++++++++++++
libempathy-gtk/empathy-contact-list-view.c | 8 ++++++
libempathy/Makefile.am | 2 +
libempathy/empathy-contact-list.c | 2 +
6 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 16850ea..3d1e097 100644
--- a/configure.ac
+++ b/configure.ac
@@ -442,6 +442,7 @@ if test "x$enable_meego" != "xno"; then
if test "x$have_meego" = "xyes"; then
AC_DEFINE(HAVE_MEEGO, 1, [Define if you have meego])
+ chain_enable_favourite_contacts="yes"
fi
else
have_meego="no"
@@ -456,6 +457,36 @@ AC_SUBST(MEEGO_CFLAGS)
AC_SUBST(MEEGO_LIBS)
# -----------------------------------------------------------
+# favourite contacts support
+# -----------------------------------------------------------
+AC_ARG_ENABLE(favourite_contacts,
+ AS_HELP_STRING([--enable-favourite-contacts=@<:no/yes@:>@],
+ [Enable favourite contacts]), ,
+ enable_favourite_contacts=no)
+
+if test "x$enable_favourite_contacts" != "xno" -o "x$chain_enable_favourite_contacts" == "xyes"; then
+ PKG_CHECK_MODULES(TELEPATHY_LOGGER,
+ [
+ libtelepathy-logger
+ ], have_telepathy_logger="yes", have_telepathy_logger="no")
+
+ if test "x$have_telepathy_logger" = "xyes"; then
+ have_favourite_contacts="yes"
+ AC_DEFINE(HAVE_FAVOURITE_CONTACTS, 1, [Define if you want favourite contacts support])
+ fi
+else
+ have_favourite_contacts="no"
+fi
+
+if test "x$enable_favourite_contacts" = "xyes" -a "x$have_favourite_contacts" != "xyes"; then
+ AC_MSG_ERROR([Couldn't find favourite contacts dependencies.])
+fi
+
+AM_CONDITIONAL(HAVE_FAVOURITE_CONTACTS, test "x$have_telepathy_logger" = "xyes")
+AC_SUBST(FAVOURITE_CONTACTS_CFLAGS)
+AC_SUBST(FAVOURITE_CONTACTS_LIBS)
+
+# -----------------------------------------------------------
# nautilus-sendto
# -----------------------------------------------------------
AC_ARG_ENABLE(nautilus-sendto,
@@ -551,6 +582,7 @@ Configure summary:
Location awareness (Geoclue): ${have_geoclue}
Adium themes (Webkit).......: ${have_webkit}
Meego widgets ..............: ${have_meego}
+ Favourite contacts .........: ${have_favourite_contacts}
Control center embedding....: ${have_control_center_embedding}
Logging:
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 6ec319e..2df4001 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 8592fe9..72ba746 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 c952bb8..bd432f2 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 ();
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index 1f14239..057203b 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -10,6 +10,7 @@ AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"empathy\" \
$(TPL_CFLAGS) \
$(LIBEMPATHY_CFLAGS) \
+ $(FAVOURITE_CONTACTS_CFLAGS) \
$(GEOCLUE_CFLAGS) \
$(NETWORK_MANAGER_CFLAGS) \
$(CONNMAN_CFLAGS) \
@@ -119,6 +120,7 @@ nodist_libempathy_la_SOURCES =\
libempathy_la_LIBADD = \
$(top_builddir)/extensions/libemp-extensions.la \
$(LIBEMPATHY_LIBS) \
+ $(FAVOURITE_CONTACTS_LIBS) \
$(GEOCLUE_LIBS) \
$(TPL_LIBS) \
$(NETWORK_MANAGER_LIBS) \
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c
index 65a1ede..a46fc8d 100644
--- a/libempathy/empathy-contact-list.c
+++ b/libempathy/empathy-contact-list.c
@@ -256,12 +256,14 @@ gboolean
empathy_contact_list_contact_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;
+#endif /* HAVE_FAVOURITE_CONTACTS */
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]