[epiphany] Mave avahi a hard dependency



commit 95f5095199ea70eb5e0305e2e56a73a61058d015
Author: Xan Lopez <xan igalia com>
Date:   Thu Aug 9 23:01:09 2012 +0200

    Mave avahi a hard dependency
    
    It's listed as a OS core dependency in jhbuild, so let's reduce the
    number of moving pieces on our side.

 configure.ac                   |   41 +++------------------------------
 src/bookmarks/Makefile.am      |    7 -----
 src/bookmarks/ephy-bookmarks.c |   49 ++++-----------------------------------
 3 files changed, 9 insertions(+), 88 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7269f0b..5ce9a4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,7 @@ GNOME_KEYRING_REQUIRED=2.26.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.1
 LIBNOTIFY_REQUIRED=0.5.1
 GCR_REQUIRED=3.5.5
+AVAHI_REQUIRED=0.6.22
 
 AC_ARG_WITH(webkit2,
         [AC_HELP_STRING([--with-webkit2], [build with WebKit2 [default=no]])],
@@ -131,7 +132,9 @@ PKG_CHECK_MODULES([DEPENDENCIES], [
 		  gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
 		  libnotify >= $LIBNOTIFY_REQUIRED
 		  sqlite3
-                  gcr-3 >= $GCR_REQUIRED
+		  gcr-3 >= $GCR_REQUIRED
+		  avahi-gobject >= $AVAHI_REQUIRED
+		  avahi-client >= $AVAHI_REQUIRED
 		  ])
 
 # ******************
@@ -190,41 +193,6 @@ AM_CONDITIONAL([ENABLE_NSS],[test "$enable_nss" = "yes"])
 
 AC_SUBST([EPIPHANY_FEATURES])
 
-# *******************
-# Additional features
-# *******************
-
-# Zeroconf bookmarks sites
-
-AC_MSG_CHECKING([whether to enable zeroconf bookmarks support])
-AC_ARG_ENABLE([zeroconf],
-	AS_HELP_STRING([--disable-zeroconf],[Whether to enable zeroconf bookmarks support (default: autodetect)]),
-	[], [enable_zeroconf=auto])
-AC_MSG_RESULT([$enable_zeroconf])
-
-if test "$enable_zeroconf" != "no"; then
-	AVAHI_REQUIRED=0.6.22
-
-	PKG_CHECK_MODULES(AVAHI,
-                         [avahi-gobject >= $AVAHI_REQUIRED
-                          avahi-client >= $AVAHI_REQUIRED]
-                         ,[have_avahi=yes],[have_avahi=no])
-
-        if test "$enable_zeroconf" = "yes" -a "$have_avahi" = "no"; then
-                AC_MSG_ERROR([zeroconf support was requested but avahi not found])
-        elif test "$have_avahi" = "yes"; then
-                enable_zeroconf=yes
-        else
-                enable_zeroconf=no
-        fi
-fi
-
-if test "$enable_zeroconf" = "yes"; then
-	AC_DEFINE([ENABLE_ZEROCONF],[1],[Define to enable zeroconf bookmarks support])
-fi
-
-AM_CONDITIONAL([ENABLE_ZEROCONF],[test "$enable_zeroconf" = "yes"])
-
 # *******************************
 # Add warning flags
 # *******************************
@@ -337,7 +305,6 @@ Epiphany was configured with the following options:
 	Prefix                     : $prefix
 	Extra debugging support    : $enable_debug
 
- 	Zeroconf bookmarks support : $enable_zeroconf
  	GObject introspection      : $found_introspection
  	NSS support                : $enable_nss
 	Build tests		   : $enable_tests
diff --git a/src/bookmarks/Makefile.am b/src/bookmarks/Makefile.am
index 5843ec9..eafa820 100644
--- a/src/bookmarks/Makefile.am
+++ b/src/bookmarks/Makefile.am
@@ -115,13 +115,6 @@ libephybookmarks_la_CFLAGS = \
 
 libephybookmarks_la_LIBADD =
 
-if ENABLE_ZEROCONF
-libephybookmarks_la_CFLAGS += \
-        $(AVAHI_CFLAGS)
-libephybookmarks_la_LIBADD += \
-	$(AVAHI_LIBS)
-endif
-
 CLEANFILES = $(stamp_files) $(BUILT_SOURCES)
 DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
 MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 764032b..f86b34a 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -37,17 +37,14 @@
 #include "ephy-signal-accumulator.h"
 #include "ephy-tree-model-node.h"
 
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <string.h>
-
-#ifdef ENABLE_ZEROCONF
 #include <avahi-common/error.h>
-#include <avahi-gobject/ga-service-browser.h>
-#include <avahi-gobject/ga-service-resolver.h>
 #include <avahi-gobject/ga-client.h>
 #include <avahi-gobject/ga-enums.h>
-#endif /* ENABLE_ZEROCONF */
+#include <avahi-gobject/ga-service-browser.h>
+#include <avahi-gobject/ga-service-resolver.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <string.h>
 
 #define EPHY_BOOKMARKS_XML_ROOT    "ephy_bookmarks"
 #define EPHY_BOOKMARKS_XML_VERSION "1.03"
@@ -78,13 +75,11 @@ struct _EphyBookmarksPrivate
 	EphyNode *lower_fav;
 	double lower_score;
 
-#ifdef ENABLE_ZEROCONF
 	/* Local sites */
 	EphyNode *local;
 	GaClient *ga_client;
 	GaServiceBrowser *browse_handles[G_N_ELEMENTS (zeroconf_protos)];
 	GHashTable *resolve_handles;
-#endif
 };
 
 static const char *default_topics [] =
@@ -111,9 +106,7 @@ static void ephy_bookmarks_class_init	(EphyBookmarksClass *klass);
 static void ephy_bookmarks_init		(EphyBookmarks *tab);
 static void ephy_bookmarks_finalize	(GObject *object);
 static char *impl_resolve_address	(EphyBookmarks*, const char*, const char*);
-#ifdef ENABLE_ZEROCONF
 static void ephy_local_bookmarks_start_client (EphyBookmarks *bookmarks);
-#endif
 
 G_DEFINE_TYPE (EphyBookmarks, ephy_bookmarks, G_TYPE_OBJECT)
 
@@ -172,14 +165,9 @@ save_filter (EphyNode *node,
 
 	return node != priv->bookmarks &&
 	       node != priv->notcategorized &&
-#ifdef ENABLE_ZEROCONF
 	       node != priv->local;
-#else
-	       TRUE;
-#endif
 }
 
-#ifdef ENABLE_ZEROCONF
 static gboolean
 save_filter_local (EphyNode *node,
 		   EphyBookmarks *bookmarks)
@@ -188,7 +176,6 @@ save_filter_local (EphyNode *node,
 
 	return !ephy_node_has_child (priv->local, node);
 }
-#endif
 
 static void
 ephy_bookmarks_save (EphyBookmarks *eb)
@@ -203,11 +190,7 @@ ephy_bookmarks_save (EphyBookmarks *eb)
 		 (xmlChar *) EPHY_BOOKMARKS_XML_VERSION,
 		 (xmlChar *) "Do not rely on this file, it's only for internal use. Use bookmarks.rdf instead.",
 		 eb->priv->keywords, (EphyNodeFilterFunc) save_filter, eb,
-#ifdef ENABLE_ZEROCONF
 		 eb->priv->bookmarks, (EphyNodeFilterFunc) save_filter_local, eb,
-#else
-		 eb->priv->bookmarks, NULL, eb,
-#endif
 		 NULL);
 
 	/* Export bookmarks in rdf */
@@ -297,9 +280,7 @@ update_bookmark_keywords (EphyBookmarks *eb, EphyNode *bookmark)
 
 		if (kid != eb->priv->notcategorized && 
 		    kid != eb->priv->bookmarks &&
-#ifdef ENABLE_ZEROCONF
 		    kid != eb->priv->local &&
-#endif
 		    ephy_node_has_child (kid, bookmark))
 		{
 			const char *topic;
@@ -364,9 +345,7 @@ bookmark_is_categorized (EphyBookmarks *eb, EphyNode *bookmark)
 
 		if (kid != eb->priv->notcategorized && 
 		    kid != eb->priv->bookmarks &&
-#ifdef ENABLE_ZEROCONF
 		    kid != eb->priv->local &&
-#endif
 		    ephy_node_has_child (kid, bookmark))
 		{
 			return TRUE;
@@ -491,8 +470,6 @@ backup_file (const char *original_filename, const char *extension)
 	g_free (backup_filename);
 }
 
-#ifdef ENABLE_ZEROCONF
-
 /* C&P adapted from gnome-vfs-dns-sd.c */
 static GHashTable *
 decode_txt_record (AvahiStringList *input_text)
@@ -949,8 +926,6 @@ ephy_local_bookmarks_stop (EphyBookmarks *bookmarks)
 	}
 }
 
-#endif /* ENABLE_ZEROCONF */
-
 static void
 ephy_bookmarks_init (EphyBookmarks *eb)
 {
@@ -963,11 +938,9 @@ ephy_bookmarks_init (EphyBookmarks *eb)
 	   bookmarks */
 	const char *bk_not_categorized = C_("bookmarks", "Not Categorized");
 	
-#ifdef ENABLE_ZEROCONF
 	/* Translators: this is an automatic topic containing local
 	 * websites bookmarks autodiscovered with zeroconf. */
 	const char *bk_local_sites = C_("bookmarks", "Nearby Sites");
-#endif
 
 	eb->priv = EPHY_BOOKMARKS_GET_PRIVATE (eb);
 
@@ -1024,7 +997,6 @@ ephy_bookmarks_init (EphyBookmarks *eb)
 	
 	ephy_node_add_child (eb->priv->keywords, eb->priv->notcategorized);
 
-#ifdef ENABLE_ZEROCONF
 	/* Local Websites */
 	eb->priv->local = ephy_node_new_with_id (db, BMKS_LOCAL_NODE_ID);
 
@@ -1041,7 +1013,6 @@ ephy_bookmarks_init (EphyBookmarks *eb)
 	
 	ephy_node_add_child (eb->priv->keywords, eb->priv->local);
 	ephy_local_bookmarks_init (eb);
-#endif /* ENABLE_ZEROCONF */
 
 	/* Smart bookmarks */
 	eb->priv->smartbookmarks = ephy_node_new_with_id (db, SMARTBOOKMARKS_NODE_ID);
@@ -1101,9 +1072,7 @@ ephy_bookmarks_finalize (GObject *object)
 
 	ephy_bookmarks_save (eb);
 
-#ifdef ENABLE_ZEROCONF
 	ephy_local_bookmarks_stop (eb);
-#endif
 
 	ephy_node_unref (priv->bookmarks);
 	ephy_node_unref (priv->keywords);
@@ -1546,13 +1515,11 @@ ephy_bookmarks_get_topic_uri (EphyBookmarks *eb,
 	{
 		uri = g_strdup ("topic://Special/NotCategorized");
 	}
-#ifdef ENABLE_ZEROCONF
 	else if (ephy_bookmarks_get_local (eb) == node)
 	{
 		/* Note: do not change to "Nearby" because of existing custom toolbars */
 		uri = g_strdup ("topic://Special/Local");
 	}
-#endif
 	else
 	{
 		const char *name;
@@ -1594,12 +1561,10 @@ ephy_bookmarks_find_keyword (EphyBookmarks *eb,
 	{
 		return ephy_bookmarks_get_not_categorized (eb);
 	}
-#ifdef ENABLE_ZEROCONF
 	else if (strcmp (name, "topic://Special/Local") == 0)
 	{
 		return ephy_bookmarks_get_local (eb);
 	}
-#endif
 	else if (g_str_has_prefix (name, "topic://"))
 	{
 		topic_name += strlen ("topic://");
@@ -1717,11 +1682,7 @@ ephy_bookmarks_get_bookmarks (EphyBookmarks *eb)
 EphyNode *
 ephy_bookmarks_get_local (EphyBookmarks *eb)
 {
-#ifdef ENABLE_ZEROCONF
 	return eb->priv->local;
-#else
-	return NULL;
-#endif
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]