[gnome-books/wip/carlosg/tracker3: 1/7] search: Don't inspect Tracker settings




commit eba8418270b40e10c0dad1d6dc9701a29c262933
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jan 17 16:21:26 2021 +0100

    search: Don't inspect Tracker settings
    
    In a sandboxed environment it's no possible (or shouldn't be!) to
    inspect tracker settings. This is just used to include results from
    custom folders in addition to Documents/Downloads/Desktop folders,
    however these are not accessible within the sandbox anymore.
    
    Drop this code, and stick to the given XDG folders, if support for
    custom folders is desirable, should go through the
    org.freedesktop.Tracker3.Miner.Files.Index interface.

 src/search.js | 34 ----------------------------------
 1 file changed, 34 deletions(-)
---
diff --git a/src/search.js b/src/search.js
index b8e9b593..1a25f3ed 100644
--- a/src/search.js
+++ b/src/search.js
@@ -286,9 +286,6 @@ var SearchSourceStock = {
     LOCAL: 'local'
 };
 
-const TRACKER_SCHEMA = 'org.freedesktop.Tracker.Miner.Files';
-const TRACKER_KEY_RECURSIVE_DIRECTORIES = 'index-recursive-directories';
-
 const Source = new Lang.Class({
     Name: 'Source',
 
@@ -303,36 +300,6 @@ const Source = new Lang.Class({
         this.builtin = params.builtin;
     },
 
-    _getTrackerLocations: function() {
-        let settings = new Gio.Settings({ schema_id: TRACKER_SCHEMA });
-        let locations = settings.get_strv(TRACKER_KEY_RECURSIVE_DIRECTORIES);
-        let files = [];
-
-        locations.forEach(Lang.bind(this,
-            function(location) {
-                // ignore special XDG placeholders, since we handle those internally
-                if (location[0] == '&' || location[0] == '$')
-                    return;
-
-                let trackerFile = Gio.file_new_for_commandline_arg(location);
-
-                // also ignore XDG locations if they are present with their full path
-                for (let idx = 0; idx < GLib.UserDirectory.N_DIRECTORIES; idx++) {
-                    let path = GLib.get_user_special_dir(idx);
-                    if (!path)
-                        continue;
-
-                    let file = Gio.file_new_for_path(path);
-                    if (trackerFile.equal(file))
-                        return;
-                }
-
-                files.push(trackerFile);
-            }));
-
-        return files;
-    },
-
     _getBuiltinLocations: function() {
         let files = [];
         let xdgDirs = [GLib.UserDirectory.DIRECTORY_DESKTOP,
@@ -351,7 +318,6 @@ const Source = new Lang.Class({
 
     _buildFilterLocal: function() {
         let locations = this._getBuiltinLocations();
-        locations = locations.concat(this._getTrackerLocations());
 
         let filters = [];
         locations.forEach(Lang.bind(this,


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