[gtksourceview/wip/chergert/gsv-gtk4] gutter: remove use of style-changed signal



commit aaf543705873a6d47e34bdc25e3679696a7e5b67
Author: Christian Hergert <chergert redhat com>
Date:   Tue Mar 17 15:50:06 2020 -0700

    gutter: remove use of style-changed signal

 gtksourceview/gtksourcegutter-private.h |  9 ++++++---
 gtksourceview/gtksourcegutter.c         | 18 +++++-------------
 gtksourceview/gtksourceview.c           | 11 ++++++++++-
 3 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutter-private.h b/gtksourceview/gtksourcegutter-private.h
index f41c8dad..de5b9686 100644
--- a/gtksourceview/gtksourcegutter-private.h
+++ b/gtksourceview/gtksourcegutter-private.h
@@ -26,10 +26,13 @@
 G_BEGIN_DECLS
 
 G_GNUC_INTERNAL
-GtkSourceGutter      *_gtk_source_gutter_new        (GtkTextWindowType  type);
+GtkSourceGutter      *_gtk_source_gutter_new         (GtkTextWindowType  type);
 G_GNUC_INTERNAL
-GtkSourceGutterLines *_gtk_source_gutter_get_lines  (GtkSourceGutter   *gutter);
+GtkSourceGutterLines *_gtk_source_gutter_get_lines   (GtkSourceGutter   *gutter);
 G_GNUC_INTERNAL
-void                  _gtk_source_gutter_queue_draw (GtkSourceGutter   *gutter);
+void                  _gtk_source_gutter_queue_draw  (GtkSourceGutter   *gutter);
+G_GNUC_INTERNAL
+void                  _gtk_source_gutter_css_changed (GtkSourceGutter   *gutter,
+                                                      GtkCssStyleChange *change);
 
 G_END_DECLS
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index 21384297..124015e2 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -78,7 +78,6 @@ struct _GtkSourceGutter
 
        gulong                adj_changed_handler;
        gulong                realize_handler;
-       gulong                style_updated_handler;
 
        guint                 is_drawing : 1;
 };
@@ -89,8 +88,6 @@ static void gtk_source_gutter_add           (GtkContainer             *container
                                              GtkWidget                *widget);
 static void gtk_source_gutter_remove        (GtkContainer             *container,
                                              GtkWidget                *widget);
-static void on_view_style_updated           (GtkSourceView            *view,
-                                             GtkSourceGutter          *gutter);
 static void on_gutter_pressed_cb            (GtkSourceGutter          *gutter,
                                              gint                      n_presses,
                                              gdouble                   x,
@@ -233,12 +230,6 @@ connect_view (GtkSourceGutter *gutter,
                                  "value-changed",
                                  G_CALLBACK (on_adjustment_value_changed),
                                  gutter);
-
-       gutter->style_updated_handler =
-               g_signal_connect (view,
-                                 "style-updated",
-                                 G_CALLBACK (on_view_style_updated),
-                                 gutter);
 }
 
 static void
@@ -251,7 +242,6 @@ disconnect_view (GtkSourceGutter *gutter,
        g_clear_signal_handler (&gutter->adj_changed_handler,
                                get_adjustment (gutter, view));
        g_clear_signal_handler (&gutter->realize_handler, view);
-       g_clear_signal_handler (&gutter->style_updated_handler, view);
 }
 
 static void
@@ -1088,10 +1078,12 @@ on_gutter_pressed_cb (GtkSourceGutter *gutter,
        }
 }
 
-static void
-on_view_style_updated (GtkSourceView   *view,
-                       GtkSourceGutter *gutter)
+void
+_gtk_source_gutter_css_changed (GtkSourceGutter   *gutter,
+                                GtkCssStyleChange *change)
 {
+       g_assert (GTK_SOURCE_IS_GUTTER (gutter));
+
        do_redraw (gutter);
 }
 
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 8c45fd7b..180d41da 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -4616,11 +4616,20 @@ gtk_source_view_css_changed (GtkWidget         *widget,
 
        update_style (view);
 
-       /* Notify completion to update styling */
        if (priv->completion != NULL)
        {
                _gtk_source_completion_css_changed (priv->completion, change);
        }
+
+       if (priv->left_gutter != NULL)
+       {
+               _gtk_source_gutter_css_changed (priv->left_gutter, change);
+       }
+
+       if (priv->right_gutter != NULL)
+       {
+               _gtk_source_gutter_css_changed (priv->right_gutter, change);
+       }
 }
 
 static MarkCategory *


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