[gnome-builder/wip/gtk4-port] libide/foundry: add run_on_host bit



commit 464def3dcbaff7a2d7a4d1fc883ad1b1132ea8e1
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 21 22:43:01 2022 -0700

    libide/foundry: add run_on_host bit
    
    This cannot be realistically overridden by layers, so it is a global
    value that can still be handled, but managed independently.

 src/libide/foundry/ide-run-context.c | 19 +++++++++++++++++++
 src/libide/foundry/ide-run-context.h |  5 +++++
 2 files changed, 24 insertions(+)
---
diff --git a/src/libide/foundry/ide-run-context.c b/src/libide/foundry/ide-run-context.c
index de11f3ca9..fe9bd4944 100644
--- a/src/libide/foundry/ide-run-context.c
+++ b/src/libide/foundry/ide-run-context.c
@@ -48,6 +48,7 @@ struct _IdeRunContext
   GQueue             layers;
   IdeRunContextLayer root;
   guint              ended : 1;
+  guint              run_on_host : 1;
 };
 
 G_DEFINE_FINAL_TYPE (IdeRunContext, ide_run_context, G_TYPE_OBJECT)
@@ -279,6 +280,23 @@ ide_run_context_add_environ (IdeRunContext      *self,
     }
 }
 
+gboolean
+ide_run_context_get_run_on_host (IdeRunContext *self)
+{
+  g_return_val_if_fail (IDE_IS_RUN_CONTEXT (self), FALSE);
+
+  return self->run_on_host;
+}
+
+void
+ide_run_context_set_run_on_host (IdeRunContext *self,
+                                 gboolean       run_on_host)
+{
+  g_return_if_fail (IDE_IS_RUN_CONTEXT (self));
+
+  self->run_on_host = !!run_on_host;
+}
+
 const char *
 ide_run_context_get_cwd (IdeRunContext *self)
 {
@@ -644,6 +662,7 @@ ide_run_context_end (IdeRunContext  *self,
   ide_subprocess_launcher_set_argv (launcher, ide_run_context_get_argv (self));
   ide_subprocess_launcher_set_environ (launcher, ide_run_context_get_environ (self));
   ide_subprocess_launcher_set_cwd (launcher, ide_run_context_get_cwd (self));
+  ide_subprocess_launcher_set_run_on_host (launcher, self->run_on_host);
 
   return g_steal_pointer (&launcher);
 }
diff --git a/src/libide/foundry/ide-run-context.h b/src/libide/foundry/ide-run-context.h
index 76810c330..4fe1e4701 100644
--- a/src/libide/foundry/ide-run-context.h
+++ b/src/libide/foundry/ide-run-context.h
@@ -54,6 +54,11 @@ void                   ide_run_context_push               (IdeRunContext
                                                            gpointer               handler_data,
                                                            GDestroyNotify         handler_data_destroy);
 IDE_AVAILABLE_IN_ALL
+gboolean               ide_run_context_get_run_on_host    (IdeRunContext         *self);
+IDE_AVAILABLE_IN_ALL
+void                   ide_run_context_set_run_on_host    (IdeRunContext         *self,
+                                                           gboolean               run_on_host);
+IDE_AVAILABLE_IN_ALL
 const char * const    *ide_run_context_get_argv           (IdeRunContext         *self);
 IDE_AVAILABLE_IN_ALL
 void                   ide_run_context_set_argv           (IdeRunContext         *self,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]