[gnome-builder/wip/plugins] context: init search engine last



commit 4896a191cdbcb6952ebcab77714cc50db58285bb
Author: Christian Hergert <christian hergert me>
Date:   Fri Jun 12 21:24:11 2015 -0700

    context: init search engine last
    
    This allows the search indexes to avoid needing to wait for other
    components to have loaded.

 libide/ide-context.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 6190ba6..ddc179c 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -793,10 +793,6 @@ ide_context_init (IdeContext *self)
                                       "context", self,
                                       NULL);
 
-  self->search_engine = g_object_new (IDE_TYPE_SEARCH_ENGINE,
-                                      "context", self,
-                                      NULL);
-
   self->snippets_manager = g_object_new (IDE_TYPE_SOURCE_SNIPPETS_MANAGER,
                                          "context", self,
                                          NULL);
@@ -1351,6 +1347,26 @@ ide_context_init_add_recent (gpointer             source_object,
 }
 
 static void
+ide_context_init_search_engine (gpointer             source_object,
+                                GCancellable        *cancellable,
+                                GAsyncReadyCallback  callback,
+                                gpointer             user_data)
+{
+  g_autoptr(GTask) task = NULL;
+  IdeContext *self = source_object;
+
+  g_assert (IDE_IS_CONTEXT (self));
+  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+  self->search_engine = g_object_new (IDE_TYPE_SEARCH_ENGINE,
+                                      "context", self,
+                                      NULL);
+
+  task = g_task_new (self, cancellable, callback, user_data);
+  g_task_return_boolean (task, TRUE);
+}
+
+static void
 ide_context_init_async (GAsyncInitable      *initable,
                         int                  io_priority,
                         GCancellable        *cancellable,
@@ -1376,6 +1392,7 @@ ide_context_init_async (GAsyncInitable      *initable,
                         ide_context_init_scripts,
                         ide_context_init_unsaved_files,
                         ide_context_init_add_recent,
+                        ide_context_init_search_engine,
                         NULL);
 }
 


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