[tracker/swap-gio-for-hal: 3/7] libtracker-miner: Reimplemented tracker-store using GIO removing HAL.



commit dad01d91860b7091c5269e994a0d84a29e4e7e3d
Author: Martyn Russell <martyn lanedo com>
Date:   Tue Feb 23 15:43:42 2010 +0000

    libtracker-miner: Reimplemented tracker-store using GIO removing HAL.

 .../libtracker-miner/libtracker-miner-sections.txt |    6 +-
 src/libtracker-miner/tracker-storage.c             |  873 +++++++-------------
 src/libtracker-miner/tracker-storage.h             |   21 +-
 src/tracker-extract/tracker-albumart.c             |   18 -
 src/tracker-miner-fs/tracker-miner-files.c         |   92 +--
 5 files changed, 337 insertions(+), 673 deletions(-)
---
diff --git a/docs/reference/libtracker-miner/libtracker-miner-sections.txt b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
index a054d84..47ae66e 100644
--- a/docs/reference/libtracker-miner/libtracker-miner-sections.txt
+++ b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
@@ -115,9 +115,9 @@ TrackerStorage
 TrackerStorageClass
 tracker_storage_new
 tracker_storage_get_removable_device_roots
-tracker_storage_get_removable_device_udis
-tracker_storage_udi_get_mount_point
-tracker_storage_get_volume_udi_for_file
+tracker_storage_get_removable_device_uuids
+tracker_storage_get_mount_point_for_uuid
+tracker_storage_get_uuid_for_file
 <SUBSECTION Standard>
 TRACKER_STORAGE
 TRACKER_IS_STORAGE
diff --git a/src/libtracker-miner/tracker-storage.c b/src/libtracker-miner/tracker-storage.c
index 4dd0b6d..8be8c0a 100644
--- a/src/libtracker-miner/tracker-storage.c
+++ b/src/libtracker-miner/tracker-storage.c
@@ -1,5 +1,4 @@
 /*
- * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
  * Copyright (C) 2008, Nokia (urho konttori nokia com)
  *
  * This library is free software; you can redistribute it and/or
@@ -24,36 +23,24 @@
 
 #include <gio/gio.h>
 
-#include <libhal.h>
-#include <libhal-storage.h>
-
-#include <dbus/dbus-glib-lowlevel.h>
-
 #include <libtracker-common/tracker-log.h>
 
 #include "tracker-storage.h"
 #include "tracker-utils.h"
 #include "tracker-marshal.h"
 
-#define CAPABILITY_VOLUME      "volume"
-
-#define PROP_IS_MOUNTED        "volume.is_mounted"
-
 #define TRACKER_STORAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_STORAGE, TrackerStoragePrivate))
 
 typedef struct {
-	LibHalContext *context;
-	DBusConnection *connection;
-
-	GHashTable *all_devices;
+	GVolumeMonitor *volume_monitor;
 
 	GNode *mounts;
-	GHashTable *mounts_by_udi;
+	GHashTable *mounts_by_uuid;
 } TrackerStoragePrivate;
 
 typedef struct {
 	gchar *mount_point;
-	gchar *udi;
+	gchar *uuid;
 	guint removable : 1;
 } MountInfo;
 
@@ -63,33 +50,24 @@ typedef struct {
 } TraverseData;
 
 typedef struct {
-	LibHalContext *context;
 	GSList *roots;
 	gboolean only_removable;
 } GetRoots;
 
-static void     tracker_storage_finalize        (GObject         *object);
-static void     hal_get_property                (GObject         *object,
-                                                 guint            param_id,
-                                                 GValue                  *value,
-                                                 GParamSpec      *pspec);
-static gboolean hal_setup_devices               (TrackerStorage          *hal);
-
-static gboolean hal_device_add                  (TrackerStorage          *hal,
-                                                 LibHalVolume    *volume);
-static void     hal_device_added_cb             (LibHalContext   *context,
-                                                 const gchar     *udi);
-static void     hal_device_removed_cb           (LibHalContext   *context,
-                                                 const gchar     *udi);
-static void     hal_device_property_modified_cb (LibHalContext   *context,
-                                                 const char      *udi,
-                                                 const char      *key,
-                                                 dbus_bool_t      is_removed,
-                                                 dbus_bool_t      is_added);
-
-enum {
-	PROP_0,
-};
+static void     tracker_storage_finalize (GObject        *object);
+static gboolean mount_info_free          (GNode          *node,
+                                          gpointer        user_data);
+static void     mount_node_free          (GNode          *node);
+static gboolean drives_setup             (TrackerStorage *storage);
+static void     mount_added_cb           (GVolumeMonitor *monitor,
+                                          GMount         *mount,
+                                          gpointer        user_data);
+static void     mount_removed_cb         (GVolumeMonitor *monitor,
+                                          GMount         *mount,
+                                          gpointer        user_data);
+static void     volume_added_cb          (GVolumeMonitor *monitor,
+                                          GVolume        *volume,
+                                          gpointer        user_data);
 
 enum {
 	MOUNT_POINT_ADDED,
@@ -109,7 +87,6 @@ tracker_storage_class_init (TrackerStorageClass *klass)
 	object_class = G_OBJECT_CLASS (klass);
 
 	object_class->finalize     = tracker_storage_finalize;
-	object_class->get_property = hal_get_property;
 
 	signals[MOUNT_POINT_ADDED] =
 		g_signal_new ("mount-point-added",
@@ -142,106 +119,38 @@ static void
 tracker_storage_init (TrackerStorage *storage)
 {
 	TrackerStoragePrivate *priv;
-	DBusError error;
 
-	g_message ("Initializing HAL Storage...");
+	g_message ("Initializing Storage...");
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	priv->all_devices = g_hash_table_new_full (g_str_hash,
-	                                           g_str_equal,
-	                                           (GDestroyNotify) g_free,
-	                                           (GDestroyNotify) g_free);
 	priv->mounts = g_node_new (NULL);
 
-	priv->mounts_by_udi = g_hash_table_new_full (g_str_hash,
-	                                             g_str_equal,
-	                                             (GDestroyNotify) g_free,
-	                                             NULL);
-
-	dbus_error_init (&error);
-
-	priv->connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
-	if (dbus_error_is_set (&error)) {
-		g_critical ("Could not get the system D-Bus connection, %s",
-		            error.message);
-		dbus_error_free (&error);
-		return;
-	}
-
-	dbus_connection_set_exit_on_disconnect (priv->connection, FALSE);
-	dbus_connection_setup_with_g_main (priv->connection, NULL);
-
-	priv->context = libhal_ctx_new ();
-
-	if (!priv->context) {
-		g_critical ("Could not create HAL context");
-		return;
-	}
-
-	libhal_ctx_set_user_data (priv->context, storage);
-	libhal_ctx_set_dbus_connection (priv->context, priv->connection);
-
-	if (!libhal_ctx_init (priv->context, &error)) {
-		if (dbus_error_is_set (&error)) {
-			g_critical ("Could not initialize the HAL context, %s",
-			            error.message);
-			dbus_error_free (&error);
-		} else {
-			g_critical ("Could not initialize the HAL context, "
-			            "no error, is hald running?");
-		}
-
-		libhal_ctx_free (priv->context);
-		priv->context = NULL;
-		return;
-	}
+	priv->mounts_by_uuid = g_hash_table_new_full (g_str_hash,
+	                                              g_str_equal,
+	                                              (GDestroyNotify) g_free,
+	                                              NULL);
 
+	priv->volume_monitor = g_volume_monitor_get ();
 
 	/* Volume and property notification callbacks */
-	g_message ("HAL monitors set for devices added/removed/mounted/umounted...");
-	libhal_ctx_set_device_added (priv->context, hal_device_added_cb);
-	libhal_ctx_set_device_removed (priv->context, hal_device_removed_cb);
-	libhal_ctx_set_device_property_modified (priv->context, hal_device_property_modified_cb);
+	g_signal_connect_object (priv->volume_monitor, "mount_removed",
+	                         G_CALLBACK (mount_removed_cb), storage, 0);
+	g_signal_connect_object (priv->volume_monitor, "mount_pre_unmount",
+	                         G_CALLBACK (mount_removed_cb), storage, 0);
+	g_signal_connect_object (priv->volume_monitor, "mount_added",
+	                         G_CALLBACK (mount_added_cb), storage, 0);
+	g_signal_connect_object (priv->volume_monitor, "volume_added",
+	                         G_CALLBACK (volume_added_cb), storage, 0);
+
+	g_message ("Drive/Volume monitors set up for to watch for added, removed and pre-unmounts...");
 
 	/* Get all devices which are mountable and set them up */
-	if (!hal_setup_devices (storage)) {
+	if (!drives_setup (storage)) {
 		return;
 	}
 }
 
-static gboolean
-free_mount_info (GNode    *node,
-                 gpointer  user_data)
-{
-	MountInfo *info;
-
-	info = node->data;
-
-	if (info) {
-		g_free (info->mount_point);
-		g_free (info->udi);
-
-		g_slice_free (MountInfo, info);
-	}
-
-	return FALSE;
-}
-
-static void
-free_mount_node (GNode *node)
-{
-	g_node_traverse (node,
-	                 G_POST_ORDER,
-	                 G_TRAVERSE_ALL,
-	                 -1,
-	                 free_mount_info,
-	                 NULL);
-
-	g_node_destroy (node);
-}
-
-
 static void
 tracker_storage_finalize (GObject *object)
 {
@@ -249,112 +158,37 @@ tracker_storage_finalize (GObject *object)
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (object);
 
-	if (priv->mounts_by_udi) {
-		g_hash_table_unref (priv->mounts_by_udi);
-	}
-
-	if (priv->all_devices) {
-		g_hash_table_unref (priv->all_devices);
+	if (priv->mounts_by_uuid) {
+		g_hash_table_unref (priv->mounts_by_uuid);
 	}
 
 	if (priv->mounts) {
-		free_mount_node (priv->mounts);
-	}
-
-	if (priv->context) {
-		libhal_ctx_shutdown (priv->context, NULL);
-		libhal_ctx_set_user_data (priv->context, NULL);
-		libhal_ctx_free (priv->context);
+		mount_node_free (priv->mounts);
 	}
 
-	if (priv->connection) {
-		dbus_connection_unref (priv->connection);
+	if (priv->volume_monitor) {
+		g_object_unref (priv->volume_monitor);
 	}
 
 	(G_OBJECT_CLASS (tracker_storage_parent_class)->finalize) (object);
 }
 
 static void
-hal_get_property (GObject    *object,
-                  guint       param_id,
-                  GValue     *value,
-                  GParamSpec *pspec)
+mount_node_free (GNode *node)
 {
-	TrackerStoragePrivate *priv;
-
-	priv = TRACKER_STORAGE_GET_PRIVATE (object);
-
-	switch (param_id) {
-	default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
-		break;
-	};
-}
-
-static gboolean
-hal_setup_devices (TrackerStorage *storage)
-{
-	TrackerStoragePrivate *priv;
-	DBusError error;
-	gchar **devices, **p;
-	gint num;
-
-	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
-
-	dbus_error_init (&error);
-
-	devices = libhal_find_device_by_capability (priv->context,
-	                                            CAPABILITY_VOLUME,
-	                                            &num,
-	                                            &error);
-
-	if (dbus_error_is_set (&error)) {
-		g_critical ("Could not get devices with 'volume' capability, %s",
-		            error.message);
-		dbus_error_free (&error);
-		return FALSE;
-	}
-
-	if (!devices || !devices[0]) {
-		g_message ("HAL devices not found with 'volume' capability");
-		return TRUE;
-	}
-
-	for (p = devices; *p; p++) {
-		LibHalVolume *volume;
-
-		volume = libhal_volume_from_udi (priv->context, *p);
-		if (!volume) {
-			continue;
-		}
-
-		g_debug ("HAL device:'%s' found:",
-		         libhal_volume_get_device_file (volume));
-		g_debug ("  UDI          : %s",
-		         libhal_volume_get_udi (volume));
-		g_debug ("  Mount point: %s",
-		         libhal_volume_get_mount_point (volume));
-		g_debug ("  UUID         : %s",
-		         libhal_volume_get_uuid (volume));
-		g_debug ("  Mounted    : %s",
-		         libhal_volume_is_mounted (volume) ? "yes" : "no");
-		g_debug ("  File system: %s",
-		         libhal_volume_get_fstype (volume));
-		g_debug ("  Label        : %s",
-		         libhal_volume_get_label (volume));
-
-		hal_device_add (storage, volume);
-		libhal_volume_free (volume);
-	}
-
-	libhal_free_string_array (devices);
+	g_node_traverse (node,
+	                 G_POST_ORDER,
+	                 G_TRAVERSE_ALL,
+	                 -1,
+	                 mount_info_free,
+	                 NULL);
 
-	return TRUE;
+	g_node_destroy (node);
 }
 
 static gboolean
-mount_point_traverse_func (GNode *node,
-                           gpointer user_data)
+mount_node_traverse_func (GNode    *node,
+                          gpointer  user_data)
 {
 	TraverseData *data;
 	MountInfo *info;
@@ -376,8 +210,8 @@ mount_point_traverse_func (GNode *node,
 }
 
 static GNode *
-find_mount_point (GNode *root,
-                  const gchar *path)
+mount_node_find (GNode       *root,
+                 const gchar *path)
 {
 	TraverseData data = { path, NULL };
 
@@ -385,30 +219,43 @@ find_mount_point (GNode *root,
 	                 G_POST_ORDER,
 	                 G_TRAVERSE_ALL,
 	                 -1,
-	                 mount_point_traverse_func,
+	                 mount_node_traverse_func,
 	                 &data);
 
 	return data.node;
 }
 
+static gboolean
+mount_info_free (GNode    *node,
+                 gpointer  user_data)
+{
+	MountInfo *info;
+
+	info = node->data;
+
+	if (info) {
+		g_free (info->mount_point);
+		g_free (info->uuid);
+
+		g_slice_free (MountInfo, info);
+	}
+
+	return FALSE;
+}
+
 static MountInfo *
-find_mount_point_info (GNode *root,
-                       const gchar *path)
+mount_info_find (GNode       *root,
+                 const gchar *path)
 {
 	GNode *node;
 
-	node = find_mount_point (root, path);
+	node = mount_node_find (root, path);
 	return (node) ? node->data : NULL;
 }
 
-static GNode *
-mount_point_hierarchy_add (GNode *root,
-                           const gchar *mount_point,
-                           const gchar *udi,
-                           gboolean removable)
+static gchar *
+mount_point_normalize (const gchar *mount_point)
 {
-	MountInfo *info;
-	GNode *node;
 	gchar *mp;
 
 	/* Normalize all mount points to have a / at the end */
@@ -418,7 +265,21 @@ mount_point_hierarchy_add (GNode *root,
 		mp = g_strconcat (mount_point, G_DIR_SEPARATOR_S, NULL);
 	}
 
-	node = find_mount_point (root, mp);
+	return mp;
+}
+
+static GNode *
+mount_add_hierarchy (GNode       *root,
+                     const gchar *uuid,
+                     const gchar *mount_point,
+                     gboolean     removable)
+{
+	MountInfo *info;
+	GNode *node;
+	gchar *mp;
+
+	mp = mount_point_normalize (mount_point);
+	node = mount_node_find (root, mp);
 
 	if (!node) {
 		node = root;
@@ -426,402 +287,241 @@ mount_point_hierarchy_add (GNode *root,
 
 	info = g_slice_new (MountInfo);
 	info->mount_point = mp;
-	info->udi = g_strdup (udi);
+	info->uuid = g_strdup (uuid);
 	info->removable = removable;
 
 	return g_node_append_data (node, info);
 }
 
-
 static void
-hal_mount_point_add (TrackerStorage *storage,
-                     const gchar    *udi,
-                     const gchar    *mount_point,
-                     gboolean        removable_device)
+mount_add (TrackerStorage *storage,
+           const gchar    *uuid,
+           const gchar    *mount_point,
+           gboolean        removable_device)
 {
 	TrackerStoragePrivate *priv;
 	GNode *node;
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	g_message ("HAL device:'%s' with mount point:'%s', removable:%s now being tracked",
-	           (const gchar*) g_hash_table_lookup (priv->all_devices, udi),
-	           mount_point,
-	           removable_device ? "yes" : "no");
-
-	node = mount_point_hierarchy_add (priv->mounts, mount_point, udi, removable_device);
-	g_hash_table_insert (priv->mounts_by_udi, g_strdup (udi), node);
+	node = mount_add_hierarchy (priv->mounts, uuid, mount_point, removable_device);
+	g_hash_table_insert (priv->mounts_by_uuid, g_strdup (uuid), node);
 
-	g_signal_emit (storage, signals[MOUNT_POINT_ADDED], 0, udi, mount_point, NULL);
+	g_signal_emit (storage, signals[MOUNT_POINT_ADDED], 0, uuid, mount_point, NULL);
 }
 
 static void
-hal_mount_point_remove (TrackerStorage *storage,
-                        const gchar    *udi)
+volume_add (TrackerStorage *storage,
+            GVolume        *volume)
 {
-	MountInfo *info;
 	TrackerStoragePrivate *priv;
-	GNode *node;
+	GDrive *drive;
+	GMount *mount;
+	gchar *str;
+	gboolean is_mounted;
+	gchar *uuid;
+	gchar *mount_point;
+	gchar *device_file;
 
-	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
+	drive = g_volume_get_drive (volume);
 
-	node = g_hash_table_lookup (priv->mounts_by_udi, udi);
+	g_debug ("Drive:'%s' added 1 volume:",
+	         g_drive_get_name (drive));
 
-	if (!node) {
+	str = g_volume_get_name (volume);
+	g_debug ("  Volume:'%s' found", str);
+	g_free (str);
+		
+	if (!g_volume_should_automount (volume) ||
+	    !g_volume_can_mount (volume)) {
+		g_debug ("    Ignoring, volume can not be automatically mounted or mounted at all");
 		return;
 	}
 
-	info = node->data;
-
-	g_message ("HAL device:'%s' with mount point:'%s' (uuid:'%s'), removable:%s NO LONGER being tracked",
-	           (const gchar*) g_hash_table_lookup (priv->all_devices, udi),
-	           info->mount_point,
-	           udi,
-	           info->removable ? "yes" : "no");
-
-	g_signal_emit (storage, signals[MOUNT_POINT_REMOVED], 0, udi, info->mount_point, NULL);
-
-	g_hash_table_remove (priv->mounts_by_udi, udi);
-	free_mount_node (node);
-}
-
-static const gchar *
-hal_drive_type_to_string (LibHalDriveType type)
-{
-	switch (type) {
-	case LIBHAL_DRIVE_TYPE_REMOVABLE_DISK:
-		return "LIBHAL_DRIVE_TYPE_REMOVABLE_DISK";
-	case LIBHAL_DRIVE_TYPE_DISK:
-		return "LIBHAL_DRIVE_TYPE_DISK";
-	case LIBHAL_DRIVE_TYPE_CDROM:
-		return "LIBHAL_DRIVE_TYPE_CDROM";
-	case LIBHAL_DRIVE_TYPE_FLOPPY:
-		return "LIBHAL_DRIVE_TYPE_FLOPPY";
-	case LIBHAL_DRIVE_TYPE_TAPE:
-		return "LIBHAL_DRIVE_TYPE_TAPE";
-	case LIBHAL_DRIVE_TYPE_COMPACT_FLASH:
-		return "LIBHAL_DRIVE_TYPE_COMPACT_FLASH";
-	case LIBHAL_DRIVE_TYPE_MEMORY_STICK:
-		return "LIBHAL_DRIVE_TYPE_MEMORY_STICK";
-	case LIBHAL_DRIVE_TYPE_SMART_MEDIA:
-		return "LIBHAL_DRIVE_TYPE_SMART_MEDIA";
-	case LIBHAL_DRIVE_TYPE_SD_MMC:
-		return "LIBHAL_DRIVE_TYPE_SD_MMC";
-	case LIBHAL_DRIVE_TYPE_CAMERA:
-		return "LIBHAL_DRIVE_TYPE_CAMERA";
-	case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
-		return "LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER";
-	case LIBHAL_DRIVE_TYPE_ZIP:
-		return "LIBHAL_DRIVE_TYPE_ZIP";
-	case LIBHAL_DRIVE_TYPE_JAZ:
-		return "LIBHAL_DRIVE_TYPE_JAZ";
-	case LIBHAL_DRIVE_TYPE_FLASHKEY:
-		return "LIBHAL_DRIVE_TYPE_FLASHKEY";
-	case LIBHAL_DRIVE_TYPE_MO:
-		return "LIBHAL_DRIVE_TYPE_MO";
-	default:
-		return "";
-	}
-}
-
-static gboolean
-hal_device_is_user_removable (TrackerStorage *storage,
-                              const gchar    *device_file,
-                              const gchar    *mount_point)
-{
-	TrackerStoragePrivate *priv;
-	LibHalDrive *drive;
-	gboolean removable;
-
-	if (!device_file) {
-		return FALSE;
-	}
-
+	device_file = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+	g_debug ("    Device file  : %s", device_file);
+		
+	/* mounted, so never NULL */
+	mount = g_volume_get_mount (volume); 
+
+	if (mount) {
+		GFile *file;
+		
+		file = g_mount_get_root (mount);
+		
+		mount_point = g_file_get_path (file);
+		g_debug ("    Mount point  : %s", mount_point);
+		
+		g_object_unref (file);
+		g_object_unref (mount);
+		
+		is_mounted = TRUE;
+	} else {
+		mount_point = NULL;
+		is_mounted = FALSE;
+	}
+	
+	uuid = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UUID);
+	g_debug ("    UUID         : %s", uuid);
+	
+	g_debug ("    Mounted      : %s", is_mounted ? "yes" : "no");
+	
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	drive = libhal_drive_from_device_file (priv->context, device_file);
-	if (!drive) {
-		return FALSE;
-	}
-
-	removable = libhal_drive_uses_removable_media (drive);
-
-	if (libhal_drive_get_type (drive) == LIBHAL_DRIVE_TYPE_SD_MMC) {
-		/* mmc block devices are not considered removable according to
-		   linux kernel as they do not contain removable media, they
-		   are simply hotpluggable
-		   consider all SD/MMC volumes mounted in /media as user removable
-		*/
-		if (g_str_has_prefix (mount_point, "/media/")) {
-			removable = TRUE;
-		}
+	if (mount_point && !g_hash_table_lookup (priv->mounts_by_uuid, uuid)) {
+		mount_add (storage, uuid, mount_point, TRUE);
 	}
-
-	libhal_drive_free (drive);
-
-	return removable;
+	
+	g_free (uuid);
+	g_free (mount_point);
+	g_free (device_file);
 }
 
 static gboolean
-hal_device_should_be_tracked (TrackerStorage *storage,
-                              const gchar    *device_file)
+drives_setup (TrackerStorage *storage)
 {
 	TrackerStoragePrivate *priv;
-	LibHalDrive *drive;
-	LibHalDriveType drive_type;
-	gboolean eligible;
-
-	if (!device_file) {
-		return FALSE;
-	}
+	GList *drives, *ld;
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	drive = libhal_drive_from_device_file (priv->context, device_file);
-	if (!drive) {
-		return FALSE;
-	}
+	drives = g_volume_monitor_get_connected_drives (priv->volume_monitor);
 
-	/* From the list, the first one below seems to be the ONLY one
-	 * to ignore:
-	 *
-	 * LIBHAL_DRIVE_TYPE_REMOVABLE_DISK        = 0x00,
-	 * LIBHAL_DRIVE_TYPE_DISK                  = 0x01,
-	 * LIBHAL_DRIVE_TYPE_CDROM                 = 0x02,
-	 * LIBHAL_DRIVE_TYPE_FLOPPY                = 0x03,
-	 * LIBHAL_DRIVE_TYPE_TAPE                  = 0x04,
-	 * LIBHAL_DRIVE_TYPE_COMPACT_FLASH         = 0x05,
-	 * LIBHAL_DRIVE_TYPE_MEMORY_STICK          = 0x06,
-	 * LIBHAL_DRIVE_TYPE_SMART_MEDIA           = 0x07,
-	 * LIBHAL_DRIVE_TYPE_SD_MMC                = 0x08,
-	 * LIBHAL_DRIVE_TYPE_CAMERA                = 0x09,
-	 * LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER = 0x0a,
-	 * LIBHAL_DRIVE_TYPE_ZIP                   = 0x0b,
-	 * LIBHAL_DRIVE_TYPE_JAZ                   = 0x0c,
-	 * LIBHAL_DRIVE_TYPE_FLASHKEY              = 0x0d,
-	 * LIBHAL_DRIVE_TYPE_MO                            = 0x0e
-	 *
-	 */
-
-	drive_type = libhal_drive_get_type (drive);
-
-	/* So here we don't track CDROM devices or the hard disks in
-	 * the machine, we simply track devices which are added or
-	 * removed in real time which we are interested in and which
-	 * are viable for tracking. CDROMs are too slow.
-	 */
-	eligible = TRUE;
-	eligible &= drive_type != LIBHAL_DRIVE_TYPE_DISK;
-	eligible &= drive_type != LIBHAL_DRIVE_TYPE_CDROM;
-
-	libhal_drive_free (drive);
-
-	if (!eligible) {
-		g_message ("HAL device:'%s' is not eligible for tracking, type is '%s'",
-		           device_file,
-		           hal_drive_type_to_string (drive_type));
-	} else {
-		g_message ("HAL device:'%s' is eligible for tracking, type is '%s'",
-		           device_file,
-		           hal_drive_type_to_string (drive_type));
+	if (g_list_length (drives) < 1) {
+		g_message ("No drives found to iterate");
+		return TRUE;
 	}
 
-	return eligible;
-}
+	for (ld = drives; ld; ld = ld->next) {
+		GDrive *drive;
+		GList *volumes, *lv;
+		guint n_volumes;
 
-static gboolean
-hal_device_add (TrackerStorage *storage,
-                LibHalVolume   *volume)
-{
-	TrackerStoragePrivate *priv;
-	DBusError error;
-	const gchar *udi;
-	const gchar *mount_point;
-	const gchar *device_file;
-
-	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
+		drive = ld->data;
 
-	dbus_error_init (&error);
-
-	udi = libhal_volume_get_udi (volume);
-	mount_point = libhal_volume_get_mount_point (volume);
-	device_file = libhal_volume_get_device_file (volume);
-
-	if (g_hash_table_lookup (priv->all_devices, udi)) {
-		return TRUE;
-	}
+		if (!drive) {
+			continue;
+		}
+		
+		volumes = g_drive_get_volumes (drive);
+		n_volumes = g_list_length (volumes);
 
-	/* If there is no mount point, then there is nothing to track */
-	if (!hal_device_should_be_tracked (storage, device_file)) {
-		return TRUE;
-	}
+		g_debug ("Drive:'%s' found with %d %s:",
+		         g_drive_get_name (drive),
+		         n_volumes,
+		         n_volumes == 1 ? "volume" : "volumes");
 
-	/* Make sure we watch changes to the mount/umount state */
-	libhal_device_add_property_watch (priv->context, udi, &error);
+		for (lv = volumes; lv; lv = lv->next) {
+			volume_add (storage, lv->data);
+		}
 
-	if (dbus_error_is_set (&error)) {
-		g_critical ("Could not add device:'%s' property watch for udi:'%s', %s",
-		            device_file,
-		            udi,
-		            error.message);
-		dbus_error_free (&error);
-		return FALSE;
+		g_list_free (volumes);
+		g_object_unref (ld->data);
 	}
 
-	g_hash_table_insert (priv->all_devices,
-	                     g_strdup (udi),
-	                     g_strdup (device_file));
-
-	if (mount_point) {
-		hal_mount_point_add (storage,
-		                     udi,
-		                     mount_point,
-		                     hal_device_is_user_removable (storage, device_file, mount_point));
-	}
+	g_list_free (drives);
 
 	return TRUE;
 }
 
 static void
-hal_device_added_cb (LibHalContext *context,
-                     const gchar   *udi)
+mount_added_cb (GVolumeMonitor *monitor,
+                GMount         *mount,
+                gpointer        user_data)
 {
 	TrackerStorage *storage;
-	LibHalVolume *volume;
-
-	storage = libhal_ctx_get_user_data (context);
-
-	if (libhal_device_query_capability (context, udi, CAPABILITY_VOLUME, NULL)) {
-		volume = libhal_volume_from_udi (context, udi);
-
-		if (!volume) {
-			/* Not a device with a volume */
-			return;
-		}
-
-		g_message ("HAL device:'%s' added:",
-		           libhal_volume_get_device_file (volume));
-		g_message ("  UDI        : %s",
-		           udi);
-		g_message ("  Mount point: %s",
-		           libhal_volume_get_mount_point (volume));
-		g_message ("  UUID       : %s",
-		           libhal_volume_get_uuid (volume));
-		g_message ("  Mounted    : %s",
-		           libhal_volume_is_mounted (volume) ? "yes" : "no");
-		g_message ("  File system: %s",
-		           libhal_volume_get_fstype (volume));
-		g_message ("  Label      : %s",
-		           libhal_volume_get_label (volume));
-
-		hal_device_add (storage, volume);
-		libhal_volume_free (volume);
-	}
-}
-
-static void
-hal_device_removed_cb (LibHalContext *context,
-                       const gchar   *udi)
-{
-	TrackerStorage *storage;
-	TrackerStoragePrivate *priv;
-	const gchar *device_file;
+	GVolume *volume;
+	GFile *file;
+	gchar *device_file;
+	gchar *uuid;
+	gchar *mount_point;
+	gboolean removable_device = TRUE;
 
-	storage = libhal_ctx_get_user_data (context);
-	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
+	storage = user_data;
 
-	if (g_hash_table_lookup (priv->all_devices, udi)) {
-		device_file = g_hash_table_lookup (priv->all_devices, udi);
+	volume = g_mount_get_volume (mount);
+	device_file = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+	uuid = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UUID);
+	file = g_mount_get_root (mount);
+	mount_point = g_file_get_path (file);
 
-		if (!device_file) {
-			/* Don't report about unknown devices */
-			return;
-		}
+	/* NOTE: We only deal with removable devices */
+	removable_device = TRUE;
 
-		g_message ("HAL device:'%s' removed:",
-		           device_file);
-		g_message ("  UDI        : %s",
-		           udi);
+	g_message ("Device:'%s', UUID:'%s' now mounted on:'%s', being tracked",
+	           device_file,
+	           uuid,
+	           mount_point);
 
-		g_hash_table_remove (priv->all_devices, udi);
+	mount_add (storage, uuid, mount_point, removable_device);
 
-		hal_mount_point_remove (storage, udi);
-	}
+	g_free (mount_point);
+	g_object_unref (file);
+	g_free (uuid);
+	g_free (device_file);
+	g_object_unref (volume);
 }
 
 static void
-hal_device_property_modified_cb (LibHalContext *context,
-                                 const char    *udi,
-                                 const char    *key,
-                                 dbus_bool_t    is_removed,
-                                 dbus_bool_t    is_added)
+mount_removed_cb (GVolumeMonitor *monitor,
+                  GMount         *mount,
+                  gpointer        user_data)
 {
 	TrackerStorage *storage;
 	TrackerStoragePrivate *priv;
-	DBusError error;
+	MountInfo *info;
+	GNode *node;
+	GFile *file;
+	gchar *name;
+	gchar *mount_point;
+	gchar *mp;
 
-	storage = libhal_ctx_get_user_data (context);
+	storage = user_data;
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	dbus_error_init (&error);
+	file = g_mount_get_root (mount);
+	mount_point = g_file_get_path (file);
+	name = g_mount_get_name (mount);
 
-	if (g_hash_table_lookup (priv->all_devices, udi)) {
-		const gchar *device_file;
-		gboolean is_mounted;
+	/* device_file = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); */
+	/* uuid = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UUID); */
+	/* node = g_hash_table_lookup (priv->mounts_by_uuid, uuid); */
 
-		device_file = g_hash_table_lookup (priv->all_devices, udi);
-
-		g_message ("HAL device:'%s' property change for udi:'%s' and key:'%s'",
-		           device_file,
-		           udi,
-		           key);
-
-		if (strcmp (key, PROP_IS_MOUNTED) != 0) {
-			return;
-		}
+	mp = mount_point_normalize (mount_point);
+	node = mount_node_find (priv->mounts, mp);
+	g_free (mp);
 
-		is_mounted = libhal_device_get_property_bool (context,
-		                                              udi,
-		                                              key,
-		                                              &error);
-
-		if (dbus_error_is_set (&error)) {
-			g_message ("Could not get device property:'%s' for udi:'%s', %s",
-			           udi, key, error.message);
-			dbus_error_free (&error);
-
-			g_message ("HAL device:'%s' with udi:'%s' is now unmounted (due to error)",
-			           device_file,
-			           udi);
-			hal_mount_point_remove (storage, udi);
-			return;
-		}
-
-		if (is_mounted) {
-			LibHalVolume *volume;
-			const gchar  *mount_point;
-
-			volume = libhal_volume_from_udi (context, udi);
-			mount_point = libhal_volume_get_mount_point (volume);
+	if (node) {
+		info = node->data;
 
-			g_message ("HAL device:'%s' with udi:'%s' is now mounted",
-			           device_file,
-			           udi);
+		g_message ("Mount:'%s' with UUID:'%s' now unmounted from:'%s'",
+		           name,
+		           info->uuid,
+		           mount_point);
 
-			hal_mount_point_add (storage,
-			                     udi,
-			                     mount_point,
-			                     hal_device_is_user_removable (storage, device_file, mount_point));
+		g_signal_emit (storage, signals[MOUNT_POINT_REMOVED], 0, info->uuid, mount_point, NULL);
+		
+		g_hash_table_remove (priv->mounts_by_uuid, info->uuid);
+		mount_node_free (node);
+	} else {
+		g_message ("Mount:'%s' now unmounted from:'%s' (was not tracked)",
+		           name,
+		           mount_point);
+	}
 
-			libhal_volume_free (volume);
-		} else {
-			g_message ("HAL device:'%s' with udi:'%s' is now unmounted",
-			           device_file,
-			           udi);
+	g_free (name);
+	g_free (mount_point);
+	g_object_unref (file);
+	/* g_free (uuid); */
+	/* g_free (device_file); */
+}
 
-			hal_mount_point_remove (storage, udi);
-		}
-	}
+static void
+volume_added_cb (GVolumeMonitor *monitor,
+                 GVolume        *volume,
+                 gpointer        user_data)
+{
+	volume_add (user_data, volume);
 }
 
 /**
@@ -838,17 +538,17 @@ tracker_storage_new (void)
 }
 
 static void
-hal_get_mount_point_by_udi_foreach (gpointer key,
-                                    gpointer value,
-                                    gpointer user_data)
+get_mount_point_by_uuid_foreach (gpointer key,
+                                 gpointer value,
+                                 gpointer user_data)
 {
 	GetRoots *gr;
-	const gchar *udi;
+	const gchar *uuid;
 	GNode *node;
 	MountInfo *info;
 
 	gr = user_data;
-	udi = key;
+	uuid = key;
 	node = value;
 	info = node->data;
 
@@ -890,102 +590,103 @@ tracker_storage_get_removable_device_roots (TrackerStorage *storage)
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	gr.context = priv->context;
 	gr.roots = NULL;
 	gr.only_removable = TRUE;
 
-	g_hash_table_foreach (priv->mounts_by_udi,
-	                      hal_get_mount_point_by_udi_foreach,
+	g_hash_table_foreach (priv->mounts_by_uuid,
+	                      get_mount_point_by_uuid_foreach,
 	                      &gr);
 
 	return g_slist_reverse (gr.roots);
 }
 
 /**
- * tracker_storage_get_removable_device_udis:
+ * tracker_storage_get_removable_device_uuids:
  * @storage: A #TrackerStorage
  *
- * Returns a #GSList of strings containing the UDI for removable devices.
+ * Returns a #GSList of strings containing the UUID for removable devices.
  * Each element is owned by the #GHashTable internally, the list
  * itself through should be freed using g_slist_free().
  *
- * Returns: The list of UDIs.
+ * Returns: The list of UUIDs.
  **/
 GSList *
-tracker_storage_get_removable_device_udis (TrackerStorage *storage)
+tracker_storage_get_removable_device_uuids (TrackerStorage *storage)
 {
 	TrackerStoragePrivate *priv;
 	GHashTableIter iter;
 	gpointer key, value;
-	GSList *udis;
+	GSList *uuids;
 
 	g_return_val_if_fail (TRACKER_IS_STORAGE (storage), NULL);
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	udis = NULL;
+	uuids = NULL;
 
-	g_hash_table_iter_init (&iter, priv->mounts_by_udi);
+	g_hash_table_iter_init (&iter, priv->mounts_by_uuid);
 
 	while (g_hash_table_iter_next (&iter, &key, &value)) {
-		const gchar *udi;
+		const gchar *uuid;
 		GNode *node;
 		MountInfo *info;
 
-		udi = key;
+		uuid = key;
 		node = value;
 		info = node->data;
 
 		if (info->removable) {
-			udis = g_slist_prepend (udis, g_strdup (udi));
+			uuids = g_slist_prepend (uuids, g_strdup (uuid));
 		}
 	}
 
-	return g_slist_reverse (udis);
+	return g_slist_reverse (uuids);
 }
 
 /**
- * tracker_storage_udi_get_mount_point:
+ * tracker_storage_get_mount_point_for_uuid:
  * @storage: A #TrackerStorage
- * @udi: A string pointer to the UDI for the device.
+ * @uuid: A string pointer to the UUID for the %GVolume.
  *
- * Returns: The mount point for @udi, this should not be freed.
+ * Returns: The mount point for @uuid, this should not be freed.
  **/
 const gchar *
-tracker_storage_udi_get_mount_point (TrackerStorage *storage,
-                                     const gchar    *udi)
+tracker_storage_get_mount_point_for_uuid (TrackerStorage *storage,
+                                          const gchar    *uuid)
 {
 	TrackerStoragePrivate *priv;
 	GNode *node;
 	MountInfo *info;
 
 	g_return_val_if_fail (TRACKER_IS_STORAGE (storage), NULL);
-	g_return_val_if_fail (udi != NULL, NULL);
+	g_return_val_if_fail (uuid != NULL, NULL);
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	node = g_hash_table_lookup (priv->mounts_by_udi, udi);
+	node = g_hash_table_lookup (priv->mounts_by_uuid, uuid);
 
 	if (!node) {
 		return NULL;
 	}
 
 	info = node->data;
+
 	return info->mount_point;
 }
 
 /**
- * tracker_storage_get_volume_udi_for_file:
+ * tracker_storage_get_uuid_for_file:
  * @storage: A #TrackerStorage
  * @file: a file
  *
- * Returns the UDI of the removable device for @file
+ * Returns the UUID of the removable device for @file
  *
- * Returns: Returns the UDI of the removable device for @file
+ * Returns: Returns the UUID of the removable device for @file, this
+ * should not be freed.
  **/
 const gchar *
-tracker_storage_get_volume_udi_for_file (TrackerStorage *storage,
-                                         GFile          *file)
+tracker_storage_get_uuid_for_file (TrackerStorage *storage,
+                                   GFile          *file)
 {
 	TrackerStoragePrivate *priv;
 	gchar *path;
@@ -1010,18 +711,18 @@ tracker_storage_get_volume_udi_for_file (TrackerStorage *storage,
 
 	priv = TRACKER_STORAGE_GET_PRIVATE (storage);
 
-	info = find_mount_point_info (priv->mounts, path);
+	info = mount_info_find (priv->mounts, path);
 
 	if (!info) {
 		g_free (path);
 		return NULL;
 	}
 
-	g_debug ("Mount for path '%s' is '%s' (UDI:'%s')",
-	         path, info->mount_point, info->udi);
+	/* g_debug ("Mount for path '%s' is '%s' (UUID:'%s')", */
+	/*          path, info->mount_point, info->uuid); */
 
 	g_free (path);
 
-	return info->udi;
+	return info->uuid;
 }
 
diff --git a/src/libtracker-miner/tracker-storage.h b/src/libtracker-miner/tracker-storage.h
index 4a113bd..ee40e91 100644
--- a/src/libtracker-miner/tracker-storage.h
+++ b/src/libtracker-miner/tracker-storage.h
@@ -43,19 +43,14 @@ struct _TrackerStorageClass {
 	GObjectClass parent_class;
 };
 
-GType           tracker_storage_get_type                    (void) G_GNUC_CONST;
-TrackerStorage *tracker_storage_new                         (void);
-
-
-/* Needed */
-GSList *        tracker_storage_get_removable_device_roots  (TrackerStorage  *storage);
-GSList *        tracker_storage_get_removable_device_udis   (TrackerStorage  *storage);
-const gchar *   tracker_storage_udi_get_mount_point         (TrackerStorage  *storage,
-                                                             const gchar     *udi);
-const gchar*    tracker_storage_get_volume_udi_for_file     (TrackerStorage  *storage,
-                                                             GFile           *file);
-
-
+GType           tracker_storage_get_type                   (void) G_GNUC_CONST;
+TrackerStorage *tracker_storage_new                        (void);
+GSList *        tracker_storage_get_removable_device_roots (TrackerStorage *storage);
+GSList *        tracker_storage_get_removable_device_uuids (TrackerStorage *storage);
+const gchar *   tracker_storage_get_mount_point_for_uuid   (TrackerStorage *storage,
+                                                            const gchar    *uuid);
+const gchar*    tracker_storage_get_uuid_for_file          (TrackerStorage *storage,
+                                                            GFile          *file);
 
 G_END_DECLS
 
diff --git a/src/tracker-extract/tracker-albumart.c b/src/tracker-extract/tracker-albumart.c
index fc17b34..35cd6bd 100644
--- a/src/tracker-extract/tracker-albumart.c
+++ b/src/tracker-extract/tracker-albumart.c
@@ -562,11 +562,7 @@ albumart_request_download (TrackerStorage *storage,
 
 	info = g_slice_new (GetFileInfo);
 
-#ifdef HAVE_HAL
 	info->storage = storage ? g_object_ref (storage) : NULL;
-#else
-	info->storage = NULL;
-#endif
 
 	info->local_uri = g_strdup (local_uri);
 	info->art_path = g_strdup (art_path);
@@ -609,7 +605,6 @@ albumart_copy_to_local (TrackerStorage *storage,
 	guint flen;
 
 	/* Determining if we are on a removable device */
-#ifdef HAVE_HAL
 	if (!storage) {
 		/* This is usually because we are running on the
 		 * command line, so we don't error here with
@@ -619,10 +614,6 @@ albumart_copy_to_local (TrackerStorage *storage,
 	}
 
 	removable_roots = tracker_storage_get_removable_device_roots (storage);
-#else
-	removable_roots = g_slist_append (removable_roots, "/media");
-	removable_roots = g_slist_append (removable_roots, "/mnt");
-#endif
 
 	flen = strlen (filename);
 
@@ -637,10 +628,7 @@ albumart_copy_to_local (TrackerStorage *storage,
 		}
 	}
 
-#ifdef HAVE_HAL
 	g_slist_foreach (removable_roots, (GFunc) g_free, NULL);
-#endif
-
 	g_slist_free (removable_roots);
 
 	if (on_removable_device) {
@@ -723,11 +711,7 @@ tracker_albumart_init (void)
 
 	g_return_val_if_fail (initialized == FALSE, FALSE);
 
-#ifdef HAVE_HAL
 	albumart_storage = tracker_storage_new ();
-#else  /* HAVE_HAL */
-	albumart_storage = NULL;
-#endif /* HAVE_HAL */
 
 	/* Cache to know if we have already handled uris */
 	albumart_cache = g_hash_table_new_full (g_str_hash,
@@ -769,11 +753,9 @@ tracker_albumart_shutdown (void)
 		g_hash_table_unref (albumart_cache);
 	}
 
-#ifdef HAVE_HAL
 	if (albumart_storage) {
 		g_object_unref (albumart_storage);
 	}
-#endif /* HAVE_HAL */
 
 	initialized = FALSE;
 }
diff --git a/src/tracker-miner-fs/tracker-miner-files.c b/src/tracker-miner-fs/tracker-miner-files.c
index 34d8595..fd7080d 100644
--- a/src/tracker-miner-fs/tracker-miner-files.c
+++ b/src/tracker-miner-fs/tracker-miner-files.c
@@ -75,7 +75,7 @@ struct TrackerMinerFilesPrivate {
 
 	DBusGProxy *extractor_proxy;
 
-	GQuark quark_mount_point_udi;
+	GQuark quark_mount_point_uuid;
 	GQuark quark_directory_config_root;
 };
 
@@ -103,20 +103,18 @@ static void        mount_pre_unmount_cb                 (GVolumeMonitor       *v
                                                          GMount               *mount,
                                                          TrackerMinerFiles    *mf);
 
-#ifdef HAVE_HAL
 static void        mount_point_added_cb                 (TrackerStorage       *storage,
-                                                         const gchar          *udi,
+                                                         const gchar          *uuid,
                                                          const gchar          *mount_point,
                                                          gpointer              user_data);
 static void        mount_point_removed_cb               (TrackerStorage       *storage,
-                                                         const gchar          *udi,
+                                                         const gchar          *uuid,
                                                          const gchar          *mount_point,
                                                          gpointer              user_data);
 static void        check_battery_status                 (TrackerMinerFiles    *fs);
 static void        battery_status_cb                    (GObject              *object,
                                                          GParamSpec           *pspec,
                                                          gpointer              user_data);
-#endif
 
 static void        init_mount_points                    (TrackerMinerFiles    *miner);
 static void        disk_space_check_start               (TrackerMinerFiles    *mf);
@@ -189,7 +187,6 @@ tracker_miner_files_init (TrackerMinerFiles *mf)
 
 	priv = mf->private = TRACKER_MINER_FILES_GET_PRIVATE (mf);
 
-#ifdef HAVE_HAL
 	priv->storage = tracker_storage_new ();
 
 	g_signal_connect (priv->storage, "mount-point-added",
@@ -200,6 +197,7 @@ tracker_miner_files_init (TrackerMinerFiles *mf)
 	                  G_CALLBACK (mount_point_removed_cb),
 	                  mf);
 
+#ifdef HAVE_HAL
 	priv->power = tracker_power_new ();
 
 	g_signal_connect (priv->power, "notify::on-low-battery",
@@ -218,7 +216,7 @@ tracker_miner_files_init (TrackerMinerFiles *mf)
 	/* Set up extractor and signals */
 	priv->extractor_proxy = extractor_create_proxy ();
 
-	priv->quark_mount_point_udi = g_quark_from_static_string ("tracker-mount-point-udi");
+	priv->quark_mount_point_uuid = g_quark_from_static_string ("tracker-mount-point-uuid");
 	priv->quark_directory_config_root = g_quark_from_static_string ("tracker-directory-config-root");
 
 	init_mount_points (mf);
@@ -295,9 +293,10 @@ miner_files_finalize (GObject *object)
 
 #ifdef HAVE_HAL
 	g_object_unref (priv->power);
-	g_object_unref (priv->storage);
 #endif /* HAVE_HAL */
 
+	g_object_unref (priv->storage);
+
 	g_signal_handlers_disconnect_by_func (priv->volume_monitor,
 	                                      mount_pre_unmount_cb,
 	                                      object);
@@ -324,11 +323,11 @@ miner_files_constructed (GObject *object)
 		g_assert_not_reached ();
 	}
 
-#ifdef HAVE_HAL
 	if (tracker_config_get_index_removable_devices (mf->private->config)) {
 		mounts = tracker_storage_get_removable_device_roots (mf->private->storage);
 	}
 
+#ifdef HAVE_HAL
 	check_battery_status (mf);
 #endif /* HAVE_HAL */
 
@@ -434,15 +433,12 @@ miner_files_constructed (GObject *object)
 
 	for (m = mounts; m; m = m->next) {
 		GFile *file = g_file_new_for_path (m->data);
-#ifdef HAVE_HAL
-		const gchar *udi = tracker_storage_get_volume_udi_for_file (mf->private->storage, file);
+		const gchar *uuid = tracker_storage_get_uuid_for_file (mf->private->storage, file);
 
 		g_object_set_qdata_full (G_OBJECT (file),
-					 mf->private->quark_mount_point_udi,
-					 g_strdup (udi),
+					 mf->private->quark_mount_point_uuid,
+					 g_strdup (uuid),
 					 (GDestroyNotify) g_free);
-#endif
-
 		g_object_set_qdata (G_OBJECT (file),
 		                    mf->private->quark_directory_config_root,
 		                    GINT_TO_POINTER (TRUE));
@@ -610,9 +606,7 @@ query_mount_points_cb (GObject      *source,
 	gint i;
 	GError *error = NULL;
 	const GPtrArray *query_results;
-#ifdef HAVE_HAL
-	GSList *udis, *u;
-#endif
+	GSList *uuids, *u;
 
 	query_results = tracker_miner_execute_sparql_finish (miner,
 	                                                     result,
@@ -647,17 +641,16 @@ query_mount_points_cb (GObject      *source,
 	g_hash_table_replace (volumes, g_strdup (TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN),
 	                      GINT_TO_POINTER (VOLUME_MOUNTED));
 
-#ifdef HAVE_HAL
-	udis = tracker_storage_get_removable_device_udis (priv->storage);
+	uuids = tracker_storage_get_removable_device_uuids (priv->storage);
 
 	/* Then, get all currently mounted volumes, according to HAL */
-	for (u = udis; u; u = u->next) {
-		const gchar *udi;
+	for (u = uuids; u; u = u->next) {
+		const gchar *uuid;
 		gchar *removable_device_urn;
 		gint state;
 
-		udi = u->data;
-		removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", udi);
+		uuid = u->data;
+		removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
 
 		state = GPOINTER_TO_INT (g_hash_table_lookup (volumes, removable_device_urn));
 		state |= VOLUME_MOUNTED;
@@ -665,9 +658,8 @@ query_mount_points_cb (GObject      *source,
 		g_hash_table_replace (volumes, removable_device_urn, GINT_TO_POINTER (state));
 	}
 
-	g_slist_foreach (udis, (GFunc) g_free, NULL);
-	g_slist_free (udis);
-#endif
+	g_slist_foreach (uuids, (GFunc) g_free, NULL);
+	g_slist_free (uuids);
 
 	accumulator = g_string_new (NULL);
 	g_hash_table_iter_init (&iter, volumes);
@@ -681,14 +673,12 @@ query_mount_points_cb (GObject      *source,
 		    !(state & VOLUME_MOUNTED_IN_STORE)) {
 			const gchar *mount_point = NULL;
 
-#ifdef HAVE_HAL
 			if (g_str_has_prefix (urn, TRACKER_DATASOURCE_URN_PREFIX)) {
-				const gchar *udi;
+				const gchar *uuid;
 
-				udi = urn + strlen (TRACKER_DATASOURCE_URN_PREFIX);
-				mount_point = tracker_storage_udi_get_mount_point (priv->storage, udi);
+				uuid = urn + strlen (TRACKER_DATASOURCE_URN_PREFIX);
+				mount_point = tracker_storage_get_mount_point_for_uuid (priv->storage, uuid);
 			}
-#endif
 
 			if (urn) {
 				if (mount_point) {
@@ -733,11 +723,9 @@ init_mount_points (TrackerMinerFiles *miner)
 	                              NULL);
 }
 
-#ifdef HAVE_HAL
-
 static void
 mount_point_removed_cb (TrackerStorage *storage,
-                        const gchar    *udi,
+                        const gchar    *uuid,
                         const gchar    *mount_point,
                         gpointer        user_data)
 {
@@ -746,7 +734,7 @@ mount_point_removed_cb (TrackerStorage *storage,
 
 	g_debug ("Removing mount point '%s'", mount_point);
 
-	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", udi);
+	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
 
 	set_up_mount_point (miner, urn, mount_point, FALSE, NULL);
 	g_free (urn);
@@ -754,7 +742,7 @@ mount_point_removed_cb (TrackerStorage *storage,
 
 static void
 mount_point_added_cb (TrackerStorage *storage,
-                      const gchar    *udi,
+                      const gchar    *uuid,
                       const gchar    *mount_point,
                       gpointer        user_data)
 {
@@ -772,8 +760,8 @@ mount_point_added_cb (TrackerStorage *storage,
 
 		file = g_file_new_for_path (mount_point);
 		g_object_set_qdata_full (G_OBJECT (file),
-		                         priv->quark_mount_point_udi,
-		                         g_strdup (udi),
+		                         priv->quark_mount_point_uuid,
+		                         g_strdup (uuid),
 		                         (GDestroyNotify) g_free);
 
 		g_object_set_qdata (G_OBJECT (file),
@@ -788,12 +776,14 @@ mount_point_added_cb (TrackerStorage *storage,
 
 	g_debug ("Configuring added mount point '%s'", mount_point);
 
-	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", udi);
+	urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
 
 	set_up_mount_point (miner, urn, mount_point, TRUE, NULL);
 	g_free (urn);
 }
 
+#ifdef HAVE_HAL
+
 static void
 set_up_throttle (TrackerMinerFiles *mf,
                  gboolean           enable)
@@ -1366,7 +1356,7 @@ miner_files_add_to_datasource (TrackerMinerFiles    *mf,
                                TrackerSparqlBuilder *sparql)
 {
 	TrackerMinerFilesPrivate *priv;
-	const gchar *removable_device_udi;
+	const gchar *removable_device_uuid;
 	gchar *removable_device_urn, *uri;
 	const gchar *urn;
 	gboolean is_iri;
@@ -1374,15 +1364,11 @@ miner_files_add_to_datasource (TrackerMinerFiles    *mf,
 	priv = TRACKER_MINER_FILES_GET_PRIVATE (mf);
 	uri = g_file_get_uri (file);
 
-#ifdef HAVE_HAL
-	removable_device_udi = tracker_storage_get_volume_udi_for_file (priv->storage, file);
-#else  /* HAVE_HAL */
-	removable_device_udi = NULL;
-#endif /* HAVE_HAL */
+	removable_device_uuid = tracker_storage_get_uuid_for_file (priv->storage, file);
 
-	if (removable_device_udi) {
+	if (removable_device_uuid) {
 		removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s",
-		                                        removable_device_udi);
+		                                        removable_device_uuid);
 	} else {
 		removable_device_urn = g_strdup (TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN);
 	}
@@ -1456,7 +1442,7 @@ extractor_get_embedded_metadata_cb (DBusGProxy *proxy,
 {
 	TrackerMinerFilesPrivate *priv;
 	ProcessFileData *data = user_data;
-	const gchar *udi;
+	const gchar *uuid;
 
 	priv = TRACKER_MINER_FILES_GET_PRIVATE (data->miner);
 
@@ -1494,15 +1480,15 @@ extractor_get_embedded_metadata_cb (DBusGProxy *proxy,
 		tracker_sparql_builder_prepend (data->sparql, preupdate);
 	}
 
-	udi = g_object_get_qdata (G_OBJECT (data->file),
-				  data->miner->private->quark_mount_point_udi);
+	uuid = g_object_get_qdata (G_OBJECT (data->file),
+				  data->miner->private->quark_mount_point_uuid);
 
 	/* File represents a mount point */
-	if (G_UNLIKELY (udi)) {
+	if (G_UNLIKELY (uuid)) {
 		GString *queries;
 		gchar *removable_device_urn, *uri;
 
-		removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", udi);
+		removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
 		uri = g_file_get_uri (G_FILE (data->file));
 
 		queries = g_string_new ("");



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