[gnome-clocks] handle mouse "back" button
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] handle mouse "back" button
- Date: Sun, 9 Oct 2016 09:08:20 +0000 (UTC)
commit 09988198a8a95ebe7c9a8ebd4d9aed1c7af976d6
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Oct 9 11:05:13 2016 +0200
handle mouse "back" button
https://bugzilla.gnome.org/show_bug.cgi?id=771936
src/clock.vala | 3 +++
src/window.vala | 12 ++++++++++++
src/world.vala | 6 ++++++
3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/clock.vala b/src/clock.vala
index 73335ca..bcede58 100644
--- a/src/clock.vala
+++ b/src/clock.vala
@@ -45,6 +45,9 @@ public interface Clock : GLib.Object {
return false;
}
+ public virtual void back () {
+ }
+
public virtual void update_header_bar () {
}
}
diff --git a/src/window.vala b/src/window.vala
index 308b35b..2dabc9a 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -186,6 +186,18 @@ public class Window : Gtk.ApplicationWindow {
return base.key_press_event (event);
}
+ public override bool button_release_event (Gdk.EventButton event) {
+ const uint BUTTON_BACK = 8;
+ uint button;
+
+ if (((Gdk.Event)(event)).get_button (out button) && button == BUTTON_BACK) {
+ ((Clock) stack.visible_child).back ();
+ return true;
+ }
+
+ return base.button_release_event (event);
+ }
+
protected override bool configure_event (Gdk.EventConfigure event) {
if (get_realized () && !(Gdk.WindowState.MAXIMIZED in get_window ().get_state ())) {
int width, height;
diff --git a/src/world.vala b/src/world.vala
index 3d4d057..386a114 100644
--- a/src/world.vala
+++ b/src/world.vala
@@ -438,6 +438,12 @@ public class Face : Gtk.Stack, Clocks.Clock {
return content_view.escape_pressed ();
}
+ public void back () {
+ if (visible_child == standalone) {
+ reset_view ();
+ }
+ }
+
public void reset_view () {
standalone_location = null;
visible_child = locations.get_n_items () == 0 ? empty_view : content_view;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]