Web lists-archives.com

One more Gobject Introspection issue




GtkIconSize type is reported as plain gint, but it is an enum.

For this function all is correct, see last line of code segment:

      <method name="set_icon_size" c:identifier="gtk_toolbar_set_icon_size">
        <doc xml:space="preserve">This function sets the size of stock icons in the toolbar. You
can call it both before you add the icons and after they’ve been
added. The size you set will override user preferences for the default
icon size.

This should only be used for special-purpose toolbars, normal
application toolbars should respect the user preferences for the
size of icons.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <instance-parameter name="toolbar" transfer-ownership="none">
            <doc xml:space="preserve">A #GtkToolbar</doc>
            <type name="Toolbar" c:type="GtkToolbar*"/>
          </instance-parameter>
          <parameter name="icon_size" transfer-ownership="none">
            <doc xml:space="preserve">The #GtkIconSize that stock icons in the toolbar shall have.</doc>
            <type name="IconSize" c:type="GtkIconSize"/>

But here, again see last line of code segment:

      <constructor name="new_from_icon_name"
                   c:identifier="gtk_image_new_from_icon_name"
                   version="2.6">
        <doc xml:space="preserve">Creates a #GtkImage displaying an icon from the current icon theme.
If the icon name isn’t known, a “broken image” icon will be
displayed instead.  If the current icon theme is changed, the icon
will be updated appropriately.</doc>
        <return-value transfer-ownership="none">
          <doc xml:space="preserve">a new #GtkImage displaying the themed icon</doc>
          <type name="Widget" c:type="GtkWidget*"/>
        </return-value>
        <parameters>
          <parameter name="icon_name"
                     transfer-ownership="none"
                     nullable="1"
                     allow-none="1">
            <doc xml:space="preserve">an icon name or %NULL</doc>
            <type name="utf8" c:type="const gchar*"/>
          </parameter>
          <parameter name="size" transfer-ownership="none">
            <doc xml:space="preserve">a stock icon size (#GtkIconSize)</doc>
            <type name="gint" c:type="GtkIconSize"/>

So ctype is GtkIconSize, but due to name="gint" I get from gobject-
introspection only plain gint=int32. Unfortunately there exists a few
functions with that bug, and it is some work fixing it manually. I will
investigate if there is a way to get the ctype from gobject-
introspection, but I think that that is not possible.

I think the problem is in the C header files, I have seen something
like (type int) for some function parameters with GtkIconSize data
type.

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list