[gnome-music/wip/jfelder/3-36-selection-fixes: 3/5] albumsview: Fix selection of multiple albums
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/3-36-selection-fixes: 3/5] albumsview: Fix selection of multiple albums
- Date: Sat, 5 Sep 2020 21:33:50 +0000 (UTC)
commit 37cd9debb2ee534f8702dd01ccc2faff0f092a88
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 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]