[gnome-music/wip/jfelder/searchview-selection-fixes: 2/3] searchview: Correctly select a song
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/searchview-selection-fixes: 2/3] searchview: Correctly select a song
- Date: Sat, 22 Aug 2020 10:51:01 +0000 (UTC)
commit e8c6f60b4f21d3a8bc59d972d7e61df090893390
Author: Jean Felder <jfelder src gnome org>
Date: Fri Aug 21 13:32:41 2020 +0200
searchview: Correctly select a song
This allows to select a song by clicking on its widget.
Closes: #407
gnomemusic/views/searchview.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 3c5cc122..e901772c 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -237,12 +237,22 @@ class SearchView(Gtk.Stack):
self.props.search_state = Search.State.NO_RESULT
def _song_activated(self, widget, event):
+ if widget.props.select_click:
+ widget.props.select_click = False
+ return
+
mod_mask = Gtk.accelerator_get_default_mod_mask()
if ((event.get_state() & mod_mask) == Gdk.ModifierType.CONTROL_MASK
and not self.props.selection_mode):
self.props.selection_mode = True
return
+ if self.props.selection_mode:
+ widget.props.select_click = True
+ widget.props.selected = not widget.props.selected
+ widget.props.coresong.props.selected = widget.props.selected
+ return
+
(_, button) = event.get_button()
if (button == Gdk.BUTTON_PRIMARY
and not self.props.selection_mode):
@@ -251,10 +261,6 @@ class SearchView(Gtk.Stack):
self._coremodel.props.active_core_object = widget.props.coresong
self._player.play(widget.props.coresong)
- # FIXME: Need to ignore the event from the checkbox.
- # if self.props.selection_mode:
- # widget.props.selected = not widget.props.selected
-
return True
def _on_album_flowbox_size_allocate(self, widget, allocation, data=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]