[gnome-games/wip/jfelder/tracker3-port: 2/3] Port to tracker3




commit 531c072a4e2eac1faf54c70c681da2abfe16edcb
Author: Jean Felder <jean felder gmail com>
Date:   Sat May 30 18:48:06 2020 +0200

    Port to tracker3
    
    With tracker3, tracker-miner-fs dumps data in different graphs. Games
    only needs to access data stored in the tracker:Software graph.
    
    'tracker_sparql_connection_get' has been replaced by
    'tracker_sparql_connection_bus_new'.

 meson.build                                  | 2 +-
 plugins/desktop/src/desktop-plugin.vala      | 2 +-
 src/tracker/mime-type-tracker-uri-query.vala | 2 +-
 src/ui/application.vala                      | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8f0fbb80..9116dd0a 100644
--- a/meson.build
+++ b/meson.build
@@ -45,7 +45,7 @@ retro_gtk_dep = dependency ('retro-gtk-1', version: '>=' + retro_gtk_min_version
 rsvg_dep = dependency ('librsvg-2.0')
 soup_dep = dependency ('libsoup-2.4')
 sqlite_dep = dependency ('sqlite3')
-tracker_sparql_dep = dependency ('tracker-sparql-2.0')
+tracker_sparql_dep = dependency ('tracker-sparql-3.0')
 xml_dep = dependency ('libxml-2.0')
 
 srcdir = join_paths (meson.source_root (), 'src')
diff --git a/plugins/desktop/src/desktop-plugin.vala b/plugins/desktop/src/desktop-plugin.vala
index 93f824c8..1c9da904 100644
--- a/plugins/desktop/src/desktop-plugin.vala
+++ b/plugins/desktop/src/desktop-plugin.vala
@@ -19,7 +19,7 @@ private class Games.DesktopPlugin : Object, Plugin {
        public UriSource[] get_uri_sources () {
                var query = new DesktopTrackerUriQuery ();
                try {
-                       var connection = Tracker.Sparql.Connection.@get ();
+                       var connection = Tracker.Sparql.Connection.@bus_new 
("org.freedesktop.Tracker3.Miner.Files", null, null);
                        var uri_source = new TrackerUriSource (connection);
                        uri_source.add_query (query);
 
diff --git a/src/tracker/mime-type-tracker-uri-query.vala b/src/tracker/mime-type-tracker-uri-query.vala
index d536899a..bf7b889a 100644
--- a/src/tracker/mime-type-tracker-uri-query.vala
+++ b/src/tracker/mime-type-tracker-uri-query.vala
@@ -8,6 +8,6 @@ public class Games.MimeTypeTrackerUriQuery : Object, TrackerUriQuery {
        }
 
        public string get_query () {
-               return @"SELECT DISTINCT nie:url(?urn) WHERE { ?urn nie:mimeType \"$mime_type\" . }";
+               return @"SELECT DISTINCT nie:isStoredAs(?urn) { GRAPH tracker:Software { ?urn nie:mimeType 
\"$mime_type\" . } }";
        }
 }
diff --git a/src/ui/application.vala b/src/ui/application.vala
index d65b7ae1..80cf4f46 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -2,7 +2,7 @@
 
 public class Games.Application : Gtk.Application {
        const string HELP_URI = "https://wiki.gnome.org/Apps/Games/Documentation";;
-       const string TEST_QUERY = "SELECT nie:url(?f) WHERE { ?f fts:match 'test query to check tracker' }";
+       const string TEST_QUERY = "SELECT nie:isStoredAs(?f) WHERE { GRAPH tracker:Software { ?f fts:match 
'test query to check tracker' } }";
 
        private static bool? is_flatpak;
 
@@ -345,7 +345,7 @@ public class Games.Application : Gtk.Application {
 
                TrackerUriSource tracker_uri_source = null;
                try {
-                       var connection = Tracker.Sparql.Connection.@get ();
+                       var connection = Tracker.Sparql.Connection.@bus_new 
("org.freedesktop.Tracker3.Miner.Files", null, null);
                        connection.query (TEST_QUERY);
                        tracker_uri_source = new TrackerUriSource (connection);
                }


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