[gnome-builder] workbench: allow exiting from credits with enter/space/escape.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] workbench: allow exiting from credits with enter/space/escape.
- Date: Sun, 11 Jan 2015 03:39:35 +0000 (UTC)
commit 99387f9aac6d426f4210ba49cb445614390595fc
Author: Christian Hergert <christian hergert me>
Date: Sat Jan 10 19:38:50 2015 -0800
workbench: allow exiting from credits with enter/space/escape.
All the normal keys to escape from something like this. I guess we could
cancel on pretty much any key, but this seems good enough.
https://bugzilla.gnome.org/show_bug.cgi?id=742659
src/workbench/gb-workbench.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/workbench/gb-workbench.c b/src/workbench/gb-workbench.c
index 4ab27a3..de62e98 100644
--- a/src/workbench/gb-workbench.c
+++ b/src/workbench/gb-workbench.c
@@ -130,6 +130,35 @@ gb_workbench_get_navigation_list (GbWorkbench *workbench)
return workbench->priv->navigation_list;
}
+static gboolean
+gb_workbench_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ GbWorkbench *self = (GbWorkbench *)widget;
+
+ g_return_val_if_fail (GB_IS_WORKBENCH (self), FALSE);
+ g_return_val_if_fail (event, FALSE);
+
+ switch (event->keyval)
+ {
+ case GDK_KEY_KP_Enter:
+ case GDK_KEY_Return:
+ case GDK_KEY_Escape:
+ case GDK_KEY_space:
+ if (gb_credits_widget_is_rolling (self->priv->credits))
+ {
+ gb_credits_widget_stop (self->priv->credits);
+ return GDK_EVENT_STOP;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return GTK_WIDGET_CLASS (gb_workbench_parent_class)->key_press_event (widget, event);
+}
+
static void
load_repository_func (GTask *task,
gpointer source_object,
@@ -833,6 +862,7 @@ gb_workbench_class_init (GbWorkbenchClass *klass)
widget_class->realize = gb_workbench_realize;
widget_class->delete_event = gb_workbench_delete_event;
+ widget_class->key_press_event = gb_workbench_key_press_event;
window_class->set_focus = gb_workbench_set_focus;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]