[gnome-builder] meson: set IdeObject:context property
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] meson: set IdeObject:context property
- Date: Wed, 18 Oct 2017 03:40:39 +0000 (UTC)
commit 156ef9a2fde18e701a1ca5f923e43afb091b86e6
Author: Christian Hergert <chergert redhat com>
Date: Tue Oct 17 20:38:26 2017 -0700
meson: set IdeObject:context property
We weren't setting this initially, and we need to ensure that
the IdeObject has access to the context. It's not strictly
necessary, but it might be in the future.
src/plugins/meson/gbp-meson-build-system.c | 7 ++++++-
src/plugins/meson/gbp-meson-build-target.c | 14 +++++++++++---
src/plugins/meson/gbp-meson-build-target.h | 5 +++--
3 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/meson/gbp-meson-build-system.c b/src/plugins/meson/gbp-meson-build-system.c
index 4db6e27..835c63c 100644
--- a/src/plugins/meson/gbp-meson-build-system.c
+++ b/src/plugins/meson/gbp-meson-build-system.c
@@ -473,6 +473,8 @@ gbp_meson_build_system_get_build_targets_communciate_cb (GObject *object,
g_autoptr(GError) error = NULL;
g_autofree gchar *stdout_buf = NULL;
g_autoptr(GPtrArray) ret = NULL;
+ GbpMesonBuildSystem *self;
+ IdeContext *context;
JsonArray *array;
JsonNode *root;
guint len;
@@ -511,6 +513,9 @@ gbp_meson_build_system_get_build_targets_communciate_cb (GObject *object,
return;
}
+ self = g_task_get_source_object (task);
+ context = ide_object_get_context (IDE_OBJECT (self));
+
len = json_array_get_length (array);
ret = g_ptr_array_new_with_free_func (g_object_unref);
@@ -548,7 +553,7 @@ gbp_meson_build_system_get_build_targets_communciate_cb (GObject *object,
base = g_path_get_basename (filename);
dir = g_file_new_for_path (install_dir);
- g_ptr_array_add (ret, gbp_meson_build_target_new (dir, base));
+ g_ptr_array_add (ret, gbp_meson_build_target_new (context, dir, base));
}
}
diff --git a/src/plugins/meson/gbp-meson-build-target.c b/src/plugins/meson/gbp-meson-build-target.c
index b88968d..a703704 100644
--- a/src/plugins/meson/gbp-meson-build-target.c
+++ b/src/plugins/meson/gbp-meson-build-target.c
@@ -83,11 +83,19 @@ gbp_meson_build_target_init (GbpMesonBuildTarget *self)
}
IdeBuildTarget *
-gbp_meson_build_target_new (GFile *install_directory,
- gchar *name)
+gbp_meson_build_target_new (IdeContext *context,
+ GFile *install_directory,
+ gchar *name)
{
- GbpMesonBuildTarget *self = g_object_new (GBP_TYPE_MESON_BUILD_TARGET, NULL);
+ GbpMesonBuildTarget *self;
+ g_return_val_if_fail (!context || IDE_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (G_IS_FILE (install_directory), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ self = g_object_new (GBP_TYPE_MESON_BUILD_TARGET,
+ "context", context,
+ NULL);
g_set_object (&self->install_directory, install_directory);
self->name = g_strdup (name);
diff --git a/src/plugins/meson/gbp-meson-build-target.h b/src/plugins/meson/gbp-meson-build-target.h
index 4fc4668..de4921f 100644
--- a/src/plugins/meson/gbp-meson-build-target.h
+++ b/src/plugins/meson/gbp-meson-build-target.h
@@ -26,7 +26,8 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GbpMesonBuildTarget, gbp_meson_build_target, GBP, MESON_BUILD_TARGET, IdeObject)
-IdeBuildTarget *gbp_meson_build_target_new (GFile *install_directory,
- gchar *name);
+IdeBuildTarget *gbp_meson_build_target_new (IdeContext *context,
+ GFile *install_directory,
+ gchar *name);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]