It derives from <GObject>.
A list model that maps the items in another model to different items.
<GtkMapListModel> uses a
GtkMapListModelMapFunc.
Example: Create a list of GtkEventControllers
static gpointer
map_to_controllers (gpointer widget,
gpointer data)
{
gpointer result = gtk_widget_observe_controllers (widget);
g_object_unref (widget);
return result;
}
widgets = gtk_widget_observe_children (widget);
controllers = gtk_map_list_model_new (widgets,
map_to_controllers,
NULL, NULL);
model = gtk_flatten_list_model_new (GTK_TYPE_EVENT_CONTROLLER,
controllers);
<GtkMapListModel> will attempt to discard the
mapped objects as soon as they are no longer needed and recreate them if
necessary.
<GtkMapListModel> passes through sections
from the underlying model.
If a map is set for this model
Its value is a boolean.
It is read only.
The type of items. See list-model:get-item-type.
Its value is a class, or a GType number.
It is read only.
The model being mapped.
Its value is a <GListModel>, or #f.
Set it with (set! (map-list-model:model self) value).
The number of items. See list-model:get-n-items.
Its value is an unsigned 32-bit integer.
It is read only.
Gets the model that is currently being mapped or #f if none.
Passed: a <GtkMapListModel>.
Returned: a <GListModel>, or #f.
The model that gets mapped
Checks if a map function is currently set on self.
Passed: a <GtkMapListModel>.
Returned: a boolean.
#t if a map function is set
Creates a new <GtkMapListModel> for the given
arguments.
Passed, or left out: a <GListModel>, or
#f.
The model to map
Passed, or left out: a procedure, or #f.
map function
See GtkMapListModelMapFunc for how it
is called.
Returned: a <GtkMapListModel>.
a new <GtkMapListModel>
Not passed: guile-gi supplies it.
user data passed to map-func
Not passed: guile-gi supplies it.
destroy notifier for user-data
See GDestroyNotify for how it is
called.
Sets the function used to map items.
The function will be called whenever an item needs to be mapped and must return the item to use for the given input item.
Note that <GtkMapListModel> may call this
function multiple times on the same item, because it may delete items it
doesn’t need anymore.
GTK makes no effort to ensure that map-func conforms to the item type of self. It assumes that the caller knows what they are doing and the map function returns items of the appropriate type.
Passed: a <GtkMapListModel>.
Passed, or left out: a procedure, or #f.
map function
See GtkMapListModelMapFunc for how it
is called.
Not passed: guile-gi supplies it.
user data passed to map-func
Not passed: guile-gi supplies it.
destroy notifier for user-data
See GDestroyNotify for how it is
called.
Sets the model to be mapped.
GTK makes no effort to ensure that model conforms to the item type expected by the map function. It assumes that the caller knows what they are doing and have set up an appropriate map function.
Passed: a <GtkMapListModel>.
Passed, or left out: a <GListModel>, or
#f.
The model to be mapped