[gnome-builder/wip/gtk4-port] libide/editor: wire up grid lines setting to view



commit 0e3a6571f12b4f103e35a1681f110976c911b923
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 27 15:50:09 2022 -0700

    libide/editor: wire up grid lines setting to view

 src/libide/editor/ide-editor-page-settings.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-page-settings.c b/src/libide/editor/ide-editor-page-settings.c
index 56ecb7a81..6ec17951e 100644
--- a/src/libide/editor/ide-editor-page-settings.c
+++ b/src/libide/editor/ide-editor-page-settings.c
@@ -79,6 +79,19 @@ show_map_to_vscrollbar_policy (GValue   *value,
   return TRUE;
 }
 
+static gboolean
+grid_lines_to_background_pattern (GValue   *value,
+                                  GVariant *variant,
+                                  gpointer  user_data)
+{
+  if (g_variant_get_boolean (variant))
+    g_value_set_enum (value, GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID);
+  else
+    g_value_set_enum (value, GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE);
+
+  return TRUE;
+}
+
 static gboolean
 font_name_to_font_desc (GValue   *value,
                         GVariant *variant,
@@ -182,6 +195,11 @@ _ide_editor_page_settings_init (IdeEditorPage *self)
                                 G_SETTINGS_BIND_GET,
                                 show_map_to_vscrollbar_policy,
                                 NULL, NULL, NULL);
+  g_settings_bind_with_mapping (editor_settings, "show-grid-lines",
+                                self->view, "background-pattern",
+                                G_SETTINGS_BIND_GET,
+                                grid_lines_to_background_pattern,
+                                NULL, NULL, NULL);
   g_settings_bind (editor_settings, "enable-snippets",
                    self->view, "enable-snippets",
                    G_SETTINGS_BIND_GET);


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