[devhelp] shortcuts: add 'Open the menu' (F10) to the shortcuts window
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] shortcuts: add 'Open the menu' (F10) to the shortcuts window
- Date: Mon, 11 Jan 2021 08:25:57 +0000 (UTC)
commit aaccec438dd3dc13f364d78f76ff2ab0d7b9487a
Author: Sébastien Wilmet <sw swilmet be>
Date: Mon Jan 11 09:04:58 2021 +0100
shortcuts: add 'Open the menu' (F10) to the shortcuts window
Thanks to Sabri Ünal for an initial patch.
src/dh-app.c | 26 ++++++++++++++++++++++++++
src/dh-window.c | 1 +
2 files changed, 27 insertions(+)
---
diff --git a/src/dh-app.c b/src/dh-app.c
index e7a090da..a2ce0466 100644
--- a/src/dh-app.c
+++ b/src/dh-app.c
@@ -23,6 +23,9 @@ struct _DhAppPrivate {
G_DEFINE_TYPE_WITH_PRIVATE (DhApp, dh_app, GTK_TYPE_APPLICATION);
+/* This function adds the AmtkActionInfo's for the GActions that are present in
+ * a menu.
+ */
static void
add_menu_action_infos (DhApp *app)
{
@@ -94,6 +97,9 @@ add_menu_action_infos (DhApp *app)
GTK_APPLICATION (app));
}
+/* This function adds the AmtkActionInfo's for other GActions (GActions that are
+ * not present in a menu).
+ */
static void
add_other_action_infos (DhApp *app)
{
@@ -134,11 +140,31 @@ add_other_action_infos (DhApp *app)
g_object_unref (store);
}
+/* This function adds the AmtkActionInfo's for things that have no related
+ * GActions.
+ */
+static void
+add_no_gaction_action_infos (void)
+{
+ AmtkActionInfoStore *store;
+
+ const AmtkActionInfoEntry entries[] = {
+ /* action, icon, label, accel, tooltip */
+ { "no-gaction-open-menu", NULL, NULL, "F10", N_("Open the menu") },
+ { NULL }
+ };
+
+ store = amtk_action_info_store_new ();
+ amtk_action_info_store_add_entries (store, entries, -1, GETTEXT_PACKAGE);
+ g_object_unref (store);
+}
+
static void
add_action_infos (DhApp *app)
{
add_menu_action_infos (app);
add_other_action_infos (app);
+ add_no_gaction_action_infos ();
}
static DhAssistant *
diff --git a/src/dh-window.c b/src/dh-window.c
index 7e81e922..f985bebe 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -405,6 +405,7 @@ shortcuts_window_cb (GSimpleAction *action,
group = amtk_shortcuts_group_new (_("General"));
gtk_container_add (group, amtk_factory_create_shortcut (factory, "app.help"));
+ gtk_container_add (group, amtk_factory_create_shortcut (factory, "no-gaction-open-menu"));
gtk_container_add (group, amtk_factory_create_shortcut (factory, "win.shortcuts-window"));
gtk_container_add (section, GTK_WIDGET (group));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]