[gnome-builder/wip/gtk4-port: 1487/1774] libide/gui: add active configuration to build menu
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1487/1774] libide/gui: add active configuration to build menu
- Date: Mon, 11 Jul 2022 22:31:47 +0000 (UTC)
commit ca415621462b80fadfb220ef289cbee9be82872b
Author: Christian Hergert <chergert redhat com>
Date: Mon Jun 13 16:39:27 2022 -0700
libide/gui: add active configuration to build menu
src/libide/gui/ide-primary-workspace.c | 12 ++++++++++++
src/libide/gui/ide-primary-workspace.ui | 3 ++-
src/plugins/buildui/gtk/menus.ui | 15 +++++----------
3 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/src/libide/gui/ide-primary-workspace.c b/src/libide/gui/ide-primary-workspace.c
index a81c2d7bb..4735b19af 100644
--- a/src/libide/gui/ide-primary-workspace.c
+++ b/src/libide/gui/ide-primary-workspace.c
@@ -61,6 +61,7 @@ struct _IdePrimaryWorkspace
IdeGrid *grid;
GtkOverlay *overlay;
IdeOmniBar *omni_bar;
+ IdeJoinedMenu *build_menu;
};
G_DEFINE_FINAL_TYPE (IdePrimaryWorkspace, ide_primary_workspace, IDE_TYPE_WORKSPACE)
@@ -70,8 +71,10 @@ ide_primary_workspace_context_set (IdeWorkspace *workspace,
IdeContext *context)
{
IdePrimaryWorkspace *self = (IdePrimaryWorkspace *)workspace;
+ IdeConfigManager *config_manager;
IdeProjectInfo *project_info;
IdeWorkbench *workbench;
+ GMenuModel *config_menu;
g_assert (IDE_IS_MAIN_THREAD ());
g_assert (IDE_IS_PRIMARY_WORKSPACE (self));
@@ -86,6 +89,10 @@ ide_primary_workspace_context_set (IdeWorkspace *workspace,
g_object_bind_property (project_info, "name",
self->project_title, "label",
G_BINDING_SYNC_CREATE);
+
+ config_manager = ide_config_manager_from_context (context);
+ config_menu = ide_config_manager_get_menu (config_manager);
+ ide_joined_menu_prepend_menu (self->build_menu, G_MENU_MODEL (config_menu));
}
static void
@@ -240,6 +247,7 @@ ide_primary_workspace_class_init (IdePrimaryWorkspaceClass *klass)
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, build_menu);
gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, dock);
gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, edge_bottom);
gtk_widget_class_bind_template_child (widget_class, IdePrimaryWorkspace, edge_end);
@@ -262,6 +270,7 @@ ide_primary_workspace_class_init (IdePrimaryWorkspaceClass *klass)
static void
ide_primary_workspace_init (IdePrimaryWorkspace *self)
{
+ GMenu *build_menu;
GMenu *menu;
gtk_widget_init_template (GTK_WIDGET (self));
@@ -269,6 +278,9 @@ ide_primary_workspace_init (IdePrimaryWorkspace *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));
+ build_menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "build-menu");
+ ide_joined_menu_append_menu (self->build_menu, G_MENU_MODEL (build_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 59fa4ea6d..dc0bff6fd 100644
--- a/src/libide/gui/ide-primary-workspace.ui
+++ b/src/libide/gui/ide-primary-workspace.ui
@@ -24,7 +24,7 @@
<object class="IdeOmniBar" id="omni_bar">
<property name="icon-name">builder-build-symbolic</property>
<property name="action-name">build-manager.build</property>
- <property name="menu-id">build-menu</property>
+ <property name="menu-model">build_menu</property>
<child type="placeholder">
<object class="GtkLabel" id="project_title">
<property name="ellipsize">end</property>
@@ -102,4 +102,5 @@
</object>
</child>
</template>
+ <object class="IdeJoinedMenu" id="build_menu"/>
</interface>
diff --git a/src/plugins/buildui/gtk/menus.ui b/src/plugins/buildui/gtk/menus.ui
index 9cb385203..6e13fd066 100644
--- a/src/plugins/buildui/gtk/menus.ui
+++ b/src/plugins/buildui/gtk/menus.ui
@@ -29,16 +29,11 @@
</section>
</menu>
<menu id="build-menu">
- <section id="build-menu-config">
- <submenu id="build-menu-configs">
- <attribute name="label" translatable="yes">Active Configuration</attribute>
- </submenu>
- <item>
- <attribute name="label" translatable="yes">Configure Project…</attribute>
- <attribute name="action">workbench.configure</attribute>
- <attribute name="accel"><alt>comma</attribute>
- </item>
- </section>
+ <item>
+ <attribute name="label" translatable="yes">Configure Project…</attribute>
+ <attribute name="action">workbench.configure</attribute>
+ <attribute name="accel"><alt>comma</attribute>
+ </item>
<section id="build-menu-target">
<item>
<attribute name="label" translatable="yes">Select Build Target…</attribute>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]