[gnome-builder/wip/gtk4-port: 426/736] libide/editor: map font description to source view




commit d4e3054d6bb0a0eb87e2efd01b23db7949463969
Author: Christian Hergert <chergert redhat com>
Date:   Tue Apr 5 18:52:47 2022 -0700

    libide/editor: map font description to source view

 src/libide/editor/ide-editor-page-settings.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-page-settings.c b/src/libide/editor/ide-editor-page-settings.c
index 5f89827de..dccd230df 100644
--- a/src/libide/editor/ide-editor-page-settings.c
+++ b/src/libide/editor/ide-editor-page-settings.c
@@ -77,6 +77,21 @@ show_map_to_vscrollbar_policy (GValue   *value,
   return TRUE;
 }
 
+static gboolean
+font_name_to_font_desc (GValue   *value,
+                        GVariant *variant,
+                        gpointer  user_data)
+{
+  const char *str;
+
+  if ((str = g_variant_get_string (variant, NULL)))
+    g_value_take_boxed (value, pango_font_description_from_string (str));
+  else
+    g_value_set_boxed (value, NULL);
+
+  return TRUE;
+}
+
 void
 _ide_editor_page_settings_init (IdeEditorPage *self)
 {
@@ -133,6 +148,12 @@ _ide_editor_page_settings_init (IdeEditorPage *self)
                                 show_map_to_vscrollbar_policy,
                                 NULL, NULL, NULL);
 
+  g_settings_bind_with_mapping (editor_settings, "font-name",
+                                self->view, "font-desc",
+                                G_SETTINGS_BIND_GET,
+                                font_name_to_font_desc,
+                                NULL, NULL, NULL);
+
 #if 0
   ide_binding_group_bind (self->view_file_settings,
                           "insert-matching-brace", self->view, "insert-matching-brace",


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