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