[gtksourceview/wip/chergert/gsv-gtk4: 154/192] lines: avoid use of style-updated
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 154/192] lines: avoid use of style-updated
- Date: Fri, 7 Aug 2020 18:31:10 +0000 (UTC)
commit ce526c9cdc3f605e52bf4add7c9b53e9df575a34
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 17 17:10:35 2020 -0700
lines: avoid use of style-updated
This API was removed in GTK 4, so we need to drop our use of it. Instead
we will watch for CSS changes and apply that.
Long term, this will work better as CSS is inhereted from parent widgets
before 4.0 is released.
gtksourceview/gtksourcegutterrendererlines.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutterrendererlines.c b/gtksourceview/gtksourcegutterrendererlines.c
index 23cc5dfc4..67072c49f 100644
--- a/gtksourceview/gtksourcegutterrendererlines.c
+++ b/gtksourceview/gtksourcegutterrendererlines.c
@@ -141,9 +141,13 @@ gutter_renderer_change_buffer (GtkSourceGutterRenderer *renderer,
}
static void
-on_view_style_updated (GtkTextView *view,
- GtkSourceGutterRendererLines *renderer)
+gtk_source_gutter_renderer_lines_css_changed (GtkWidget *widget,
+ GtkCssStyleChange *change)
{
+ GtkSourceGutterRendererLines *renderer = GTK_SOURCE_GUTTER_RENDERER_LINES (widget);
+
+ GTK_WIDGET_CLASS (_gtk_source_gutter_renderer_lines_parent_class)->css_changed (widget, change);
+
/* Force to recalculate the size. */
renderer->num_line_digits = -1;
recalculate_size (renderer);
@@ -165,9 +169,6 @@ gutter_renderer_change_view (GtkSourceGutterRenderer *renderer,
if (old_view != NULL)
{
- g_signal_handlers_disconnect_by_func (old_view,
- on_view_style_updated,
- renderer);
g_signal_handlers_disconnect_by_func (old_view,
on_view_notify_cursor_visible,
renderer);
@@ -177,12 +178,6 @@ gutter_renderer_change_view (GtkSourceGutterRenderer *renderer,
if (new_view != NULL)
{
- g_signal_connect_object (new_view,
- "style-updated",
- G_CALLBACK (on_view_style_updated),
- renderer,
- 0);
-
g_signal_connect_object (new_view,
"notify::cursor-visible",
G_CALLBACK (on_view_notify_cursor_visible),
@@ -384,6 +379,7 @@ _gtk_source_gutter_renderer_lines_class_init (GtkSourceGutterRendererLinesClass
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->measure = gtk_source_gutter_renderer_lines_measure;
+ widget_class->css_changed = gtk_source_gutter_renderer_lines_css_changed;
renderer_class->query_activatable = gutter_renderer_query_activatable;
renderer_class->query_data = gtk_source_gutter_renderer_lines_query_data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]