summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Felder <jfelder@src.gnome.org>2020-08-19 18:00:14 +0200
committerJean Felder <jfelder@src.gnome.org>2020-09-05 23:26:19 +0200
commit37cd9debb2ee534f8702dd01ccc2faff0f092a88 (patch)
tree771866df4d919398a4edd395d720a56c1e4eb712
parent2b11865d2aefa94905765eaf15e5d2df435b9417 (diff)
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
-rw-r--r--gnomemusic/views/albumsview.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 81eb14f3..6d7cef34 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