[gnome-music/wip/jfelder/selection-misc-cleanups: 13/20] disclistbox: Do not change a DiscBox selection-mode from DiscListBox



commit 488cf114fbc1a10a76ed5dceadefdce55a4c23f0
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Jan 9 17:32:36 2020 +0100

    disclistbox: Do not change a DiscBox selection-mode from DiscListBox
    
    Instead a DiscListBox consumer should create a binding between
    DiscListBox and DiscBox.

 gnomemusic/widgets/artistalbumwidget.py | 5 +++++
 gnomemusic/widgets/disclistboxwidget.py | 6 ------
 2 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index 264554ed..fcf89641 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -94,6 +94,11 @@ class ArtistAlbumWidget(Gtk.Box):
     def _create_widget(self, disc):
         disc_box = self._create_disc_box(disc.props.disc_nr, disc.model)
 
+        self._disc_list_box.bind_property(
+            "selection-mode", disc_box, "selection-mode",
+            GObject.BindingFlags.BIDIRECTIONAL
+            | GObject.BindingFlags.SYNC_CREATE)
+
         return disc_box
 
     def _create_disc_box(self, disc_nr, album_model):
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index 1ae1411c..fc7acea1 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -205,9 +205,3 @@ class DiscListBox(Gtk.ListBox):
             return
 
         self._selection_mode = value
-
-        def set_selection_mode(child):
-            print("set selection mode on", child)
-            child.props.selection_mode = value
-
-        self.foreach(set_selection_mode)


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