Blame SOURCES/0001-gl-application.c-add-four-shortcuts.patch

9a84e9
From 8b7f222e75d006cc3573c9b545c26d6fac56b5ce Mon Sep 17 00:00:00 2001
9a84e9
From: =?UTF-8?q?Sabri=20=C3=9Cnal?= <libreajans@gmail.com>
9a84e9
Date: Fri, 3 Apr 2020 15:09:26 +0300
9a84e9
Subject: [PATCH 1/2] gl-application.c: add four shortcuts
9a84e9
9a84e9
F1: Help
9a84e9
Ctrl+E: Export
9a84e9
Ctrl+N: New window
9a84e9
Ctrl+question: Keyboard shortcuts
9a84e9
---
9a84e9
 src/gl-application.c | 13 +++++++++++++
9a84e9
 1 file changed, 13 insertions(+)
9a84e9
9a84e9
diff --git a/src/gl-application.c b/src/gl-application.c
9a84e9
index c20052c..b2ef1f7 100644
9a84e9
--- a/src/gl-application.c
9a84e9
+++ b/src/gl-application.c
9a84e9
@@ -178,67 +178,80 @@ on_monospace_font_name_changed (GSettings *settings,
9a84e9
     }
9a84e9
 }
9a84e9
 
9a84e9
 static GActionEntry actions[] = {
9a84e9
     { "new-window", on_new_window },
9a84e9
     { "help", on_help },
9a84e9
     { "about", on_about }
9a84e9
 };
9a84e9
 
9a84e9
 static void
9a84e9
 gl_application_startup (GApplication *application)
9a84e9
 {
9a84e9
     g_action_map_add_action_entries (G_ACTION_MAP (application), actions,
9a84e9
                                      G_N_ELEMENTS (actions), application);
9a84e9
 
9a84e9
     /* Calls gtk_init() with no arguments. */
9a84e9
     G_APPLICATION_CLASS (gl_application_parent_class)->startup (application);
9a84e9
 
9a84e9
     /* gtk_init() calls setlocale(), so gettext must be called after that. */
9a84e9
     g_set_application_name (_(PACKAGE_NAME));
9a84e9
     gtk_window_set_default_icon_name (PACKAGE_TARNAME);
9a84e9
 }
9a84e9
 
9a84e9
 static void
9a84e9
 gl_application_activate (GApplication *application)
9a84e9
 {
9a84e9
     GtkWidget *window;
9a84e9
     GlApplicationPrivate *priv;
9a84e9
     const gchar * const close_accel[] = { "<Primary>w", NULL };
9a84e9
     const gchar * const search_accel[] = { "<Primary>f", NULL };
9a84e9
+    const gchar * const export_accel[] = { "<Primary>e", NULL };
9a84e9
+    const gchar * const help_accel[] = { "F1", NULL };
9a84e9
+    const gchar * const new_window_accel[] = { "<Primary>n", NULL };
9a84e9
+    const gchar * const help_overlay_accel[] = { "<Primary>question", NULL };
9a84e9
 
9a84e9
     window = gl_window_new (GTK_APPLICATION (application));
9a84e9
     gtk_widget_show (window);
9a84e9
     gtk_application_set_accels_for_action (GTK_APPLICATION (application),
9a84e9
                                            "win.close", close_accel);
9a84e9
     gtk_application_set_accels_for_action (GTK_APPLICATION (application),
9a84e9
                                            "win.search", search_accel);
9a84e9
+    gtk_application_set_accels_for_action (GTK_APPLICATION (application),
9a84e9
+                                           "win.export", export_accel);
9a84e9
+    gtk_application_set_accels_for_action (GTK_APPLICATION (application),
9a84e9
+                                           "app.help", help_accel);
9a84e9
+    gtk_application_set_accels_for_action (GTK_APPLICATION (application),
9a84e9
+                                           "app.new-window", new_window_accel);
9a84e9
+    gtk_application_set_accels_for_action (GTK_APPLICATION (application),
9a84e9
+                                           "win.show-help-overlay",
9a84e9
+                                           help_overlay_accel);
9a84e9
 
9a84e9
     priv = gl_application_get_instance_private (GL_APPLICATION (application));
9a84e9
 
9a84e9
     on_monospace_font_name_changed (priv->desktop, DESKTOP_MONOSPACE_FONT_NAME,
9a84e9
                                     priv);
9a84e9
 }
9a84e9
 
9a84e9
 static const GOptionEntry options[] =
9a84e9
 {
9a84e9
     { "version", 'v', 0, G_OPTION_ARG_NONE, NULL,
9a84e9
       N_("Print version information and exit"), NULL },
9a84e9
     { NULL }
9a84e9
 };
9a84e9
 
9a84e9
 static gint
9a84e9
 gl_application_handle_local_options (GApplication *application,
9a84e9
                                      GVariantDict *options)
9a84e9
 {
9a84e9
     if (g_variant_dict_contains (options, "version"))
9a84e9
     {
9a84e9
         g_print ("%s - Version %s\n", g_get_application_name (), PACKAGE_VERSION);
9a84e9
         return 0;
9a84e9
     }
9a84e9
 
9a84e9
     return -1;
9a84e9
 }
9a84e9
 
9a84e9
 static void
9a84e9
 gl_application_finalize (GObject *object)
9a84e9
 {
9a84e9
-- 
9a84e9
2.35.1
9a84e9