[gvfs] Drop hal volume monitor and fallback code in gphoto2 and cdda backend



commit ec9c45d7c7671266193a93500c7477990e390fc7
Author: Michael Biebl <biebl debian org>
Date:   Wed Aug 31 21:18:02 2016 +0200

    Drop hal volume monitor and fallback code in gphoto2 and cdda backend
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770671

 common/Makefile.am                                 |   10 -
 common/gvfshalutils.c                              |  538 --------
 common/gvfshalutils.h                              |   42 -
 configure.ac                                       |   52 +-
 daemon/Makefile.am                                 |   26 +-
 daemon/gvfsbackendcdda.c                           |  124 +--
 daemon/gvfsbackendgphoto2.c                        |  317 +-----
 monitor/Makefile.am                                |    6 +-
 monitor/gphoto2/Makefile.am                        |   45 +-
 monitor/gphoto2/ggphoto2volume.c                   |  233 +----
 monitor/gphoto2/ggphoto2volume.h                   |   19 +-
 monitor/gphoto2/ggphoto2volumemonitor.c            |  398 +------
 monitor/gphoto2/hal-device.c                       |  297 -----
 monitor/gphoto2/hal-device.h                       |   93 --
 monitor/gphoto2/hal-marshal.list                   |    3 -
 monitor/gphoto2/hal-pool.c                         |  458 -------
 monitor/gphoto2/hal-pool.h                         |   74 --
 monitor/gphoto2/hal-utils.c                        |  142 --
 monitor/gphoto2/hal-utils.h                        |   40 -
 monitor/hal/.gitignore                             |    1 -
 monitor/hal/Makefile.am                            |   83 --
 monitor/hal/ghaldrive.c                            |  959 --------------
 monitor/hal/ghaldrive.h                            |   62 -
 monitor/hal/ghalmount.c                            | 1192 -----------------
 monitor/hal/ghalmount.h                            |   76 --
 monitor/hal/ghalvolume.c                           | 1007 ---------------
 monitor/hal/ghalvolume.h                           |   84 --
 monitor/hal/ghalvolumemonitor.c                    | 1361 --------------------
 monitor/hal/ghalvolumemonitor.h                    |   59 -
 monitor/hal/gvfs-hal-volume-monitor.service.in     |    7 -
 monitor/hal/hal-device.c                           |  304 -----
 monitor/hal/hal-device.h                           |   93 --
 monitor/hal/hal-marshal.list                       |    3 -
 monitor/hal/hal-pool.c                             |  451 -------
 monitor/hal/hal-pool.h                             |   74 --
 monitor/hal/hal-utils.c                            |  171 ---
 monitor/hal/hal-utils.h                            |   42 -
 monitor/hal/hal-volume-monitor-daemon.c            |   43 -
 monitor/hal/hal.monitor                            |    5 -
 .../hal/org.gtk.vfs.HalVolumeMonitor.service.in    |    4 -
 po/POTFILES.in                                     |    6 -
 test/Makefile.am                                   |    7 -
 42 files changed, 29 insertions(+), 8982 deletions(-)
---
diff --git a/common/Makefile.am b/common/Makefile.am
index 8105169..9fff709 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -42,16 +42,6 @@ libgvfscommon_la_LDFLAGS = -no-undefined -avoid-version
 libgvfscommon_la_LIBADD =      \
        $(GLIB_LIBS)
 
-if USE_HAL
-noinst_LTLIBRARIES += libgvfscommon-hal.la
-libgvfscommon_hal_la_SOURCES = \
-       gvfshalutils.c gvfshalutils.h
-libgvfscommon_hal_la_CFLAGS =  \
-       $(DBUS_CFLAGS)
-libgvfscommon_hal_la_LIBADD =  \
-       $(DBUS_LIBS)
-endif
-
 libgvfscommon_monitor_la_SOURCES =     \
        gvfsmountinfo.h gvfsmountinfo.c \
        $(NULL)
diff --git a/configure.ac b/configure.ac
index 8939be8..0e778f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,8 +63,6 @@ AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
 
 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.51.0 gobject-2.0 gmodule-no-export-2.0 gio-unix-2.0 gio-2.0])
 
-PKG_CHECK_MODULES([DBUS], [dbus-1])
-
 AC_ARG_WITH([dbus_service_dir],
            [AS_HELP_STRING([--with-dbus-service-dir=PATH],[choose directory for dbus service files, 
[default=PREFIX/share/dbus-1/services]])],
            [with_dbus_service_dir="$withval"], [with_dbus_service_dir=$datadir/dbus-1/services])
@@ -298,32 +296,6 @@ fi
 AM_CONDITIONAL(USE_LIBSYSTEMD_LOGIN, [test "$msg_libsystemd_login" = "yes"])
 
 dnl **********************
-dnl *** Check for HAL ***
-dnl **********************
-AC_ARG_ENABLE([hal], [AS_HELP_STRING([--disable-hal],[build without HAL support])])
-msg_hal=no
-have_hal_fast_init=no
-HAL_REQUIRED=0.5.10
-
-if test "x$enable_hal" != "xno" && test "x$msg_gdu" = "xno"; then
-  PKG_CHECK_EXISTS([hal >= $HAL_REQUIRED], [msg_hal=yes])
-
-  if test "x$msg_hal" = "xyes"; then
-    PKG_CHECK_MODULES([HAL],[hal >= $HAL_REQUIRED])
-    AC_DEFINE([HAVE_HAL], 1, [Define to 1 if HAL is available])
-    save_libs="$LIBS"
-    LIBS="$HAL_LIBS"
-    AC_CHECK_LIB([hal], [libhal_get_all_devices_with_properties], [have_hal_fast_init=yes])
-    if test "x$have_hal_fast_init" = "xyes"; then
-      AC_DEFINE([HAVE_HAL_FAST_INIT], 1, [Define to 1 if libhal_get_all_devices_with_properties is 
available])
-    fi
-    LIBS="$save_libs"
-  fi
-fi
-
-AM_CONDITIONAL([USE_HAL], [test "$msg_hal" = "yes"])
-
-dnl **********************
 dnl *** Check for gudev ***
 dnl **********************
 AC_ARG_ENABLE([gudev], [AS_HELP_STRING([--disable-gudev],[build without gudev support])])
@@ -340,23 +312,13 @@ if test "x$enable_gudev" != "xno"; then
 fi
 AM_CONDITIONAL([USE_GUDEV], [test "$msg_gudev" = "yes"])
 
-if test "x$msg_gudev" = "xyes"; then
-  msg_hotplug_backend="gudev"
-else 
-  if test "x$msg_hal" = "xyes"; then
-    msg_hotplug_backend="hal"
-  else
-    msg_hotplug_backend="none"
-  fi
-fi
-
 dnl **************************************************
 dnl *** Check if we should build with CDDA backend ***
 dnl **************************************************
 AC_ARG_ENABLE([cdda], [AS_HELP_STRING([--disable-cdda],[build without CDDA backend])])
 msg_cdda=no
 
-if test "x$enable_cdda" != "xno" -a \( "x$msg_hal" = "xyes" -o "x$msg_gudev" = "xyes" \); then
+if test "x$enable_cdda" != "xno" -a "x$msg_gudev" = "xyes"; then
   PKG_CHECK_EXISTS([libcdio_paranoia >= 0.78.2], [msg_cdda=yes])
 
   if test "x$msg_cdda" = "xyes"; then
@@ -443,10 +405,10 @@ dnl *************************
 AC_ARG_ENABLE([gphoto2], [AS_HELP_STRING([--disable-gphoto2],[build without gphoto2 support])])
 msg_gphoto2=no
 
-if test "x$enable_gphoto2" != "xno" -a \( "x$msg_hal" = "xyes" -o "x$msg_gudev" = "xyes" \); then
+if test "x$enable_gphoto2" != "xno" -a "x$msg_gudev" = "xyes"; then
   PKG_CHECK_MODULES([GPHOTO2], [libgphoto2 >= 2.4.0], [msg_gphoto2=yes])
 
-  # Need OS tweaks in hal volume monitor backend
+  # Need OS tweaks in volume monitor backend
   case "$host" in
     *-linux* | *-freebsd* | *-kfreebsd*-gnu)
       use_gphoto2=yes
@@ -469,9 +431,9 @@ if test "x$enable_gphoto2" != "xno" -a \( "x$msg_hal" = "xyes" -o "x$msg_gudev"
       )
     else
       if test "x$enable_gphoto2" = "xyes"; then
-        AC_MSG_ERROR([Cannot build with gphoto2 support. Need OS tweaks in hal volume monitor.])
+        AC_MSG_ERROR([Cannot build with gphoto2 support. Need OS tweaks in volume monitor.])
       else
-        AC_MSG_WARN([Not building with gphoto2 support. Need OS tweaks in hal volume monitor.])
+        AC_MSG_WARN([Not building with gphoto2 support. Need OS tweaks in volume monitor.])
       fi
       msg_gphoto2=no
     fi
@@ -912,7 +874,6 @@ daemon/trashlib/Makefile
 daemon/Makefile
 monitor/Makefile
 monitor/proxy/Makefile
-monitor/hal/Makefile
 monitor/gdu/Makefile
 monitor/udisks2/Makefile
 monitor/gphoto2/Makefile
@@ -931,8 +892,6 @@ echo "gvfs configuration summary:"
 echo "
         gio module directory : $giomodulesdir
 
-        hotplug backend:              $msg_hotplug_backend
-
        Blu-ray metadata support:     $msg_bluray
        Google support:               $msg_google
         HTTP/WebDAV support:          $msg_http
@@ -947,7 +906,6 @@ echo "
         AFP support:                  $msg_afp
         NFS support:                  $msg_nfs
         DNS-SD support:               $msg_avahi
-       Build HAL volume monitor:     $msg_hal (with fast init path: $have_hal_fast_init)
        Build GDU volume monitor:     $msg_gdu
        Build udisks2 volume monitor: $msg_udisks2
        Build GOA volume monitor:     $msg_goa
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 24b3921..801c58d 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -444,19 +444,10 @@ gvfsd_cdda_CPPFLAGS = \
        -DDEFAULT_BACKEND_TYPE=cdda \
        -DMAX_JOB_THREADS=1 \
        -DBACKEND_TYPES='"cdda", G_VFS_TYPE_BACKEND_CDDA,' \
-       $(CDDA_CFLAGS)
-if USE_GUDEV
-gvfsd_cdda_CPPFLAGS += $(GUDEV_CFLAGS)
-else
-gvfsd_cdda_CPPFLAGS += $(HAL_CFLAGS)
-endif
+       $(CDDA_CFLAGS) \
+       $(GUDEV_CFLAGS)
 
-if USE_GUDEV
 gvfsd_cdda_LDADD = $(libraries) $(CDDA_LIBS) $(GUDEV_LIBS)
-else
-gvfsd_cdda_LDADD = $(libraries) $(CDDA_LIBS) $(HAL_LIBS) \
-                  $(top_builddir)/common/libgvfscommon-hal.la
-endif
 
 gvfsd_admin_SOURCES = \
        gvfsbackendadmin.c gvfsbackendadmin.h \
@@ -496,21 +487,12 @@ gvfsd_gphoto2_CPPFLAGS = \
        -DBACKEND_HEADER=gvfsbackendgphoto2.h \
        -DDEFAULT_BACKEND_TYPE=gphoto2 \
        -DMAX_JOB_THREADS=1 \
+       -DBACKEND_TYPES='"gphoto2", G_VFS_TYPE_BACKEND_GPHOTO2,' \
        $(GPHOTO2_CFLAGS) \
-       -DBACKEND_TYPES='"gphoto2", G_VFS_TYPE_BACKEND_GPHOTO2,'
-if USE_GUDEV
-gvfsd_gphoto2_CPPFLAGS += $(GUDEV_CFLAGS)
-else
-gvfsd_gphoto2_CPPFLAGS += $(HAL_CFLAGS)
-endif
+       $(GUDEV_CFLAGS)
 
-if USE_GUDEV
 gvfsd_gphoto2_LDADD = $(libraries) $(GPHOTO2_LIBS) $(GUDEV_LIBS) \
                      $(top_builddir)/common/libgvfscommon-gphoto2.la
-else
-gvfsd_gphoto2_LDADD = $(libraries) $(GPHOTO2_LIBS) $(HAL_LIBS) \
-                     $(top_builddir)/common/libgvfscommon-hal.la
-endif
 
 gvfsd_mtp_SOURCES = \
        gvfsbackendmtp.c gvfsbackendmtp.h \
diff --git a/daemon/gvfsbackendcdda.c b/daemon/gvfsbackendcdda.c
index a2f1e18..edce885 100644
--- a/daemon/gvfsbackendcdda.c
+++ b/daemon/gvfsbackendcdda.c
@@ -37,15 +37,7 @@
 #include <glib/gstdio.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
-#ifdef HAVE_GUDEV
-  #include <gudev/gudev.h>
-#elif defined(HAVE_HAL)
-  #include <libhal.h>
-  #include <dbus/dbus.h>
-#else
-  #error Needs hal or gudev
-#endif
-
+#include <gudev/gudev.h>
 
 #include "gvfsbackendcdda.h"
 #include "gvfsjobopenforread.h"
@@ -99,13 +91,7 @@ struct _GVfsBackendCdda
 {
   GVfsBackend parent_instance;
 
-#ifdef HAVE_GUDEV
   GUdevClient *gudev_client;
-#elif defined(HAVE_HAL)
-  DBusConnection *dbus_connection;
-  LibHalContext *hal_ctx;
-  char *hal_udi;
-#endif
 
   guint64 size;
 
@@ -225,7 +211,6 @@ fetch_metadata (GVfsBackendCdda *cdda_backend)
   cdio_destroy (cdio);
 }
 
-#ifdef HAVE_GUDEV
 static void
 on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer user_data)
 {
@@ -243,60 +228,6 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
     }
 }
 
-#elif defined(HAVE_HAL)
-static void
-find_udi_for_device (GVfsBackendCdda *cdda_backend)
-{
-  int num_devices;
-  char **devices;
-  int n;
-
-  cdda_backend->hal_udi = NULL;
-
-  devices = libhal_manager_find_device_string_match (cdda_backend->hal_ctx,
-                                                     "block.device",
-                                                     cdda_backend->device_path,
-                                                     &num_devices,
-                                                     NULL);
-  if (devices != NULL)
-    {
-      for (n = 0; n < num_devices && cdda_backend->hal_udi == NULL; n++)
-        {
-          char *udi = devices[n];
-          LibHalPropertySet *ps;
-
-          ps = libhal_device_get_all_properties (cdda_backend->hal_ctx, udi, NULL);
-          if (ps != NULL)
-            {
-              if (libhal_ps_get_bool (ps, "block.is_volume"))
-                {
-                  cdda_backend->hal_udi = g_strdup (udi);
-                  cdda_backend->size = libhal_ps_get_uint64 (ps, "volume.size");
-                }                
-            }
-                  
-          libhal_free_property_set (ps);
-        }
-    }
-  libhal_free_string_array (devices);
-
-  /*g_warning ("found udi '%s'", cdda_backend->hal_udi);*/
-}
-
-static void
-_hal_device_removed (LibHalContext *hal_ctx, const char *udi)
-{
-  GVfsBackendCdda *cdda_backend;
-
-  cdda_backend = G_VFS_BACKEND_CDDA (libhal_ctx_get_user_data (hal_ctx));
-
-  if (cdda_backend->hal_udi != NULL && strcmp (udi, cdda_backend->hal_udi) == 0)
-    {
-      g_vfs_backend_force_unmount (G_VFS_BACKEND (cdda_backend));
-    }
-}
-#endif
-
 static void
 g_vfs_backend_cdda_finalize (GObject *object)
 {
@@ -345,7 +276,6 @@ do_mount (GVfsBackend *backend,
 
   //g_warning ("do_mount %p", cdda_backend);
 
-#ifdef HAVE_GUDEV
   /* setup gudev */
   const char *subsystems[] = {"block", NULL};
   GUdevDevice *gudev_device;
@@ -363,53 +293,6 @@ do_mount (GVfsBackend *backend,
 
   g_signal_connect (cdda_backend->gudev_client, "uevent", G_CALLBACK (on_uevent), cdda_backend);
 
-#elif defined(HAVE_HAL)
-  DBusError dbus_error;
-
-  /* setup libhal */
-
-  dbus_error_init (&dbus_error);
-  cdda_backend->dbus_connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &dbus_error);
-  if (dbus_error_is_set (&dbus_error))
-    {
-      release_device (cdda_backend);
-      release_metadata (cdda_backend);
-      dbus_error_free (&dbus_error);
-      g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot connect to the system bus"));
-      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
-      g_error_free (error);
-      return;
-    }
-  
-  cdda_backend->hal_ctx = libhal_ctx_new ();
-  if (cdda_backend->hal_ctx == NULL)
-    {
-      release_device (cdda_backend);
-      release_metadata (cdda_backend);
-      g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot create libhal context"));
-      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
-      g_error_free (error);
-      return;
-    }
-
-  _g_dbus_connection_integrate_with_main (cdda_backend->dbus_connection);
-  libhal_ctx_set_dbus_connection (cdda_backend->hal_ctx, cdda_backend->dbus_connection);
-  
-  if (!libhal_ctx_init (cdda_backend->hal_ctx, &dbus_error))
-    {
-      release_device (cdda_backend);
-      release_metadata (cdda_backend);
-      dbus_error_free (&dbus_error);
-      g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot initialize libhal"));
-      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
-      g_error_free (error);
-      return;
-    }
-
-  libhal_ctx_set_device_removed (cdda_backend->hal_ctx, _hal_device_removed);
-  libhal_ctx_set_user_data (cdda_backend->hal_ctx, cdda_backend);
-#endif
-
   /* setup libcdio */
 
   host = g_mount_spec_get (mount_spec, "host");
@@ -426,16 +309,11 @@ do_mount (GVfsBackend *backend,
 
   cdda_backend->device_path = g_strdup_printf ("/dev/%s", host);
 
-#ifdef HAVE_GUDEV
   gudev_device = g_udev_client_query_by_device_file (cdda_backend->gudev_client, cdda_backend->device_path);
   if (gudev_device != NULL)
     cdda_backend->size = g_udev_device_get_sysfs_attr_as_uint64 (gudev_device, "size") * 512;
   g_object_unref (gudev_device);
 
-#elif defined(HAVE_HAL)
-  find_udi_for_device (cdda_backend);
-#endif
-
   cdda_backend->drive = cdio_cddap_identify (cdda_backend->device_path, 0, NULL);
   if (cdda_backend->drive == NULL)
     {
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 335ea09..54a6f8a 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -36,17 +36,10 @@
 #include <gio/gio.h>
 #include <gio/gfiledescriptorbased.h>
 #include <gphoto2.h>
-#ifdef HAVE_GUDEV
-  #include <gudev/gudev.h>
-  #include "gvfsgphoto2utils.h"
-#elif defined(HAVE_HAL)
-  #include <libhal.h>
-  #include <dbus/dbus.h>
-#else
-  #error Needs hal or gudev
-#endif
+#include <gudev/gudev.h>
 #include <sys/time.h>
 
+#include "gvfsgphoto2utils.h"
 #include "gvfsbackendgphoto2.h"
 #include "gvfsjobopenforread.h"
 #include "gvfsjobopeniconforread.h"
@@ -174,15 +167,8 @@ struct _GVfsBackendGphoto2
   /* see comment in ensure_ignore_prefix() */
   char *ignore_prefix;
 
-#ifdef HAVE_GUDEV
   GUdevClient *gudev_client;
   GUdevDevice *udev_device;
-#elif defined(HAVE_HAL)
-  DBusConnection *dbus_connection;
-  LibHalContext *hal_ctx;
-  char *hal_udi;
-  char *hal_name;
-#endif
   char *icon_name;
   char *symbolic_icon_name;
 
@@ -542,31 +528,11 @@ release_device (GVfsBackendGphoto2 *gphoto2_backend)
       gphoto2_backend->camera = NULL;
     }
 
-#ifdef HAVE_GUDEV
   if (gphoto2_backend->gudev_client != NULL)
     g_object_unref (gphoto2_backend->gudev_client);
   if (gphoto2_backend->udev_device != NULL)
     g_object_unref (gphoto2_backend->udev_device);
 
-#elif defined(HAVE_HAL)
-  if (gphoto2_backend->dbus_connection != NULL)
-    {
-      dbus_connection_close (gphoto2_backend->dbus_connection);
-      dbus_connection_unref (gphoto2_backend->dbus_connection);
-      gphoto2_backend->dbus_connection = NULL;
-    }
-
-  if (gphoto2_backend->hal_ctx != NULL)
-    {
-      libhal_ctx_free (gphoto2_backend->hal_ctx);
-      gphoto2_backend->hal_ctx = NULL;
-
-    }
-  g_free (gphoto2_backend->hal_udi);
-  gphoto2_backend->hal_udi = NULL;
-  g_free (gphoto2_backend->hal_name);
-  gphoto2_backend->hal_name = NULL;
-#endif
   g_free (gphoto2_backend->icon_name);
   gphoto2_backend->icon_name = NULL;
   g_free (gphoto2_backend->symbolic_icon_name);
@@ -712,7 +678,6 @@ compute_display_name (GVfsBackendGphoto2 *gphoto2_backend)
 {
   char *result = NULL;
 
-#ifdef HAVE_GUDEV
   if (gphoto2_backend->udev_device != NULL)
     result = g_vfs_get_volume_name (gphoto2_backend->udev_device, "ID_GPHOTO2");
   if (result == NULL )
@@ -720,24 +685,12 @@ compute_display_name (GVfsBackendGphoto2 *gphoto2_backend)
       /* Translator: %s represents the device, e.g. usb:001,042  */
       result = g_strdup_printf (_("Digital Camera (%s)"), gphoto2_backend->gphoto2_port);
     }
-#elif defined(HAVE_HAL)
-  if (gphoto2_backend->hal_name == NULL)
-    {
-      /* Translator: %s represents the device, e.g. usb:001,042  */
-      result = g_strdup_printf (_("Digital Camera (%s)"), gphoto2_backend->gphoto2_port);
-    }
-  else
-    {
-      result = g_strdup (gphoto2_backend->hal_name);
-    }
-#endif
 
   return result;
 }
 
 /* ------------------------------------------------------------------------------------------------- */
 
-#ifdef HAVE_GUDEV
 static void
 setup_for_device (GVfsBackendGphoto2 *gphoto2_backend)
 {
@@ -798,225 +751,6 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
     }
 }
 
-#elif defined(HAVE_HAL)
-static void
-find_udi_for_device (GVfsBackendGphoto2 *gphoto2_backend)
-{
-  int num_camera_devices;
-  int num_mtp_devices;
-  int num_devices;
-  char **camera_devices;
-  char **mtp_devices;
-  char **devices;
-  int n, m;
-  int usb_bus_num;
-  int usb_device_num;
-  char **tokens;
-  char *endp;
-  char *camera_x_content_types[] = {"x-content/image-dcf", NULL};
-  char *music_player_x_content_types[] = {"x-content/audio-player", NULL};
-
-  gphoto2_backend->hal_udi = NULL;
-
-  /* parse the usb:001,041 string */
-
-  if (!g_str_has_prefix (gphoto2_backend->gphoto2_port, "usb:"))
-    {
-      return;
-    }
-
-  tokens = g_strsplit (gphoto2_backend->gphoto2_port + 4, ",", 0);
-  if (g_strv_length (tokens) != 2)
-    {
-      g_strfreev (tokens);
-      return;
-    }
-
-  usb_bus_num = strtol (tokens[0], &endp, 10);
-  if (*endp != '\0')
-    {
-      g_strfreev (tokens);
-      return;
-    }
-
-  usb_device_num = strtol (tokens[1], &endp, 10);
-  if (*endp != '\0')
-    {
-      g_strfreev (tokens);
-      return;
-    }
-
-  g_strfreev (tokens);
-
-  g_debug ("Parsed '%s' into bus=%d device=%d\n", gphoto2_backend->gphoto2_port, usb_bus_num, 
usb_device_num);
-
-  camera_devices = libhal_find_device_by_capability (gphoto2_backend->hal_ctx,
-                                                     "camera",
-                                                     &num_camera_devices,
-                                                     NULL);
-  mtp_devices = libhal_find_device_by_capability (gphoto2_backend->hal_ctx,
-                                                  "portable_audio_player",
-                                                  &num_mtp_devices,
-                                                  NULL);
-  for (m = 0; m < 2 && gphoto2_backend->hal_udi == NULL; m++)
-    {
-      devices = m == 0 ? camera_devices : mtp_devices;
-      num_devices = m == 0 ? num_camera_devices : num_mtp_devices;
-
-      if (devices != NULL)
-        {
-          for (n = 0; n < num_devices && gphoto2_backend->hal_udi == NULL; n++)
-            {
-              char *udi = devices[n];
-              LibHalPropertySet *ps;
-              
-              ps = libhal_device_get_all_properties (gphoto2_backend->hal_ctx, udi, NULL);
-              if (ps != NULL)
-                {
-                  const char *subsystem;
-              
-                  subsystem = libhal_ps_get_string (ps, "info.subsystem");
-                  if (subsystem != NULL && strcmp (subsystem, "usb") == 0)
-                    {
-                      int device_usb_bus_num;
-                      int device_usb_device_num;
-                      const char *icon_from_hal;
-                      const char *name_from_hal;
-                      
-                      device_usb_bus_num = libhal_ps_get_int32 (ps, "usb.bus_number");
-                      device_usb_device_num = libhal_ps_get_int32 (ps, "usb.linux.device_number");
-                      icon_from_hal = libhal_ps_get_string (ps, "info.desktop.icon");
-                      name_from_hal = libhal_ps_get_string (ps, "info.desktop.name");
-                      
-                      g_debug ("looking at usb device '%s' with bus=%d, device=%d\n",
-                               udi, device_usb_bus_num, device_usb_device_num);
-                      
-                      if (device_usb_bus_num == usb_bus_num && 
-                          device_usb_device_num == usb_device_num)
-                        {
-                          char *name;
-                          const char *parent_udi;
-                          LibHalPropertySet *ps2;
-
-                          g_debug ("udi '%s' is the one!\n", udi);
-                          
-                          /* IMPORTANT: 
-                           * 
-                           * Keep this naming code in sync with
-                           *
-                           *   hal/ghalvolume;do_update_from_hal_for_camera() 
-                           */
-                          name = NULL;
-                          parent_udi = libhal_ps_get_string (ps, "info.parent");
-                          if (name_from_hal != NULL)
-                            {
-                              name = g_strdup (name_from_hal);
-                            }
-                          else if (parent_udi != NULL)
-                            {
-                              ps2 = libhal_device_get_all_properties (gphoto2_backend->hal_ctx, parent_udi, 
NULL);
-                              if (ps2 != NULL)
-                                {
-                                  const char *vendor;
-                                  const char *product;
-                                  
-                                  vendor = libhal_ps_get_string (ps2, "usb_device.vendor");
-                                  product = libhal_ps_get_string (ps2, "usb_device.product");
-                                  if (vendor == NULL)
-                                    {
-                                      if (product != NULL)
-                                        name = g_strdup (product);
-                                    }
-                                  else
-                                    {
-                                      if (product != NULL)
-                                        name = g_strdup_printf ("%s %s", vendor, product);
-                                      else
-                                        {
-                                          if (m == 0)
-                                            /* Translator: %s is the vendor name, e.g. Panasonic */
-                                            name = g_strdup_printf (_("%s Camera"), vendor);
-                                          else
-                                            /* Translator: %s is the vendor name, e.g. Panasonic */
-                                            name = g_strdup_printf (_("%s Audio Player"), vendor);
-                                        }
-                                    }
-                                  libhal_free_property_set (ps2);
-                                }
-                            }
-                          if (name == NULL)
-                            {
-                              if (m == 0)
-                                name = g_strdup (_("Camera"));
-                              else
-                                name = g_strdup (_("Audio Player"));
-                            }
-                          
-                          gphoto2_backend->hal_udi = g_strdup (udi);
-                          gphoto2_backend->hal_name = name;
-                          if (icon_from_hal != NULL)
-                            {
-                              gphoto2_backend->icon_name = g_strdup (icon_from_hal);
-                            }
-                          else
-                            {
-                              if (m == 1)
-                                {
-                                  gphoto2_backend->icon_name = g_strdup ("multimedia-player");
-                                }
-                              else
-                                {
-                                  gphoto2_backend->icon_name = g_strdup ("camera-photo");
-                                }
-                            }
-
-                          /* TODO: should we sniff the files instead? */
-                          if (m == 0)
-                            {
-                              gphoto2_backend->symbolic_icon_name = g_strdup ("camera-photo-symbolic");
-                              g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend),
-                                                                 camera_x_content_types);
-                            }
-                          else
-                            {
-                              gphoto2_backend->symbolic_icon_name = g_strdup ("multimedia-player-symbolic");
-                              g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend),
-                                                                 music_player_x_content_types);
-                            }
-
-                        }
-                      
-                    }
-                  
-                  libhal_free_property_set (ps);
-                }
-            }
-          libhal_free_string_array (devices);
-        }
-    }
-}
-
-/* ------------------------------------------------------------------------------------------------- */
-
-static void
-_hal_device_removed (LibHalContext *hal_ctx, const char *udi)
-{
-  GVfsBackendGphoto2 *gphoto2_backend;
-
-  gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (libhal_ctx_get_user_data (hal_ctx));
-
-  if (gphoto2_backend->hal_udi != NULL && strcmp (udi, gphoto2_backend->hal_udi) == 0)
-    {
-      g_debug ("we have been removed!\n");
-
-      /* nuke all caches so we're a bit more valgrind friendly */
-      caches_invalidate_all (gphoto2_backend);
-
-      g_vfs_backend_force_unmount (G_VFS_BACKEND (gphoto2_backend));
-    }
-}
-#endif
-
 /* ------------------------------------------------------------------------------------------------- */
 
 static void
@@ -1502,7 +1236,6 @@ do_mount (GVfsBackend *backend,
 
   g_debug ("do_mount %p\n", gphoto2_backend);
 
-#ifdef HAVE_GUDEV
   /* setup gudev */
   const char *subsystems[] = {"usb", NULL};
 
@@ -1517,48 +1250,6 @@ do_mount (GVfsBackend *backend,
 
   g_signal_connect (gphoto2_backend->gudev_client, "uevent", G_CALLBACK (on_uevent), gphoto2_backend);
 
-#elif defined(HAVE_HAL)
-  /* setup libhal */
-  DBusError dbus_error;
-
-  dbus_error_init (&dbus_error);
-  gphoto2_backend->dbus_connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &dbus_error);
-  if (dbus_error_is_set (&dbus_error))
-    {
-      dbus_error_free (&dbus_error);
-      g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot connect to the system bus"));
-      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
-      g_error_free (error);
-      return;
-    }
-  
-  dbus_connection_set_exit_on_disconnect (gphoto2_backend->dbus_connection, FALSE);
-
-  gphoto2_backend->hal_ctx = libhal_ctx_new ();
-  if (gphoto2_backend->hal_ctx == NULL)
-    {
-      g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot create libhal context"));
-      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
-      g_error_free (error);
-      return;
-    }
-
-  _g_dbus_connection_integrate_with_main (gphoto2_backend->dbus_connection);
-  libhal_ctx_set_dbus_connection (gphoto2_backend->hal_ctx, gphoto2_backend->dbus_connection);
-  
-  if (!libhal_ctx_init (gphoto2_backend->hal_ctx, &dbus_error))
-    {
-      dbus_error_free (&dbus_error);
-      g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot initialize libhal"));
-      g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
-      g_error_free (error);
-      return;
-    }
-
-  libhal_ctx_set_device_removed (gphoto2_backend->hal_ctx, _hal_device_removed);
-  libhal_ctx_set_user_data (gphoto2_backend->hal_ctx, gphoto2_backend);
-#endif
-
   /* setup gphoto2 */
 
   host = g_mount_spec_get (mount_spec, "host");
@@ -1576,11 +1267,7 @@ do_mount (GVfsBackend *backend,
 
   g_debug ("  decoded host='%s'\n", gphoto2_backend->gphoto2_port);
 
-#ifdef HAVE_GUDEV
   setup_for_device (gphoto2_backend);
-#elif defined(HAVE_HAL)
-  find_udi_for_device (gphoto2_backend);
-#endif
 
   gphoto2_backend->context = gp_context_new ();
   if (gphoto2_backend->context == NULL)
diff --git a/monitor/Makefile.am b/monitor/Makefile.am
index f7cf7a2..10df398 100644
--- a/monitor/Makefile.am
+++ b/monitor/Makefile.am
@@ -1,10 +1,6 @@
-DIST_SUBDIRS = proxy hal gdu gphoto2 afc udisks2 mtp goa
+DIST_SUBDIRS = proxy gdu gphoto2 afc udisks2 mtp goa
 SUBDIRS = proxy
 
-if USE_HAL
-SUBDIRS += hal
-endif
-
 if USE_GDU
 SUBDIRS += gdu
 endif
diff --git a/monitor/gphoto2/Makefile.am b/monitor/gphoto2/Makefile.am
index 0cd8e1b..b13fd98 100644
--- a/monitor/gphoto2/Makefile.am
+++ b/monitor/gphoto2/Makefile.am
@@ -3,29 +3,7 @@ NULL =
 
 libexec_PROGRAMS = gvfs-gphoto2-volume-monitor
 
-BUILT_SOURCES =                                         \
-       hal-marshal.h           hal-marshal.c
-
-hal-marshal.h: hal-marshal.list
-       $(AM_V_GEN) glib-genmarshal $< --prefix=hal_marshal --header > $@
-
-hal-marshal.c: hal-marshal.list
-       $(AM_V_GEN) echo "#include \"hal-marshal.h\"" > $@ && glib-genmarshal $< --prefix=hal_marshal --body 
$@
-
-
-if USE_GUDEV
-gvfs_gphoto2_volume_monitor_SOURCES =
-
-else
 gvfs_gphoto2_volume_monitor_SOURCES =                  \
-       hal-utils.c             hal-utils.h             \
-       hal-marshal.c           hal-marshal.h           \
-       hal-device.c            hal-device.h            \
-       hal-pool.c              hal-pool.h              \
-       $(NULL)
-endif
-
-gvfs_gphoto2_volume_monitor_SOURCES +=                 \
        gphoto2-volume-monitor-daemon.c                 \
        ggphoto2volume.c        ggphoto2volume.h        \
        ggphoto2volumemonitor.c ggphoto2volumemonitor.h \
@@ -37,38 +15,22 @@ gvfs_gphoto2_volume_monitor_CFLAGS =                \
        -I$(top_srcdir)/monitor/proxy           \
        $(GLIB_CFLAGS)                          \
        $(GPHOTO2_CFLAGS)                       \
+       $(GUDEV_CFLAGS)                         \
        -DGIO_MODULE_DIR=\"$(GIO_MODULE_DIR)\"  \
        -DGVFS_LOCALEDIR=\""$(localedir)"\"     \
        $(NULL)
 
-if USE_GUDEV
-gvfs_gphoto2_volume_monitor_CFLAGS += $(GUDEV_CFLAGS)
-else
-gvfs_gphoto2_volume_monitor_CFLAGS += $(HAL_CFLAGS)
-endif
-
 gvfs_gphoto2_volume_monitor_LDFLAGS =  \
        $(NULL)
 
 gvfs_gphoto2_volume_monitor_LDADD  =                                         \
        $(GLIB_LIBS)                                                          \
        $(GPHOTO2_LIBS)                                                       \
-       $(top_builddir)/common/libgvfscommon.la                               \
-       $(top_builddir)/monitor/proxy/libgvfsproxyvolumemonitordaemon-noin.la \
-       $(NULL)
-
-if USE_GUDEV
-gvfs_gphoto2_volume_monitor_LDADD +=                                          \
        $(GUDEV_LIBS)                                                         \
        $(top_builddir)/common/libgvfscommon-gphoto2.la                       \
+       $(top_builddir)/common/libgvfscommon.la                               \
+       $(top_builddir)/monitor/proxy/libgvfsproxyvolumemonitordaemon-noin.la \
        $(NULL)
-else
-gvfs_gphoto2_volume_monitor_LDADD +=                                          \
-       $(HAL_LIBS)                                                          \
-       $(top_builddir)/common/libgvfscommon-hal.la                          \
-       $(NULL)
-endif
-
 
 remote_volume_monitorsdir = $(datadir)/gvfs/remote-volume-monitors
 remote_volume_monitors_DATA = gphoto2.monitor
@@ -97,7 +59,6 @@ CLEANFILES = \
        $(NULL)
 
 EXTRA_DIST = \
-       hal-marshal.list \
        $(service_in_files) \
        $(systemd_user_in_files) \
        $(remote_volume_monitors_DATA) \
diff --git a/monitor/gphoto2/ggphoto2volume.c b/monitor/gphoto2/ggphoto2volume.c
index 50d9b0c..c1be77e 100644
--- a/monitor/gphoto2/ggphoto2volume.c
+++ b/monitor/gphoto2/ggphoto2volume.c
@@ -33,11 +33,7 @@
 
 #include "ggphoto2volume.h"
 
-#ifdef HAVE_GUDEV
 #include "gvfsgphoto2utils.h"
-#else
-#include "hal-utils.h"
-#endif
 
 /* Protects all fields of GHalDrive that can change */
 G_LOCK_DEFINE_STATIC(gphoto2_volume);
@@ -48,12 +44,7 @@ struct _GGPhoto2Volume {
   GVolumeMonitor *volume_monitor; /* owned by volume monitor */
 
   char *device_path;
-#ifdef HAVE_GUDEV
   GUdevDevice *device;
-#else
-  HalDevice *device;
-  HalDevice *drive_device;
-#endif
 
   GFile *activation_root;
 
@@ -105,228 +96,35 @@ g_gphoto2_volume_init (GGPhoto2Volume *gphoto2_volume)
 {
 }
 
-#ifndef HAVE_GUDEV
-static gboolean
-changed_in_idle (gpointer data)
-{
-  GGPhoto2Volume *volume = data;
-
-  g_signal_emit_by_name (volume, "changed");
-  if (volume->volume_monitor != NULL)
-    g_signal_emit_by_name (volume->volume_monitor, "volume_changed", volume);
-  g_object_unref (volume);
-
-  return FALSE;
-}
-
-static char **
-dupv_and_uniqify (char **str_array)
-{
-  int n, m, o;
-  int len;
-  char **result;
-
-  result = g_strdupv (str_array);
-  len = g_strv_length (result);
-
-  for (n = 0; n < len; n++)
-    {
-      char *s = result[n];
-      for (m = n + 1; m < len; m++)
-        {
-          char *p = result[m];
-          if (strcmp (s, p) == 0)
-            {
-              for (o = m + 1; o < len; o++)
-                result[o - 1] = result[o];
-              len--;
-              result[len] = NULL;
-              m--;
-            }
-        }
-    }
-
-  return result;
-}
-
-static void
-do_update_from_hal_for_camera (GGPhoto2Volume *v)
-{
-  const char *vendor;
-  const char *product;
-  const char *icon_from_hal;
-  const char *name_from_hal;
-  gboolean is_audio_player;
-
-  vendor = hal_device_get_property_string (v->drive_device, "usb_device.vendor");
-  product = hal_device_get_property_string (v->drive_device, "usb_device.product");
-  icon_from_hal = hal_device_get_property_string (v->device, "info.desktop.icon");
-  name_from_hal = hal_device_get_property_string (v->device, "info.desktop.name");
-
-  is_audio_player = hal_device_has_capability (v->device, "portable_audio_player");
-
-  v->name = NULL;
-  if (strlen (name_from_hal) > 0)
-    v->name = g_strdup (name_from_hal);
-  else if (vendor == NULL)
-    {
-      if (product != NULL)
-        v->name = g_strdup (product);
-    }
-  else
-    {
-      if (product != NULL)
-        v->name = g_strdup_printf ("%s %s", vendor, product);
-      else
-        {
-          if (is_audio_player)
-            {
-              /* Translators: %s is the device vendor */
-              v->name = g_strdup_printf (_("%s Audio Player"), vendor);
-            }
-          else
-            {
-              /* Translators: %s is the device vendor */
-              v->name = g_strdup_printf (_("%s Camera"), vendor);
-            }
-        }
-    }
-  if (v->name == NULL)
-    {
-      if (is_audio_player)
-        v->name = g_strdup (_("Audio Player"));
-      else
-        v->name = g_strdup (_("Camera"));
-    }
-
-  if (strlen (icon_from_hal) > 0)
-    v->icon = g_strdup (icon_from_hal);
-  else if (is_audio_player)
-    v->icon = g_strdup ("multimedia-player");
-  else
-    v->icon = g_strdup ("camera-photo");
-
-  g_object_set_data_full (G_OBJECT (v),
-                          "hal-storage-device-capabilities",
-                          dupv_and_uniqify (hal_device_get_property_strlist (v->device, 
"info.capabilities")),
-                          (GDestroyNotify) g_strfreev);
-}
-
-static void
-update_from_hal (GGPhoto2Volume *mv, gboolean emit_changed)
-{
-  char *old_name;
-  char *old_icon;
-
-  G_LOCK (gphoto2_volume);
-
-  old_name = g_strdup (mv->name);
-  old_icon = g_strdup (mv->icon);
-
-  g_free (mv->name);
-  g_free (mv->icon);
-
-  do_update_from_hal_for_camera (mv);
-
-  if (emit_changed)
-    {
-      if (old_name == NULL ||
-          old_icon == NULL ||
-          strcmp (old_name, mv->name) != 0 ||
-          strcmp (old_icon, mv->icon) != 0)
-        g_idle_add (changed_in_idle, g_object_ref (mv));
-    }
-  g_free (old_name);
-  g_free (old_icon);
-
-  G_UNLOCK (gphoto2_volume);
-}
-
-static void
-hal_changed (HalDevice *device, const char *key, gpointer user_data)
-{
-  GGPhoto2Volume *gphoto2_volume = G_GPHOTO2_VOLUME (user_data);
-
-  /*g_warning ("hal modifying %s (property %s changed)", gphoto2_volume->device_path, key);*/
-  update_from_hal (gphoto2_volume, TRUE);
-}
-#endif
-
 GGPhoto2Volume *
 g_gphoto2_volume_new (GVolumeMonitor   *volume_monitor,
-#ifdef HAVE_GUDEV
                       GUdevDevice      *device,
                       GUdevClient      *gudev_client,
-#else
-                      HalDevice        *device,
-                      HalPool          *pool,
-#endif
                       GFile            *activation_root)
 {
   GGPhoto2Volume *volume;
-#ifndef HAVE_GUDEV
-  HalDevice *drive_device;
-  const char *storage_udi;
-#endif
   const char *device_path;
 
   g_return_val_if_fail (volume_monitor != NULL, NULL);
   g_return_val_if_fail (device != NULL, NULL);
-#ifdef HAVE_GUDEV
   g_return_val_if_fail (gudev_client != NULL, NULL);
-#else
-  g_return_val_if_fail (pool != NULL, NULL);
-#endif
   g_return_val_if_fail (activation_root != NULL, NULL);
 
-#ifdef HAVE_GUDEV
   if (!g_udev_device_has_property (device, "ID_GPHOTO2"))
       return NULL;
   device_path = g_udev_device_get_device_file (device);
-#else
-  if (!(hal_device_has_capability (device, "camera") ||
-        (hal_device_has_capability (device, "portable_audio_player") &&
-         hal_device_get_property_bool (device, "camera.libgphoto2.support"))))
-    return NULL;
-
-  /* OK, so we abuse storage_udi and drive_device for the USB main
-   * device that holds this interface...
-   */
-  storage_udi = hal_device_get_property_string (device, "info.parent");
-  if (storage_udi == NULL)
-    return NULL;
-
-  drive_device = hal_pool_get_device_by_udi (pool, storage_udi);
-  if (drive_device == NULL)
-    return NULL;
-
-  /* TODO: other OS'es? Will address this with DK aka HAL 2.0 */
-  device_path = hal_device_get_property_string (drive_device, "linux.device_file");
-  if (strlen (device_path) == 0)
-    device_path = NULL;
-#endif
 
   volume = g_object_new (G_TYPE_GPHOTO2_VOLUME, NULL);
   volume->volume_monitor = volume_monitor;
   g_object_add_weak_pointer (G_OBJECT (volume_monitor), (gpointer) &(volume->volume_monitor));
   volume->device_path = g_strdup (device_path);
   volume->device = g_object_ref (device);
-#ifndef HAVE_GUDEV
-  volume->drive_device = g_object_ref (drive_device);
-#endif
   volume->activation_root = g_object_ref (activation_root);
 
-#ifdef HAVE_GUDEV
   volume->name = g_vfs_get_volume_name (device, "ID_GPHOTO2");
   volume->icon = g_vfs_get_volume_icon (device);
   volume->symbolic_icon = g_vfs_get_volume_symbolic_icon (device);
   /* we do not really need to listen for changes */
-#else
-  g_signal_connect_object (device, "hal_property_changed", (GCallback) hal_changed, volume, 0);
-  g_signal_connect_object (drive_device, "hal_property_changed", (GCallback) hal_changed, volume, 0);
-
-  update_from_hal (volume, FALSE);
-#endif
 
   return volume;
 }
@@ -410,7 +208,6 @@ g_gphoto2_volume_get_mount (GVolume *volume)
   return NULL;
 }
 
-#ifdef HAVE_GUDEV
 gboolean
 g_gphoto2_volume_has_path (GGPhoto2Volume  *volume,
                       const char  *sysfs_path)
@@ -426,24 +223,6 @@ g_gphoto2_volume_has_path (GGPhoto2Volume  *volume,
   return res;
 }
 
-#else
-
-gboolean
-g_gphoto2_volume_has_udi (GGPhoto2Volume  *volume,
-                      const char  *udi)
-{
-  GGPhoto2Volume *gphoto2_volume = G_GPHOTO2_VOLUME (volume);
-  gboolean res;
-
-  G_LOCK (gphoto2_volume);
-  res = FALSE;
-  if (gphoto2_volume->device != NULL)
-    res = strcmp (hal_device_get_udi (gphoto2_volume->device), udi) == 0;
-  G_UNLOCK (gphoto2_volume);
-  return res;
-}
-#endif
-
 typedef struct
 {
   GGPhoto2Volume *enclosing_volume;
@@ -518,12 +297,7 @@ g_gphoto2_volume_get_identifier (GVolume              *volume,
 
   G_LOCK (gphoto2_volume);
   id = NULL;
-#ifndef HAVE_GUDEV
-  if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_HAL_UDI) == 0)
-    id = g_strdup (hal_device_get_udi (gphoto2_volume->device));
-  else 
-#endif
-    if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0)
+  if (strcmp (kind, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) == 0)
     id = g_strdup (gphoto2_volume->device_path);
   G_UNLOCK (gphoto2_volume);
 
@@ -540,11 +314,6 @@ g_gphoto2_volume_enumerate_identifiers (GVolume *volume)
 
   res = g_ptr_array_new ();
 
-#ifndef HAVE_GUDEV
-  g_ptr_array_add (res,
-                   g_strdup (G_VOLUME_IDENTIFIER_KIND_HAL_UDI));
-#endif
-
   if (gphoto2_volume->device_path && *gphoto2_volume->device_path != 0)
     g_ptr_array_add (res,
                      g_strdup (G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE));
diff --git a/monitor/gphoto2/ggphoto2volume.h b/monitor/gphoto2/ggphoto2volume.h
index caa5b45..c5a02e8 100644
--- a/monitor/gphoto2/ggphoto2volume.h
+++ b/monitor/gphoto2/ggphoto2volume.h
@@ -26,13 +26,8 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 
-#ifdef HAVE_GUDEV
- #include <gudev/gudev.h>
-#elif defined(HAVE_HAL)
- #include "hal-pool.h"
-#else
- #error Needs gudev or hal
-#endif
+#include <gudev/gudev.h>
+
 #include "ggphoto2volumemonitor.h"
 
 G_BEGIN_DECLS
@@ -52,22 +47,12 @@ struct _GGPhoto2VolumeClass {
 GType g_gphoto2_volume_get_type (void) G_GNUC_CONST;
 
 GGPhoto2Volume *g_gphoto2_volume_new            (GVolumeMonitor   *volume_monitor,
-#ifdef HAVE_GUDEV
                                                  GUdevDevice      *device,
                                                  GUdevClient      *gudev_client,
-#else
-                                                 HalDevice        *device,
-                                                 HalPool          *pool,
-#endif
                                                  GFile            *activation_root);
 
-#ifdef HAVE_GUDEV
 gboolean    g_gphoto2_volume_has_path       (GGPhoto2Volume       *volume,
                                              const char       *path);
-#else
-gboolean    g_gphoto2_volume_has_udi        (GGPhoto2Volume       *volume,
-                                             const char       *udi);
-#endif
 
 void        g_gphoto2_volume_removed        (GGPhoto2Volume       *volume);
 
diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c
index 9b8f333..f4fae8b 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -35,76 +35,39 @@
 #include "ggphoto2volumemonitor.h"
 #include "ggphoto2volume.h"
 
-#ifdef HAVE_GUDEV
 #include <gio/gunixmounts.h>
-#else
-#include "hal-pool.h"
-#endif
 
-G_LOCK_DEFINE_STATIC(hal_vm);
+G_LOCK_DEFINE_STATIC(gphoto2_vm);
 
 static GGPhoto2VolumeMonitor *the_volume_monitor = NULL;
-#ifndef HAVE_GUDEV
-static HalPool *pool = NULL;
-#endif
 
 struct _GGPhoto2VolumeMonitor {
   GNativeVolumeMonitor parent;
 
   GUnixMountMonitor *mount_monitor;
 
-#ifdef HAVE_GUDEV
   GUdevClient *gudev_client;
-#else
-  HalPool *pool;
-#endif
 
   GList *last_camera_devices;
 
   GList *camera_volumes;
 };
 
-#ifdef HAVE_GUDEV
 static void on_uevent                (GUdevClient *client, 
                                       gchar *action,
                                       GUdevDevice *device,
                                       gpointer user_data);
-#else
-static void hal_changed              (HalPool    *pool,
-                                      HalDevice  *device,
-                                      gpointer    user_data);
-
-static void update_all (GGPhoto2VolumeMonitor *monitor,
-                        gboolean emit_changes);
-
-static void update_cameras           (GGPhoto2VolumeMonitor *monitor,
-                                      GList **added_volumes,
-                                      GList **removed_volumes);
-#endif
 
 static GList* get_stores_for_camera (const char *bus_num, const char *device_num);
 
 G_DEFINE_TYPE (GGPhoto2VolumeMonitor, g_gphoto2_volume_monitor, G_TYPE_VOLUME_MONITOR)
 
-#ifndef HAVE_GUDEV
-static HalPool *
-get_hal_pool (void)
-{
-  char *cap_only[] = {"camera", "portable_audio_player", "usb_device", NULL};
-
-  if (pool == NULL)
-    pool = hal_pool_new (cap_only);
-
-  return pool;
-}
-#endif
-
 static void
 g_gphoto2_volume_monitor_dispose (GObject *object)
 {
-  G_LOCK (hal_vm);
+  G_LOCK (gphoto2_vm);
   the_volume_monitor = NULL;
-  G_UNLOCK (hal_vm);
+  G_UNLOCK (gphoto2_vm);
 
   if (G_OBJECT_CLASS (g_gphoto2_volume_monitor_parent_class)->dispose)
     (*G_OBJECT_CLASS (g_gphoto2_volume_monitor_parent_class)->dispose) (object);
@@ -117,14 +80,9 @@ g_gphoto2_volume_monitor_finalize (GObject *object)
 
   monitor = G_GPHOTO2_VOLUME_MONITOR (object);
 
-#ifdef HAVE_GUDEV
   g_signal_handlers_disconnect_by_func (monitor->gudev_client, on_uevent, monitor);
 
   g_object_unref (monitor->gudev_client);
-#else
-  g_signal_handlers_disconnect_by_func (monitor->pool, hal_changed, monitor);
-  g_object_unref (monitor->pool);
-#endif
 
   g_list_free_full (monitor->last_camera_devices, g_object_unref);
   g_list_free_full (monitor->camera_volumes, g_object_unref);
@@ -147,12 +105,12 @@ get_volumes (GVolumeMonitor *volume_monitor)
 
   monitor = G_GPHOTO2_VOLUME_MONITOR (volume_monitor);
 
-  G_LOCK (hal_vm);
+  G_LOCK (gphoto2_vm);
 
   l = g_list_copy (monitor->camera_volumes);
   g_list_foreach (l, (GFunc)g_object_ref, NULL);
 
-  G_UNLOCK (hal_vm);
+  G_UNLOCK (gphoto2_vm);
 
   return l;
 }
@@ -175,8 +133,6 @@ get_mount_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid)
   return NULL;
 }
 
-#ifdef HAVE_GUDEV
-
 static void
 gudev_add_camera (GGPhoto2VolumeMonitor *monitor, GUdevDevice *device, gboolean do_emit)
 {
@@ -319,21 +275,6 @@ gudev_coldplug_cameras (GGPhoto2VolumeMonitor *monitor)
     }
 }
 
-#else
-
-static void
-hal_changed (HalPool    *pool,
-             HalDevice  *device,
-             gpointer    user_data)
-{
-  GGPhoto2VolumeMonitor *monitor = G_GPHOTO2_VOLUME_MONITOR (user_data);
-
-  /*g_warning ("hal changed");*/
-
-  update_all (monitor, TRUE);
-}
-#endif
-
 static GObject *
 g_gphoto2_volume_monitor_constructor (GType                  type,
                                   guint                  n_construct_properties,
@@ -344,14 +285,14 @@ g_gphoto2_volume_monitor_constructor (GType                  type,
   GGPhoto2VolumeMonitorClass *klass;
   GObjectClass *parent_class;
 
-  G_LOCK (hal_vm);
+  G_LOCK (gphoto2_vm);
   if (the_volume_monitor != NULL)
     {
       object = g_object_ref (the_volume_monitor);
-      G_UNLOCK (hal_vm);
+      G_UNLOCK (gphoto2_vm);
       return object;
     }
-  G_UNLOCK (hal_vm);
+  G_UNLOCK (gphoto2_vm);
 
   /*g_warning ("creating hal vm");*/
 
@@ -366,7 +307,6 @@ g_gphoto2_volume_monitor_constructor (GType                  type,
 
   monitor = G_GPHOTO2_VOLUME_MONITOR (object);
 
-#ifdef HAVE_GUDEV
   const char *subsystems[] = {"usb", NULL};
   monitor->gudev_client = g_udev_client_new (subsystems);
 
@@ -376,23 +316,9 @@ g_gphoto2_volume_monitor_constructor (GType                  type,
 
   gudev_coldplug_cameras (monitor);
 
-#else
-  monitor->pool = g_object_ref (get_hal_pool ());
-
-  g_signal_connect (monitor->pool,
-                    "device_added", G_CALLBACK (hal_changed),
-                    monitor);
-
-  g_signal_connect (monitor->pool,
-                    "device_removed", G_CALLBACK (hal_changed),
-                    monitor);
-
-  update_all (monitor, FALSE);
-#endif
-
-  G_LOCK (hal_vm);
+  G_LOCK (gphoto2_vm);
   the_volume_monitor = monitor;
-  G_UNLOCK (hal_vm);
+  G_UNLOCK (gphoto2_vm);
 
   return object;
 }
@@ -405,13 +331,9 @@ g_gphoto2_volume_monitor_init (GGPhoto2VolumeMonitor *monitor)
 static gboolean
 is_supported (void)
 {
-#ifdef HAVE_GUDEV
   /* Today's Linux desktops pretty much need udev to have anything working, so
    * assume it's there */
   return TRUE;
-#else
-  return get_hal_pool() != NULL;
-#endif
 }
 
 static void
@@ -447,147 +369,6 @@ g_gphoto2_volume_monitor_new (void)
   return G_VOLUME_MONITOR (monitor);
 }
 
-#ifndef HAVE_GUDEV
-static void
-diff_sorted_lists (GList         *list1,
-                   GList         *list2,
-                   GCompareFunc   compare,
-                   GList        **added,
-                   GList        **removed)
-{
-  int order;
-
-  *added = *removed = NULL;
-
-  while (list1 != NULL &&
-         list2 != NULL)
-    {
-      order = (*compare) (list1->data, list2->data);
-      if (order < 0)
-        {
-          *removed = g_list_prepend (*removed, list1->data);
-          list1 = list1->next;
-        }
-      else if (order > 0)
-        {
-          *added = g_list_prepend (*added, list2->data);
-          list2 = list2->next;
-        }
-      else
-        { /* same item */
-          list1 = list1->next;
-          list2 = list2->next;
-        }
-    }
-
-  while (list1 != NULL)
-    {
-      *removed = g_list_prepend (*removed, list1->data);
-      list1 = list1->next;
-    }
-  while (list2 != NULL)
-    {
-      *added = g_list_prepend (*added, list2->data);
-      list2 = list2->next;
-    }
-}
-
-static GGPhoto2Volume *
-find_camera_volume_by_udi (GGPhoto2VolumeMonitor *monitor, const char *udi)
-{
-  GList *l;
-
-  for (l = monitor->camera_volumes; l != NULL; l = l->next)
-    {
-      GGPhoto2Volume *volume = l->data;
-
-      if (g_gphoto2_volume_has_udi (volume, udi))
-        return volume;
-    }
-
-  return NULL;
-}
-
-static gint
-hal_device_compare (HalDevice *a, HalDevice *b)
-{
-  return strcmp (hal_device_get_udi (a), hal_device_get_udi (b));
-}
-
-static void
-list_emit (GGPhoto2VolumeMonitor *monitor,
-           const char *monitor_signal,
-           const char *object_signal,
-           GList *objects)
-{
-  GList *l;
-
-  for (l = objects; l != NULL; l = l->next)
-    {
-      g_signal_emit_by_name (monitor, monitor_signal, l->data);
-      if (object_signal)
-        g_signal_emit_by_name (l->data, object_signal);
-    }
-}
-
-typedef struct {
-  GGPhoto2VolumeMonitor *monitor;
-  GList *added_volumes, *removed_volumes;
-} ChangedLists;
-
-
-static gboolean
-emit_lists_in_idle (gpointer data)
-{
-  ChangedLists *lists = data;
-
-  list_emit (lists->monitor,
-             "volume_removed", "removed",
-             lists->removed_volumes);
-  list_emit (lists->monitor,
-             "volume_added", NULL,
-             lists->added_volumes);
-
-  g_list_free_full (lists->removed_volumes, g_object_unref);
-  g_list_free_full (lists->added_volumes, g_object_unref);
-  g_object_unref (lists->monitor);
-  g_free (lists);
-
-  return FALSE;
-}
-
-/* Must be called from idle if emit_changes, with no locks held */
-static void
-update_all (GGPhoto2VolumeMonitor *monitor,
-            gboolean emit_changes)
-{
-  ChangedLists *lists;
-  GList *added_volumes, *removed_volumes;
-
-  added_volumes = NULL;
-  removed_volumes = NULL;
-
-  G_LOCK (hal_vm);
-  update_cameras (monitor, &added_volumes, &removed_volumes);
-  G_UNLOCK (hal_vm);
-
-  if (emit_changes)
-    {
-      lists = g_new0 (ChangedLists, 1);
-      lists->monitor = g_object_ref (monitor);
-      lists->added_volumes = added_volumes;
-      lists->removed_volumes = removed_volumes;
-
-      g_idle_add (emit_lists_in_idle, lists);
-    }
-  else
-    {
-      g_list_free_full (removed_volumes, g_object_unref);
-      g_list_free_full (added_volumes, g_object_unref);
-    }
-}
-#endif
-
 static GList *
 get_stores_for_camera (const char *bus_num, const char *device_num)
 {
@@ -671,162 +452,3 @@ out:
 
   return l;
 }
-
-#ifndef HAVE_GUDEV
-static GList *
-get_stores_for_camera_int (int bus_num, int device_num)
-{
-       GList *ret;
-       char *bus_num_str, *device_num_str;
-
-       bus_num_str = g_strdup_printf ("%d", bus_num);
-       device_num_str = g_strdup_printf ("%d", device_num);
-       ret = get_stores_for_camera (bus_num_str, device_num_str);
-       g_free (bus_num_str);
-       g_free (device_num_str);
-
-       return ret;
-}
-
-static void
-update_cameras (GGPhoto2VolumeMonitor *monitor,
-                GList **added_volumes,
-                GList **removed_volumes)
-{
-  GList *new_camera_devices;
-  GList *new_mtp_devices;
-  GList *removed, *added;
-  GList *l, *ll;
-  GGPhoto2Volume *volume;
-  const char *udi;
-
-  new_mtp_devices = hal_pool_find_by_capability (monitor->pool, "portable_audio_player");
-  for (l = new_mtp_devices; l != NULL; l = ll)
-    {
-      HalDevice *d = l->data;
-      ll = l->next;
-      if (! hal_device_get_property_bool (d, "camera.libgphoto2.support"))
-        {
-          /*g_warning ("ignoring %s", hal_device_get_udi (d));*/
-          /* filter out everything that isn't supported by libgphoto2 */
-          new_mtp_devices = g_list_delete_link (new_mtp_devices, l);
-        }
-    }
-
-  new_camera_devices = hal_pool_find_by_capability (monitor->pool, "camera");
-  new_camera_devices = g_list_concat (new_camera_devices, new_mtp_devices);
-  for (l = new_camera_devices; l != NULL; l = ll)
-    {
-      HalDevice *d = l->data;
-      ll = l->next;
-      /*g_warning ("got %s", hal_device_get_udi (d));*/
-      if (! hal_device_get_property_bool (d, "camera.libgphoto2.support"))
-        {
-          /*g_warning ("ignoring %s", hal_device_get_udi (d));*/
-          /* filter out everything that isn't supported by libgphoto2 */
-          new_camera_devices = g_list_delete_link (new_camera_devices, l);
-        }
-    }
-  g_list_foreach (new_camera_devices, (GFunc) g_object_ref, NULL);
-
-  new_camera_devices = g_list_sort (new_camera_devices, (GCompareFunc) hal_device_compare);
-  diff_sorted_lists (monitor->last_camera_devices,
-                     new_camera_devices, (GCompareFunc) hal_device_compare,
-                     &added, &removed);
-
-  for (l = removed; l != NULL; l = l->next)
-    {
-      HalDevice *d = l->data;
-
-      udi = hal_device_get_udi (d);
-      /*g_warning ("camera removing %s", udi);*/
-
-      volume = find_camera_volume_by_udi (monitor, udi);
-      if (volume != NULL)
-        {
-          g_gphoto2_volume_removed (volume);
-          monitor->camera_volumes = g_list_remove (monitor->camera_volumes, volume);
-          *removed_volumes = g_list_prepend (*removed_volumes, volume);
-        }
-    }
-
-  for (l = added; l != NULL; l = l->next)
-    {
-      HalDevice *d = l->data;
-      int usb_bus_num;
-      int usb_device_num;
-      gboolean found;
-      GList *store_heads, *l;
-      guint num_store_heads;
-
-      /* Look for the device in the added volumes, so as
-       * not to add devices that are both audio players, and cameras */
-      found = FALSE;
-      for (ll = *added_volumes; ll; ll = ll->next)
-        {
-          if (g_gphoto2_volume_has_udi (ll->data, hal_device_get_udi (d)) != FALSE)
-            {
-              found = TRUE;
-              break;
-            }
-        }
-
-      if (found)
-        continue;
-
-      usb_bus_num = hal_device_get_property_int (d, "usb.bus_number");
-#if defined(__linux__)
-      usb_device_num = hal_device_get_property_int (d, "usb.linux.device_number");
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-      usb_device_num = hal_device_get_property_int (d, "freebsd.unit");
-#else
-# error "Need OS specific tweaks"
-#endif
-
-      store_heads = get_stores_for_camera_int (usb_bus_num, usb_device_num);
-      num_store_heads = g_list_length (store_heads);
-      for (l = store_heads ; l != NULL; l = l->next)
-        {
-          char *store_path = (char *) l->data;
-          GFile *activation_mount_root;
-          gchar *uri;
-
-          /* If we only have a single store, don't use the store name at all. The backend automatically
-           * prepend the storename; this is to work around bugs with devices (like the iPhone) for which
-           * the store name changes every time the camera is initialized (e.g. mounted).
-           */
-          if (num_store_heads == 1)
-            {
-              uri = g_strdup_printf ("gphoto2://[usb:%03d,%03d]", usb_bus_num, usb_device_num);
-            }
-          else
-            {
-              uri = g_strdup_printf ("gphoto2://[usb:%03d,%03d]/%s", usb_bus_num, usb_device_num,
-                                     store_path[0] == '/' ? store_path + 1 : store_path);
-            }
-          activation_mount_root = g_file_new_for_uri (uri);
-          g_free (uri);
-
-          udi = hal_device_get_udi (d);
-          volume = g_gphoto2_volume_new (G_VOLUME_MONITOR (monitor),
-                                         d,
-                                         monitor->pool,
-                                         activation_mount_root);
-          if (volume != NULL)
-            {
-              monitor->camera_volumes = g_list_prepend (monitor->camera_volumes, volume);
-              *added_volumes = g_list_prepend (*added_volumes, g_object_ref (volume));
-            }
-
-          if (activation_mount_root != NULL)
-            g_object_unref (activation_mount_root);
-        }
-      g_list_free_full (store_heads, g_free);
-    }
-
-  g_list_free (added);
-  g_list_free (removed);
-  g_list_free_full (monitor->last_camera_devices, g_object_unref);
-  monitor->last_camera_devices = new_camera_devices;
-}
-#endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7fbaf1d..71591a8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -97,12 +97,6 @@ monitor/gdu/ggduvolume.c
 monitor/goa/goavolume.c
 monitor/gphoto2/ggphoto2volume.c
 monitor/gphoto2/ggphoto2volumemonitor.c
-monitor/gphoto2/hal-utils.c
-monitor/hal/ghaldrive.c
-monitor/hal/ghalmount.c
-monitor/hal/ghalvolume.c
-monitor/hal/ghalvolumemonitor.c
-monitor/hal/hal-utils.c
 monitor/proxy/gproxydrive.c
 monitor/proxy/gproxymount.c
 monitor/proxy/gproxyvolume.c
diff --git a/test/Makefile.am b/test/Makefile.am
index 6b46d57..3c169e6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -54,13 +54,6 @@ CONFIG_FILES+=org.gtk.vfs.GPhoto2VolumeMonitor.service gphoto2.monitor
 CONFIG_FILES_INSTALLED+=$(top_builddir)/monitor/gphoto2/org.gtk.vfs.GPhoto2VolumeMonitor.service 
gphoto2.monitor
 endif
 
-if USE_HAL
-org.gtk.vfs.HalVolumeMonitor.service: $(top_srcdir)/monitor/hal/org.gtk.vfs.HalVolumeMonitor.service.in 
../config.log
-       $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)/monitor/hal|" $< > $@
-CONFIG_FILES+=org.gtk.vfs.HalVolumeMonitor.service hal.monitor
-CONFIG_FILES_INSTALLED+=$(top_builddir)/monitor/hal/org.gtk.vfs.HalVolumeMonitor.service hal.monitor
-endif
-
 if USE_UDISKS2
 org.gtk.vfs.UDisks2VolumeMonitor.service: 
$(top_srcdir)/monitor/udisks2/org.gtk.vfs.UDisks2VolumeMonitor.service.in ../config.log
        $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)/monitor/udisks2|" $< > $@


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