GNOME Bugzilla – Bug 770180
[PATCH] GtkModelButton icon property should be nullable
Last modified: 2016-09-01 06:58:05 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.
Nullability in vala is done as: GLib.Icon? icon; What you have there now is just a pointer.
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).
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.
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. :·)
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 on attachment 334493 [details] [review] Mark the icon property of GtkModelButton as nullable. https://git.gnome.org/browse/vala/commit/?id=55127b74a71a3e5d84cb034fd12b5463f2f592da