[gnome-music/wip/mschraal/albumwidget-selection-fix: 4/4] albumwidget: Fix checkbox selection



commit 6d87fd193e032c18d0f76dd4d5898959ab6ce59c
Author: Marinus Schraal <mschraal gnome org>
Date:   Sat Sep 1 20:31:48 2018 +0200

    albumwidget: Fix checkbox selection
    
    When using the checkbox in selection mode, the checkbox widget's
    'activated' signal came before the bound 'selected' property being updated.
    Resulting in a discrepancy between the actual selection and the visible
    representation, which is based on the latter, but signalled by the first.
    
    Use the SongWidget 'selected' property notification instead to emit
    the 'selection-changed' signal.

 data/SongWidget.ui               | 2 +-
 gnomemusic/widgets/songwidget.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/data/SongWidget.ui b/data/SongWidget.ui
index b3ff7819..c8837536 100644
--- a/data/SongWidget.ui
+++ b/data/SongWidget.ui
@@ -5,6 +5,7 @@
   <template class="SongWidget" parent="GtkEventBox">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
+    <signal name="notify::selected" handler="_on_selection_changed"/>
     <child>
       <object class="GtkBox" id="box1">
         <property name="visible">True</property>
@@ -40,7 +41,6 @@
                 <property name="receives_default">False</property>
                 <property name="no_show_all">True</property>
                 <property name="draw_indicator">True</property>
-                <signal name="toggled" handler="_on_selection_changed" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/gnomemusic/widgets/songwidget.py b/gnomemusic/widgets/songwidget.py
index 5e153c15..aa0dd4a8 100644
--- a/gnomemusic/widgets/songwidget.py
+++ b/gnomemusic/widgets/songwidget.py
@@ -128,7 +128,7 @@ class SongWidget(Gtk.EventBox):
 
     @Gtk.Template.Callback()
     @log
-    def _on_selection_changed(self, klass):
+    def _on_selection_changed(self, klass, value):
         self.emit('selection-changed')
 
     @Gtk.Template.Callback()


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