rhythmbox r6026 - in trunk: . plugins/daap



Author: jmatthew
Date: Sun Nov  9 06:12:50 2008
New Revision: 6026
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6026&view=rev

Log:
2008-11-09  Jonathan Matthew  <jonathan d14n org>

	* configure.ac:
	* plugins/daap/rb-daap-mdns-browser-avahi.c: (client_cb),
	(avahi_client_init), (resolve_cb), (rb_daap_mdns_browser_resolve),
	(browse_cb), (rb_daap_mdns_browser_start):
	* plugins/daap/rb-daap-mdns-publisher-avahi.c: (client_cb),
	(avahi_client_init), (create_service):
	Drop avahi 0.5 compatibility.  Avahi 0.6 has been out for almost three
	years now.


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/plugins/daap/rb-daap-mdns-browser-avahi.c
   trunk/plugins/daap/rb-daap-mdns-publisher-avahi.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sun Nov  9 06:12:50 2008
@@ -36,6 +36,7 @@
 NCB_MIN_REQS=2.21.6
 TOTEM_PLPARSER_REQS=2.22.0
 VALA_REQS=0.1.0
+AVAHI_REQS=0.6
 
 AC_MSG_CHECKING([for GNU extension fwrite_unlocked])
 AC_LINK_IFELSE(
@@ -268,65 +269,27 @@
    [Select the mDNS/DNS-SD implementation to use (default auto)]),,
    with_mdns=auto)
 
-#have_howl=no
 have_avahi=no
 have_mdns=no
-#use_howl=no
 use_avahi=no
 
 PKG_CHECK_MODULES(AVAHI,
-   avahi-client >= 0.6
-   avahi-glib >= 0.6,
-   have_avahi_06=yes,
-   have_avahi_06=no)
-if test x$have_avahi_06 != xyes; then
-   PKG_CHECK_MODULES(AVAHI,
-      avahi-client >= 0.5
-      avahi-glib >= 0.5,
-      have_avahi_05=yes,
-      have_avahi_05=no)
-fi
-if test x$have_avahi_06 = xyes || test x$have_avahi_05 = xyes; then
-   have_avahi=yes
-else
-   have_avahi=no
-fi
+   avahi-client >= $AVAHI_REQS
+   avahi-glib >= $AVAHI_REQS,
+   have_avahi=yes,
+   have_avahi=no)
 
-if test x"$with_mdns" = xauto; then
+if test x"$with_mdns" = xauto || test x"$with_mdns" = xavahi; then
    if test x"$have_avahi" = xyes; then
       MDNS_CFLAGS=$AVAHI_CFLAGS
       MDNS_LIBS=$AVAHI_LIBS
       AC_DEFINE(WITH_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi])
       use_avahi=yes
       AC_MSG_NOTICE([Detected Avahi, using it for mDNS/DNS-SD])
-      if test x$have_avahi_06 = xyes; then
-         AC_DEFINE(HAVE_AVAHI_0_6, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.6])
-      else
-         AC_DEFINE(HAVE_AVAHI_0_5, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.5])
-      fi
-
       have_mdns=yes
-   fi
-fi
-
-if test x"$with_mdns" = xavahi; then
-   if test x"$have_avahi" = xno; then
+   elif test x"$with_mdns" = xavahi; then
       AC_MSG_ERROR([Avahi explicitly requested but not found.])
    fi
-
-   MDNS_CFLAGS=$AVAHI_CFLAGS
-   MDNS_LIBS=$AVAHI_LIBS
-   AC_DEFINE(WITH_AVAHI, 1, [Define if mDNS/DNS-SD implementation uses Avahi])
-   use_avahi=yes
-   AC_MSG_NOTICE([Using Avahi for mDNS/DNS-SD])
-
-   if test x$have_avahi_06 = xyes; then
-      AC_DEFINE(HAVE_AVAHI_0_6, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.6])
-   else
-      AC_DEFINE(HAVE_AVAHI_0_5, 1, [Define if mDNS/DNS-SD implementation uses Avahi 0.5])
-   fi
-
-   have_mdns=yes
 fi
 
 AM_CONDITIONAL(USE_AVAHI, test "x$use_avahi" = "xyes")

Modified: trunk/plugins/daap/rb-daap-mdns-browser-avahi.c
==============================================================================
--- trunk/plugins/daap/rb-daap-mdns-browser-avahi.c	(original)
+++ trunk/plugins/daap/rb-daap-mdns-browser-avahi.c	Sun Nov  9 06:12:50 2008
@@ -37,10 +37,8 @@
 #include <glib/gi18n.h>
 #include <glib-object.h>
 
-#ifdef HAVE_AVAHI_0_6
 #include <avahi-client/lookup.h>
 #include <avahi-client/publish.h>
-#endif
 #include <avahi-client/client.h>
 #include <avahi-common/error.h>
 #include <avahi-glib/glib-malloc.h>
@@ -50,10 +48,6 @@
 #include "rb-marshal.h"
 #include "rb-debug.h"
 
-#ifdef HAVE_AVAHI_0_5
-#define AVAHI_ADDRESS_STR_MAX	(40)	/* IPv6 Max = 4*8 + 7 + 1 for NUL */
-#endif
-
 static void	rb_daap_mdns_browser_class_init (RBDaapMdnsBrowserClass *klass);
 static void	rb_daap_mdns_browser_init	(RBDaapMdnsBrowser	*browser);
 static void	rb_daap_mdns_browser_finalize   (GObject	        *object);
@@ -104,12 +98,10 @@
 	/* Called whenever the client or server state changes */
 
 	switch (state) {
-#ifdef HAVE_AVAHI_0_6
 	case AVAHI_CLIENT_FAILURE:
 
 		 g_warning ("Client failure: %s\n", avahi_strerror (avahi_client_errno (client)));
 		 break;
-#endif
 	default:
 		break;
 	}
@@ -119,6 +111,7 @@
 avahi_client_init (RBDaapMdnsBrowser *browser)
 {
 	int error = 0;
+	AvahiClientFlags flags;
 
 	avahi_set_allocator (avahi_glib_allocator ());
 
@@ -128,24 +121,13 @@
 		rb_debug ("Unable to create AvahiGlibPoll object for mDNS");
 	}
 
-#ifdef HAVE_AVAHI_0_5
+	flags = 0;
+
 	browser->priv->client = avahi_client_new (avahi_glib_poll_get (browser->priv->poll),
-						  (AvahiClientCallback) client_cb,
+						  flags,
+						  (AvahiClientCallback)client_cb,
 						  browser,
 						  &error);
-#endif
-#ifdef HAVE_AVAHI_0_6
-	{
-		AvahiClientFlags flags;
-		flags = 0;
-
-		browser->priv->client = avahi_client_new (avahi_glib_poll_get (browser->priv->poll),
-							  flags,
-							  (AvahiClientCallback)client_cb,
-							  browser,
-							  &error);
-	}
-#endif
 }
 
 static void
@@ -160,9 +142,7 @@
 	    const AvahiAddress    *address,
 	    uint16_t               port,
 	    AvahiStringList       *text,
-#ifdef HAVE_AVAHI_0_6
 	    AvahiLookupResultFlags flags,
-#endif
 	    RBDaapMdnsBrowser     *browser)
 {
 	if (event == AVAHI_RESOLVER_FOUND) {
@@ -232,9 +212,7 @@
 						       "_daap._tcp",
 						       NULL,
 						       AVAHI_PROTO_UNSPEC,
-#ifdef HAVE_AVAHI_0_6
 						       0,
-#endif
 						       (AvahiServiceResolverCallback)resolve_cb,
 						       browser);
 	if (service_resolver == NULL) {
@@ -269,19 +247,12 @@
 	   const char            *name,
 	   const char            *type,
 	   const char            *domain,
-#ifdef HAVE_AVAHI_0_6
 	   AvahiLookupResultFlags flags,
-#endif
 	   RBDaapMdnsBrowser     *browser)
 {
 	gboolean local;
 
-#ifdef HAVE_AVAHI_0_5
-	local = avahi_client_is_service_local (browser->priv->client, interface, protocol, name, type, domain);
-#endif
-#ifdef HAVE_AVAHI_0_6
 	local = ((flags & AVAHI_LOOKUP_RESULT_LOCAL) != 0);
-#endif
 	if (local) {
 		rb_debug ("Ignoring local service %s", name);
 		return;
@@ -320,9 +291,7 @@
 								    AVAHI_PROTO_UNSPEC,
 								    "_daap._tcp",
 								    NULL,
-#ifdef HAVE_AVAHI_0_6
 								    0,
-#endif
 								    (AvahiServiceBrowserCallback)browse_cb,
 								    browser);
 	if (browser->priv->service_browser == NULL) {

Modified: trunk/plugins/daap/rb-daap-mdns-publisher-avahi.c
==============================================================================
--- trunk/plugins/daap/rb-daap-mdns-publisher-avahi.c	(original)
+++ trunk/plugins/daap/rb-daap-mdns-publisher-avahi.c	Sun Nov  9 06:12:50 2008
@@ -36,10 +36,8 @@
 #include <glib/gi18n.h>
 #include <glib-object.h>
 
-#ifdef HAVE_AVAHI_0_6
 #include <avahi-client/lookup.h>
 #include <avahi-client/publish.h>
-#endif
 #include <avahi-client/client.h>
 #include <avahi-common/error.h>
 #include <avahi-glib/glib-malloc.h>
@@ -121,14 +119,12 @@
 		 }
 		 break;
 
-#ifdef HAVE_AVAHI_0_6
 	case AVAHI_CLIENT_FAILURE:
 
 		 g_warning ("Client failure: %s\n", avahi_strerror (avahi_client_errno (client)));
 		 break;
 	case AVAHI_CLIENT_CONNECTING:
 	case AVAHI_CLIENT_S_REGISTERING:
-#endif
 	default:
 		break;
 	}
@@ -138,6 +134,7 @@
 avahi_client_init (RBDaapMdnsPublisher *publisher)
 {
 	gint error = 0;
+	AvahiClientFlags flags;
 
 	avahi_set_allocator (avahi_glib_allocator ());
 
@@ -147,24 +144,13 @@
 		rb_debug ("Unable to create AvahiGlibPoll object for mDNS");
 	}
 
-#ifdef HAVE_AVAHI_0_5
+	flags = 0;
+
 	publisher->priv->client = avahi_client_new (avahi_glib_poll_get (publisher->priv->poll),
-						    (AvahiClientCallback) client_cb,
+						    flags,
+						    (AvahiClientCallback)client_cb,
 						    publisher,
 						    &error);
-#endif
-#ifdef HAVE_AVAHI_0_6
-	{
-		AvahiClientFlags flags;
-		flags = 0;
-
-		publisher->priv->client = avahi_client_new (avahi_glib_poll_get (publisher->priv->poll),
-							    flags,
-							    (AvahiClientCallback)client_cb,
-							    publisher,
-							    &error);
-	}
-#endif
 }
 
 static void
@@ -224,9 +210,7 @@
 	ret = avahi_entry_group_add_service (publisher->priv->entry_group,
 					     AVAHI_IF_UNSPEC,
 					     AVAHI_PROTO_UNSPEC,
-#ifdef HAVE_AVAHI_0_6
 					     0,
-#endif
 					     publisher->priv->name,
 					     "_daap._tcp",
 					     NULL,



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