GNOME Bugzilla – Bug 675582
Expose GObject property binding methods
Last modified: 2012-05-14 19:11:46 UTC
The following methods should be exposed on the GObject class: * bind_property * bind_property_full * bind_property_with_closures As described in the C library: http://developer.gnome.org/gobject/stable/GBinding.html
Confirmed.
Created attachment 213903 [details] [review] Added GObject.bind_property method and added exception for GObject.Binding This adds the "bind_property" method for binding two gobject properties together. The method returns a weak reference to a GBinding object. The BindingWeakRef object is used to manage GBinding objects within python created through GObject.bind_property. It is a sub-class PyGObjectWeakRef so that we can maintain the same reference counting semantics between Python and GObject Binding objects. This gives explicit direct control of the binding lifetime by using the "unbind" method on the BindingWeakRef object along with implicit management based on the lifetime of the source or target objects. Note this does not yet include support for converter closures. This can come later after the initial implementation is accepted. Also includes special case fix for: https://bugzilla.gnome.org/show_bug.cgi?id=675581
Thanks for this! I'm a bit hesitant about the override for the constructor though, I'd rather see bug 675581 be fixed properly (and it seems you are on a good way there, thanks!) I'll drop that part from the commit for now. There is a copy&paste error in a test case comment, I'll fix that. Pushed: http://git.gnome.org/browse/pygobject/commit/?id=6610428394d0c65987de5021bf2c38641cdb7116
Argh, and http://git.gnome.org/browse/pygobject/commit/?id=9477f0f2f17a6d9b97e5ee08378bc009b8d4c30a
Thanks for the fixups. I'll comment on https://bugzilla.gnome.org/show_bug.cgi?id=675581 separately as I actually didn't think I could do any better than the special case fix.