Basics
Guides
API Reference
Basics
Guides
API Reference
[27:7] extends: object
A tree-like data structure that can be used with the [class@Gtk.TreeView].
The GtkTreeStore object is a list model for use with a GtkTreeView
widget. It implements the [iface@Gtk.TreeModel] interface, and consequently,
can use all of the methods available there. It also implements the
[iface@Gtk.TreeSortable] interface so it can be sorted by the view. Finally,
it also implements the tree [drag][iface@Gtk.TreeDragSource] and
[drop][iface@Gtk.TreeDragDest] interfaces. GtkTreeStore is deprecated since
GTK 4.10, and should not be used in newly written code. You should use
[class@Gtk.TreeListModel] 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: xml <object class="GtkTreeStore"> <columns> <column type="gchararray"/> <column type="gchararray"/> <column type="gint"/> </columns> </object>
TreeStore (Handle = null)
Creates a new
TreeStoreby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asTreeDragDest ()
Wraps this handle as
TreeDragDest.
A TreeDragDest object.asTreeDragSource ()
Wraps this handle as
TreeDragSource.
A TreeDragSource object.asTreeModel ()
Wraps this handle as
TreeModel.
A TreeModel object.asTreeSortable ()
Wraps this handle as
TreeSortable.
A TreeSortable object.clear ()
Removes all rows from @tree_store
None.is_ancestor (iter, descendant)
Checks if @iter is an ancestor of @descendant.
iter is A valid GtkTreeIter.descendant is A valid GtkTreeIter.iter_depth (iter)
Returns the depth of the position pointed by the iterator The depth will be 0 for anything on the root level, 1 for anything down a level, etc.
iter is A valid GtkTreeIter.iter_is_valid (iter)
Checks if the given iter is a valid iter for this
GtkTreeStore. This function is slow. Only use it for debugging and/or testing purposes.
iter is the iterator to check.move_after (iter, position)
Moves @iter in @tree_store to the position after @position. @iter and
should be in the same level. Note that this function only works with unsorted stores. If @position is %NULL, @iter will be moved to the start of the level.iter is A GtkTreeIter..position is A GtkTreeIter..None.move_before (iter, position)
Moves @iter in @tree_store to the position before @position. @iter and
should be in the same level. Note that this function only works with unsorted stores. If @position is %NULL, @iter will be moved to the end of the level.iter is A GtkTreeIter.position is A GtkTreeIter.None.remove (iter)
Removes @iter from @tree_store. After being removed, @iter is set to the next valid row at that level, or invalidated if it previously pointed to the last one.
iter is A valid GtkTreeIter.reorder (parent, list new_order)
Reorders the children of @parent in @tree_store to follow the order indicated by @new_order. Note that this function only works with unsorted stores.
parent is the parent of the children to re-order.new_order is an array of integers mapping the new position of each child to its old position before the re-ordering, i.e. new_order[newpos] = oldpos.None.set_value (iter, int column, object value)
Sets the data in the cell specified by @iter and @column. The type of
must be convertible to the type of the column.iter is A valid GtkTreeIter for the row being modified.column is column number to modify.value is new value for the cell.None.swap (a, b)
Swaps @a and @b in the same level of @tree_store. Note that this function only works with unsorted stores.
a is A GtkTreeIter..b is Another GtkTreeIter..None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.