[gnome-music/wip/jfelder/selection-misc-cleanups: 10/13] albumwidget: Do not bypass DiscListBox on selection-mode changes



commit ca88d8a8fba01a7d5e426e2a1d1e361be66be6d5
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Jan 9 16:51:17 2020 +0100

    albumwidget: Do not bypass DiscListBox on selection-mode changes
    
    There is a direct binding between the AlbumWidget and each DiscBox. It
    means that DiscListBox selection-mode never changes.
    
    Fix the issue by replacing this binding by two bindings:
    * one between the AlbumWidget and the DiscListBox
    * one between the DiscListBox and each DiscBox

 data/ui/AlbumWidget.ui            | 1 +
 gnomemusic/widgets/albumwidget.py | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/AlbumWidget.ui b/data/ui/AlbumWidget.ui
index 7f6b770d..d1688ca0 100644
--- a/data/ui/AlbumWidget.ui
+++ b/data/ui/AlbumWidget.ui
@@ -226,6 +226,7 @@
                     <property name="margin_bottom">64</property>
                     <property name="margin_end">32</property>
                     <property name="selection_mode">0</property>
+                    <property name="selection_mode_allowed">True</property>
                     <property name="visible">True</property>
                   </object>
                 </child>
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index c434a465..b322ca08 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -72,6 +72,11 @@ class AlbumWidget(Gtk.EventBox):
         self._parent_view = parent_view
         self._player = player
 
+        self.bind_property(
+            "selection-mode", self._listbox, "selection-mode",
+            GObject.BindingFlags.BIDIRECTIONAL
+            | GObject.BindingFlags.SYNC_CREATE)
+
     def update(self, corealbum):
         """Update the album widget.
 
@@ -113,7 +118,7 @@ class AlbumWidget(Gtk.EventBox):
         disc_box = self._create_disc_box(
             disc.props.disc_nr, disc.model)
 
-        self.bind_property(
+        self._listbox.bind_property(
             "selection-mode", disc_box, "selection-mode",
             GObject.BindingFlags.BIDIRECTIONAL
             | GObject.BindingFlags.SYNC_CREATE)


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