[gnome-logs/wip/latest-mockup] Add accelerator for closing a window
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-logs/wip/latest-mockup] Add accelerator for closing a window
- Date: Tue, 8 Oct 2013 15:03:47 +0000 (UTC)
commit cc5b6e50b56bfb8c5011f0aee8a3603b8b4f14fc
Author: David King <davidk gnome org>
Date: Tue Oct 8 15:39:23 2013 +0100
Add accelerator for closing a window
src/gl-application.c | 2 ++
src/gl-window.c | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/gl-application.c b/src/gl-application.c
index f6bbed5..99544cf 100644
--- a/src/gl-application.c
+++ b/src/gl-application.c
@@ -127,6 +127,8 @@ gl_application_activate (GApplication *application)
window = gl_window_new (GTK_APPLICATION (application));
gtk_widget_show (window);
gtk_application_add_accelerator (GTK_APPLICATION (application),
+ "<Primary>w", "win.close", NULL);
+ gtk_application_add_accelerator (GTK_APPLICATION (application),
"<Primary>f", "win.search", NULL);
}
diff --git a/src/gl-window.c b/src/gl-window.c
index b94b4d9..b0a773e 100644
--- a/src/gl-window.c
+++ b/src/gl-window.c
@@ -82,6 +82,18 @@ on_category (GSimpleAction *action,
}
static void
+on_close (GSimpleAction *action,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GtkWindow *window;
+
+ window = GTK_WINDOW (user_data);
+
+ gtk_window_close (window);
+}
+
+static void
on_toolbar_mode (GSimpleAction *action,
GVariant *variant,
gpointer user_data)
@@ -243,7 +255,8 @@ static GActionEntry actions[] = {
{ "category", on_action_radio, "s", "'important'", on_category },
{ "view-mode", on_action_radio, "s", "'list'", on_view_mode },
{ "toolbar-mode", on_action_radio, "s", "'list'", on_toolbar_mode },
- { "search", on_action_toggle, NULL, "false", on_search }
+ { "search", on_action_toggle, NULL, "false", on_search },
+ { "close", on_close }
};
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]