Passing a GObjectClass into a function (with GooCanvas2)
- From: Zakariyya Mughal <zaki mughal gmail com>
- To: gtk-perl-list gnome org
- Subject: Passing a GObjectClass into a function (with GooCanvas2)
- Date: Sun, 1 Oct 2017 16:12:48 -0500
Hello folks,
I am trying to use a function that takes a GObjectClass as an argument
and I'm not sure how to get that using Glib::Object::Introspection.
In particular, I am trying to use the class method
`goo_canvas_item_class_list_child_properties()`
<https://developer.gnome.org/goocanvas2/stable/GooCanvasItem.html#goo-canvas-item-class-list-child-properties>.
It doesn't work if I pass it an instance:
0:main
$ GooCanvas2::CanvasItem::class_list_child_properties( GooCanvas2::CanvasTable->new )
(process:23169): GooCanvas-CRITICAL **: goo_canvas_item_class_list_child_properties: assertion
'G_IS_OBJECT_CLASS (iclass)' failed
[]
Or if I pass it the type name of the instance class or the derived GObjectClass
0:main
$ GooCanvas2::CanvasItem::class_list_child_properties( 'GooCanvas2::CanvasTable' )
Runtime error: need a hash ref to convert to struct of type ObjectClass at (eval 438) line 5.
0:main
$ GooCanvas2::CanvasItem::class_list_child_properties( 'GooCanvas2::CanvasTableClass' )
Runtime error: need a hash ref to convert to struct of type ObjectClass at (eval 440) line 5.
I noticed that the Python GIR bindings are able to work by doing
In [2]: from gi.repository import GooCanvas; GooCanvas.CanvasItem.class_list_child_properties(
GooCanvas.CanvasTable )
Out[2]:
[<GParamDouble 'left-padding'>,
<GParamDouble 'right-padding'>,
<GParamDouble 'top-padding'>,
<GParamDouble 'bottom-padding'>,
<GParamDouble 'x-align'>,
<GParamDouble 'y-align'>,
<GParamUInt 'row'>,
<GParamUInt 'column'>,
<GParamUInt 'rows'>,
<GParamUInt 'columns'>,
<GParamBoolean 'x-expand'>,
<GParamBoolean 'x-fill'>,
<GParamBoolean 'x-shrink'>,
<GParamBoolean 'y-expand'>,
<GParamBoolean 'y-fill'>,
<GParamBoolean 'y-shrink'>]
I noticed that Gtk3.pm has overrides for a similar class method in
`Gtk3::ContainerClass::list_child_properties`
<https://developer.gnome.org/gtk3/stable/GtkContainer.html#gtk-container-class-list-child-properties>,
<https://metacpan.org/source/XAOC/Gtk3-0.032/lib/Gtk3.pm#L993>,
but that works fine with the name of the container class.
0:main
$ 0 + @{ Gtk3::ContainerClass::list_child_properties( 'Gtk3::Table' ) }
8
In case it helps, I noticed that that GIR XML differs in that
`gtk_container_class_list_child_properties` specifies a <method> but
`goo_canvas_item_class_list_child_properties` specifies a <function>.
Regards,
- Zaki Mughal
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]