[gnome-builder] runner: add IdeRunner::get_runtime()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] runner: add IdeRunner::get_runtime()
- Date: Mon, 20 Mar 2017 22:25:40 +0000 (UTC)
commit 92b86e9b4632a018e35e00d83d733a09d569b177
Author: Christian Hergert <chergert redhat com>
Date: Mon Mar 20 15:22:50 2017 -0700
runner: add IdeRunner::get_runtime()
This API will allow consumers to access information about the runtime
without having to guess the runtime from the current configuration.
libide/runner/ide-runner.c | 29 +++++++++++++++++++++++++++++
libide/runner/ide-runner.h | 3 ++-
2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/libide/runner/ide-runner.c b/libide/runner/ide-runner.c
index df91c7e..cd7c56e 100644
--- a/libide/runner/ide-runner.c
+++ b/libide/runner/ide-runner.c
@@ -1103,3 +1103,32 @@ ide_runner_get_nth_fd_maping (IdeRunner *self,
return map->source_fd;
}
+
+/**
+ * ide_runner_get_runtime:
+ * @self: An #IdeRuntime
+ *
+ * This function will get the #IdeRuntime that will be used to execute the
+ * application. Consumers may want to use this to determine if a particular
+ * program is available (such as gdb, perf, strace, etc).
+ *
+ * Returns: (nullable) (transfer full): An #IdeRuntime or %NULL.
+ */
+IdeRuntime *
+ide_runner_get_runtime (IdeRunner *self)
+{
+ IdeConfigurationManager *config_manager;
+ IdeConfiguration *config;
+ IdeContext *context;
+
+ g_return_val_if_fail (IDE_IS_RUNNER (self), NULL);
+
+ if (IDE_RUNNER_GET_CLASS (self)->get_runtime)
+ return IDE_RUNNER_GET_CLASS (self)->get_runtime (self);
+
+ context = ide_object_get_context (IDE_OBJECT (self));
+ config_manager = ide_context_get_configuration_manager (context);
+ config = ide_configuration_manager_get_current (config_manager);
+
+ return config != NULL ? g_object_ref (config) : NULL;
+}
diff --git a/libide/runner/ide-runner.h b/libide/runner/ide-runner.h
index 4b97947..fb60484 100644
--- a/libide/runner/ide-runner.h
+++ b/libide/runner/ide-runner.h
@@ -50,6 +50,7 @@ struct _IdeRunnerClass
IdeSubprocessLauncher *(*create_launcher) (IdeRunner *self);
void (*fixup_launcher) (IdeRunner *self,
IdeSubprocessLauncher *launcher);
+ IdeRuntime *(*get_runtime) (IdeRunner *self);
gpointer _reserved1;
gpointer _reserved2;
@@ -58,10 +59,10 @@ struct _IdeRunnerClass
gpointer _reserved5;
gpointer _reserved6;
gpointer _reserved7;
- gpointer _reserved8;
};
IdeRunner *ide_runner_new (IdeContext *context);
+IdeRuntime *ide_runner_get_runtime (IdeRunner *self);
void ide_runner_force_quit (IdeRunner *self);
IdeEnvironment *ide_runner_get_environment (IdeRunner *self);
void ide_runner_run_async (IdeRunner *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]