[gnome-music/wip/mschraal/playlistcontrols-size] playlistcontrols: Avoid reflow on song count update



commit 36e476d8246f63dca7876a7c09960bc85004032f
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Jul 1 15:12:14 2019 +0200

    playlistcontrols: Avoid reflow on song count update
    
    To stop the song count from being iteratively updated the label was
    hidden. This in turn caused the gear button to do a small relocation.
    
    Instead of hiding, freeze the song count notifcation for the duration
    of the update. Also remove a property that was used in the former
    solution.

 gnomemusic/views/playlistsview.py      | 4 ++--
 gnomemusic/widgets/playlistcontrols.py | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/views/playlistsview.py b/gnomemusic/views/playlistsview.py
index 3e8e150d..b259c66e 100644
--- a/gnomemusic/views/playlistsview.py
+++ b/gnomemusic/views/playlistsview.py
@@ -545,8 +545,8 @@ class PlaylistsView(BaseView):
         self.model.clear()
         self._iter_to_clean = None
         self._iter_to_clean_model = None
+        self._pl_ctrls.freeze_notify()
         self._update_songs_count(0)
-        self._pl_ctrls.props.display_songs_count = False
         grilo.populate_playlist_songs(playlist, self._add_song)
 
         protected_pl = playlists.is_smart_playlist(self._current_playlist)
@@ -570,7 +570,7 @@ class PlaylistsView(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
+            self._pl_ctrls.thaw_notify()
             if self._plays_songs_on_activation:
                 first_iter = self.model.get_iter_first()
                 self.player.set_playlist(
diff --git a/gnomemusic/widgets/playlistcontrols.py b/gnomemusic/widgets/playlistcontrols.py
index cb2cd953..a13a2ff4 100644
--- a/gnomemusic/widgets/playlistcontrols.py
+++ b/gnomemusic/widgets/playlistcontrols.py
@@ -51,8 +51,6 @@ 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>'
@@ -60,8 +58,6 @@ 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]