summaryrefslogtreecommitdiff
path: root/gi/overrides/Gtk.py
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2014-05-25 21:08:47 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2014-05-25 22:13:48 -0700
commit6f5a9a37bcdec5074332b1066396321d40b15d99 (patch)
treecd9cae5eee6e6644b8b0b2bfc021342a40ae1205 /gi/overrides/Gtk.py
parentbf84915f89fd5fd502b4fb162eef7bc0a48c8783 (diff)
downloadpygobject-6f5a9a37bcdec5074332b1066396321d40b15d99.tar.gz
overrides: Make value argument to Container.child_get_property optional
Override Gtk.Container.child_get_property to optionally accept the "value" argument. If "value" is not supplied, the override will locate the child property value type and create the GValue. Additionally return the resulting GValue converted to a native Python value. https://bugzilla.gnome.org/show_bug.cgi?id=685076
Diffstat (limited to 'gi/overrides/Gtk.py')
-rw-r--r--gi/overrides/Gtk.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index bd3d42a0..060798b1 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -110,6 +110,17 @@ class Container(Gtk.Container, Widget):
get_focus_chain = strip_boolean_result(Gtk.Container.get_focus_chain)
+ def child_get_property(self, child, property_name, value=None):
+ if value is None:
+ prop = self.find_child_property(property_name)
+ if prop is None:
+ raise ValueError('Class "%s" does not contain child property "%s"' %
+ (self, property_name))
+ value = GObject.Value(prop.value_type)
+
+ Gtk.Container.child_get_property(self, child, property_name, value)
+ return value.get_value()
+
Container = override(Container)
__all__.append('Container')