[gtksourceview] map: react to changes in GtkSourceView:right-margin-position
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] map: react to changes in GtkSourceView:right-margin-position
- Date: Wed, 6 Apr 2022 18:07:55 +0000 (UTC)
commit 3855e436be9d16bf856a2664788389dc2f58d3aa
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 6 11:07:05 2022 -0700
map: react to changes in GtkSourceView:right-margin-position
This ensures we go through a resize-cycle when the right-margin-position
is updated in the linked GtkSourceView. Otherwise our size will not update
with the linked view.
gtksourceview/gtksourcemap.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gtksourceview/gtksourcemap.c b/gtksourceview/gtksourcemap.c
index 50b4b982..998ba843 100644
--- a/gtksourceview/gtksourcemap.c
+++ b/gtksourceview/gtksourcemap.c
@@ -187,8 +187,9 @@ typedef struct
GBinding *indent_width_binding;
GBinding *tab_width_binding;
- /* Our signal handler for buffer changes */
+ /* Our signal handler for view changes */
gulong view_notify_buffer_handler;
+ gulong view_notify_right_margin_position_handler;
gulong view_vadj_value_changed_handler;
gulong view_vadj_notify_upper_handler;
@@ -767,6 +768,13 @@ connect_view (GtkSourceMap *map,
G_CONNECT_SWAPPED);
view_notify_buffer (map, NULL, view);
+ priv->view_notify_right_margin_position_handler =
+ g_signal_connect_object (view,
+ "notify::right-margin-position",
+ G_CALLBACK (gtk_widget_queue_resize),
+ map,
+ G_CONNECT_SWAPPED);
+
priv->view_vadj_value_changed_handler =
g_signal_connect_object (vadj,
"value-changed",
@@ -830,11 +838,8 @@ disconnect_view (GtkSourceMap *map)
priv->tab_width_binding = NULL;
}
- if (priv->view_notify_buffer_handler != 0)
- {
- g_signal_handler_disconnect (priv->view, priv->view_notify_buffer_handler);
- priv->view_notify_buffer_handler = 0;
- }
+ g_clear_signal_handler (&priv->view_notify_buffer_handler, priv->view);
+ g_clear_signal_handler (&priv->view_notify_right_margin_position_handler, priv->view);
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (priv->view));
if (vadj != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]