[gnome-music/wip/gbsneto/contained-playlists: 25/35] playlistview: Synchronize loading notification with Playlist:ready



commit b18022281af39cff634b6e1e0a2128c9106355ac
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Dec 1 11:40:41 2016 -0200

    playlistview: Synchronize loading notification with Playlist:ready
    
    This way, we have a real notification that's notifying a real state
    of loading, instead of a arbitrary timeout that doesn't really inform
    whether we're loading something.

 gnomemusic/views/playlistview.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 1d6677f..45015a4 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -120,11 +120,21 @@ class PlaylistView(BaseView):
 
         self.show_all()
 
+        # Sync the playlists' :ready property with the window notification
+        playlists.connect('notify::ready', self._playlist_ready_changed)
+
     @log
     def _on_changes_pending(self, data=None):
         pass
 
     @log
+    def _playlist_ready_changed(self, playlists, property):
+        if playlists.ready:
+            self.window.notification.show_all()
+        else:
+            self.window.notification.dismiss()
+
+    @log
     def _add_list_renderers(self):
         list_widget = self.view.get_generic_view()
         cols = list_widget.get_columns()
@@ -260,7 +270,6 @@ class PlaylistView(BaseView):
 
     @log
     def _add_playlist_to_model(self, playlist, index=None):
-        self.window.notification.set_timeout(0)
         if index is None:
             index = -1
         _iter = self.playlists_model.insert_with_valuesv(


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