Commit 1230d87f authored by Philip Chimento's avatar Philip Chimento 🚮

Merge branch 'wip/fmuellner/more-iface-woes' into 'master'

Fix more "lost" GInterface properties

See merge request !223
parents da5ab808 97da6c39
......@@ -789,6 +789,7 @@ is_gobject_property_name(GIObjectInfo *info,
const char *name)
{
int n_props = g_object_info_get_n_properties(info);
int n_ifaces = g_object_info_get_n_interfaces(info);
int ix;
GjsAutoInfo<GIPropertyInfo> prop_info;
......@@ -802,6 +803,17 @@ is_gobject_property_name(GIObjectInfo *info,
prop_info.reset();
}
if (!prop_info) {
for (ix = 0; ix < n_ifaces; ix++) {
GjsAutoInfo<GIInterfaceInfo> iface_info =
g_object_info_get_interface(info, ix);
if (is_ginterface_property_name(iface_info, canonical_name)) {
g_free(canonical_name);
return true;
}
}
}
g_free(canonical_name);
if (!prop_info)
......
......@@ -3,10 +3,12 @@ const WarnLib = imports.gi.WarnLib;
// We use Gio to have some objects that we know exist
imports.gi.versions.Gdk = '3.0';
imports.gi.versions.Gtk = '3.0';
const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
describe('Life, the Universe and Everything', function () {
it('includes booleans', function () {
......@@ -422,6 +424,37 @@ describe('Life, the Universe and Everything', function () {
expect(o.int).toBe(42);
}).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/issues/113');
describe('Object properties on GtkBuilder-constructed objects', function () {
let o1;
beforeAll(function () {
Gtk.init(null);
});
beforeEach(function () {
const ui = `
<interface>
<object class="GtkButton" id="button">
<property name="label">Click me</property>
</object>
</interface>`;
let builder = Gtk.Builder.new_from_string(ui, -1);
o1 = builder.get_object('button');
});
it('are found on the GObject itself', function () {
expect(o1.label).toBe('Click me');
});
it('are found on the GObject\'s parents', function () {
expect(o1.visible).toBeFalsy();
});
it('are found on the GObject\'s interfaces', function () {
expect(o1.action_name).toBeNull();
});
});
describe('Object-valued GProperty', function () {
let o1, t1, t2;
beforeEach(function () {
......
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