builderparser: fix <lookup/> with interface types

If we have a <lookup name="foo" type="SomeInterface"> a runtime warning
would be emitted and the expression would fail to be created. This is
because the interfaces will likely be a GObject as well, meaning we check
the object type branch instead of the interface.

Instead, we need to use the fundamental type like other parts of the
expression system use.
This commit is contained in:
Christian Hergert 2022-05-31 15:58:21 -07:00
parent 480a933546
commit 63e9e7e899

View File

@ -1409,13 +1409,13 @@ expression_info_construct (GtkBuilder *builder,
return NULL;
}
if (g_type_is_a (type, G_TYPE_OBJECT))
if (g_type_fundamental (type) == G_TYPE_OBJECT)
{
GObjectClass *class = g_type_class_ref (type);
pspec = g_object_class_find_property (class, info->property.property_name);
g_type_class_unref (class);
}
else if (g_type_is_a (type, G_TYPE_INTERFACE))
else if (g_type_fundamental (type) == G_TYPE_INTERFACE)
{
GTypeInterface *iface = g_type_default_interface_ref (type);
pspec = g_object_interface_find_property (iface, info->property.property_name);