[gnome-music/wip/mschraal/gtk-event-controller: 75/79] window: Use event controller for back button
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/gtk-event-controller: 75/79] window: Use event controller for back button
- Date: Thu, 4 Oct 2018 15:05:40 +0000 (UTC)
commit 8199a4e455bfee222d2d7d19c1ab3b1c5a03ca18
Author: Marinus Schraal <mschraal gnome org>
Date: Tue Aug 28 20:48:27 2018 +0200
window: Use event controller for back button
gnomemusic/window.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 41fea737..68d1110c 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -217,6 +217,12 @@ class Window(Gtk.ApplicationWindow):
self._key_press_event_id = self.connect(
'key_press_event', self._on_key_press)
+ self._btn_ctrl = Gtk.GestureMultiPress().new(self)
+ self._btn_ctrl.props.propagation_phase = Gtk.PropagationPhase.CAPTURE
+ # Mouse button 8 is the back button.
+ self._btn_ctrl.props.button = 8
+ self._btn_ctrl.connect("pressed", self._on_back_button_pressed)
+
# FIXME: In case Grilo is already initialized before the views
# get created, they never receive a 'ready' signal to trigger
# population. To fix this another check was added to baseview
@@ -384,15 +390,8 @@ class Window(Gtk.ApplicationWindow):
self._searchbar.reveal(True)
@log
- def do_button_release_event(self, event):
- """Override default button release event
-
- :param Gdk.EventButton event: Button event
- """
- __, code = event.get_button()
- # Mouse button 8 is the navigation button
- if code == 8:
- self._switch_back_from_childview()
+ def _on_back_button_pressed(self, gesture, n_press, x, y, data=None):
+ self.headerbar._on_back_button_clicked()
@log
def _notify_mode_disconnect(self, data=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]