[gnome-music/wip/jfelder/playlistview-songs-count: 10/10] playlistview: Hide songs_count label on loading



commit 91d8867bbf83204e0e39613850d9ca83c6d6215e
Author: Jean Felder <jfelder src gnome org>
Date:   Mon Aug 13 23:38:48 2018 +0200

    playlistview: Hide songs_count label on loading
    
    With the new playlistcontrols logic, the _songs_count_label is visible
    when a playlist is populated. This effect can be disturbing: it
    behaves like a counter.
    Hide the count label when a playlist is being loaded and show it once
    the operation is finished.

 gnomemusic/views/playlistview.py       | 2 ++
 gnomemusic/widgets/playlistcontrols.py | 4 ++++
 2 files changed, 6 insertions(+)
---
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index ebac7620..295e0e13 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -534,6 +534,7 @@ class PlaylistView(BaseView):
         self._iter_to_clean = None
         self._iter_to_clean_model = None
         self._update_songs_count(0)
+        self._pl_ctrls.props.display_songs_count = False
         grilo.populate_playlist_songs(playlist, self._add_song)
 
         if self._current_playlist_is_protected():
@@ -562,6 +563,7 @@ class PlaylistView(BaseView):
         self._add_song_to_model(song, self.model)
         if remaining == 0:
             self._view.set_model(self.model)
+            self._pl_ctrls.props.display_songs_count = True
 
     @log
     def _add_song_to_model(self, song, model, index=-1):
diff --git a/gnomemusic/widgets/playlistcontrols.py b/gnomemusic/widgets/playlistcontrols.py
index d83b8a53..098257b0 100644
--- a/gnomemusic/widgets/playlistcontrols.py
+++ b/gnomemusic/widgets/playlistcontrols.py
@@ -51,6 +51,8 @@ class PlaylistControls(Gtk.Grid):
         type=int, default=0, minimum=0, flags=GObject.ParamFlags.READWRITE)
     playlist_name = GObject.Property(
         type=str, default="", flags=GObject.ParamFlags.READWRITE)
+    display_songs_count = GObject.Property(
+        type=bool, default=False, flags=GObject.ParamFlags.READWRITE)
 
     def __repr__(self):
         return '<PlaylistControls>'
@@ -58,6 +60,8 @@ class PlaylistControls(Gtk.Grid):
     def __init__(self):
         super().__init__()
         self.bind_property("playlist-name", self._name_label, "label")
+        self.bind_property(
+            "display-songs-count", self._songs_count_label, "visible")
 
         self.connect("notify::songs-count", self._on_songs_count_changed)
 


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