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 770180 - [PATCH] GtkModelButton icon property should be nullable
[PATCH] GtkModelButton icon property should be nullable
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GTK+ GStreamer WebKitGTK+
0.32.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-08-20 21:27 UTC by Arnaud B.
Modified: 2016-09-01 06:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The icon property of a GtkModelButton is nullable. (740 bytes, patch)
2016-08-20 21:27 UTC, Arnaud B.
none Details | Review
The icon property of a GtkModelButton is nullable. (740 bytes, patch)
2016-08-22 12:46 UTC, Arnaud B.
none Details | Review
Mark the icon property of GtkModelButton as nullable. (1.42 KB, patch)
2016-08-31 03:37 UTC, Arnaud B.
committed Details | Review

Description Arnaud B. 2016-08-20 21:27:06 UTC
Created attachment 333773 [details] [review]
The icon property of a GtkModelButton is nullable.

GtkModelButton properties have “NoAccessorMethod”. The “icon” property defines… the icon of the button: if it’s set (to a GIcon), the button displays the icon only, if it’s not set/unset (set to null), the button displays the (hopefully defined) text.

That’s the last opposition to compile dconf-editor with --enable-experimental-non-null: it complains that I shouldn’t set the icon to null. Here is my first vapi patch, so tell me if that’s the correct way to do.
Comment 1 Timm Bäder 2016-08-21 05:54:33 UTC
Nullability in vala is done as:

GLib.Icon? icon;

What you have there now is just a pointer.
Comment 2 Arnaud B. 2016-08-22 12:46:37 UTC
Created attachment 333900 [details] [review]
The icon property of a GtkModelButton is nullable.

-_-’
Sorry, I should never write patches this late.
So, second try (but that’s always my first vapi patch).
Comment 3 Al Thomas 2016-08-22 15:20:27 UTC
Thanks for the patch. 

This binding is generated through vapigen, as noted at the top of the VAPI. So the patch will be overwritten each time the binding is regenerated.

There are two types of source for vapigen to generate bindings:
 1. GIR - this is the newer method and should be used where possible. Additional binding data for this type is held in /vapi/metadata/
 2. GIDL - this is the older and now deprecated method. Additional binding data for this type is held in /vapi/packages/

To find out which gtk+-3.0 is using:

cd vapi
make gtk+-3.0

This will rebuild the VAPI and show the directory used for metadata. In this case it is ./packages/ So gtk+-3.0 is still using the older GIDL format sources.

You need to edit /vapi/packages/gtk+-3.0.metadata by adding the line:
GtkModelButton:icon nullable="1"

Then regenerate the binding. This should show the desired result in the VAPI.
It is convention when submitting the patch to include both the metadata change and VAPI change so both get committed to the repository. You will probably have to use git add --patch so exclude the change to the first line of the VAPI. Mine shows lt-vapigen instead of vapigen.

Although there is nothing that I can find in the docs to say the icon property of GtkModelButton can return null ( https://developer.gnome.org/gtk3/stable/GtkModelButton.html ), it makes sense as the icon is optional.
Comment 4 Arnaud B. 2016-08-31 03:37:39 UTC
Created attachment 334493 [details] [review]
Mark the icon property of GtkModelButton as nullable.

Thanks for this detailed help, it’s always hard to know where to start. :·)
Comment 5 Al Thomas 2016-08-31 17:39:44 UTC
Review of attachment 334493 [details] [review]:

Looks good to me. Thanks.

I've also added some details to https://wiki.gnome.org/Projects/Vala/DeveloperDocumentation to make it easier for others to contribute to maintaining bindings.
Comment 6 Arnaud B. 2016-09-01 06:57:52 UTC
Comment on attachment 334493 [details] [review]
Mark the icon property of GtkModelButton as nullable.

https://git.gnome.org/browse/vala/commit/?id=55127b74a71a3e5d84cb034fd12b5463f2f592da