[gnome-builder] foundry: add helper to locate pipeline addin by module name
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] foundry: add helper to locate pipeline addin by module name
- Date: Thu, 4 Mar 2021 01:08:35 +0000 (UTC)
commit 70e1d987adce3c414adab84f435f473da8d02b05
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 3 17:08:18 2021 -0800
foundry: add helper to locate pipeline addin by module name
src/libide/foundry/ide-pipeline-addin.h | 19 +++++++++--------
src/libide/foundry/ide-pipeline.c | 36 +++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 8 deletions(-)
---
diff --git a/src/libide/foundry/ide-pipeline-addin.h b/src/libide/foundry/ide-pipeline-addin.h
index 326aa29cb..445da59a3 100644
--- a/src/libide/foundry/ide-pipeline-addin.h
+++ b/src/libide/foundry/ide-pipeline-addin.h
@@ -47,17 +47,20 @@ struct _IdePipelineAddinInterface
IdePipeline *pipeline);
};
+IDE_AVAILABLE_IN_3_40
+IdePipelineAddin *ide_pipeline_addin_find_by_module_name (IdePipeline *pipeline,
+ const gchar *module_name);
IDE_AVAILABLE_IN_3_34
-void ide_pipeline_addin_prepare (IdePipelineAddin *self,
- IdePipeline *pipeline);
+void ide_pipeline_addin_prepare (IdePipelineAddin *self,
+ IdePipeline *pipeline);
IDE_AVAILABLE_IN_3_32
-void ide_pipeline_addin_load (IdePipelineAddin *self,
- IdePipeline *pipeline);
+void ide_pipeline_addin_load (IdePipelineAddin *self,
+ IdePipeline *pipeline);
IDE_AVAILABLE_IN_3_32
-void ide_pipeline_addin_unload (IdePipelineAddin *self,
- IdePipeline *pipeline);
+void ide_pipeline_addin_unload (IdePipelineAddin *self,
+ IdePipeline *pipeline);
IDE_AVAILABLE_IN_3_32
-void ide_pipeline_addin_track (IdePipelineAddin *self,
- guint stage_id);
+void ide_pipeline_addin_track (IdePipelineAddin *self,
+ guint stage_id);
G_END_DECLS
diff --git a/src/libide/foundry/ide-pipeline.c b/src/libide/foundry/ide-pipeline.c
index 1300eba32..aa1f81219 100644
--- a/src/libide/foundry/ide-pipeline.c
+++ b/src/libide/foundry/ide-pipeline.c
@@ -1192,6 +1192,8 @@ ide_pipeline_load_cb (IdleLoadState *state)
state->self->loaded = TRUE;
state->self->idle_addins_load_source = 0;
+ IDE_TRACE_MSG ("Pipeline ready");
+
g_signal_emit (state->self, signals [LOADED], 0);
return G_SOURCE_REMOVE;
@@ -4280,3 +4282,37 @@ ide_pipeline_contains_program_in_path (IdePipeline *self,
return FALSE;
}
+
+/**
+ * ide_pipeline_addin_find_by_module_name:
+ * @pipeline: an #IdePipeline
+ * @module_name: the name of the addin module
+ *
+ * Finds the addin (if any) matching the plugin's @module_name.
+ *
+ * Returns: (transfer none) (nullable): an #IdePipelineAddin or %NULL
+ *
+ * Since: 3.40
+ */
+IdePipelineAddin *
+ide_pipeline_addin_find_by_module_name (IdePipeline *pipeline,
+ const gchar *module_name)
+{
+ PeasPluginInfo *plugin_info;
+ PeasExtension *ret = NULL;
+ PeasEngine *engine;
+
+ g_return_val_if_fail (IDE_IS_MAIN_THREAD (), NULL);
+ g_return_val_if_fail (IDE_IS_PIPELINE (pipeline), NULL);
+ g_return_val_if_fail (module_name != NULL, NULL);
+
+ if (pipeline->addins == NULL)
+ return NULL;
+
+ engine = peas_engine_get_default ();
+
+ if ((plugin_info = peas_engine_get_plugin_info (engine, module_name)))
+ ret = ide_extension_set_adapter_get_extension (pipeline->addins, plugin_info);
+
+ return IDE_PIPELINE_ADDIN (ret);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]