Commit 6c5489ab authored by Sebastian Keller's avatar Sebastian Keller

settings: Support loading float values from keyfiles

The gtk-cursor-aspect-ratio property got added as a float property.
However there is no parser for float values from keyfiles which meant
that it could not be changed from settings.ini.

Fixes #3441
parent b933d576
......@@ -2448,6 +2448,7 @@ gtk_settings_set_property_value_internal (GtkSettings *settings,
GQuark name_quark;
if (!G_VALUE_HOLDS_LONG (&new_value->value) &&
!G_VALUE_HOLDS_FLOAT (&new_value->value) &&
!G_VALUE_HOLDS_DOUBLE (&new_value->value) &&
!G_VALUE_HOLDS_STRING (&new_value->value) &&
!G_VALUE_HOLDS (&new_value->value, G_TYPE_GSTRING))
......@@ -3443,14 +3444,20 @@ gtk_settings_load_from_key_file (GtkSettings *settings,
break;
}
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
{
gdouble d_val;
g_value_init (&svalue.value, G_TYPE_DOUBLE);
g_value_init (&svalue.value, value_type);
d_val = g_key_file_get_double (keyfile, "Settings", key, &error);
if (!error)
g_value_set_double (&svalue.value, d_val);
{
if (value_type == G_TYPE_FLOAT)
g_value_set_float (&svalue.value, (float) d_val);
else
g_value_set_double (&svalue.value, d_val);
}
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment