]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcssinitialvalue.c
entrycompletion: Don't reconnect signals all the time
[~andy/gtk] / gtk / gtkcssinitialvalue.c
index c9d253427f959e1a66e7578b9ac136a4c0a25394..427044d57466f9eeed0f5dc13b1e437a74b18b6c 100644 (file)
 
 #include "gtkcssinitialvalueprivate.h"
 
+#include "gtkcssarrayvalueprivate.h"
+#include "gtkcssnumbervalueprivate.h"
+#include "gtkcssstringvalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
+#include "gtkstyleproviderprivate.h"
 
 struct _GtkCssValue {
   GTK_CSS_VALUE_BASE
@@ -40,6 +44,39 @@ gtk_css_value_initial_compute (GtkCssValue             *value,
                                GtkCssComputedValues    *parent_values,
                                GtkCssDependencies      *dependencies)
 {
+  GtkSettings *settings;
+
+  switch (property_id)
+    {
+    case GTK_CSS_PROPERTY_FONT_FAMILY:
+      settings = _gtk_style_provider_private_get_settings (provider);
+      if (settings)
+        {
+          PangoFontDescription *description;
+          char *font_name;
+          GtkCssValue *value;
+
+          g_object_get (settings, "gtk-font-name", &font_name, NULL);
+          description = pango_font_description_from_string (font_name);
+          g_free (font_name);
+          if (description == NULL)
+            break;
+
+          if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_FAMILY)
+            {
+              value = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (description)));
+              pango_font_description_free (description);
+              return value;
+            }
+          pango_font_description_free (description);
+        }
+      break;
+
+    default:
+      break;
+    }
+
   return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
                                  property_id,
                                  provider,