[tracker/mounts-without-volumes: 4/12] libtracker-miner/tracker-storage: properly detect removable media



commit 8f3dc19f65407a4f568c398a1065da94be775f7f
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Jun 8 22:02:44 2010 +0200

    libtracker-miner/tracker-storage: properly detect removable media

 src/libtracker-miner/tracker-storage.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-storage.c b/src/libtracker-miner/tracker-storage.c
index 47c215d..a7f597f 100644
--- a/src/libtracker-miner/tracker-storage.c
+++ b/src/libtracker-miner/tracker-storage.c
@@ -480,8 +480,19 @@ mount_add (TrackerStorage *storage,
 		} else {
 			/* Any other removable media will have UUID in the GVolume.
 			 *  Note that this also may include some partitions in the machine
-			 *  which have GVolumes associated to the GMounts */
-			is_removable = TRUE;
+			 *  which have GVolumes associated to the GMounts. So, we need to
+			 *  explicitly check if the drive is media-removable (machine
+			 *  partitions won't be media-removable) */
+			GDrive *drive;
+
+			drive = g_volume_get_drive (volume);
+			if (drive) {
+				is_removable = g_drive_is_media_removable (drive);
+				g_object_unref (drive);
+			} else {
+				/* Note: not sure when this can happen... */
+				is_removable = TRUE;
+			}
 		}
 
 		g_object_unref (volume);



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