After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787033 - Add support for "type-func" attribute of ui-files
Add support for "type-func" attribute of ui-files
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator: GtkBuilder
0.37.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-30 19:09 UTC by Rico Tzschichholz
Modified: 2017-09-06 13:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codegen: Add support for "type-func" in ui-files (3.41 KB, patch)
2017-08-30 19:11 UTC, Rico Tzschichholz
none Details | Review
codegen: Add support for "type-func" in ui-files (4.40 KB, patch)
2017-08-31 17:11 UTC, Rico Tzschichholz
committed Details | Review

Description Rico Tzschichholz 2017-08-30 19:09:04 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.
Comment 1 Rico Tzschichholz 2017-08-30 19:11:42 UTC
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.
Comment 2 Debarshi Ray 2017-08-31 09:14:18 UTC
Thanks for looking into this from the Vala end.
Comment 3 Rico Tzschichholz 2017-08-31 11:41:44 UTC
@debarshi: Maybe you could give that patch some testing?
Comment 4 Debarshi Ray 2017-08-31 13:51:02 UTC
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;
Comment 5 Rico Tzschichholz 2017-08-31 17:10:54 UTC
Thanks, of course my test-case was way to simple :-(
Comment 6 Rico Tzschichholz 2017-08-31 17:11:14 UTC
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.
Comment 7 Rico Tzschichholz 2017-09-03 08:38:21 UTC
Attachment 358878 [details] pushed as f778ba4 - codegen: Add support for "type-func" in ui-files
Comment 8 Debarshi Ray 2017-09-06 13:32:59 UTC
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).