mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 06:10:21 +00:00
builder: Allow values of type GType
In particular this allows setting the item-type property of GListStore.
This commit is contained in:
parent
6a0e0031b1
commit
836635d1ae
@ -2215,6 +2215,27 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
case G_TYPE_POINTER:
|
||||
if (G_VALUE_HOLDS (value, G_TYPE_GTYPE))
|
||||
{
|
||||
GType resolved_type;
|
||||
|
||||
resolved_type = gtk_builder_get_type_from_name (builder, string);
|
||||
if (resolved_type == G_TYPE_INVALID)
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_VALUE,
|
||||
"Unsupported GType '%s' for value of type 'GType'", string);
|
||||
return FALSE;
|
||||
}
|
||||
g_value_set_gtype (value, resolved_type);
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
break;
|
||||
default:
|
||||
ret = FALSE;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user