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



commit fcb9fd8322f2c4aa194d3cac150acae7748ee46f
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]