[gnome-builder] workbench: add F10 for window menu
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] workbench: add F10 for window menu
- Date: Fri, 12 Oct 2018 00:09:31 +0000 (UTC)
commit 2323af21b2a621b990035e6c9627729369872272
Author: Christian Hergert <chergert redhat com>
Date: Thu Oct 11 15:31:19 2018 -0700
workbench: add F10 for window menu
src/libide/workbench/ide-workbench-actions.c | 14 ++++++++++++++
src/libide/workbench/ide-workbench-header-bar.c | 10 ++++++++++
src/libide/workbench/ide-workbench-header-bar.h | 2 ++
src/libide/workbench/ide-workbench-shortcuts.c | 12 ++++++++++++
4 files changed, 38 insertions(+)
---
diff --git a/src/libide/workbench/ide-workbench-actions.c b/src/libide/workbench/ide-workbench-actions.c
index b5ba777af..3fb252a84 100644
--- a/src/libide/workbench/ide-workbench-actions.c
+++ b/src/libide/workbench/ide-workbench-actions.c
@@ -315,6 +315,19 @@ ide_workbench_actions_close_project (GSimpleAction *action,
gtk_window_close (GTK_WINDOW (self));
}
+static void
+ide_workbench_actions_menu (GSimpleAction *action,
+ GVariant *variant,
+ gpointer user_data)
+{
+ IdeWorkbench *self = user_data;
+
+ g_assert (G_IS_SIMPLE_ACTION (action));
+ g_assert (IDE_IS_WORKBENCH (self));
+
+ ide_workbench_header_bar_show_menu (self->header_bar);
+}
+
void
ide_workbench_actions_init (IdeWorkbench *self)
{
@@ -329,6 +342,7 @@ ide_workbench_actions_init (IdeWorkbench *self)
{ "inspector", ide_workbench_actions_inspector },
{ "update-dependencies", ide_workbench_actions_update_dependencies },
{ "close-project", ide_workbench_actions_close_project },
+ { "menu", ide_workbench_actions_menu },
};
g_action_map_add_action_entries (G_ACTION_MAP (self), actions, G_N_ELEMENTS (actions), self);
diff --git a/src/libide/workbench/ide-workbench-header-bar.c b/src/libide/workbench/ide-workbench-header-bar.c
index f9c447339..533aed0c4 100644
--- a/src/libide/workbench/ide-workbench-header-bar.c
+++ b/src/libide/workbench/ide-workbench-header-bar.c
@@ -319,3 +319,13 @@ _ide_workbench_header_bar_set_fullscreen (IdeWorkbenchHeaderBar *self,
NULL);
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self), fullscreen == FALSE);
}
+
+void
+ide_workbench_header_bar_show_menu (IdeWorkbenchHeaderBar *self)
+{
+ IdeWorkbenchHeaderBarPrivate *priv = ide_workbench_header_bar_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_WORKBENCH_HEADER_BAR (self));
+
+ gtk_widget_activate (GTK_WIDGET (priv->menu_button));
+}
diff --git a/src/libide/workbench/ide-workbench-header-bar.h b/src/libide/workbench/ide-workbench-header-bar.h
index 8753a2434..b4ee4c429 100644
--- a/src/libide/workbench/ide-workbench-header-bar.h
+++ b/src/libide/workbench/ide-workbench-header-bar.h
@@ -52,6 +52,8 @@ IDE_AVAILABLE_IN_ALL
IdeOmniBar *ide_workbench_header_bar_get_omni_bar (IdeWorkbenchHeaderBar *self);
IDE_AVAILABLE_IN_ALL
void ide_workbench_header_bar_focus_search (IdeWorkbenchHeaderBar *self);
+IDE_AVAILABLE_IN_3_32
+void ide_workbench_header_bar_show_menu (IdeWorkbenchHeaderBar *self);
IDE_AVAILABLE_IN_ALL
void ide_workbench_header_bar_add_primary (IdeWorkbenchHeaderBar *self,
GtkWidget *widget);
diff --git a/src/libide/workbench/ide-workbench-shortcuts.c b/src/libide/workbench/ide-workbench-shortcuts.c
index 00400f0fd..0be4b0a0a 100644
--- a/src/libide/workbench/ide-workbench-shortcuts.c
+++ b/src/libide/workbench/ide-workbench-shortcuts.c
@@ -28,6 +28,12 @@
#define I_(s) (g_intern_static_string(s))
static DzlShortcutEntry workbench_shortcuts[] = {
+ { "org.gnome.builder.workbench.menu",
+ 0, NULL,
+ NC_("shortcut window", "Workbench shortcuts"),
+ NC_("shortcut window", "General"),
+ NC_("shortcut window", "Show workbench menu") },
+
{ "org.gnome.builder.workbench.fullscreen",
0, NULL,
NC_("shortcut window", "Workbench shortcuts"),
@@ -102,6 +108,12 @@ _ide_workbench_init_shortcuts (IdeWorkbench *self)
controller = dzl_shortcut_controller_find (GTK_WIDGET (self));
+ dzl_shortcut_controller_add_command_action (controller,
+ I_("org.gnome.builder.workbench.menu"),
+ "F10",
+ DZL_SHORTCUT_PHASE_BUBBLE | DZL_SHORTCUT_PHASE_GLOBAL,
+ I_("win.menu"));
+
dzl_shortcut_controller_add_command_action (controller,
I_("org.gnome.builder.workbench.fullscreen"),
"F11",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]