[gnome-music/wip/jfelder/selection-misc-cleanups: 12/20] albumwidget: Deselect all when leaving selection-mode



commit 9ae9d84a10ad6d9d2bb67da3e75303ac306ed96b
Author: Jean Felder <jfelder src gnome org>
Date:   Fri Jan 10 14:26:07 2020 +0100

    albumwidget: Deselect all when leaving selection-mode

 gnomemusic/widgets/albumwidget.py | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 0a166d1f..eb2ce53a 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -71,6 +71,8 @@ class AlbumWidget(Gtk.EventBox):
         self._parent_view = parent_view
         self._player = player
 
+        self.connect("notify::selection-mode", self._on_selection_mode_changed)
+
     def update(self, corealbum):
         """Update the album widget.
 
@@ -185,6 +187,10 @@ class AlbumWidget(Gtk.EventBox):
     def select_none(self):
         self._listbox.select_none()
 
+    def _on_selection_mode_changed(self, widget, value):
+        if not self.props.selection_mode:
+            self.select_none()
+
     @GObject.Property(
         type=Grl.Media, default=None, flags=GObject.ParamFlags.READABLE)
     def album(self):


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