aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Reitter <treitter@gmail.com>2010-02-24 02:08:05 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-15 16:28:40 +0800
commit50a0138f16ceabeecd1ee92f127684a9d50b3e70 (patch)
treea4d995ff700cb3510ccd6c16c12d4e3c5a8a8f04
parentb8657a61fe72be0da2d91325b0851dd4d7fd533c (diff)
downloadgsoc2013-empathy-50a0138f16ceabeecd1ee92f127684a9d50b3e70.tar
gsoc2013-empathy-50a0138f16ceabeecd1ee92f127684a9d50b3e70.tar.gz
gsoc2013-empathy-50a0138f16ceabeecd1ee92f127684a9d50b3e70.tar.bz2
gsoc2013-empathy-50a0138f16ceabeecd1ee92f127684a9d50b3e70.tar.lz
gsoc2013-empathy-50a0138f16ceabeecd1ee92f127684a9d50b3e70.tar.xz
gsoc2013-empathy-50a0138f16ceabeecd1ee92f127684a9d50b3e70.tar.zst
gsoc2013-empathy-50a0138f16ceabeecd1ee92f127684a9d50b3e70.zip
Add a favorite contacts build option and make Moblin support automatically turn it on.
-rw-r--r--configure.ac32
-rw-r--r--libempathy-gtk/Makefile.am2
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c22
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c8
-rw-r--r--libempathy/Makefile.am2
-rw-r--r--libempathy/empathy-contact-list.c2
6 files changed, 68 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 16850eaa3..3d1e09721 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 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 ();
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index 1f1423952..057203bd3 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 65a1edeec..a46fc8db4 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;
}