[gnome-builder] ctags: Initialize highlighter in constructed method



commit 11e350b2bbfec83352d2a99ffbc92d541c0e2444
Author: Dimitris Zenios <dimitris zenios gmail com>
Date:   Fri May 22 18:00:06 2015 +0300

    ctags: Initialize highlighter in constructed method
    
    IdeHighlighter needs an IdeContext which cannot be retrieved via
    the instance init method.

 libide/ctags/ide-ctags-service.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/libide/ctags/ide-ctags-service.c b/libide/ctags/ide-ctags-service.c
index 612a57a..988e0cf 100644
--- a/libide/ctags/ide-ctags-service.c
+++ b/libide/ctags/ide-ctags-service.c
@@ -374,6 +374,19 @@ ide_ctags_service_stop (IdeService *service)
 }
 
 static void
+ide_ctags_service_constructed (GObject *object)
+{
+  IdeCtagsService *self = (IdeCtagsService *)object;
+  IdeContext *context = ide_object_get_context (IDE_OBJECT (self));
+
+  G_OBJECT_CLASS (ide_ctags_service_parent_class)->constructed (object);
+
+  self->highlighter = g_object_new (IDE_TYPE_CTAGS_HIGHLIGHTER,
+                                    "context", context,
+                                    NULL);
+}
+
+static void
 ide_ctags_service_finalize (GObject *object)
 {
   IdeCtagsService *self = (IdeCtagsService *)object;
@@ -396,6 +409,7 @@ ide_ctags_service_class_init (IdeCtagsServiceClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   IdeServiceClass *service_class = IDE_SERVICE_CLASS (klass);
 
+  object_class->constructed = ide_ctags_service_constructed;
   object_class->finalize = ide_ctags_service_finalize;
 
   service_class->start = ide_ctags_service_start;
@@ -408,11 +422,6 @@ ide_ctags_service_init (IdeCtagsService *self)
   self->provider = g_object_new (IDE_TYPE_CTAGS_COMPLETION_PROVIDER,
                                  NULL);
 
-  self->highlighter = g_object_new (IDE_TYPE_CTAGS_HIGHLIGHTER,
-                                    "context",ide_object_get_context (IDE_OBJECT (self)),
-                                    NULL);
-
-
   self->indexes = egg_task_cache_new ((GHashFunc)g_file_hash,
                                       (GEqualFunc)g_file_equal,
                                       g_object_ref,


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