[gnome-builder] libide/foundry: add push_at_base() helper



commit fb9f4e8562f460d5154dda8e78d0bbb58f7c020d
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jul 21 12:41:17 2022 -0700

    libide/foundry: add push_at_base() helper
    
    This is needed for some cases where we need to inject a tool at the root
    of the runcontext as the tool is not in the build container. In this case,
    we need it for gnome-builder-sysprof.

 src/libide/foundry/ide-run-context.c | 21 +++++++++++++++++++++
 src/libide/foundry/ide-run-context.h |  5 +++++
 2 files changed, 26 insertions(+)
---
diff --git a/src/libide/foundry/ide-run-context.c b/src/libide/foundry/ide-run-context.c
index ea202ac64..4a205d79a 100644
--- a/src/libide/foundry/ide-run-context.c
+++ b/src/libide/foundry/ide-run-context.c
@@ -225,6 +225,27 @@ ide_run_context_push (IdeRunContext        *self,
   g_queue_push_head_link (&self->layers, &layer->qlink);
 }
 
+void
+ide_run_context_push_at_base (IdeRunContext        *self,
+                              IdeRunContextHandler  handler,
+                              gpointer              handler_data,
+                              GDestroyNotify        handler_data_destroy)
+{
+  IdeRunContextLayer *layer;
+
+  g_return_if_fail (IDE_IS_RUN_CONTEXT (self));
+
+  layer = g_slice_new0 (IdeRunContextLayer);
+
+  ide_run_context_layer_init (layer);
+
+  layer->handler = handler;
+  layer->handler_data = handler_data;
+  layer->handler_data_destroy = handler_data_destroy;
+
+  g_queue_insert_before_link (&self->layers, &self->root.qlink, &layer->qlink);
+}
+
 static gboolean
 ide_run_context_host_handler (IdeRunContext       *self,
                               const char * const  *argv,
diff --git a/src/libide/foundry/ide-run-context.h b/src/libide/foundry/ide-run-context.h
index f14e920ef..36dedb36d 100644
--- a/src/libide/foundry/ide-run-context.h
+++ b/src/libide/foundry/ide-run-context.h
@@ -56,6 +56,11 @@ void                   ide_run_context_push                    (IdeRunContext
                                                                 gpointer               handler_data,
                                                                 GDestroyNotify         handler_data_destroy);
 IDE_AVAILABLE_IN_ALL
+void                   ide_run_context_push_at_base            (IdeRunContext         *self,
+                                                                IdeRunContextHandler   handler,
+                                                                gpointer               handler_data,
+                                                                GDestroyNotify         handler_data_destroy);
+IDE_AVAILABLE_IN_ALL
 void                   ide_run_context_push_error              (IdeRunContext         *self,
                                                                 GError                *error);
 IDE_AVAILABLE_IN_ALL


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