[gnome-music/wip/mschraal/core: 158/164] searchview: Fix select all/none for albums



commit f46af85b6e3f55f82da40e239e3f1291770a34bd
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Jul 1 11:08:06 2019 +0200

    searchview: Fix select all/none for albums

 gnomemusic/views/searchview.py | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 74b30fec..4d4e5957 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -196,21 +196,27 @@ class SearchView(BaseView):
 
         return True
 
-    def select_all(self):
+    def _child_select(self, child, value):
+        widget = child.get_child()
+        widget.props.selected = value
+
+    def _select_all(self, value):
         with self._model.freeze_notify():
-            def child_select_all(child):
+            def song_select(child):
                 song_widget = child.get_child()
-                song_widget.props.selected = True
+                song_widget.props.selected = value
 
-            self._songs_listbox.foreach(child_select_all)
+            def album_select(child):
+                child.props.selected = value
 
-    def unselect_all(self):
-        with self._model.freeze_notify():
-            def child_select_none(child):
-                song_widget = child.get_child()
-                song_widget.props.selected = False
+            self._songs_listbox.foreach(song_select)
+            self._album_flowbox.foreach(album_select)
+
+    def select_all(self):
+        self._select_all(True)
 
-            self._songs_listbox.foreach(child_select_none)
+    def unselect_all(self):
+        self._select_all(False)
 
     @log
     def _back_button_clicked(self, widget, data=None):


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