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 601425 - Change GtkIconSize to int in params/return values
Change GtkIconSize to int in params/return values
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2009-11-10 17:47 UTC by Dan Winship
Modified: 2015-02-07 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[Gtk] Change GtkIconSize to int in params/return values (5.37 KB, patch)
2009-11-10 17:47 UTC, Dan Winship
committed Details | Review

Description Dan Winship 2009-11-10 17:47:30 UTC
GtkIconSize is an enum type, but it's explicitly extensible; you can
register new icon sizes with gtk_icon_size_register(), and then methods
that take a GtkIconSize will accept that value and methods that return
a GtkIconSize may return it. (In particular, gtk_icon_size_register()
will never return an actual GtkIconSize value.)

This patches changes Gtk-2.0.gir to use "int" instead of "GtkIconSize"
everywhere (or at least, everywhere that we can change via annotations
that I know of; there's one place noted with a FIXME where an annotation
ought to be picked up but is not).

An alternative would be to explicitly tag GtkIconSize as being "non-strict"
and then let bindings DTRT thing with it. That would also solve the
GdkModifierType problem (bug 597292).
Comment 1 Dan Winship 2009-11-10 17:47:31 UTC
Created attachment 147393 [details] [review]
[Gtk] Change GtkIconSize to int in params/return values

GtkIconSize is an extensible enumeration (via
gtk_icon_size_register()), so methods that claim to take/return a
GtkIconSize need to actually use "int" to work correctly with bindings
that are strict about enum values.

Also fix up some "(out)" and "(transfer none)" in the gtk_image_get_*
methods while we're there.
Comment 2 Johan (not receiving bugmail) Dahlin 2009-12-02 12:48:19 UTC
Same should be done with GtkResponse or whatever the enum is called that GtkDialog uses for responses.
Comment 3 Colin Walters 2009-12-17 17:24:29 UTC
Review of attachment 147393 [details] [review]:

We need to add the annotations into GTK+ too now, but this looks fine for g-i.
Comment 4 Dan Winship 2009-12-18 10:17:12 UTC
So actually, this would be another good use for the meta-annotations
in bug 604658...

Attachment 147393 [details] pushed as 659b2b2 - [Gtk] Change GtkIconSize to int in params/return values
Comment 5 Torsten Schoenfeld 2009-12-31 11:01:52 UTC
For the record: this kind of change would badly break bindings that treat enums specially.  For example, the current non-gobject-introspection Perl bindings convert enum values to and from strings.  For extensible enum types like GtkIconSize we use custom handlers that use functionality like gtk_icon_size_get_name() and gtk_icon_size_from_name() to also convert newly registered icon sizes to and from strings.  All this magic can only work if GtkIconSize parameters have the correct type tag.

(The Perl bindings don't use gobject-introspection yet, so this is not an urgent problem.)
Comment 6 André Klapper 2015-02-07 16:55:32 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]