GObject.Object.prototype.bind_property
function bind_property(source_property: String, target: GObject.Object, target_property: String, flags: GObject.BindingFlags): GObject.Binding { // Gjs wrapper for g_object_bind_property() }
Creates a binding between source_property on source and target_property on target. Whenever the source_property is changed the target_property is updated using the same value. For instance:
|[ g_object_bind_property (action, "active", widget, "sensitive", 0); ]|
Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.
If flags contains GObject.BindingFlags.bidirectional then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.
The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call GObject.Object.unref on the returned GObject.Binding instance.
A GObject.Object can have multiple bindings.
Since 2.26
- source_property
the property on source to bind
- target
the target GObject.Object
- target_property
the property on target to bind
- flags
flags to pass to GObject.Binding
- Returns
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.