mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
GSettings: complete support for enum binding
This commit is contained in:
parent
dbe68f7c83
commit
ea6470e31a
@ -446,6 +446,28 @@ g_settings_get_mapping (GValue *value,
|
||||
g_value_set_string (value, g_variant_get_string (variant, NULL));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING) &&
|
||||
G_VALUE_HOLDS_ENUM (value))
|
||||
{
|
||||
GEnumClass *eclass;
|
||||
GEnumValue *evalue;
|
||||
const gchar *nick;
|
||||
|
||||
eclass = g_type_class_ref (G_VALUE_TYPE (value));
|
||||
nick = g_variant_get_string (variant, NULL);
|
||||
evalue = g_enum_get_value_by_nick (eclass, nick);
|
||||
g_type_class_unref (eclass);
|
||||
|
||||
if (evalue)
|
||||
{
|
||||
g_value_set_enum (value, evalue->value);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_warning ("Unable to lookup enum nick '%s' via GType\n", nick);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE ("ay")))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user