Re: One more Gobject Introspection issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14 September 2017 at 21:12, Stefan Salewski <mail@xxxxxxxxxxxx> wrote:
> GtkIconSize type is reported as plain gint, but it is an enum.

It's an "extensible" enumeration, like GtkResponseType for GtkDialog:
the API accepts an integer, because app and library developers can
register their own icon sizes, but GTK+ provides default icon sizes
out of the box.

It's a relatively unused functionality, these days.

> But here, again see last line of code segment:

>           <parameter name="size" transfer-ownership="none">
>             <doc xml:space="preserve">a stock icon size (#GtkIconSize)</doc>
>             <type name="gint" c:type="GtkIconSize"/>

All API that takes a GtkIconSize should have a `type int` annotation.
How you handle the translation between an enumeration value and an
integer is entirely up to your language binding; the Perl bindings,
for instance, have additional code that allows transforming strings
(and array of strings, for bitmasks) into integer values, whereas the
Python bindings simply turn enumeration names into integers after
resolving their name from "Namespace.TypeName.VALUE" to
"NAMESPACE_TYPENAME_VALUE". In both cases, integers are passed through
as they are, given that enumeration values in C are by definition
integers.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux