mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-09 02:46:16 +01:00
docs: Move the GBinding SECTION
Move the content into the struct docs. Helps: #3037
This commit is contained in:
parent
6d460f6c7e
commit
e7720a2c1a
@ -21,36 +21,33 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gbinding
|
||||
* @Title: GBinding
|
||||
* @Short_Description: Bind two object properties
|
||||
* GBinding:
|
||||
*
|
||||
* #GBinding is the representation of a binding between a property on a
|
||||
* #GObject instance (or source) and another property on another #GObject
|
||||
* `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:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* ```c
|
||||
* g_object_bind_property (object1, "property-a",
|
||||
* object2, "property-b",
|
||||
* G_BINDING_DEFAULT);
|
||||
* ]|
|
||||
* ```
|
||||
*
|
||||
* will cause the property named "property-b" of @object2 to be updated
|
||||
* every time g_object_set() or the specific accessor changes the value of
|
||||
* every time [method@GObject.set] or the specific accessor changes the value of
|
||||
* the property "property-a" of @object1.
|
||||
*
|
||||
* It is possible to create a bidirectional binding between two properties
|
||||
* of two #GObject instances, so that if either property changes, the
|
||||
* of two `GObject` instances, so that if either property changes, the
|
||||
* other is updated as well, for instance:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* ```c
|
||||
* g_object_bind_property (object1, "property-a",
|
||||
* object2, "property-b",
|
||||
* G_BINDING_BIDIRECTIONAL);
|
||||
* ]|
|
||||
* ```
|
||||
*
|
||||
* will keep the two properties in sync.
|
||||
*
|
||||
@ -59,14 +56,14 @@
|
||||
* transformation from the source value to the target value before
|
||||
* applying it; for instance, the following binding:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* ```c
|
||||
* 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 "value"
|
||||
@ -80,29 +77,29 @@
|
||||
*
|
||||
* 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
|
||||
* 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().
|
||||
* using the `GObject::notify` signal, so it is susceptible to all the
|
||||
* various ways of blocking a signal emission, like [func@GObject.signal_stop_emission]
|
||||
* or [func@GObject.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
|
||||
* either one of the `GObject` instances it refers to are finalized, or when
|
||||
* the #GBinding instance loses its last reference.
|
||||
*
|
||||
* Bindings for languages with garbage collection can use
|
||||
* g_binding_unbind() to explicitly release a binding between the source
|
||||
* [method@GObject.Binding.unbind] to explicitly release a binding between the source
|
||||
* and target properties, instead of relying on the last reference on the
|
||||
* binding, source, and target instances to drop.
|
||||
*
|
||||
* #GBinding is available since GObject 2.26
|
||||
* Since: 2.26
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -38,14 +38,6 @@ G_BEGIN_DECLS
|
||||
#define G_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_BINDING, GBinding))
|
||||
#define G_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_BINDING))
|
||||
|
||||
/**
|
||||
* GBinding:
|
||||
*
|
||||
* GBinding is an opaque structure whose members
|
||||
* cannot be accessed directly.
|
||||
*
|
||||
* Since: 2.26
|
||||
*/
|
||||
typedef struct _GBinding GBinding;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user