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 791023 - Constant type declarations missing from gobject.vapi
Constant type declarations missing from gobject.vapi
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GLib
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-11-30 13:12 UTC by bob
Modified: 2017-11-30 17:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-gobject.vapi-add-missing-GObject-type-constants.patch (1.96 KB, patch)
2017-11-30 13:12 UTC, bob
none Details | Review
0001-gobject.vapi-add-missing-GObject-type-constants.patch (1.83 KB, patch)
2017-11-30 13:51 UTC, bob
committed Details | Review

Description bob 2017-11-30 13:12:59 UTC
Created attachment 364668 [details] [review]
0001-gobject.vapi-add-missing-GObject-type-constants.patch

Several constant-valued GTypes listed in the GObject documentation[1] are not declared in the Vala bindings, which can make things like switch statements with GTypes a pain.

I've added a patch that just adds the missing declarations to gobject-2.0.vapi.
Comment 1 Al Thomas 2017-11-30 13:43:12 UTC
Review of attachment 364668 [details] [review]:

Looks good. Couple of points:

 - GTYPE and CHECKSUM are missing, why are they not needed?
 - Maybe sort the constants alphabetically, this makes them appear in order on the valadoc.org page: https://valadoc.org/gobject-2.0/GLib.Type.html 
   I know the current order is the same as the documentation https://developer.gnome.org/gobject/stable/gobject-Type-Information.html
Comment 2 bob 2017-11-30 13:46:44 UTC
> - GTYPE and CHECKSUM are missing, why are they not needed?

GTYPE and CHECKSUM aren't constants, they're function calls. I suppose they could still be added, but it might cause unexpected C errors since a C compiler doesn't typically allow a function call to be used in a 'case' statement, for example.

> - GTYPE and CHECKSUM are missing, why are they not needed?

I'll add an amended patch in a moment.
Comment 3 bob 2017-11-30 13:47:09 UTC
woops, that last quote was meant to read:

> - Maybe sort the constants alphabetically
Comment 4 bob 2017-11-30 13:51:27 UTC
Created attachment 364678 [details] [review]
0001-gobject.vapi-add-missing-GObject-type-constants.patch

Sorted GType constants alphabetically
Comment 5 Al Thomas 2017-11-30 14:53:39 UTC
Review of attachment 364678 [details] [review]:

Looks good to me, patch applies and has the relevant constants