]> git.0d.be Git - empathy.git/commitdiff
Add a favorite contacts build option and make Moblin support automatically turn it on.
authorTravis Reitter <treitter@gmail.com>
Tue, 23 Feb 2010 18:08:05 +0000 (10:08 -0800)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 15 Mar 2010 08:28:40 +0000 (09:28 +0100)
configure.ac
libempathy-gtk/Makefile.am
libempathy-gtk/empathy-contact-list-store.c
libempathy-gtk/empathy-contact-list-view.c
libempathy/Makefile.am
libempathy/empathy-contact-list.c

index 16850eaa397272e1d548aee98a3271b21abb3a09..3d1e097213dcf81cb19fb3080e0ac0bc50c8f301 100644 (file)
@@ -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"
@@ -455,6 +456,36 @@ AM_CONDITIONAL(HAVE_MEEGO, test "x$have_meego" = "xyes")
 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
 # -----------------------------------------------------------
@@ -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:
index 6ec319e1ca5469009d14a6f19ee81330ade72dc3..2df40010360c72bd8ba1b61230621dd524b6266b 100644 (file)
@@ -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)                          \
index 8592fe96fe72ccc9e2a90b9abcc67a20ab4b9246..72ba746959411349aaec9aeb18b3906068eee4fa 100644 (file)
@@ -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) {
index c952bb8ae4a4b7395bafb4d35004ab29844b980a..bd432f2614f49104f1cf7b8c6c898a1f74c6c67b 100644 (file)
@@ -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 ();
index 1f1423952a5e0543f4e2a7100bd31199ae98fe55..057203bd377127ecb69e8f0fdbcbdecac7932649 100644 (file)
@@ -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) \
index 65a1edeec20f47c0cec6289140f198c9316819fa..a46fc8db4a8bbc5a9bf7a8df3de7d10010a969b5 100644 (file)
@@ -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;
 }