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 675582 - Expose GObject property binding methods
Expose GObject property binding methods
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-05-07 00:59 UTC by Simon Feltman
Modified: 2012-05-14 19:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Added GObject.bind_property method and added exception for GObject.Binding (13.28 KB, patch)
2012-05-12 03:46 UTC, Simon Feltman
none Details | Review

Description Simon Feltman 2012-05-07 00:59:59 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
Comment 1 Martin Pitt 2012-05-07 01:39:47 UTC
Confirmed.
Comment 2 Simon Feltman 2012-05-12 03:46:24 UTC
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
Comment 3 Martin Pitt 2012-05-14 13:48:00 UTC
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
Comment 5 Simon Feltman 2012-05-14 19:11:46 UTC
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.