[gnome-builder] Revert "doap: don't block project load on doap processing"



commit 333266d3b15e838c7704333efaaaddc31b8104f9
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jan 21 18:34:58 2019 -0800

    Revert "doap: don't block project load on doap processing"
    
    This reverts commit ed3235daec95c1dc3782cc510e3940cb1b889283.
    
    We need to block startup so that we can persist the doap data back
    to the recent-info after open completes.

 src/plugins/doap/gbp-doap-workbench-addin.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/doap/gbp-doap-workbench-addin.c b/src/plugins/doap/gbp-doap-workbench-addin.c
index 9cc5b5836..9057318d1 100644
--- a/src/plugins/doap/gbp-doap-workbench-addin.c
+++ b/src/plugins/doap/gbp-doap-workbench-addin.c
@@ -96,17 +96,21 @@ gbp_doap_workbench_addin_find_doap_cb (GObject      *object,
 }
 
 static void
-gbp_doap_workbench_addin_project_loaded (IdeWorkbenchAddin *addin,
-                                         IdeProjectInfo    *project_info)
+gbp_doap_workbench_addin_load_project_async (IdeWorkbenchAddin   *addin,
+                                             IdeProjectInfo      *project_info,
+                                             GCancellable        *cancellable,
+                                             GAsyncReadyCallback  callback,
+                                             gpointer             user_data)
 {
   g_autoptr(IdeTask) task = NULL;
   GFile *directory;
 
   g_assert (GBP_IS_DOAP_WORKBENCH_ADDIN (addin));
   g_assert (IDE_IS_PROJECT_INFO (project_info));
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
-  task = ide_task_new (addin, NULL, NULL, NULL);
-  ide_task_set_source_tag (task, gbp_doap_workbench_addin_project_loaded);
+  task = ide_task_new (addin, cancellable, callback, user_data);
+  ide_task_set_source_tag (task, gbp_doap_workbench_addin_load_project_async);
   ide_task_set_task_data (task, g_object_ref (project_info), g_object_unref);
 
   if (!(directory = ide_project_info_get_directory (project_info)))
@@ -118,11 +122,22 @@ gbp_doap_workbench_addin_project_loaded (IdeWorkbenchAddin *addin,
   ide_g_file_find_with_depth_async (directory,
                                     "*.doap",
                                     1,
-                                    NULL,
+                                    cancellable,
                                     gbp_doap_workbench_addin_find_doap_cb,
                                     g_steal_pointer (&task));
 }
 
+static gboolean
+gbp_doap_workbench_addin_load_project_finish (IdeWorkbenchAddin  *addin,
+                                              GAsyncResult       *result,
+                                              GError            **error)
+{
+  g_assert (GBP_IS_DOAP_WORKBENCH_ADDIN (addin));
+  g_assert (IDE_IS_TASK (result));
+
+  return ide_task_propagate_boolean (IDE_TASK (result), error);
+}
+
 static void
 gbp_doap_workbench_addin_load (IdeWorkbenchAddin *addin,
                                IdeWorkbench      *workbench)
@@ -140,7 +155,8 @@ gbp_doap_workbench_addin_unload (IdeWorkbenchAddin *addin,
 static void
 workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface)
 {
-  iface->project_loaded = gbp_doap_workbench_addin_project_loaded;
+  iface->load_project_async = gbp_doap_workbench_addin_load_project_async;
+  iface->load_project_finish = gbp_doap_workbench_addin_load_project_finish;
   iface->load = gbp_doap_workbench_addin_load;
   iface->unload = gbp_doap_workbench_addin_unload;
 }


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