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()4.

This method is not directly available to language bindings.

Parameters

model

Type: GObject

A GListModel.

The data is owned by the caller of the method.
child_type

Type: GType

The type of ClutterActor to use when creating children mapping to items inside the model.

first_model_property

Type: const char*

The first property of model to bind.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
...

Type: 

Tuples of property names on the model, on the child, and the GBindingFlags used to bind them, terminated by NULL.