Back to Seed Clases

GObject


Classes

Interfaces

Structs

Unions

Enums

GObject.Object
parent-child marker GObject.Binding

Class GObject.Binding

Import line: GObject = imports.gi.GObject;
GIR File: GObject-2.0.gir
C documentation: GBinding
Class : Binding
Extends: GObject.Object
GBinding is the representation of a binding between a property on a
GObject instance (or source) and another property on another GObject
instance (or target). Whenever the source property changes, the same
value is applied to the target property; for instance, the following
binding:
|[
g_object_bind_property (object1, "property-a",
object2, "property-b",
G_BINDING_DEFAULT);
]|
will cause object2:property-b to be updated every
time g_object_set() or the specific accessor changes the value of
object1:property-a.
It is possible to create a bidirectional binding between two properties
of two GObject instances, so that if either property changes, the
other is updated as well, for instance:
|[
g_object_bind_property (object1, "property-a",
object2, "property-b",
G_BINDING_BIDIRECTIONAL);
]|
will keep the two properties in sync.
It is also possible to set a custom transformation function (in both
directions, in case of a bidirectional binding) to apply a custom
transformation from the source value to the target value before
applying it; for instance, the following binding:
|[
g_object_bind_property_full (adjustment1, "value",
adjustment2, "value",
G_BINDING_BIDIRECTIONAL,
celsius_to_fahrenheit,
fahrenheit_to_celsius,
NULL, NULL);
]|
will keep the value property of the two adjustments
in sync; the celsius_to_fahrenheit function will be
called whenever the adjustment1:value property changes
and will transform the current value of the property before applying it
to the adjustment2:value property; vice versa, the
fahrenheit_to_celsius function will be called whenever
the adjustment2:value property changes, and will
transform the current value of the property before applying it to the
adjustment1:value.
Note that GBinding does not resolve cycles by itself; a cycle like
|[
object1:propertyA -> object2:propertyB
object2:propertyB -> object3:propertyC
object3:propertyC -> object1:propertyA
]|
might lead to an infinite loop. The loop, in this particular case,
can be avoided if the objects emit the GObject::notify signal only
if the value has effectively been changed. A binding is implemented
using the GObject::notify signal, so it is susceptible to all the
various ways of blocking a signal emission, like g_signal_stop_emission()
or g_signal_handler_block().
A binding will be severed, and the resources it allocates freed, whenever
either one of the GObject instances it refers to are finalized, or when
the GBinding instance loses its last reference.
GBinding is available since GObject 2.26
Properties
Properties Defined By
Methods / Constructors
Method / Constructor Defined By
Events
None
Used by These Methods / Signals / Properties
Class / Namespace Method / Signal / Properties
GObject.InitiallyUnowned
Method
GObject.InitiallyUnowned.bind_property (void* source, String source_property, void* target, String target_property, BindingFlags flags) : GObject.Binding
Creates a binding between source_property on source and target_property
on target.
GObject.InitiallyUnowned
Method
GObject.InitiallyUnowned.bind_property_full (void* source, String source_property, void* target, String target_property, BindingFlags flags, Closure transform_to, Closure transform_from) : GObject.Binding
Complete version of g_object_bind_property().
TelepathyGLib.Account
Method
bind_connection_status_to_property (void* target, String target_property, gboolean invert) : GObject.Binding
TelepathyGLib.Connection
Method
bind_connection_status_to_property (void* target, String target_property, gboolean invert) : GObject.Binding
Documentation generated by Introspection Doc Generator Loosely Based on JsDoc Toolkit on Sat Apr 16 2011 17:10:42 GMT+0800 (HKT)