[gnome-builder/wip/gtk4-port: 409/1774] libide/gui: add system-font property helper




commit f6c1a3249dbdd77aad7f0595fc74f6001311e815
Author: Christian Hergert <chergert redhat com>
Date:   Tue Apr 5 18:48:29 2022 -0700

    libide/gui: add system-font property helper

 src/libide/gui/ide-application-settings.c |  1 +
 src/libide/gui/ide-application.c          | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
---
diff --git a/src/libide/gui/ide-application-settings.c b/src/libide/gui/ide-application-settings.c
index 9bd5437c9..d24a71698 100644
--- a/src/libide/gui/ide-application-settings.c
+++ b/src/libide/gui/ide-application-settings.c
@@ -58,6 +58,7 @@ on_portal_settings_changed_cb (IdeApplication *self,
       g_free (self->system_font_name);
       self->system_font_name = g_strdup (g_variant_get_string (value, NULL));
       g_object_notify (G_OBJECT (self), "system-font-name");
+      g_object_notify (G_OBJECT (self), "system-font");
     }
 }
 
diff --git a/src/libide/gui/ide-application.c b/src/libide/gui/ide-application.c
index 1e4bbacc4..57f8808c6 100644
--- a/src/libide/gui/ide-application.c
+++ b/src/libide/gui/ide-application.c
@@ -50,6 +50,7 @@ G_DEFINE_FINAL_TYPE (IdeApplication, ide_application, ADW_TYPE_APPLICATION)
 enum {
   PROP_0,
   PROP_STYLE_SCHEME,
+  PROP_SYSTEM_FONT,
   PROP_SYSTEM_FONT_NAME,
   N_PROPS
 };
@@ -353,6 +354,12 @@ ide_application_get_property (GObject    *object,
       g_value_set_string (value, ide_application_get_system_font_name (self));
       break;
 
+    case PROP_SYSTEM_FONT: {
+      const char *system_font_name = ide_application_get_system_font_name (self);
+      g_value_take_boxed (value, pango_font_description_from_string (system_font_name));
+      break;
+    }
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -429,6 +436,13 @@ ide_application_class_init (IdeApplicationClass *klass)
                          NULL,
                          (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
 
+  properties[PROP_SYSTEM_FONT] =
+    g_param_spec_boxed ("system-font",
+                        "System Font",
+                        "System Font",
+                        PANGO_TYPE_FONT_DESCRIPTION,
+                        (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
   properties[PROP_SYSTEM_FONT_NAME] =
     g_param_spec_string ("system-font-name",
                          "System Font Name",


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