[tracker/tracker-0.10] libtracker-miner: Add mount-name to tracker:Volume as nie:title Author: Lionel Landwerling <lione



commit fd1d42679a44ca7c3375e40b2c23eb1a7192da81
Author: Lionel Landwerling <lionel g landwerlin linux intel com>
Date:   Mon Feb 28 17:00:13 2011 +0200

    libtracker-miner: Add mount-name to tracker:Volume as nie:title
    Author:    Lionel Landwerling <lionel g landwerlin linux intel com>

 data/ontologies/90-tracker.ontology       |    1 +
 src/libtracker-miner/tracker-marshal.list |    1 +
 src/libtracker-miner/tracker-storage.c    |    9 ++++++---
 src/miners/fs/tracker-miner-files.c       |   24 +++++++++++++++++-------
 4 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/data/ontologies/90-tracker.ontology b/data/ontologies/90-tracker.ontology
index abdeb0b..efc5da1 100644
--- a/data/ontologies/90-tracker.ontology
+++ b/data/ontologies/90-tracker.ontology
@@ -25,6 +25,7 @@ tracker:notify a rdf:Property ;
 
 tracker:Volume a rdfs:Class ;
 	rdfs:label "Storage media" ;
+        rdfs:subClassOf nie:InformationElement ;
 	rdfs:subClassOf nie:DataSource .
 
 tracker:isMounted a rdf:Property ;
diff --git a/src/libtracker-miner/tracker-marshal.list b/src/libtracker-miner/tracker-marshal.list
index 9c85140..28f8e4a 100644
--- a/src/libtracker-miner/tracker-marshal.list
+++ b/src/libtracker-miner/tracker-marshal.list
@@ -6,6 +6,7 @@ VOID:STRING,DOUBLE
 VOID:STRING,STRING
 VOID:STRING,STRING,DOUBLE
 VOID:STRING,STRING,BOOLEAN,BOOLEAN
+VOID:STRING,STRING,STRING,BOOLEAN,BOOLEAN
 BOOL:OBJECT,OBJECT,OBJECT
 BOOL:OBJECT,OBJECT
 BOOL:OBJECT,POINTER
diff --git a/src/libtracker-miner/tracker-storage.c b/src/libtracker-miner/tracker-storage.c
index b80ccb6..0630f2a 100644
--- a/src/libtracker-miner/tracker-storage.c
+++ b/src/libtracker-miner/tracker-storage.c
@@ -104,11 +104,12 @@ tracker_storage_class_init (TrackerStorageClass *klass)
 		              G_SIGNAL_RUN_LAST,
 		              0,
 		              NULL, NULL,
-		              tracker_marshal_VOID__STRING_STRING_BOOLEAN_BOOLEAN,
+		              tracker_marshal_VOID__STRING_STRING_STRING_BOOLEAN_BOOLEAN,
 		              G_TYPE_NONE,
-		              4,
+		              5,
 		              G_TYPE_STRING,
 		              G_TYPE_STRING,
+                              G_TYPE_STRING,
 		              G_TYPE_BOOLEAN,
 		              G_TYPE_BOOLEAN);
 
@@ -325,6 +326,7 @@ static void
 mount_add_new (TrackerStorage *storage,
                const gchar    *uuid,
                const gchar    *mount_point,
+               const gchar    *mount_name,
                gboolean        removable_device,
                gboolean        optical_disc)
 {
@@ -341,6 +343,7 @@ mount_add_new (TrackerStorage *storage,
 	               0,
 	               uuid,
 	               mount_point,
+                       mount_name,
 	               removable_device,
 	               optical_disc,
 	               NULL);
@@ -663,7 +666,7 @@ mount_add (TrackerStorage *storage,
 		         is_removable ? "yes" : "no",
 		         is_optical ? "yes" : "no",
 		         mount_path);
-		mount_add_new (storage, uuid, mount_path, is_removable, is_optical);
+		mount_add_new (storage, uuid, mount_path, mount_name, is_removable, is_optical);
 	} else {
 		g_debug ("  Skipping mount point with UUID: '%s', path: '%s', already managed: '%s'",
 		         uuid ? uuid : "none",
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index bb01ee6..32e6975 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -165,6 +165,7 @@ static void        mount_pre_unmount_cb                 (GVolumeMonitor       *v
 static void        mount_point_added_cb                 (TrackerStorage       *storage,
                                                          const gchar          *uuid,
                                                          const gchar          *mount_point,
+                                                         const gchar          *mount_name,
                                                          gboolean              removable,
                                                          gboolean              optical,
                                                          gpointer              user_data);
@@ -772,6 +773,7 @@ static void
 set_up_mount_point (TrackerMinerFiles *miner,
                     const gchar       *removable_device_urn,
                     const gchar       *mount_point,
+                    const gchar       *mount_name,
                     gboolean           mounted,
                     GString           *accumulator)
 {
@@ -812,7 +814,7 @@ set_up_mount_point (TrackerMinerFiles *miner,
 			                        "} WHERE { "
 			                        "  ?u a nfo:FileDataObject; "
 			                        "     nie:url \"%s\" "
-			                        "}",
+			                        "} ",
 			                        removable_device_urn, removable_device_urn, uri);
 
 			g_object_unref (file);
@@ -823,10 +825,15 @@ set_up_mount_point (TrackerMinerFiles *miner,
 		                        "DELETE { <%s> tracker:isMounted ?unknown } WHERE { <%s> a tracker:Volume; tracker:isMounted ?unknown } ",
 		                        removable_device_urn, removable_device_urn);
 
-		g_string_append_printf (queries,
-		                        "INSERT INTO <%s> { <%s> a tracker:Volume; tracker:isMounted true } ",
-		                        removable_device_urn, removable_device_urn);
-
+                if (mount_name) {
+                        g_string_append_printf (queries,
+                                                "INSERT INTO <%s> { <%s> a tracker:Volume; tracker:isMounted true; nie:title \"%s\" } ",
+                                                removable_device_urn, removable_device_urn, mount_name);
+                } else {
+                        g_string_append_printf (queries,
+                                                "INSERT INTO <%s> { <%s> a tracker:Volume; tracker:isMounted true } ",
+                                                removable_device_urn, removable_device_urn);
+                }
 		g_string_append_printf (queries,
 		                        "INSERT { GRAPH <%s> { ?do tracker:available true } } WHERE { ?do nie:dataSource <%s> OPTIONAL { ?do tracker:available ?available } FILTER (!bound(?available)) } ",
 		                        removable_device_urn, removable_device_urn);
@@ -1033,6 +1040,7 @@ init_mount_points (TrackerMinerFiles *miner_files)
 				set_up_mount_point (TRACKER_MINER_FILES (miner),
 				                    urn,
 				                    mount_point,
+                                                    NULL,
 				                    TRUE,
 				                    accumulator);
 
@@ -1053,6 +1061,7 @@ init_mount_points (TrackerMinerFiles *miner_files)
 				set_up_mount_point (TRACKER_MINER_FILES (miner),
 				                    urn,
 				                    NULL,
+                                                    NULL,
 				                    FALSE,
 				                    accumulator);
 			}
@@ -1139,7 +1148,7 @@ mount_point_removed_cb (TrackerStorage *storage,
 	mount_point_file = g_file_new_for_path (mount_point);
 
 	/* Set mount point status in tracker-store */
-	set_up_mount_point (miner, urn, mount_point, FALSE, NULL);
+	set_up_mount_point (miner, urn, mount_point, NULL, FALSE, NULL);
 
 	/* Tell TrackerMinerFS to skip monitoring everything under the mount
 	 *  point (in case there was no pre-unmount notification) */
@@ -1153,6 +1162,7 @@ static void
 mount_point_added_cb (TrackerStorage *storage,
                       const gchar    *uuid,
                       const gchar    *mount_point,
+                      const gchar    *mount_name,
                       gboolean        removable,
                       gboolean        optical,
                       gpointer        user_data)
@@ -1237,7 +1247,7 @@ mount_point_added_cb (TrackerStorage *storage,
 	}
 
 	queries = g_string_new ("");
-	set_up_mount_point (miner, urn, mount_point, TRUE, queries);
+	set_up_mount_point (miner, urn, mount_point, mount_name, TRUE, queries);
 	set_up_mount_point_type (miner, urn, removable, optical, queries);
 	tracker_sparql_connection_update_async (tracker_miner_get_connection (TRACKER_MINER (miner)),
 	                                        queries->str,



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