[gnome-builder] highlighter: add IdeHighlighter::load() vfunc



commit 8e0126cba2ff18cc83b40852b95c939e984b12bc
Author: Christian Hergert <chergert redhat com>
Date:   Thu Nov 3 03:08:56 2016 -0700

    highlighter: add IdeHighlighter::load() vfunc
    
    This is useful for plugins to do various setup work such as binding any
    properties they need.

 libide/highlighting/ide-highlight-engine.c |    6 +++++-
 libide/highlighting/ide-highlighter.c      |    9 +++++++++
 libide/highlighting/ide-highlighter.h      |    3 +++
 3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/libide/highlighting/ide-highlight-engine.c b/libide/highlighting/ide-highlight-engine.c
index b2ad102..2c26eeb 100644
--- a/libide/highlighting/ide-highlight-engine.c
+++ b/libide/highlighting/ide-highlight-engine.c
@@ -494,7 +494,11 @@ ide_highlight_engine_set_highlighter (IdeHighlightEngine *self,
   if (g_set_object (&self->highlighter, highlighter))
     {
       if (highlighter != NULL)
-        IDE_HIGHLIGHTER_GET_IFACE (highlighter)->set_engine (highlighter, self);
+        {
+          IDE_HIGHLIGHTER_GET_IFACE (highlighter)->set_engine (highlighter, self);
+          ide_highlighter_load (highlighter);
+        }
+
       ide_highlight_engine_reload (self);
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_HIGHLIGHTER]);
     }
diff --git a/libide/highlighting/ide-highlighter.c b/libide/highlighting/ide-highlighter.c
index ef8d602..300443d 100644
--- a/libide/highlighting/ide-highlighter.c
+++ b/libide/highlighting/ide-highlighter.c
@@ -83,3 +83,12 @@ ide_highlighter_update (IdeHighlighter       *self,
 
   IDE_HIGHLIGHTER_GET_IFACE (self)->update (self, callback, range_begin, range_end, location);
 }
+
+void
+ide_highlighter_load (IdeHighlighter *self)
+{
+  g_return_if_fail (IDE_IS_HIGHLIGHTER (self));
+
+  if (IDE_HIGHLIGHTER_GET_IFACE (self)->load)
+    IDE_HIGHLIGHTER_GET_IFACE (self)->load (self);
+}
diff --git a/libide/highlighting/ide-highlighter.h b/libide/highlighting/ide-highlighter.h
index 67fb037..082fded 100644
--- a/libide/highlighting/ide-highlighter.h
+++ b/libide/highlighting/ide-highlighter.h
@@ -68,8 +68,11 @@ struct _IdeHighlighterInterface
 
   void (*set_engine) (IdeHighlighter       *self,
                       IdeHighlightEngine   *engine);
+
+  void (*load)       (IdeHighlighter       *self);
 };
 
+void ide_highlighter_load   (IdeHighlighter       *self);
 void ide_highlighter_update (IdeHighlighter       *self,
                              IdeHighlightCallback  callback,
                              const GtkTextIter    *range_begin,


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