[gnome-games/wip/exalm/desktop-in-flatpak: 60/64] tracker: Add prefix



commit 0ab17763b887572746d93371d27a8d47e0851291
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Aug 9 20:04:52 2018 +0500

    tracker: Add prefix

 src/tracker/tracker-uri-iterator.vala | 6 ++++--
 src/tracker/tracker-uri-source.vala   | 8 +++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker/tracker-uri-iterator.vala b/src/tracker/tracker-uri-iterator.vala
index f04130db..a8e0f241 100644
--- a/src/tracker/tracker-uri-iterator.vala
+++ b/src/tracker/tracker-uri-iterator.vala
@@ -3,13 +3,15 @@
 private class Games.TrackerUriIterator : Object, UriIterator {
        private Tracker.Sparql.Connection connection;
        private TrackerUriQuery[] queries;
+       private string prefix;
        private int query_index;
        private Uri? uri;
        private Tracker.Sparql.Cursor cursor;
 
-       internal TrackerUriIterator (Tracker.Sparql.Connection connection, TrackerUriQuery[] queries) {
+       internal TrackerUriIterator (Tracker.Sparql.Connection connection, TrackerUriQuery[] queries, string 
prefix) {
                this.connection = connection;
                this.queries = queries;
+               this.prefix = prefix;
                query_index = 0;
                uri = null;
                cursor = null;
@@ -54,7 +56,7 @@ private class Games.TrackerUriIterator : Object, UriIterator {
                if (!cursor.next ())
                        return false;
 
-               uri = new Uri (cursor.get_string (0));
+               uri = new Uri (prefix + cursor.get_string (0));
 
                return true;
        }
diff --git a/src/tracker/tracker-uri-source.vala b/src/tracker/tracker-uri-source.vala
index 3a6ec58d..7d5e47ea 100644
--- a/src/tracker/tracker-uri-source.vala
+++ b/src/tracker/tracker-uri-source.vala
@@ -3,13 +3,19 @@
 public class Games.TrackerUriSource : Object, UriSource {
        private Tracker.Sparql.Connection connection { get; private set; }
        private TrackerUriQuery[] queries;
+       private string prefix;
 
        public TrackerUriSource (Tracker.Sparql.Connection connection) {
                this.connection = connection;
        }
 
+       public void set_prefix (string prefix) {
+               this.prefix = prefix;
+       }
+
        construct {
                queries = {};
+               prefix = "";
        }
 
        public void add_query (TrackerUriQuery query) {
@@ -17,6 +23,6 @@ public class Games.TrackerUriSource : Object, UriSource {
        }
 
        public UriIterator iterator () {
-               return new TrackerUriIterator (connection, queries);
+               return new TrackerUriIterator (connection, queries, prefix);
        }
 }


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