[gnome-music/wip/jfelder/albumsview-selection-fix] albumsview: Fix selection of multiple albums
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/albumsview-selection-fix] albumsview: Fix selection of multiple albums
- Date: Thu, 20 Aug 2020 20:40:43 +0000 (UTC)
commit 7d801f64a52a7e4b18a1a7d95e9eb57cc704b083
Author: Jean Felder <jfelder src gnome org>
Date: Wed Aug 19 18:00:14 2020 +0200
albumsview: Fix selection of multiple albums
Since the introduction of rubberband selection in AlbumsView (commit
9d0445640494031f43648868318b4f593cfc2194), the selection of multiple
albums via left click is broken. When updating the selected albums,
the rubberband selection is not correctly detected.
The issue is fixed by correctly detecting a rubberband selection: this
selection is active when the number of newly selected albums is
greater than 1.
Once the selection mode is active, the following behavior is expected:
* with rubberband selection, holding ctrl inverts the selection state
* with rubberband selection, not holding ctrl creates a new selection
* a left click inverts the selected state of an album
Closes: #406
gnomemusic/views/albumsview.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 1a1018cc..c2063a18 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -227,11 +227,14 @@ class AlbumsView(Gtk.Stack):
if self.props.selection_mode is False:
self.props.selection_mode = True
+ rubberband_selection = len(self._flowbox.get_selected_children()) > 1
with self._application.props.coreselection.freeze_notify():
- if self._ctrl_hold is False:
+ if (rubberband_selection
+ and not self._ctrl_hold):
self.deselect_all()
for child in self._flowbox.get_selected_children():
- if self._ctrl_hold is True:
+ if (self._ctrl_hold is True
+ or not rubberband_selection):
child.props.selected = not child.props.selected
else:
child.props.selected = True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]