2012-07-16 12:45:17 |
Rumpeltux |
description |
Same for Gtk-2.0.gir
The get_iter method is overriden by models to return a custom iter. The GtkTreeIter is initialised by the caller and passed to the callee who will fill in the user_data attribute.
Since the direction is set to "out", the param cannot be passed to the callee (e.g. using pygobject).
This makes it impossible to implement custom TreeModels with pygobject.
A fix will be to change the direction to "inout" so that the argument gets passed to the callee.
<virtual-method name="get_iter" invoker="get_iter">
<doc xml:whitespace="preserve">Sets @iter to a valid iterator pointing to @path. If @path does
not exist, @iter is set to an invalid iterator and %FALSE is returned.</doc>
<return-value transfer-ownership="none">
<doc xml:whitespace="preserve">%TRUE, if @iter was set</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<parameter name="iter"
direction="out"
caller-allocates="1"
transfer-ownership="none">
<doc xml:whitespace="preserve">the uninitialized #GtkTreeIter</doc>
<type name="TreeIter" c:type="GtkTreeIter*"/>
</parameter>
<parameter name="path" transfer-ownership="none">
<doc xml:whitespace="preserve">the #GtkTreePath</doc>
<type name="TreePath" c:type="GtkTreePath*"/>
</parameter>
</parameters>
</virtual-method>
As a sidenote: What I do not understand though is how the handling of the return value happens. Apparently a tuple is expected with the first argument being the boolean return value and the second argument seems to be copied to the iter->stamp field (the first field of the struct). However, it does not seem possible to set the other struct's fields.
When returning anything else than a tuple, the following error is raised (which is ok though, because the calling convention requires to return a tuple there):
ERROR:/build/buildd/pygobject-3.2.2/gi/pygi-closure.c:317:_pygi_closure_set_out_arguments: code should not be reached |
Same for Gtk-2.0.gir
The get_iter method is overriden by models to return a custom iter. The GtkTreeIter is initialised by the caller and passed to the callee who will fill in the user_data attribute.
Since the direction is set to "out", the param cannot be passed to the callee (e.g. using pygobject).
This makes it impossible to implement custom TreeModels with pygobject.
A fix will be to change the direction to "in" so that the argument gets passed to the callee ("inout" seems not to work :/).
<field name="get_iter">
<callback name="get_iter">
<return-value transfer-ownership="none">
<doc xml:whitespace="preserve">%TRUE, if @iter was set</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<parameter name="tree_model" transfer-ownership="none">
<type name="TreeModel" c:type="GtkTreeModel*"/>
</parameter>
<parameter name="iter"
direction="in"
caller-allocates="1"
transfer-ownership="none">
<doc xml:whitespace="preserve">the uninitialized #GtkTreeIter</doc>
<type name="TreeIter" c:type="GtkTreeIter*"/>
</parameter>
<parameter name="path" transfer-ownership="none">
<doc xml:whitespace="preserve">the #GtkTreePath</doc>
<type name="TreePath" c:type="GtkTreePath*"/>
</parameter>
</parameters>
</callback>
</field>
As a sidenote: What I do not understand though is how the handling of the return value happens. Apparently a tuple is expected with the first argument being the boolean return value and the second argument seems to be copied to the iter->stamp field (the first field of the struct). However, it does not seem possible to set the other struct's fields.
When returning anything else than a tuple, the following error is raised (which is ok though, because the calling convention requires to return a tuple there):
ERROR:/build/buildd/pygobject-3.2.2/gi/pygi-closure.c:317:_pygi_closure_set_out_arguments: code should not be reached |
|