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 652941 - Problem with Gtk.Container.child_get_property
Problem with Gtk.Container.child_get_property
Status: RESOLVED DUPLICATE of bug 685076
Product: gtk+
Classification: Platform
Component: Widget: Other
3.4.x
Other Linux
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-06-19 14:12 UTC by the_isz
Modified: 2012-11-08 01:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description the_isz 2011-06-19 14:12:14 UTC
Steps to reproduce:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

hBox = Gtk.HBox()
button = Gtk.RadioButton()
hBox.pack_start(button, False, False, 0)
hBox.child_get_property(button, "expand")

Traceback (most recent call last):
  • File "<stdin>", line 5 in <module>
  • File "/usr/lib/python2.7/site-packages/gi/types.py", line 44 in function
    return info.invoke(*args)
TypeError: child_get_property() takes exactly 4 argument(s) (3 given)

OS: Arch Linux 64-bit
Component versions:
- python2: 2.7.2
- gtk3: 3.0.11
- gobject-introspection: 0.10.8
- pygobject: 2.28.4
Comment 1 johnp 2011-06-20 21:06:00 UTC
The value argument needs to be annotated (out caller-allocates) in Gtk but still that doesn't work.  Seems like we have an issue with GValue out values.  I'll have to debug that.  Is button.get_property("expand") different?
Comment 2 the_isz 2011-06-20 22:34:42 UTC
(In reply to comment #1)
> The value argument needs to be annotated (out caller-allocates) in Gtk but
> still that doesn't work.  Seems like we have an issue with GValue out values. 
> I'll have to debug that.  Is button.get_property("expand") different?

- hBox.child_get_property(button, "expand")
+ button.get_property("expand")

This doesn't cause any errors.
Comment 3 johnp 2011-06-20 22:52:20 UTC
What I meant is do they give you the same values or is the parent's "expand" property for a child different from the child's "expand" property?
Comment 4 the_isz 2011-06-21 06:48:55 UTC
(In reply to comment #3)
> What I meant is do they give you the same values or is the parent's "expand"
> property for a child different from the child's "expand" property?

Oh, sorry, I misunderstood that question. Well, button.get_property("expand")
returns False for me, but I can't tell for
hBox.child_get_property(button, "expand") as that one crashes as described.

Is there a way for me to tell you without using this function?
Comment 5 johnp 2011-06-21 15:52:38 UTC
write it in C but that doesn't prove anything even if they return the same values since it could just be coincidence.  I posed the question to #gtk+ in irc last night but no one was on who could answer it.  Can you see if you can get someone to describe the difference between the two methods.
Comment 6 the_isz 2011-06-22 08:57:02 UTC
Well, I can try to ask there, but I'm typically not hanging out on IRC every
day, so it may take me a while. Plus, I also found that channel to be very badly
frequented, so maybe some -devel channel might be a good idea to try, too.

But why exactly do you need to know what makes those functions different? We're
talking about those two here, right?

g_object_get_property
http://git.gnome.org/browse/glib/tree/gobject/gobject.c#n1935

gtk_container_child_get_property
http://git.gnome.org/browse/gtk+/tree/gtk/gtkcontainer.c#n946

I'm not experienced at reading C code, but they definitely do similar, yet
different stuff. If I'm not completely mistaken here, the problem is a broken
language binding, not the glib/gtk+ function they're binding to.
Comment 7 the_isz 2011-10-10 13:17:25 UTC
This bug also/still exists in 3.0.1.
Comment 8 Martin Pitt 2012-04-20 07:32:13 UTC
This still applies to pygobject 3.2.1 and current GTK 3.4.2.

This is not easily fixable, I'm afraid. The GValue* argument is not strictly "out", as it needs to be initialized and set to the correct type before calling the function. But you cannot initialize a GValue from Python (or any other scripting language), so by and large gtk_container_child_get_property() is not introspectable as it is.

Setting to "minor" as this has an obvious workaround (calling child.get_property()).

As we likely don't want to change the ABI/behaviour of gtk_container_child_get_property(), I suggest to just mark this method as (skip)? If it is useful for some cases, there could perhaps be a similar function which does the GValue initialization by itself, so that it can become a real (out) value?
Comment 9 Simon Feltman 2012-11-08 01:44:07 UTC
Marking as dup of bug 685076 (because that one has patches)

*** This bug has been marked as a duplicate of bug 685076 ***