Next: , Previous: GtkTreeModelSort, Up: Top


41 GtkTreeModelFilter

A GtkTreeModel which hides parts of an underlying tree model

41.1 Overview

A <gtk-tree-model-filter> is a tree model which wraps another tree model, and can do the following things:

Filter specific rows, based on data from a "visible column", a column storing booleans indicating whether the row should be filtered or not, or based on the return value of a "visible function", which gets a model, iter and user_data and returns a boolean indicating whether the row should be filtered or not.

Modify the "appearance" of the model, using a modify function. This is extremely powerful and allows for just changing some values and also for creating a completely different model based on the given child model.

Set a different root node, also known as a "virtual root". You can pass in a <gtk-tree-path> indicating the root node for the filter at construction time.

41.2 Usage

— Class: <gtk-tree-model-filter>

Derives from <gtk-tree-model>, <gtk-tree-drag-source>, <gobject>.

This class defines the following slots:

child-model
The model for the filtermodel to filter
virtual-root
The virtual root (relative to the child model) for this filtermodel
— Function: gtk-tree-model-filter-new (self <gtk-tree-model>) (root <gtk-tree-path>) ⇒  (ret <gtk-tree-model>)
— Method: filter-new

Creates a new <gtk-tree-model>, with child-model as the child_model and root as the virtual root.

child-model
A <gtk-tree-model>.
root
A <gtk-tree-path> or ‘#f’.
ret
A new <gtk-tree-model>.

Since 2.4

— Function: gtk-tree-model-filter-get-model (self <gtk-tree-model-filter>) ⇒  (ret <gtk-tree-model>)
— Method: get-model

Returns a pointer to the child model of filter.

filter
A <gtk-tree-model-filter>.
ret
A pointer to a <gtk-tree-model>.

Since 2.4

— Function: gtk-tree-model-filter-refilter (self <gtk-tree-model-filter>)
— Method: refilter

Emits ::row_changed for each row in the child model, which causes the filter to re-evaluate whether a row is visible or not.

filter
A <gtk-tree-model-filter>.

Since 2.4

— Function: gtk-tree-model-filter-clear-cache (self <gtk-tree-model-filter>)
— Method: clear-cache

This function should almost never be called. It clears the filter of any cached iterators that haven't been reffed with gtk-tree-model-ref-node. This might be useful if the child model being filtered is static (and doesn't change often) and there has been a lot of unreffed access to nodes. As a side effect of this function, all unreffed iters will be invalid.

filter
A <gtk-tree-model-filter>.

Since 2.4