Method
ClutterActorbind_model_with_properties
Declaration [src]
void
clutter_actor_bind_model_with_properties (
ClutterActor* self,
GListModel* model,
GType child_type,
const char* first_model_property,
...
)
Description [src]
Binds a GListModel
to a ClutterActor
.
Unlike clutter_actor_bind_model(), this function automatically creates
a child ClutterActor
of type child_type
, and binds properties on the
items inside the model
to the corresponding properties on the child,
for instance:
clutter_actor_bind_model_with_properties (actor, model,
MY_TYPE_CHILD_VIEW,
"label", "text", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
"icon", "image", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
"selected", "selected", G_BINDING_BIDIRECTIONAL,
"active", "active", G_BINDING_BIDIRECTIONAL,
NULL);
is the equivalent of calling clutter_actor_bind_model()
with a
ClutterActorCreateChildFunc
of:
ClutterActor *res = g_object_new (MY_TYPE_CHILD_VIEW, NULL);
g_object_bind_property (item, "label", res, "text", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (item, "icon", res, "image", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (item, "selected", res, "selected", G_BINDING_BIDIRECTIONAL);
g_object_bind_property (item, "active", res, "active", G_BINDING_BIDIRECTIONAL);
return res;
If the ClutterActor
was already bound to a GListModel
, the previous
binding is destroyed.
When a ClutterActor
is bound to a model, adding and removing children
directly is undefined behaviour.
See also: clutter_actor_bind_model()
Available since: | 1.24 |
This method is not directly available to language bindings. |
Parameters
model |
GObject |
A |
|
The data is owned by the caller of the function. | |
child_type |
GType |
The type of |
|
first_model_property |
const char* |
The first property of |
|
The data is owned by the caller of the function. | |
The value is a NUL terminated UTF-8 string. | |
... |
|
Tuples of property names on the |