GNOME Bugzilla – Bug 787033
Add support for "type-func" attribute of ui-files
Last modified: 2017-09-06 13:32:59 UTC
See https://bugzilla.gnome.org/show_bug.cgi?id=786932 When both "class" and "type-func" attributes are present, the parser currently ignores the latter in favour of the former. That's odd because "class" is specified as mandatory in the rnc/rng files. So, by its very nature, the "type-func" attribute should be the preferred way to get the GType when both are present.
Created attachment 358791 [details] [review] codegen: Add support for "type-func" in ui-files If "type-func" attribute is given then prefer it over "class" if matching it to a known object is possible.
Thanks for looking into this from the Vala end.
@debarshi: Maybe you could give that patch some testing?
Review of attachment 358791 [details] [review]: I tested this with gnome-boxes:wip/rishi/rhel that I am working on for bug 786679. I used a gtk+ without the patch from bug 786932, and this one with both vala master and 0.36. However, I am getting a build failure: app-window.vala:86.5-86.30: error: cannot convert from Gtk child type `Boxes.AppWindow' to `Boxes.Searchbar' public Searchbar searchbar; ^^^^^^^^^^^^^^^^^^^^^^^^^^ app-window.vala:88.5-88.24: error: cannot convert from Gtk child type `Boxes.AppWindow' to `Boxes.Topbar' public Topbar topbar;
Thanks, of course my test-case was way to simple :-(
Created attachment 358878 [details] [review] codegen: Add support for "type-func" in ui-files If "type-func" attribute is given then prefer it over "class" if matching it to a known object is possible.
Attachment 358878 [details] pushed as f778ba4 - codegen: Add support for "type-func" in ui-files
Works for me! I tried a GtkBuilder XML that only had a "type-func" attribute, and I didn't get a build failure due to the absence of "class". Thanks. I wonder if the absence of "class" should be flagged as a warning because strictly speaking "class" is supposed to be mandatory (bug 786931).