[gnome-builder/wip/gtk4-port: 194/1774] libide/gui: setup various menus in primary workspace
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 194/1774] libide/gui: setup various menus in primary workspace
- Date: Mon, 11 Jul 2022 22:31:01 +0000 (UTC)
commit 64cc5e42c142b7cb8287d3fe563b3e00967b5bc4
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 30 12:35:18 2022 -0700
libide/gui: setup various menus in primary workspace
src/libide/gui/gtk/menus.ui | 22 ++++++++++------------
src/libide/gui/ide-primary-workspace.c | 7 +++++++
src/libide/gui/ide-primary-workspace.ui | 6 ++++++
3 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/src/libide/gui/gtk/menus.ui b/src/libide/gui/gtk/menus.ui
index 91b72fddb..d9af95591 100644
--- a/src/libide/gui/gtk/menus.ui
+++ b/src/libide/gui/gtk/menus.ui
@@ -1,11 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <menu id="ide-primary-workspace-surfaces-menu">
- <section id="ide-primary-workspace-surfaces-menu-section">
- <attribute name="label" translatable="yes">Switch Surface</attribute>
- </section>
- <section id="ide-primary-workspace-surfaces-menu-utils-section"/>
- </menu>
<menu id="ide-primary-workspace-menu">
<section id="ide-primary-workspace-menu-projects-section"/>
<section id="ide-primary-workspace-menu-placeholder1"/>
@@ -58,18 +52,22 @@
</section>
</menu>
<menu id="run-menu">
- <section id="run-menu-section">
- <attribute name="label" translatable="yes">Run Options</attribute>
+ <section id="run-menu-observation-section">
+ <attribute name="label" translatable="yes">Observation</attribute>
<item>
<attribute name="id">default-run-handler</attribute>
- <attribute name="action">run-manager.run-with-handler</attribute>
- <attribute name="target">run</attribute>
- <attribute name="label" translatable="yes">Run</attribute>
+ <attribute name="action">run-manager.handler</attribute>
+ <attribute name="target" type='s'>'disabled'</attribute>
+ <attribute name="label" translatable="yes">Disabled</attribute>
<attribute name="verb-icon-name">builder-run-start-symbolic</attribute>
- <attribute name="accel"><Control>F5</attribute>
</item>
</section>
</menu>
+ <menu id="new-document-menu">
+ <section id="new-document-section"/>
+ <section id="open-document-section"/>
+ <section id="terminal-section"/>
+ </menu>
<menu id="project-tree-menu">
<section id="project-tree-menu-placeholder0"/>
<section id="project-tree-menu-new-section"/>
diff --git a/src/libide/gui/ide-primary-workspace.c b/src/libide/gui/ide-primary-workspace.c
index 3d35222ea..288c3c5a9 100644
--- a/src/libide/gui/ide-primary-workspace.c
+++ b/src/libide/gui/ide-primary-workspace.c
@@ -54,6 +54,7 @@ struct _IdePrimaryWorkspace
IdeHeaderBar *header_bar;
IdeRunButton *run_button;
GtkLabel *project_title;
+ GtkMenuButton *add_button;
PanelPaned *edge_start;
PanelPaned *edge_end;
PanelPaned *edge_bottom;
@@ -162,6 +163,7 @@ ide_primary_workspace_class_init (IdePrimaryWorkspaceClass *klass)
workspace_class->add_pane = ide_primary_workspace_add_pane;
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/libide-gui/ui/ide-primary-workspace.ui");
+ gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, add_button);
gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, header_bar);
gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, project_title);
gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, run_button);
@@ -178,7 +180,12 @@ ide_primary_workspace_class_init (IdePrimaryWorkspaceClass *klass)
static void
ide_primary_workspace_init (IdePrimaryWorkspace *self)
{
+ GMenu *menu;
+
gtk_widget_init_template (GTK_WIDGET (self));
+ menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "new-document-menu");
+ gtk_menu_button_set_menu_model (self->add_button, G_MENU_MODEL (menu));
+
_ide_primary_workspace_init_actions (self);
}
diff --git a/src/libide/gui/ide-primary-workspace.ui b/src/libide/gui/ide-primary-workspace.ui
index 79230ad05..cce61d03f 100644
--- a/src/libide/gui/ide-primary-workspace.ui
+++ b/src/libide/gui/ide-primary-workspace.ui
@@ -4,6 +4,12 @@
<child type="titlebar">
<object class="IdeHeaderBar" id="header_bar">
<property name="menu-id">ide-primary-workspace-menu</property>
+ <child type="left">
+ <object class="GtkMenuButton" id="add_button">
+ <property name="icon-name">list-add-symbolic</property>
+ <property name="always-show-arrow">true</property>
+ </object>
+ </child>
<child type="left">
<object class="PanelDockSwitcher">
<property name="dock">dock</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]