Gio.ListStore
Description: Reference for Gio.ListStore

### Class

# GioListStore

#### Description [src]

    final class Gio.ListStore : GObject.Object
      implements Gio.ListModel {
      /* No available fields */
    }

`GListStore` is a simple implementation of `GListModel` that stores all items in memory.

It provides insertions, deletions, and lookups in logarithmic time with a fast path for the common case of iterating the list linearly.

#### Ancestors

- GObject

#### Implements

- GListModel

#### Constructors

###### g_list_store_new

Creates a new `GListStore` with items of type `item_type`. `item_type` must be a subclass of `GObject`.

since: 2.44

#### Instance methods

###### g_list_store_append

Appends `item` to `store`. `item` must be of type `GListStore:item-type`.

since: 2.44

###### g_list_store_find

Looks up the given `item` in the list store by looping over the items until the first occurrence of `item`. If `item` was not found, then `position` will not be set, and this method will return `FALSE`.

since: 2.64

###### g_list_store_find_with_equal_func

Looks up the given `item` in the list store by looping over the items and comparing them with `equal_func` until the first occurrence of `item` which matches. If `item` was not found, then `position` will not be set, and this method will return `FALSE`.

since: 2.64

###### g_list_store_find_with_equal_func_full

Like `g_list_store_find_with_equal_func()` but with an additional `user_data` that is passed to `equal_func`.

since: 2.74

###### g_list_store_insert

Inserts `item` into `store` at `position`. `item` must be of type `GListStore:item-type` or derived from it. `position` must be smaller than the length of the list, or equal to it to append.

since: 2.44

###### g_list_store_insert_sorted

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

since: 2.44

###### g_list_store_remove

Removes the item from `store` that is at `position`. `position` must be smaller than the current length of the list.

since: 2.44

###### g_list_store_remove_all

Removes all items from `store`.

since: 2.44

###### g_list_store_sort

Sort the items in `store` according to `compare_func`.

since: 2.46

###### g_list_store_splice

Changes `store` by removing `n_removals` items and adding `n_additions` items to it. `additions` must contain `n_additions` items of type `GListStore:item-type`. `NULL` is not permitted.

since: 2.44

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GListModel (5)

###### g_list_model_get_item

Get the item at `position`.

since: 2.44

###### g_list_model_get_item_type

Gets the type of the items in `list`.

since: 2.44

###### g_list_model_get_n_items

Gets the number of items in `list`.

since: 2.44

###### g_list_model_get_object

Get the item at `position`.

since: 2.44

###### g_list_model_items_changed

Emits the `GListModel::items-changed` signal on `list`.

since: 2.44

#### Properties

###### Gio.ListStore:item-type

The type of items contained in this list store. Items must be subclasses of `GObject`.

since: 2.44

###### Gio.ListStore:n-items

The number of items contained in this list store.

since: 2.74

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

##### Signals inherited from GListModel (1)

###### GListModel::items-changed

This signal is emitted whenever items were added to or removed from `list`. At `position`, `removed` items were removed and `added` items were added in their place.

since: 2.44

#### Class structure

    struct GioListStoreClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.