[gnome-builder] libide/foundry: wire foundry managers to context muxer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/foundry: wire foundry managers to context muxer
- Date: Wed, 27 Jul 2022 00:15:43 +0000 (UTC)
commit 028450d237c3d93213f41945e0c0123a856b6e7a
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 26 17:05:38 2022 -0700
libide/foundry: wire foundry managers to context muxer
src/libide/foundry/ide-foundry-init.c | 46 +++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
---
diff --git a/src/libide/foundry/ide-foundry-init.c b/src/libide/foundry/ide-foundry-init.c
index 1ad3af7f8..980598748 100644
--- a/src/libide/foundry/ide-foundry-init.c
+++ b/src/libide/foundry/ide-foundry-init.c
@@ -95,6 +95,46 @@ ide_foundry_init_async_cb (GObject *init_object,
ide_task_return_boolean (task, TRUE);
}
+static void
+ide_foundry_init_notify_completed_cb (IdeTask *task,
+ GParamSpec *pspec,
+ IdeContext *context)
+{
+ g_autoptr(IdeActionMuxer) muxer = NULL;
+ struct {
+ GType gtype;
+ const char *action_group_name;
+ } action_groups[] = {
+ { IDE_TYPE_DEVICE_MANAGER, "device-manager" },
+ { IDE_TYPE_RUNTIME_MANAGER, "runtime-manager" },
+ { IDE_TYPE_TOOLCHAIN_MANAGER, "toolchain-mainager" },
+ { IDE_TYPE_CONFIG_MANAGER, "config-manager" },
+ { IDE_TYPE_BUILD_MANAGER, "build-manager" },
+ { IDE_TYPE_RUN_MANAGER, "run-manager" },
+ { IDE_TYPE_TEST_MANAGER, "test-manager" },
+ };
+
+ g_assert (IDE_IS_TASK (task));
+ g_assert (IDE_IS_CONTEXT (context));
+
+ if (ide_task_had_error (task))
+ return;
+
+ muxer = ide_context_ref_action_muxer (context);
+
+ for (guint i = 0; i < G_N_ELEMENTS (action_groups); i++)
+ {
+ IdeObject *object = ide_context_peek_child_typed (context, action_groups[i].gtype);
+
+ if (!object || !g_type_is_a (action_groups[i].gtype, G_TYPE_ACTION_GROUP))
+ continue;
+
+ ide_action_muxer_insert_action_group (muxer,
+ action_groups[i].action_group_name,
+ G_ACTION_GROUP (object));
+ }
+}
+
void
_ide_foundry_init_async (IdeContext *context,
GCancellable *cancellable,
@@ -122,6 +162,12 @@ _ide_foundry_init_async (IdeContext *context,
ide_task_set_source_tag (task, _ide_foundry_init_async);
ide_task_set_task_data (task, state, foundry_init_free);
+ g_signal_connect_object (task,
+ "notify::completed",
+ G_CALLBACK (ide_foundry_init_notify_completed_cb),
+ context,
+ 0);
+
for (guint i = 0; i < G_N_ELEMENTS (foundry_types); i++)
{
g_autoptr(IdeObject) object = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]