[gnome-music] playlists: Handle grilo internally



commit 6c321fca178d7d4fa4cdbc50469115e55678b4b2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Oct 4 10:22:38 2016 -0300

    playlists: Handle grilo internally
    
    There is no reason to delegate this to the view, and it also makes
    the code less understandable.

 gnomemusic/playlists.py        |    6 ++++++
 gnomemusic/views/searchview.py |    4 ----
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/playlists.py b/gnomemusic/playlists.py
index 7fb6d25..77158e1 100644
--- a/gnomemusic/playlists.py
+++ b/gnomemusic/playlists.py
@@ -121,6 +121,12 @@ class Playlists(GObject.GObject):
         self.tracker = TrackerWrapper().tracker
         StaticPlaylists()
 
+        grilo.connect('ready', self._on_grilo_ready)
+
+    @log
+    def _on_grilo_ready(self, data=None):
+        self.fetch_or_create_static_playlists()
+
     @log
     def fetch_or_create_static_playlists(self):
         """For all static playlists: get ID, if exists; if not, create the playlist and get ID."""
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 4b31e1f..8a030b6 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -405,10 +405,6 @@ class SearchView(BaseView):
         return model.iter_parent(_iter) is not None or model.iter_has_child(_iter)
 
     @log
-    def _on_grilo_ready(self, data=None):
-        playlists.fetch_or_create_static_playlists()
-
-    @log
     def set_search_text(self, search_term, fields_filter):
         query_matcher = {
             'album': {


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