[tracker] tracker-miner-fs: Don't index removable media on initial index if disabled



commit ec03ea6fad5bfde565425135b8d5b80800e98f1e
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Feb 13 19:25:04 2012 +0000

    tracker-miner-fs: Don't index removable media on initial index if disabled

 src/miners/fs/tracker-config.c      |    2 +-
 src/miners/fs/tracker-miner-files.c |   28 +++++++++++++++-------------
 2 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/src/miners/fs/tracker-config.c b/src/miners/fs/tracker-config.c
index 4ceefb3..0f21083 100644
--- a/src/miners/fs/tracker-config.c
+++ b/src/miners/fs/tracker-config.c
@@ -38,7 +38,7 @@
 #define DEFAULT_INITIAL_SLEEP                    15       /* 0->1000 */
 #define DEFAULT_ENABLE_MONITORS                  TRUE
 #define DEFAULT_THROTTLE                         0        /* 0->20 */
-#define DEFAULT_INDEX_REMOVABLE_DEVICES          TRUE
+#define DEFAULT_INDEX_REMOVABLE_DEVICES          FALSE
 #define DEFAULT_INDEX_OPTICAL_DISCS              FALSE
 #define DEFAULT_INDEX_ON_BATTERY                 FALSE
 #define DEFAULT_INDEX_ON_BATTERY_FIRST_TIME      TRUE
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 768c7db..bcd1c42 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -971,23 +971,25 @@ init_mount_points (TrackerMinerFiles *miner_files)
 	g_slist_free (uuids);
 
 	/* Then, get all currently mounted REMOVABLE volumes, according to GIO */
-	uuids = tracker_storage_get_device_uuids (priv->storage, TRACKER_STORAGE_REMOVABLE, FALSE);
-	for (u = uuids; u; u = u->next) {
-		const gchar *uuid;
-		gchar *removable_device_urn;
-		gint state;
+	if (priv->index_removable_devices) {
+		uuids = tracker_storage_get_device_uuids (priv->storage, TRACKER_STORAGE_REMOVABLE, FALSE);
+		for (u = uuids; u; u = u->next) {
+			const gchar *uuid;
+			gchar *removable_device_urn;
+			gint state;
 
-		uuid = u->data;
-		removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", uuid);
+			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;
+			state = GPOINTER_TO_INT (g_hash_table_lookup (volumes, removable_device_urn));
+			state |= VOLUME_MOUNTED;
 
-		g_hash_table_replace (volumes, removable_device_urn, GINT_TO_POINTER (state));
-	}
+			g_hash_table_replace (volumes, removable_device_urn, GINT_TO_POINTER (state));
+		}
 
-	g_slist_foreach (uuids, (GFunc) g_free, NULL);
-	g_slist_free (uuids);
+		g_slist_foreach (uuids, (GFunc) g_free, NULL);
+		g_slist_free (uuids);
+	}
 
 	accumulator = g_string_new (NULL);
 	g_hash_table_iter_init (&iter, volumes);



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