Gio.ListStore.insert_sorted

### Method

# Gio ListStoreinsert_sorted

since: 2.44

#### Declaration

    guint
    g_list_store_insert_sorted (
      GListStore* store,
      GObject* item,
      GCompareDataFunc compare_func,
      gpointer user_data
    )

#### Description

Inserts `item` into `store` at a position to be determined by the `compare_func`.

The list must already be sorted before calling this function or the result is undefined. Usually you would approach this by only ever inserting items by way of this function.

This function takes a ref on `item`.

Available since: 2.44

#### Parameters

`item`

  Type: `GObject`

  The new item.

  The data is owned by the caller of the method.

`compare_func`

  Type: `GCompareDataFunc`

  Pairwise comparison function for sorting.

`user_data`

  Type: `gpointer`

  User data for `compare_func`.

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

#### Return value

Type: `guint`

The position at which `item` was inserted.