[gnome-music/wip/jfelder/artistview-fixes: 9/9] artistalbumswidget: Simplify _on_model_items_changed



commit 64e8f98c730931a83812533144e563beb7216884
Author: Jean Felder <jfelder src gnome org>
Date:   Tue Sep 10 16:03:46 2019 +0200

    artistalbumswidget: Simplify _on_model_items_changed

 gnomemusic/widgets/artistalbumwidget.py | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index ea3df015..9d90fb2c 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -108,17 +108,11 @@ class ArtistAlbumWidget(Gtk.Box):
 
     def _on_model_items_changed(self, model, position, removed, added):
         n_items = model.get_n_items()
-        if n_items == 1:
-            row = self._disc_list_box.get_row_at_index(0)
+        for i in range(n_items):
+            row = self._disc_list_box.get_row_at_index(i)
             row.props.selectable = False
             discbox = row.get_child()
-            discbox.props.show_disc_label = False
-        else:
-            for i in range(n_items):
-                row = self._disc_list_box.get_row_at_index(i)
-                row.props.selectable = False
-                discbox = row.get_child()
-                discbox.props.show_disc_label = True
+            discbox.props.show_disc_label = (n_items > 1)
 
     def _song_activated(self, widget, song_widget):
         if self.props.selection_mode:


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