[gnome-builder] terminal: add debug-terminal action
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: add debug-terminal action
- Date: Wed, 20 Sep 2017 23:09:51 +0000 (UTC)
commit b3e6d7c5ce9a949831252903e2d4fc0185fceb3b
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 20 16:08:50 2017 -0700
terminal: add debug-terminal action
This provides an easy way to access a debug terminal inside the
namespace of the Builder application. "debug-terminal" from the
command bar will place you in the mount/pid namespace for
troubleshooting Builder issues.
plugins/terminal/gb-terminal-view-private.h | 1 +
plugins/terminal/gb-terminal-view.c | 19 ++++++++++++++++++-
plugins/terminal/gb-terminal-workbench-addin.c | 10 +++++++++-
3 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/plugins/terminal/gb-terminal-view-private.h b/plugins/terminal/gb-terminal-view-private.h
index 6467efd..67c2e16 100644
--- a/plugins/terminal/gb-terminal-view-private.h
+++ b/plugins/terminal/gb-terminal-view-private.h
@@ -60,6 +60,7 @@ struct _GbTerminalView
guint manage_spawn : 1;
guint top_has_spawned : 1;
guint top_has_needs_attention : 1;
+ guint run_on_host : 1;
};
G_END_DECLS
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index 9c213eb..cd02ca3 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -43,6 +43,7 @@ enum {
PROP_MANAGE_SPAWN,
PROP_PTY,
PROP_RUNTIME,
+ PROP_RUN_ON_HOST,
LAST_PROP
};
@@ -278,7 +279,7 @@ gb_terminal_respawn (GbTerminalView *self,
launcher = ide_subprocess_launcher_new (0);
ide_subprocess_launcher_set_flags (launcher, 0);
- ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
+ ide_subprocess_launcher_set_run_on_host (launcher, self->run_on_host);
ide_subprocess_launcher_set_clear_env (launcher, FALSE);
ide_subprocess_launcher_set_cwd (launcher, workpath);
ide_subprocess_launcher_push_argv (launcher, shell);
@@ -620,6 +621,10 @@ gb_terminal_view_get_property (GObject *object,
g_value_set_object (value, self->runtime);
break;
+ case PROP_RUN_ON_HOST:
+ g_value_set_boolean (value, self->run_on_host);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -651,6 +656,10 @@ gb_terminal_view_set_property (GObject *object,
self->runtime = g_value_dup_object (value);
break;
+ case PROP_RUN_ON_HOST:
+ self->run_on_host = g_value_get_boolean (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -709,6 +718,13 @@ gb_terminal_view_class_init (GbTerminalViewClass *klass)
IDE_TYPE_RUNTIME,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ properties [PROP_RUN_ON_HOST] =
+ g_param_spec_boolean ("run-on-host",
+ "Run on Host",
+ "If the process should be spawned on the host",
+ TRUE,
+ (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
g_object_class_install_properties (object_class, LAST_PROP, properties);
g_type_ensure (GB_TYPE_TERMINAL);
@@ -720,6 +736,7 @@ gb_terminal_view_init (GbTerminalView *self)
GtkStyleContext *style_context;
g_autoptr(GSettings) settings = NULL;
+ self->run_on_host = TRUE;
self->manage_spawn = TRUE;
self->tsearch = g_object_new (GB_TYPE_TERMINAL_SEARCH, NULL);
diff --git a/plugins/terminal/gb-terminal-workbench-addin.c b/plugins/terminal/gb-terminal-workbench-addin.c
index 9235a48..dd37f3e 100644
--- a/plugins/terminal/gb-terminal-workbench-addin.c
+++ b/plugins/terminal/gb-terminal-workbench-addin.c
@@ -76,17 +76,24 @@ new_terminal_activate (GSimpleAction *action,
GbTerminalView *view;
IdePerspective *perspective;
IdeRuntime *runtime = NULL;
+ const gchar *name;
+ gboolean run_on_host = TRUE;
g_assert (G_IS_SIMPLE_ACTION (action));
g_assert (GB_IS_TERMINAL_WORKBENCH_ADDIN (self));
- if (g_strcmp0 (g_action_get_name (G_ACTION (action)), "new-terminal-in-runtime") == 0)
+ name = g_action_get_name (G_ACTION (action));
+
+ if (g_strcmp0 (name, "new-terminal-in-runtime") == 0)
runtime = find_runtime (self->workbench);
+ else if (g_strcmp0 (name, "debug-terminal") == 0)
+ run_on_host = FALSE;
perspective = ide_workbench_get_perspective_by_name (self->workbench, "editor");
ide_workbench_set_visible_perspective (self->workbench, perspective);
view = g_object_new (GB_TYPE_TERMINAL_VIEW,
+ "run-on-host", run_on_host,
"runtime", runtime,
"visible", TRUE,
NULL);
@@ -230,6 +237,7 @@ gb_terminal_workbench_addin_load (IdeWorkbenchAddin *addin,
static const GActionEntry actions[] = {
{ "new-terminal", new_terminal_activate },
{ "new-terminal-in-runtime", new_terminal_activate },
+ { "debug-terminal", new_terminal_activate },
};
g_assert (GB_IS_TERMINAL_WORKBENCH_ADDIN (self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]