Gtk.TreeStore
Description: Reference for Gtk.TreeStore

### Class

# GtkTreeStore

deprecated: 4.10

#### Description [src]

    class Gtk.TreeStore : GObject.Object
      implements Gtk.Buildable, Gtk.TreeDragDest, Gtk.TreeDragSource, Gtk.TreeModel, Gtk.TreeSortable {
      priv: GtkTreeStorePrivate*
    }

A tree-like data structure that can be used with the `GtkTreeView`.

The `GtkTreeStore` object is a list model for use with a `GtkTreeView` widget. It implements the `GtkTreeModel` interface, and consequently, can use all of the methods available there. It also implements the `GtkTreeSortable` interface so it can be sorted by the view. Finally, it also implements the tree drag and drop interfaces.

`GtkTreeStore` is deprecated since GTK 4.10, and should not be used in newly written code. You should use `GtkTreeListModel` for a tree-like model object.

## GtkTreeStore as GtkBuildable

The GtkTreeStore implementation of the `GtkBuildable` interface allows to specify the model columns with a `<columns>` element that may contain multiple `<column>` elements, each specifying one model column. The “type” attribute specifies the data type for the column.

An example of a UI Definition fragment for a tree store:

    <object class="GtkTreeStore">
      <columns>
        <column type="gchararray"/>
        <column type="gchararray"/>
        <column type="gint"/>
      </columns>
    </object>

Deprecated since: 4.10

Use `GtkTreeListModel` instead.

#### Hierarchy

#### Ancestors

- GObject

#### Implements

- GtkBuildable
- GtkTreeDragDest
- GtkTreeDragSource
- GtkTreeModel
- GtkTreeSortable

#### Constructors

###### gtk_tree_store_new

Creates a new tree store.

deprecated: 4.10

###### gtk_tree_store_newv

Creates a new tree store.

deprecated: 4.10

#### Instance methods

###### gtk_tree_store_append

Appends a new row to `tree_store`.

deprecated: 4.10

###### gtk_tree_store_clear

Removes all rows from `tree_store`.

deprecated: 4.10

###### gtk_tree_store_insert

Creates a new row at `position`.

deprecated: 4.10

###### gtk_tree_store_insert_after

Inserts a new row after `sibling`.

deprecated: 4.10

###### gtk_tree_store_insert_before

Inserts a new row before `sibling`.

deprecated: 4.10

###### gtk_tree_store_insert_with_values

Creates a new row at the given `position`.

deprecated: 4.10

###### gtk_tree_store_insert_with_valuesv

A variant of `gtk_tree_store_insert_with_values()` which takes the columns and values as two arrays, instead of varargs.

deprecated: 4.10

###### gtk_tree_store_is_ancestor

Checks if `iter` is an ancestor of `descendant`.

deprecated: 4.10

###### gtk_tree_store_iter_depth

Returns the depth of the position pointed by the iterator.

deprecated: 4.10

###### gtk_tree_store_iter_is_valid

Checks if the given iter is a valid iter for this `GtkTreeStore`.

deprecated: 4.10

###### gtk_tree_store_move_after

Moves `iter` in `tree_store` to the position after `position`.

deprecated: 4.10

###### gtk_tree_store_move_before

Moves `iter` in `tree_store` to the position before `position`.

deprecated: 4.10

###### gtk_tree_store_prepend

Prepends a new row to `tree_store`.

deprecated: 4.10

###### gtk_tree_store_remove

Removes `iter` from `tree_store`.

deprecated: 4.10

###### gtk_tree_store_reorder

Reorders the children of `parent` in `tree_store` to follow the order indicated by `new_order`.

deprecated: 4.10

###### gtk_tree_store_set

Sets the value of one or more cells in the row referenced by `iter`.

deprecated: 4.10

###### gtk_tree_store_set_column_types

Sets the type of the columns in a tree store.

deprecated: 4.10

###### gtk_tree_store_set_valist

A version of `gtk_tree_store_set()` using `va_list`.

deprecated: 4.10

###### gtk_tree_store_set_value

Sets the data in the cell specified by `iter` and `column`.

deprecated: 4.10

###### gtk_tree_store_set_valuesv

A variant of `gtk_tree_store_set_valist()` which takes the columns and values as two arrays, instead of using variadic arguments.

deprecated: 4.10

###### gtk_tree_store_swap

Swaps `a` and `b` in the same level of `tree_store`.

deprecated: 4.10

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

Please see GObject for a full list of methods.

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

###### gtk_buildable_get_buildable_id

Gets the ID of the `buildable` object.

##### Methods inherited from GtkTreeDragDest (2)

###### gtk_tree_drag_dest_drag_data_received

Asks the `GtkTreeDragDest` to insert a row before the path `dest`, deriving the contents of the row from `value`. If `dest` is outside the tree so that inserting before it is impossible, `FALSE` will be returned. Also, `FALSE` may be returned if the new row is not created for some model-specific reason. Should robustly handle a `dest` no longer found in the model!

deprecated: 4.10

###### gtk_tree_drag_dest_row_drop_possible

Determines whether a drop is possible before the given `dest_path`, at the same depth as `dest_path`. i.e., can we drop the data in `value` at that location. `dest_path` does not have to exist; the return value will almost certainly be `FALSE` if the parent of `dest_path` doesn’t exist, though.

deprecated: 4.10

##### Methods inherited from GtkTreeDragSource (3)

###### gtk_tree_drag_source_drag_data_delete

Asks the `GtkTreeDragSource` to delete the row at `path`, because it was moved somewhere else via drag-and-drop. Returns `FALSE` if the deletion fails because `path` no longer exists, or for some model-specific reason. Should robustly handle a `path` no longer found in the model!

deprecated: 4.10

###### gtk_tree_drag_source_drag_data_get

Asks the `GtkTreeDragSource` to return a `GdkContentProvider` representing the row at `path`. Should robustly handle a `path` no longer found in the model!

deprecated: 4.10

###### gtk_tree_drag_source_row_draggable

Asks the `GtkTreeDragSource` whether a particular row can be used as the source of a DND operation. If the source doesn’t implement this interface, the row is assumed draggable.

deprecated: 4.10

##### Methods inherited from GtkTreeModel (28)

Please see GtkTreeModel for a full list of methods.

##### Methods inherited from GtkTreeSortable (6)

###### gtk_tree_sortable_get_sort_column_id

Fills in `sort_column_id` and `order` with the current sort column and the order. It returns `TRUE` unless the `sort_column_id` is `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID` or `GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID`.

deprecated: 4.10

###### gtk_tree_sortable_has_default_sort_func

Returns `TRUE` if the model has a default sort function. This is used primarily by GtkTreeViewColumns in order to determine if a model can go back to the default state, or not.

deprecated: 4.10

###### gtk_tree_sortable_set_default_sort_func

Sets the default comparison function used when sorting to be `sort_func`. If the current sort column id of `sortable` is `GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID`, then the model will sort using this function.

deprecated: 4.10

###### gtk_tree_sortable_set_sort_column_id

Sets the current sort column to be `sort_column_id`. The `sortable` will resort itself to reflect this change, after emitting a `GtkTreeSortable::sort-column-changed` signal. `sort_column_id` may either be a regular column id, or one of the following special values:

deprecated: 4.10

###### gtk_tree_sortable_set_sort_func

Sets the comparison function used when sorting to be `sort_func`. If the current sort column id of `sortable` is the same as `sort_column_id`, then the model will sort using this function.

deprecated: 4.10

###### gtk_tree_sortable_sort_column_changed

Emits a `GtkTreeSortable::sort-column-changed` signal on `sortable`.

deprecated: 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 GtkTreeModel (5)

###### GtkTreeModel::row-changed

This signal is emitted when a row in the model has changed.

###### GtkTreeModel::row-deleted

This signal is emitted when a row has been deleted.

###### GtkTreeModel::row-has-child-toggled

This signal is emitted when a row has gotten the first child row or lost its last child row.

###### GtkTreeModel::row-inserted

This signal is emitted when a new row has been inserted in the model.

###### GtkTreeModel::rows-reordered

This signal is emitted when the children of a node in the `GtkTreeModel` have been reordered.

##### Signals inherited from GtkTreeSortable (1)

###### GtkTreeSortable::sort-column-changed

The ::sort-column-changed signal is emitted when the sort column or sort order of `sortable` is changed. The signal is emitted before the contents of `sortable` are resorted.

#### Class structure

    struct GtkTreeStoreClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`
  No description available.