[gnome-documents] application: Prioritize relevant rdf:types



commit 230f5cfff710edb223d364167d73e57c835470a9
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Mar 20 22:08:46 2014 +0100

    application: Prioritize relevant rdf:types
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726796

 src/application.js |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index e92fcd8..083a6e5 100644
--- a/src/application.js
+++ b/src/application.js
@@ -87,6 +87,22 @@ let selectionController = null;
 let sourceManager = null;
 let trackerController = null;
 
+const TrackerExtractPriorityIface = '<node> \
+<interface name="org.freedesktop.Tracker1.Extract.Priority"> \
+    <method name="ClearRdfTypes" /> \
+    <method name="SetRdfTypes"> \
+        <arg name="rdf_types" type="as" /> \
+    </method> \
+</interface> \
+</node>';
+
+var TrackerExtractPriorityProxy = Gio.DBusProxy.makeProxyWrapper(TrackerExtractPriorityIface);
+function TrackerExtractPriority() {
+    return new TrackerExtractPriorityProxy(Gio.DBus.session,
+                                           'org.freedesktop.Tracker1.Miner.Extract',
+                                           '/org/freedesktop/Tracker1/Extract/Priority');
+}
+
 const MINER_REFRESH_TIMEOUT = 60; /* seconds */
 
 const Application = new Lang.Class({
@@ -96,6 +112,7 @@ const Application = new Lang.Class({
     _init: function() {
         this.minersRunning = [];
         this._activationTimestamp = Gdk.CURRENT_TIME;
+        this._extractPriority = null;
 
         Gettext.bindtextdomain('gnome-documents', Path.LOCALE_DIR);
         Gettext.textdomain('gnome-documents');
@@ -385,6 +402,14 @@ const Application = new Lang.Class({
         }
 
         try {
+            this._extractPriority = TrackerExtractPriority();
+            this._extractPriority.SetRdfTypesRemote(['nfo:Document']);
+        } catch (e) {
+            log('Unable to connect to the tracker extractor: ' + e.toString());
+            return;
+        }
+
+        try {
             goaClient = Goa.Client.new_sync(null);
         } catch (e) {
             log('Unable to create the GOA client: ' + e.toString());
@@ -487,6 +512,11 @@ const Application = new Lang.Class({
         this._initGettingStarted();
     },
 
+    vfunc_shutdown: function() {
+        this._extractPriority.ClearRdfTypesRemote();
+        this.parent();
+    },
+
     _createWindow: function() {
         if (this._mainWindow)
             return;


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