[gnome-builder] plugins/flatpak: ensure runtimes have parent IdeObject
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/flatpak: ensure runtimes have parent IdeObject
- Date: Fri, 15 Jul 2022 21:21:32 +0000 (UTC)
commit 35befd9485a9774d4a11e4d96584f9f4a21ff734
Author: Christian Hergert <chergert redhat com>
Date: Fri Jul 15 14:21:27 2022 -0700
plugins/flatpak: ensure runtimes have parent IdeObject
That way we can always assume they can get a context object.
src/plugins/flatpak/gbp-flatpak-manifest.c | 7 ++++---
src/plugins/flatpak/gbp-flatpak-runtime-provider.c | 6 +++---
src/plugins/flatpak/gbp-flatpak-runtime.c | 5 ++++-
src/plugins/flatpak/gbp-flatpak-runtime.h | 3 ++-
4 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-manifest.c b/src/plugins/flatpak/gbp-flatpak-manifest.c
index 28d5a7212..19f8002f9 100644
--- a/src/plugins/flatpak/gbp-flatpak-manifest.c
+++ b/src/plugins/flatpak/gbp-flatpak-manifest.c
@@ -33,7 +33,7 @@
struct _GbpFlatpakManifest
{
- IdeConfig parent_instance;
+ IdeConfig parent_instance;
GFile *file;
GFileMonitor *file_monitor;
@@ -66,7 +66,7 @@ struct _GbpFlatpakManifest
static void initable_iface_init (GInitableIface *iface);
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpFlatpakManifest, gbp_flatpak_manifest, IDE_TYPE_CONFIG,
- G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init))
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init))
enum {
PROP_0,
@@ -609,7 +609,8 @@ find_extension (GbpFlatpakManifest *self,
&deploy_dir,
&metadata,
&is_extension))
- ret = gbp_flatpak_runtime_new (name,
+ ret = gbp_flatpak_runtime_new (IDE_OBJECT (self),
+ name,
arch,
branch,
sdk_name,
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
index c23f5b017..cd5ccfead 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -47,7 +47,7 @@ struct _GbpFlatpakRuntimeProvider
static void runtime_provider_iface_init (IdeRuntimeProviderInterface *iface);
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpFlatpakRuntimeProvider, gbp_flatpak_runtime_provider, IDE_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_RUNTIME_PROVIDER, runtime_provider_iface_init))
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_RUNTIME_PROVIDER,
runtime_provider_iface_init))
static void
gbp_flatpak_runtime_provider_dispose (GObject *object)
@@ -115,7 +115,8 @@ on_runtime_added_cb (GbpFlatpakRuntimeProvider *self,
context = ide_object_ref_context (IDE_OBJECT (self));
manager = ide_runtime_manager_from_context (context);
- runtime = gbp_flatpak_runtime_new (name,
+ runtime = gbp_flatpak_runtime_new (IDE_OBJECT (self),
+ name,
arch,
branch,
sdk_name,
@@ -128,7 +129,6 @@ on_runtime_added_cb (GbpFlatpakRuntimeProvider *self,
name, arch, branch, sdk_name, sdk_branch, deploy_dir);
g_ptr_array_add (self->runtimes, g_object_ref (runtime));
- ide_object_append (IDE_OBJECT (self), IDE_OBJECT (runtime));
ide_runtime_manager_add (manager, IDE_RUNTIME (runtime));
IDE_EXIT;
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.c b/src/plugins/flatpak/gbp-flatpak-runtime.c
index 901e655ef..26bba560c 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.c
@@ -870,7 +870,8 @@ gbp_flatpak_runtime_init (GbpFlatpakRuntime *self)
}
GbpFlatpakRuntime *
-gbp_flatpak_runtime_new (const char *name,
+gbp_flatpak_runtime_new (IdeObject *parent,
+ const char *name,
const char *arch,
const char *branch,
const char *sdk_name,
@@ -887,6 +888,7 @@ gbp_flatpak_runtime_new (const char *name,
g_autoptr(IdeTriplet) triplet_object = NULL;
g_autoptr(GString) category = NULL;
+ g_return_val_if_fail (IDE_IS_OBJECT (parent), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (arch != NULL, NULL);
g_return_val_if_fail (branch != NULL, NULL);
@@ -925,6 +927,7 @@ gbp_flatpak_runtime_new (const char *name,
runtime_name = g_strdup_printf ("%s %s", _("Flatpak"), triplet);
return g_object_new (GBP_TYPE_FLATPAK_RUNTIME,
+ "parent", parent,
"id", id,
"short-id", short_id,
"triplet", triplet_object,
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.h b/src/plugins/flatpak/gbp-flatpak-runtime.h
index 3512f1197..85641acd0 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.h
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.h
@@ -28,7 +28,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GbpFlatpakRuntime, gbp_flatpak_runtime, GBP, FLATPAK_RUNTIME, IdeRuntime)
-GbpFlatpakRuntime *gbp_flatpak_runtime_new (const char *name,
+GbpFlatpakRuntime *gbp_flatpak_runtime_new (IdeObject *parent,
+ const char *name,
const char *arch,
const char *branch,
const char *sdk_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]