settings: Ensure derived fields are initialized

I mistakenly assumed that gtk_settings_init was already doing
something to trigger a notify for all properties. It doesn't,
so we have to ensure that settings_update_font_values() is
called at least once.

https://bugzilla.gnome.org/show_bug.cgi?id=765966
This commit is contained in:
Matthias Clasen 2016-05-04 06:28:59 -04:00
parent adc90b9e9d
commit 1d0ba98d5d

View File

@ -257,6 +257,7 @@ static void settings_update_key_theme (GtkSettings *setting
static gboolean settings_update_xsetting (GtkSettings *settings,
GParamSpec *pspec,
gboolean force);
static void settings_update_font_values (GtkSettings *settings);
static void gtk_settings_load_from_key_file (GtkSettings *settings,
const gchar *path,
@ -356,6 +357,10 @@ gtk_settings_init (GtkSettings *settings)
g_free (path);
g_object_thaw_notify (G_OBJECT (settings));
/* ensure that derived fields are initialized */
if (priv->font_size == 0)
settings_update_font_values (settings);
}
static void
@ -1966,15 +1971,18 @@ settings_update_font_values (GtkSettings *settings)
PangoFontDescription *desc;
const gchar *font_name;
priv->font_size = 0;
priv->font_size_absolute = FALSE;
priv->font_family = NULL;
g_free (priv->font_family);
font_name = g_value_get_string (&priv->property_values[PROP_FONT_NAME - 1].value);
desc = pango_font_description_from_string (font_name);
if (desc == NULL)
return;
{
priv->font_size = 10 * PANGO_SCALE;
priv->font_size_absolute = FALSE;
priv->font_family = g_strdup ("Sans");
return;
}
if (pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_SIZE)
{