[gnome-games/wip/exalm/gtk4: 204/238] ui: Stop using 'button-press-event' signal
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/gtk4: 204/238] ui: Stop using 'button-press-event' signal
- Date: Mon, 19 Aug 2019 20:33:35 +0000 (UTC)
commit 77ccf2ac343fcb8ca4ac78d23b03d3971ff23c4a
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sat Jul 28 20:04:38 2018 +0500
ui: Stop using 'button-press-event' signal
Replace it with GtkGestureMultiPress and its 'pressed' signal.
data/ui/application-window.ui | 8 +++++++-
src/ui/application-window.vala | 5 +++--
src/ui/collection-view.vala | 4 ----
src/ui/display-view.vala | 10 ----------
src/ui/ui-view.vala | 2 --
5 files changed, 10 insertions(+), 19 deletions(-)
---
diff --git a/data/ui/application-window.ui b/data/ui/application-window.ui
index 802b67a0..6aa394b7 100644
--- a/data/ui/application-window.ui
+++ b/data/ui/application-window.ui
@@ -7,9 +7,15 @@
<property name="show-menubar">False</property>
<signal name="delete-event" after="yes" handler="on_delete_event"/>
<signal name="key-press-event" after="yes" handler="on_key_pressed"/>
- <signal name="button-press-event" after="yes" handler="on_button_pressed"/>
<signal name="window-state-event" after="yes" handler="on_window_state_event"/>
<signal name="notify::is-active" after="yes" handler="on_active_changed"/>
+ <child>
+ <object class="GtkGestureClick">
+ <!-- Mouse button 8 is the navigation previous button -->
+ <property name="button">8</property>
+ <signal name="pressed" handler="on_back_mouse_button_pressed"/>
+ </object>
+ </child>
<child>
<object class="GtkStack" id="content_box">
<property name="visible">True</property>
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index ce120003..a10f8cd4 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -180,8 +180,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
}
[GtkCallback]
- public bool on_button_pressed (Gdk.EventButton event) {
- return current_view.on_button_pressed (event);
+ public void on_back_mouse_button_pressed () {
+ if (current_view == display_view)
+ display_view.back ();
}
[GtkCallback]
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index e383d41e..159e3fec 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -102,10 +102,6 @@ private class Games.CollectionView : Object, UiView {
box.show_error (error_message);
}
- public bool on_button_pressed (Gdk.EventButton event) {
- return false;
- }
-
public bool on_key_pressed (Gdk.EventKey event) {
var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index 399d1098..0639957d 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -81,16 +81,6 @@ private class Games.DisplayView : Object, UiView {
focus_out_timeout_id = -1;
}
- public bool on_button_pressed (Gdk.EventButton event) {
- // Mouse button 8 is the navigation previous button
- if (event.button == 8) {
- back ();
- return true;
- }
-
- return false;
- }
-
public bool on_key_pressed (Gdk.EventKey event) {
var default_modifiers = Gtk.accelerator_get_default_mod_mask ();
diff --git a/src/ui/ui-view.vala b/src/ui/ui-view.vala
index f5e19ab0..7feb66c4 100644
--- a/src/ui/ui-view.vala
+++ b/src/ui/ui-view.vala
@@ -7,8 +7,6 @@ private interface Games.UiView : Object {
public abstract bool is_view_active { get; set; }
- public abstract bool on_button_pressed (Gdk.EventButton event);
-
public abstract bool on_key_pressed (Gdk.EventKey event);
public abstract bool gamepad_button_press_event (Manette.Event event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]