[gnome-builder] terminal: add plumbing for terminal workspace
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: add plumbing for terminal workspace
- Date: Sat, 27 Apr 2019 00:10:21 +0000 (UTC)
commit 631d5032e3a0acdad411049f7222bc26fae23322
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 26 17:10:06 2019 -0700
terminal: add plumbing for terminal workspace
We still have a lot of work to do on the terminal workspace itself, but
this gets a way to activate and show the terminal window.
src/libide/terminal/gtk/menus.ui | 10 ++++++++++
.../terminal/gbp-terminal-workspace-addin.c | 22 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
---
diff --git a/src/libide/terminal/gtk/menus.ui b/src/libide/terminal/gtk/menus.ui
index 604559627..d8b14028a 100644
--- a/src/libide/terminal/gtk/menus.ui
+++ b/src/libide/terminal/gtk/menus.ui
@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <menu id="ide-primary-workspace-menu">
+ <section id="ide-primary-workspace-menu-placeholder1">
+ <item>
+ <attribute name="after">ide-primary-workspace-menu-new-editor-workspace</attribute>
+ <attribute name="id">ide-primary-workspace-menu-new-terminal-workspace</attribute>
+ <attribute name="label" translatable="yes">New Terminal Workspace…</attribute>
+ <attribute name="action">win.new-terminal-workspace</attribute>
+ </item>
+ </section>
+ </menu>
<menu id="ide-terminal-workspace-menu">
<section id="ide-terminal-workspace-menu-close">
<item>
diff --git a/src/plugins/terminal/gbp-terminal-workspace-addin.c
b/src/plugins/terminal/gbp-terminal-workspace-addin.c
index aa5620161..1cb9a8332 100644
--- a/src/plugins/terminal/gbp-terminal-workspace-addin.c
+++ b/src/plugins/terminal/gbp-terminal-workspace-addin.c
@@ -43,6 +43,27 @@ struct _GbpTerminalWorkspaceAddin
IdeTerminalPage *run_terminal;
};
+static void
+new_terminal_workspace (GSimpleAction *action,
+ GVariant *param,
+ gpointer user_data)
+{
+ GbpTerminalWorkspaceAddin *self = user_data;
+ IdeTerminalWorkspace *workspace;
+ IdeWorkbench *workbench;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
+ g_assert (G_IS_SIMPLE_ACTION (action));
+ g_assert (GBP_IS_TERMINAL_WORKSPACE_ADDIN (self));
+
+ workbench = ide_widget_get_workbench (GTK_WIDGET (self->workspace));
+ workspace = g_object_new (IDE_TYPE_TERMINAL_WORKSPACE,
+ "application", IDE_APPLICATION_DEFAULT,
+ NULL);
+ ide_workbench_add_workspace (workbench, IDE_WORKSPACE (workspace));
+ ide_workbench_focus_workspace (workbench, IDE_WORKSPACE (workspace));
+}
+
static IdeRuntime *
find_runtime (IdeWorkspace *workspace)
{
@@ -257,6 +278,7 @@ on_run_manager_stopped (GbpTerminalWorkspaceAddin *self,
}
static const GActionEntry terminal_actions[] = {
+ { "new-terminal-workspace", new_terminal_workspace },
{ "new-terminal", new_terminal_activate },
{ "new-terminal-in-runner", new_terminal_activate },
{ "new-terminal-in-runtime", new_terminal_activate },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]