[gnome-builder] editor: add draw-layer signal and vfunc



commit 8832d28ad40b5f10f989113f96ffafdeba2c67be
Author: Christian Hergert <christian hergert me>
Date:   Mon Oct 20 18:45:20 2014 -0700

    editor: add draw-layer signal and vfunc

 src/editor/gb-source-view.c |   31 ++++++++++++++++++++++++++++---
 src/editor/gb-source-view.h |    3 +++
 2 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/src/editor/gb-source-view.c b/src/editor/gb-source-view.c
index 6178f31..037383d 100644
--- a/src/editor/gb-source-view.c
+++ b/src/editor/gb-source-view.c
@@ -77,9 +77,10 @@ enum {
 };
 
 enum {
-  PUSH_SNIPPET,
-  POP_SNIPPET,
   BEGIN_SEARCH,
+  DRAW_LAYER,
+  POP_SNIPPET,
+  PUSH_SNIPPET,
   LAST_SIGNAL
 };
 
@@ -1332,7 +1333,16 @@ gb_source_view_draw_layer (GtkTextView     *text_view,
                            GtkTextViewLayer layer,
                            cairo_t         *cr)
 {
-  GbSourceViewPrivate *priv = GB_SOURCE_VIEW (text_view)->priv;
+  g_signal_emit (text_view, gSignals [DRAW_LAYER], 0, layer, cr);
+}
+
+static void
+gb_source_view_real_draw_layer (GbSourceView     *view,
+                                GtkTextViewLayer  layer,
+                                cairo_t          *cr)
+{
+  GbSourceViewPrivate *priv = view->priv;
+  GtkTextView *text_view = GTK_TEXT_VIEW (view);
 
   GTK_TEXT_VIEW_CLASS (gb_source_view_parent_class)->draw_layer (text_view, layer, cr);
 
@@ -1505,6 +1515,8 @@ gb_source_view_class_init (GbSourceViewClass *klass)
 
   text_view_class->draw_layer = gb_source_view_draw_layer;
 
+  klass->draw_layer = gb_source_view_real_draw_layer;
+
   gParamSpecs [PROP_FONT_NAME] =
     g_param_spec_string ("font-name",
                          _("Font Name"),
@@ -1574,6 +1586,19 @@ gb_source_view_class_init (GbSourceViewClass *klass)
                   2,
                   GTK_TYPE_DIRECTION_TYPE,
                   G_TYPE_STRING);
+
+  gSignals [DRAW_LAYER] =
+    g_signal_new ("draw-layer",
+                  GB_TYPE_SOURCE_VIEW,
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GbSourceViewClass, draw_layer),
+                  NULL,
+                  NULL,
+                  NULL,
+                  G_TYPE_NONE,
+                  2,
+                  GTK_TYPE_TEXT_VIEW_LAYER,
+                  G_TYPE_POINTER);
 }
 
 static void
diff --git a/src/editor/gb-source-view.h b/src/editor/gb-source-view.h
index 99175c8..8905ea8 100644
--- a/src/editor/gb-source-view.h
+++ b/src/editor/gb-source-view.h
@@ -60,6 +60,9 @@ struct _GbSourceViewClass
   void (*begin_search) (GbSourceView           *view,
                         GtkDirectionType        direction,
                         const gchar            *search_text);
+  void (*draw_layer)   (GbSourceView           *view,
+                        GtkTextViewLayer        layer,
+                        cairo_t                *cr);
 };
 
 void                  gb_source_view_begin_search       (GbSourceView         *view,


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