[gnome-builder] libide/sourceview: hoist line-height property into setter
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/sourceview: hoist line-height property into setter
- Date: Sat, 13 Aug 2022 18:08:55 +0000 (UTC)
commit 16bcf5b62be627bc3c1e663086cffc91c4231efa
Author: Christian Hergert <chergert redhat com>
Date: Sat Aug 13 11:05:40 2022 -0700
libide/sourceview: hoist line-height property into setter
Just easier to find when looking for it. Also queue_resize() (although
that doesn't seem to have enough of an effect when shrinking line-height).
src/libide/sourceview/ide-source-view.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index d5a479507..ca32cc8fa 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -151,6 +151,23 @@ ide_source_view_update_css (IdeSourceView *self)
gtk_css_provider_load_from_data (self->css_provider, css, -1);
}
+static void
+ide_source_view_set_line_height (IdeSourceView *self,
+ double line_height)
+{
+ g_return_if_fail (IDE_IS_SOURCE_VIEW (self));
+ g_return_if_fail (line_height >= .5);
+ g_return_if_fail (line_height <= 10.);
+
+ if (self->line_height != line_height)
+ {
+ self->line_height = line_height;
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LINE_HEIGHT]);
+ ide_source_view_update_css (self);
+ gtk_widget_queue_resize (GTK_WIDGET (self));
+ }
+}
+
static void
tweak_gutter_spacing (GtkSourceView *view)
{
@@ -776,12 +793,7 @@ ide_source_view_set_property (GObject *object,
break;
case PROP_LINE_HEIGHT:
- if (self->line_height != g_value_get_double (value))
- {
- self->line_height = g_value_get_double (value);
- ide_source_view_update_css (self);
- g_object_notify_by_pspec (G_OBJECT (self), pspec);
- }
+ ide_source_view_set_line_height (self, g_value_get_double (value));
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]