bind_model


Description:

public void bind_model (ListModel? model, owned SidebarSectionCreateItemFunc? create_item_func)

Binds model to this.

If this was already bound to a model, that previous binding is destroyed.

The contents of this are cleared and then filled with items that represent items from model . this is updated whenever model changes.

If model is `NULL`, this is left empty.

Calling [method@SidebarSection.prepend], [method@SidebarSection.insert], [method@SidebarSection.append], [method@SidebarSection.remove] or [method@SidebarSection.remove_all] while a model is bound is not allowed.

Accessing items and modifying them is allowed, but the changes will be erased whenever that part of the model changes, so it's not recommended.

Parameters:

this

a sidebar section

model

the model to be bound

create_item_func

a function that creates [class@SidebarItem] for model items, or `NULL` in case model is also `NULL`

user_data

user data passed to create_widget_func

user_data_free_func

function for freeing user_data