### Class

# Gtk StringList

#### Description [src]

    final class Gtk.StringList : GObject.Object
      implements Gio.ListModel, Gtk.Buildable {
      /* No available fields */
    }

A list model that wraps an array of strings.

The objects in the model are of type `GtkStringObject` and have a “string” property that can be used inside expressions.

`GtkStringList` is well-suited for any place where you would typically use a `char*[]`, but need a list model.

## GtkStringList as GtkBuildable

The `GtkStringList` implementation of the `GtkBuildable` interface supports adding items directly using the `<items>` element and specifying `<item>` elements for each item. Each `<item>` element supports the regular translation attributes “translatable”, “context” and “comments”.

Here is a UI definition fragment specifying a `GtkStringList`

    <object class="GtkStringList">
      <items>
        <item translatable="yes">Factory</item>
        <item translatable="yes">Home</item>
        <item translatable="yes">Subway</item>
      </items>
    </object>

#### Ancestors

- GObject

#### Implements

- GListModel
- GtkBuildable

#### Constructors

###### gtk_string_list_new

Creates a new `GtkStringList` with the given `strings`.

#### Instance methods

###### gtk_string_list_append

Appends `string` to `self`.

###### gtk_string_list_find

Gets the position of the `string` in `self`.

since: 4.18

###### gtk_string_list_get_string

Gets the string that is at `position` in `self`.

###### gtk_string_list_remove

Removes the string at `position` from `self`.

###### gtk_string_list_splice

Changes `self` by removing `n_removals` strings and adding `additions` to it.

###### gtk_string_list_take

Adds `string` to self at the end, and takes ownership of it.

##### 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`.

###### g_list_model_get_item_type

Gets the type of the items in `list`.

###### g_list_model_get_n_items

Gets the number of items in `list`.

###### g_list_model_get_object

Get the item at `position`.

###### g_list_model_items_changed

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

##### Methods inherited from GtkBuildable (1)

###### gtk_buildable_get_buildable_id

Gets the ID of the `buildable` object.

#### Properties

###### Gtk.StringList:item-type

The type of items. See `g_list_model_get_item_type()`.

since: 4.14

###### Gtk.StringList:n-items

The number of items. See `g_list_model_get_n_items()`.

since: 4.14

###### Gtk.StringList:strings

The strings in the model.

since: 4.10

#### 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.

#### Class structure

    struct GtkStringListClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.