[gnome-music/wip/mschraal/core] window: Implement a bare-bones Tracker check



commit f67398e1427af6a975dd85e950243d1436cec7a7
Author: Marinus Schraal <mschraal gnome org>
Date:   Sun Jul 14 22:07:50 2019 +0200

    window: Implement a bare-bones Tracker check

 gnomemusic/coregrilo.py | 2 ++
 gnomemusic/window.py    | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
index 62684156..8c94f12f 100644
--- a/gnomemusic/coregrilo.py
+++ b/gnomemusic/coregrilo.py
@@ -21,6 +21,7 @@ class CoreGrilo(GObject.GObject):
     _theaudiodb_api_key = "195003"
 
     cover_sources = GObject.Property(type=bool, default=False)
+    tracker_available = GObject.Property(type=bool, default=False)
 
     def __repr__(self):
         return "<CoreGrilo>"
@@ -80,6 +81,7 @@ class CoreGrilo(GObject.GObject):
             new_wrapper = GrlTrackerWrapper(
                 source, self._coremodel, self._coreselection, self)
             self._wrappers[source.props.source_id] = new_wrapper
+            self.props.tracker_available = True
         # elif source.props.source_id[:10] == "grl-dleyna":
         #     new_wrapper = GrlDLeynaWrapper(
         #         source, self._coremodel, self._coreselection, self)
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 3aa4a39d..81eb97d4 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -181,9 +181,12 @@ class Window(Gtk.ApplicationWindow):
     def _switch_to_empty_view(self):
         did_initial_state = self._settings.get_boolean('did-initial-state')
 
-        # if not grilo.props.tracker_available:
-        #     self.views[View.EMPTY].props.state = EmptyView.State.NO_TRACKER
-        if did_initial_state:
+        # FIXME: Tracker just checks for TrackerWrapper right now.
+        # It should also check for the viability of certain queries to
+        # make sure we have a recent version available.
+        if not self._app.props.coremodel._grilo.props.tracker_available:
+            self.views[View.EMPTY].props.state = EmptyView.State.NO_TRACKER
+        elif did_initial_state:
             self.views[View.EMPTY].props.state = EmptyView.State.EMPTY
         else:
             # FIXME: On switch back this view does not show properly.


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