[gnome-builder/wip/gtk4-port: 1399/1774] libide/projects: give IdeTemplateInput access to context
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1399/1774] libide/projects: give IdeTemplateInput access to context
- Date: Mon, 11 Jul 2022 22:31:44 +0000 (UTC)
commit 33e4071dd597cc0919fac290aff1d6f5af262c01
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 7 16:38:35 2022 -0700
libide/projects: give IdeTemplateInput access to context
We will need the context when expanding so that we can create IdeObjects
that can be bound to the context.
src/libide/projects/ide-template-input.c | 6 ++++++
src/libide/projects/ide-template-input.h | 1 +
src/plugins/create-project/gbp-create-project-widget.c | 4 ++++
3 files changed, 11 insertions(+)
---
diff --git a/src/libide/projects/ide-template-input.c b/src/libide/projects/ide-template-input.c
index be2d1b951..b8c04b7c7 100644
--- a/src/libide/projects/ide-template-input.c
+++ b/src/libide/projects/ide-template-input.c
@@ -1126,6 +1126,7 @@ ide_template_input_expand_cb (GObject *object,
void
ide_template_input_expand_async (IdeTemplateInput *self,
+ IdeContext *context,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1139,6 +1140,7 @@ ide_template_input_expand_async (IdeTemplateInput *self,
g_return_if_fail (IDE_IS_MAIN_THREAD ());
g_return_if_fail (IDE_IS_TEMPLATE_INPUT (self));
+ g_return_if_fail (IDE_IS_CONTEXT (context));
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
task = ide_task_new (self, cancellable, callback, user_data);
@@ -1146,6 +1148,10 @@ ide_template_input_expand_async (IdeTemplateInput *self,
ide_task_set_task_data (task,
g_file_get_child (self->directory, self->name),
g_object_unref);
+ g_object_set_data_full (G_OBJECT (task),
+ "CONTEXT",
+ g_object_ref (context),
+ g_object_unref);
if (ide_template_input_validate (self) != IDE_TEMPLATE_INPUT_VALID)
{
diff --git a/src/libide/projects/ide-template-input.h b/src/libide/projects/ide-template-input.h
index 9d3d0da96..ff0182fd1 100644
--- a/src/libide/projects/ide-template-input.h
+++ b/src/libide/projects/ide-template-input.h
@@ -104,6 +104,7 @@ IDE_AVAILABLE_IN_ALL
char *ide_template_input_get_license_path (IdeTemplateInput *self);
IDE_AVAILABLE_IN_ALL
void ide_template_input_expand_async (IdeTemplateInput *self,
+ IdeContext *context,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
diff --git a/src/plugins/create-project/gbp-create-project-widget.c
b/src/plugins/create-project/gbp-create-project-widget.c
index 778f7ac30..7d31a44f8 100644
--- a/src/plugins/create-project/gbp-create-project-widget.c
+++ b/src/plugins/create-project/gbp-create-project-widget.c
@@ -295,16 +295,20 @@ expand_action (GtkWidget *widget,
{
GbpCreateProjectWidget *self = (GbpCreateProjectWidget *)widget;
IdeGreeterWorkspace *greeter;
+ IdeContext *context;
IDE_ENTRY;
g_assert (GBP_IS_CREATE_PROJECT_WIDGET (self));
greeter = IDE_GREETER_WORKSPACE (ide_widget_get_workspace (widget));
+ context = ide_workspace_get_context (IDE_WORKSPACE (greeter));
+
ide_greeter_workspace_begin (greeter);
gtk_widget_action_set_enabled (widget, "create-project.expand", FALSE);
ide_template_input_expand_async (self->input,
+ context,
ide_workspace_get_cancellable (IDE_WORKSPACE (greeter)),
gbp_create_project_widget_expand_cb,
g_object_ref (greeter));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]