[gnome-builder] libide/editor: propagate notification to IdePage for progress



commit 226084c3db36fb2e086616f0d219bda1efc449c5
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jul 27 23:09:52 2022 -0700

    libide/editor: propagate notification to IdePage for progress

 src/libide/editor/ide-editor-save-delegate.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-save-delegate.c b/src/libide/editor/ide-editor-save-delegate.c
index 772770a05..9b90c20c9 100644
--- a/src/libide/editor/ide-editor-save-delegate.c
+++ b/src/libide/editor/ide-editor-save-delegate.c
@@ -29,6 +29,7 @@
 struct _IdeEditorSaveDelegate
 {
   PanelSaveDelegate  parent_instance;
+  IdeEditorPage     *page;
   IdeBuffer         *buffer;
 };
 
@@ -50,6 +51,7 @@ ide_editor_save_delegate_save_cb (GObject      *object,
   IdeBuffer *buffer = (IdeBuffer *)object;
   g_autoptr(IdeTask) task = user_data;
   g_autoptr(GError) error = NULL;
+  IdeEditorSaveDelegate *self;
 
   IDE_ENTRY;
 
@@ -58,6 +60,11 @@ ide_editor_save_delegate_save_cb (GObject      *object,
   g_assert (G_IS_ASYNC_RESULT (result));
   g_assert (IDE_IS_TASK (task));
 
+  self = ide_task_get_source_object (task);
+
+  if (self->page != NULL)
+    ide_page_set_progress (IDE_PAGE (self->page), NULL);
+
   if (!ide_buffer_save_file_finish (buffer, result, &error))
     ide_task_return_error (task, g_steal_pointer (&error));
   else
@@ -93,6 +100,9 @@ ide_editor_save_delegate_save_async (PanelSaveDelegate   *delegate,
 
   g_object_bind_property (notif, "progress", self, "progress", G_BINDING_SYNC_CREATE);
 
+  if (self->page != NULL)
+    ide_page_set_progress (IDE_PAGE (self->page), notif);
+
   IDE_EXIT;
 }
 
@@ -118,6 +128,7 @@ ide_editor_save_delegate_dispose (GObject *object)
 {
   IdeEditorSaveDelegate *self = (IdeEditorSaveDelegate *)object;
 
+  g_clear_weak_pointer (&self->page);
   g_clear_object (&self->buffer);
 
   G_OBJECT_CLASS (ide_editor_save_delegate_parent_class)->dispose (object);
@@ -201,6 +212,8 @@ ide_editor_save_delegate_new (IdeEditorPage *page)
                       "buffer", buffer,
                       NULL);
 
+  g_set_weak_pointer (&ret->page, page);
+
   g_object_bind_property (page, "title", ret, "title", G_BINDING_SYNC_CREATE);
   g_object_bind_property (page, "icon", ret, "icon", G_BINDING_SYNC_CREATE);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]