[gnome-games] application: Warn users of the absence of Tracker



commit b3a02a7ba7ae1248e3e96d70d612efff8bdae71a
Author: Neville <nevilleantony98 gmail com>
Date:   Thu Feb 27 00:54:40 2020 +0530

    application: Warn users of the absence of Tracker
    
    Fixes #29

 src/ui/application.vala | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 0d8c002e..38d1459d 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -2,6 +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' }";
 
        private static bool? is_flatpak;
 
@@ -17,6 +18,8 @@ public class Games.Application : Gtk.Application {
 
        private Manette.Monitor manette_monitor;
 
+       private bool tracker_failed;
+
        private const ActionEntry[] action_entries = {
                { "preferences",    preferences      },
                { "help",           help             },
@@ -291,6 +294,11 @@ public class Games.Application : Gtk.Application {
                });
                window.show ();
 
+               if (tracker_failed) {
+                       string error_msg = _("Couldn't find Tracker, automatic game discovery may not work.");
+                       window.show_error (error_msg);
+               }
+
                GLib.Timeout.add (500, show_loading_notification);
        }
 
@@ -308,10 +316,12 @@ public class Games.Application : Gtk.Application {
                TrackerUriSource tracker_uri_source = null;
                try {
                        var connection = Tracker.Sparql.Connection.@get ();
+                       connection.query (TEST_QUERY);
                        tracker_uri_source = new TrackerUriSource (connection);
                }
                catch (Error e) {
-                       debug (e.message);
+                       tracker_failed = true;
+                       critical ("Couldn't find Tracker: %s", e.message);
                }
 
                game_collection = new GameCollection (database);
@@ -536,3 +546,4 @@ public class Games.Application : Gtk.Application {
                return GLib.Application.get_default () as Application;
        }
 }
+


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