### Method

# Adw SidebarSection bind_model

since: 1.9

#### Declaration [src]

    void
    adw_sidebar_section_bind_model (
      AdwSidebarSection* self,
      GListModel* model,
      AdwSidebarSectionCreateItemFunc create_item_func,
      gpointer user_data,
      GDestroyNotify user_data_free_func
    )

#### Description [src]

Binds `model` to `self`.

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

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

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

Calling `adw_sidebar_section_prepend()`, `adw_sidebar_section_insert()`, `adw_sidebar_section_append()`, `adw_sidebar_section_remove()` or `adw_sidebar_section_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.

Available since: 1.9

#### Parameters

`model`

  Type: `GObject`

  The model to be bound.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`create_item_func`

  Type: `AdwSidebarSectionCreateItemFunc`

      a function that creates <a href="class.SidebarItem.html"><code>AdwSidebarItem</code></a> for model items, or `NULL` in
      case `model` is also `NULL`.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  User data passed to `create_widget_func`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`user_data_free_func`

  Type: `GDestroyNotify`

  Function for freeing `user_data`.