[gvfs] conditionalize hal support in obexftp backend



commit 1495ad1fefac1e7d0861095793c337ab478c1748
Author: Martin Pitt <martin pitt ubuntu com>
Date:   Fri Jul 3 10:26:26 2009 +0200

    conditionalize hal support in obexftp backend
    
    The obexftp backend only uses hal for finding devices with the "obex"
    capability if the gvfs device path starts with "usb". However, neither hal nor
    bluez actually provide devices with this capability, and the obexftp backend
    works fine with obex:// gvfs mounts without hal.
    
    Conditionalize hal support to only query hal if libhal is available.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=586411

 configure.ac                |    2 +-
 daemon/Makefile.am          |    9 +++++++--
 daemon/gvfsbackendobexftp.c |    8 +++++++-
 3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3149309..f8ff267 100644
--- a/configure.ac
+++ b/configure.ac
@@ -333,7 +333,7 @@ msg_obexftp=no
 OBEXFTP_LIBS=
 OBEXFTP_CFLAGS=
 
-if test "x$enable_obexftp" != "xno" -a "x$msg_hal" = "xyes" ; then
+if test "x$enable_obexftp" != "xno";  then
   PKG_CHECK_EXISTS(dbus-glib-1 bluez >= 4.0, msg_obexftp=yes)
 
   dnl Make sure we have expat
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index b1d4b37..b9b6f01 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -228,10 +228,15 @@ gvfsd_obexftp_CPPFLAGS = \
 	-DBACKEND_HEADER=gvfsbackendobexftp.h \
 	-DDEFAULT_BACKEND_TYPE=obex \
 	-DMAX_JOB_THREADS=1 \
-	$(HAL_CFLAGS) \
 	-DBACKEND_TYPES='"obex", G_VFS_TYPE_BACKEND_OBEXFTP,'
+if USE_HAL
+gvfsd_obexftp_CPPFLAGS += $(HAL_CFLAGS)
+endif
 
-gvfsd_obexftp_LDADD = $(OBEXFTP_LIBS) $(XML_LIBS) $(HAL_LIBS) $(libraries)
+gvfsd_obexftp_LDADD = $(OBEXFTP_LIBS) $(XML_LIBS) $(libraries)
+if USE_HAL
+gvfsd_obexftp_LDADD += $(HAL_LIBS)
+endif
 
 gvfsd_ftp_SOURCES = \
 	gvfsftpconnection.c gvfsftpconnection.h \
diff --git a/daemon/gvfsbackendobexftp.c b/daemon/gvfsbackendobexftp.c
index 2a38177..e658b16 100644
--- a/daemon/gvfsbackendobexftp.c
+++ b/daemon/gvfsbackendobexftp.c
@@ -34,7 +34,9 @@
 #include <glib/gstdio.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
-#include <libhal.h>
+#if defined(HAVE_HAL)
+  #include <libhal.h>
+#endif	
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-bindings.h>
 #include <dbus/dbus-glib-lowlevel.h>
@@ -330,9 +332,11 @@ _get_usb_intfnum_and_properties (DBusGProxy *obex_manager, const char *device, c
   int usb_bus_num;
   int usb_device_num;
   int usb_intf_num;
+#ifdef HAVE_HAL
   DBusError dbus_error;
   DBusConnection *dbus_connection;
   LibHalContext *hal_ctx;
+#endif
   int ods_intf_num = 1;
   int n;
 
@@ -347,6 +351,7 @@ _get_usb_intfnum_and_properties (DBusGProxy *obex_manager, const char *device, c
 
   g_message ("Parsed '%s' into bus=%d device=%d interface=%d", device, usb_bus_num, usb_device_num, usb_intf_num);
 
+#ifdef HAVE_HAL
   dbus_error_init (&dbus_error);
   dbus_connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &dbus_error);
   if (dbus_error_is_set (&dbus_error))
@@ -467,6 +472,7 @@ end:
   dbus_connection_close (dbus_connection);
   dbus_connection_unref (dbus_connection);
   dbus_error_free (&dbus_error);
+#endif /* HAVE_HAL */
 
   return ods_intf_num;
 }



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