[gnome-music/wip/jfelder/notifications-startup: 2/2] views: Fix notifications_popup calls on startup



commit 7564321b528f148212242c007436203460354e8a
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Apr 5 14:18:10 2018 +0200

    views: Fix notifications_popup calls on startup
    
    4 views are populated on startup: Albums, Artists, Songs and
    Playlists. Each populate call goes with a push_loading call to display a
    loading notification popup and increment a counter. However,
    push_loading call from PlaylistView never happens because it is placed
    in _populate method instead of populate.
    A push_loading call happens in SearchView on startup. It shouldn't be
    the case as this view is not populated on startup.
    
    The following changes solve this isssue:
    Moving push_loading call from PlaylistView in the populate method.
    Moving push_loading call from SearchView in the set_search_text
    method.
    PlaylistView does not need a specific _populate method as this is now
    the same as BaseView.

 gnomemusic/views/playlistview.py | 7 +------
 gnomemusic/views/searchview.py   | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 94800ca7..287a8f17 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -256,12 +256,6 @@ class PlaylistView(BaseView):
         else:
             cell.set_visible(False)
 
-    @log
-    def _populate(self):
-        self._init = True
-        self._window.notifications_popup.push_loading()
-        self.populate()
-
     @log
     def _update_model(self, player, playlist, current_iter):
         if self._iter_to_clean:
@@ -821,4 +815,5 @@ class PlaylistView(BaseView):
         """Populate sidebar.
         Do not reload playlists already displayed.
         """
+        self._window.notifications_popup.push_loading()
         grilo.populate_playlists(self._offset, self._add_playlist_item)
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 68544241..41923ec1 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -346,7 +346,6 @@ class SearchView(BaseView):
     @log
     def populate(self):
         self._init = True
-        self._window.notifications_popup.push_loading()
         self._header_bar.set_state(ToolbarState.MAIN)
 
     @log
@@ -530,6 +529,7 @@ class SearchView(BaseView):
                 or grilo.search_source.get_id() == 'grl-tracker-source'):
             for category in ('album', 'artist', 'song'):
                 query = query_matcher[category][fields_filter](search_term)
+                self._window.notifications_popup.push_loading()
                 grilo.populate_custom_query(
                     query, self._add_item, -1, [self.model, category])
         if (not grilo.search_source


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