[gnome-builder/wip/gtk4-port: 705/1774] libide/editor: bring old editor workspace menu over
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 705/1774] libide/editor: bring old editor workspace menu over
- Date: Mon, 11 Jul 2022 22:31:21 +0000 (UTC)
commit 54daeaedcbe49a5ed7fb5e8b2cc47bbb3332717b
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 22 16:12:36 2022 -0700
libide/editor: bring old editor workspace menu over
src/libide/editor/gtk/menus.ui | 53 ++++++++++++++++++
src/libide/greeter/gtk/menus.ui | 2 +
.../editorui/gbp-editorui-workspace-addin.c | 24 ++++++++
src/plugins/editorui/gtk/menus.ui | 65 ++++------------------
4 files changed, 89 insertions(+), 55 deletions(-)
---
diff --git a/src/libide/editor/gtk/menus.ui b/src/libide/editor/gtk/menus.ui
index 13f209c56..1e45f9c72 100644
--- a/src/libide/editor/gtk/menus.ui
+++ b/src/libide/editor/gtk/menus.ui
@@ -1,5 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <menu id="ide-editor-workspace-menu">
+ <section id="ide-editor-workspace-menu-theme-section">
+ <item>
+ <attribute name="custom">theme_selector</attribute>
+ </item>
+ </section>
+ <section id="ide-editor-workspace-menu-projects-section"/>
+ <section id="ide-editor-workspace-menu-placeholder1"/>
+ <section id="ide-editor-workspace-menu-placeholder2"/>
+ <section id="ide-editor-workspace-menu-open-section">
+ <attribute name="id">ide-editor-workspace-menu-open-section</attribute>
+ <item>
+ <attribute name="id">ide-editor-workspace-menu-open</attribute>
+ <attribute name="label" translatable="yes">Open File…</attribute>
+ <attribute name="action">workbench.open</attribute>
+ <attribute name="accel"><primary>o</attribute>
+ </item>
+ </section>
+ <section id="ide-editor-workspace-menu-app-section">
+ <attribute name="id">ide-editor-workspace-menu-app-section</attribute>
+ <item>
+ <attribute name="id">ide-editor-workspace-menu-preferences</attribute>
+ <attribute name="label" translatable="yes">Preferences</attribute>
+ <attribute name="action">app.preferences</attribute>
+ <attribute name="accel"><primary>comma</attribute>
+ </item>
+ <item>
+ <attribute name="id">ide-editor-workspace-menu-shortcuts</attribute>
+ <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
+ <attribute name="action">app.shortcuts</attribute>
+ <attribute name="accel"><primary>question</attribute>
+ </item>
+ <item>
+ <attribute name="id">ide-editor-workspace-menu-help</attribute>
+ <attribute name="label" translatable="yes">Help</attribute>
+ <attribute name="action">app.help</attribute>
+ <attribute name="accel">F1</attribute>
+ </item>
+ <item>
+ <attribute name="id">ide-editor-workspace-menu-about</attribute>
+ <attribute name="label" translatable="yes">About Builder</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ </section>
+ <section id="ide-editor-workspace-menu-quit-section">
+ <attribute name="id">ide-editor-workspace-menu-quit-section</attribute>
+ <item>
+ <attribute name="id">ide-editor-workspace-menu-quit</attribute>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="action">app.quit</attribute>
+ </item>
+ </section>
+ </menu>
<menu id="ide-editor-page-menu">
<section id="ide-editor-page-document-section">
<attribute name="label" translatable="yes">Document</attribute>
diff --git a/src/libide/greeter/gtk/menus.ui b/src/libide/greeter/gtk/menus.ui
index 62583f70a..3d0100fd7 100644
--- a/src/libide/greeter/gtk/menus.ui
+++ b/src/libide/greeter/gtk/menus.ui
@@ -71,6 +71,8 @@
</section>
</menu>
<menu id="ide-editor-workspace-menu">
+ <section id="ide-editor-workspace-menu-theme-section">
+ </section>
<section id="ide-editor-workspace-menu-projects-section">
<item>
<attribute name="id">ide-editor-workspace-menu-open</attribute>
diff --git a/src/plugins/editorui/gbp-editorui-workspace-addin.c
b/src/plugins/editorui/gbp-editorui-workspace-addin.c
index 810ee6887..4a12c0aa7 100644
--- a/src/plugins/editorui/gbp-editorui-workspace-addin.c
+++ b/src/plugins/editorui/gbp-editorui-workspace-addin.c
@@ -210,6 +210,29 @@ open_in_new_workspace (GSimpleAction *action,
IDE_EXIT;
}
+static void
+new_workspace (GSimpleAction *action,
+ GVariant *param,
+ gpointer user_data)
+{
+ GbpEditoruiWorkspaceAddin *self = user_data;
+ IdeEditorWorkspace *workspace;
+ IdeWorkbench *workbench;
+
+ IDE_ENTRY;
+
+ g_assert (G_IS_SIMPLE_ACTION (action));
+ g_assert (GBP_IS_EDITORUI_WORKSPACE_ADDIN (self));
+
+ workbench = ide_workspace_get_workbench (self->workspace);
+ workspace = ide_editor_workspace_new (IDE_APPLICATION_DEFAULT);
+ ide_workbench_add_workspace (workbench, IDE_WORKSPACE (workspace));
+
+ gtk_window_present (GTK_WINDOW (workspace));
+
+ IDE_EXIT;
+}
+
static void
new_file_cb (GObject *object,
GAsyncResult *result,
@@ -274,6 +297,7 @@ static const GActionEntry actions[] = {
{ "open-in-new-frame", open_in_new_frame },
{ "open-in-new-workspace", open_in_new_workspace },
{ "new-file", new_file },
+ { "new-workspace", new_workspace },
};
static void
diff --git a/src/plugins/editorui/gtk/menus.ui b/src/plugins/editorui/gtk/menus.ui
index c28b5895d..00e06c820 100644
--- a/src/plugins/editorui/gtk/menus.ui
+++ b/src/plugins/editorui/gtk/menus.ui
@@ -1,59 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <menu id="ide-editor-workspace-menu">
- <section id="ide-editor-workspace-menu-projects-section"/>
- <section id="ide-editor-workspace-menu-placeholder1">
- <item>
- <attribute name="id">ide-editor-workspace-menu-new-editor-workspace</attribute>
- <attribute name="label" translatable="yes">New Editor Workspace…</attribute>
- <attribute name="action">win.new-editor-workspace</attribute>
- </item>
- </section>
- <section id="ide-editor-workspace-menu-placeholder2"/>
- <section id="ide-editor-workspace-menu-open-section">
- <attribute name="id">ide-editor-workspace-menu-open-section</attribute>
- <item>
- <attribute name="id">ide-editor-workspace-menu-open</attribute>
- <attribute name="label" translatable="yes">Open File…</attribute>
- <attribute name="action">workbench.open</attribute>
- <attribute name="accel"><primary>o</attribute>
- </item>
- </section>
- <section id="ide-editor-workspace-menu-app-section">
- <attribute name="id">ide-editor-workspace-menu-app-section</attribute>
- <item>
- <attribute name="id">ide-editor-workspace-menu-preferences</attribute>
- <attribute name="label" translatable="yes">Preferences</attribute>
- <attribute name="action">app.preferences</attribute>
- <attribute name="accel"><primary>comma</attribute>
- </item>
- <item>
- <attribute name="id">ide-editor-workspace-menu-shortcuts</attribute>
- <attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
- <attribute name="action">app.shortcuts</attribute>
- <attribute name="accel"><primary>question</attribute>
- </item>
- <item>
- <attribute name="id">ide-editor-workspace-menu-help</attribute>
- <attribute name="label" translatable="yes">Help</attribute>
- <attribute name="action">app.help</attribute>
- <attribute name="accel">F1</attribute>
- </item>
- <item>
- <attribute name="id">ide-editor-workspace-menu-about</attribute>
- <attribute name="label" translatable="yes">About Builder</attribute>
- <attribute name="action">app.about</attribute>
- </item>
- </section>
- <section id="ide-editor-workspace-menu-quit-section">
- <attribute name="id">ide-editor-workspace-menu-quit-section</attribute>
- <item>
- <attribute name="id">ide-editor-workspace-menu-quit</attribute>
- <attribute name="label" translatable="yes">_Quit</attribute>
- <attribute name="action">app.quit</attribute>
- </item>
- </section>
- </menu>
<menu id="editorui-indent-menu">
<section id="editorui-indent-section">
<attribute name="label" translatable="yes">Indentation</attribute>
@@ -133,7 +79,7 @@
<attribute name="action">editorui.open-in-new-frame</attribute>
</item>
<item>
- <attribute name="label" translatable="yes">Open in New Workspace</attribute>
+ <attribute name="label" translatable="yes">Open in New Workspace…</attribute>
<attribute name="id">editor-document-open-in-new-workspace</attribute>
<attribute name="action">editorui.open-in-new-workspace</attribute>
</item>
@@ -142,6 +88,15 @@
</item>
</section>
</menu>
+ <menu id="ide-editor-workspace-menu">
+ <section id="ide-editor-workspace-menu-placeholder1">
+ <item>
+ <attribute name="label" translatable="yes">New Editor Workspace…</attribute>
+ <attribute name="id">ide-editor-workspace-new-workspace</attribute>
+ <attribute name="action">editorui.new-workspace</attribute>
+ </item>
+ </section>
+ </menu>
<menu id="new-document-menu">
<section id="new-document-section">
<attribute name="id">new-document-section</attribute>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]