[rygel] tracker: Support existing non-indexed files



commit 4ebc4ddbf8dcc0fa1949f928cbdded9ca5526e3e
Author: Jens Georg <mail jensge org>
Date:   Thu May 19 18:14:15 2011 +0200

    tracker: Support existing non-indexed files

 .../rygel-tracker-category-all-container.vala      |    2 --
 .../tracker/rygel-tracker-insertion-query.vala     |   14 ++++++++++++++
 src/plugins/tracker/rygel-tracker-interfaces.vala  |    5 +++++
 3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-category-all-container.vala b/src/plugins/tracker/rygel-tracker-category-all-container.vala
index f3e64a1..dab7983 100644
--- a/src/plugins/tracker/rygel-tracker-category-all-container.vala
+++ b/src/plugins/tracker/rygel-tracker-category-all-container.vala
@@ -33,8 +33,6 @@ public class Rygel.Tracker.CategoryAllContainer : SearchContainer,
     /* class-wide constants */
     private const string TRACKER_SERVICE = "org.freedesktop.Tracker1";
     private const string RESOURCES_PATH = "/org/freedesktop/Tracker1/Resources";
-    private const string MINER_SERVICE = "org.freedesktop.Tracker1.Miner.Files";
-    private const string MINER_PATH = "/org/freedesktop/Tracker1/Miner/Files";
 
     public ArrayList<string> create_classes { get; set; }
 
diff --git a/src/plugins/tracker/rygel-tracker-insertion-query.vala b/src/plugins/tracker/rygel-tracker-insertion-query.vala
index 23bfe1c..1fdb2f7 100644
--- a/src/plugins/tracker/rygel-tracker-insertion-query.vala
+++ b/src/plugins/tracker/rygel-tracker-insertion-query.vala
@@ -29,6 +29,9 @@ public class Rygel.Tracker.InsertionQuery : Query {
     private const string TEMP_ID = "x";
     private const string QUERY_ID = "_:" + TEMP_ID;
 
+    private const string MINER_SERVICE = "org.freedesktop.Tracker1.Miner.Files.Index";
+    private const string MINER_PATH = "/org/freedesktop/Tracker1/Miner/Files/Index";
+
     // We need to add the size in the miner's graph so that the miner will
     // update it and correct a (possibly wrong) size we got via CreateItem
     // (DLNA requirement 7.3.128.7)
@@ -114,6 +117,17 @@ public class Rygel.Tracker.InsertionQuery : Query {
                                         (this.get_resource_id_query ());
 
             this.id = ids[0,0];
+        } else {
+            var file = File.new_for_uri (this.uri);
+            if (file.is_native () &&
+                file.query_exists ()) {
+                MinerFilesIndexIface miner  = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         MINER_SERVICE,
+                                         MINER_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
+                miner.index_file (this.uri);
+            }
         }
 
         debug ("Created item in Tracker store with ID '%s'", this.id);
diff --git a/src/plugins/tracker/rygel-tracker-interfaces.vala b/src/plugins/tracker/rygel-tracker-interfaces.vala
index dee6e23..59262e7 100644
--- a/src/plugins/tracker/rygel-tracker-interfaces.vala
+++ b/src/plugins/tracker/rygel-tracker-interfaces.vala
@@ -41,3 +41,8 @@ public interface Rygel.Tracker.ResourcesIface: DBusProxy {
     public abstract async HashTable<string,string>[,] sparql_update_blank
                                         (string query) throws IOError;
 }
+
+[DBus (name = "org.freedesktop.Tracker1.Miner.Files.Index")]
+public interface Rygel.Tracker.MinerFilesIndexIface: DBusProxy {
+    public abstract async void index_file (string uri) throws IOError;
+}



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