Gtk.TreeSortable
Description: Reference for Gtk.TreeSortable

### Interface

# GtkTreeSortable

deprecated: 4.10

#### Description [src]

    interface Gtk.TreeSortable : Gtk.TreeModel

The interface for sortable models used by GtkTreeView

`GtkTreeSortable` is an interface to be implemented by tree models which support sorting. The `GtkTreeView` uses the methods provided by this interface to sort the model.

Deprecated since: 4.10

There is no replacement for this interface. You should use `GtkSortListModel` to wrap your list model instead.

#### Prerequisite

In order to implement TreeSortable, your type must inherit from`GtkTreeModel`.

#### Implementations

- GtkListStore
- GtkTreeModelSort
- GtkTreeStore

#### Instance methods

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

###### Gtk.TreeSortable::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.

#### Interface structure

    struct GtkTreeSortableIface {
      void (* sort_column_changed) (
        GtkTreeSortable* sortable
      );
      gboolean (* get_sort_column_id) (
        GtkTreeSortable* sortable,
        int* sort_column_id,
        GtkSortType* order
      );
      void (* set_sort_column_id) (
        GtkTreeSortable* sortable,
        int sort_column_id,
        GtkSortType order
      );
      void (* set_sort_func) (
        GtkTreeSortable* sortable,
        int sort_column_id,
        GtkTreeIterCompareFunc sort_func,
        gpointer user_data,
        GDestroyNotify destroy
      );
      void (* set_default_sort_func) (
        GtkTreeSortable* sortable,
        GtkTreeIterCompareFunc sort_func,
        gpointer user_data,
        GDestroyNotify destroy
      );
      gboolean (* has_default_sort_func) (
        GtkTreeSortable* sortable
      );

    }

No description available.

###### Interface members

`sort_column_changed` |
    void (* sort_column_changed) (
        GtkTreeSortable* sortable
      )
| Signal emitted when the sort column or sort order of sortable is changed.
`get_sort_column_id` |
    gboolean (* get_sort_column_id) (
        GtkTreeSortable* sortable,
        int* sort_column_id,
        GtkSortType* order
      )
| Fills in sort_column_id and order with the current sort column and the order.
`set_sort_column_id` |
    void (* set_sort_column_id) (
        GtkTreeSortable* sortable,
        int sort_column_id,
        GtkSortType order
      )
| Sets the current sort column to be sort_column_id.
`set_sort_func` |
    void (* set_sort_func) (
        GtkTreeSortable* sortable,
        int sort_column_id,
        GtkTreeIterCompareFunc sort_func,
        gpointer user_data,
        GDestroyNotify destroy
      )
| Sets the comparison function used when sorting to be sort_func.
`set_default_sort_func` |
    void (* set_default_sort_func) (
        GtkTreeSortable* sortable,
        GtkTreeIterCompareFunc sort_func,
        gpointer user_data,
        GDestroyNotify destroy
      )
| Sets the default comparison function used when sorting to be sort_func.
`has_default_sort_func` |
    gboolean (* has_default_sort_func) (
        GtkTreeSortable* sortable
      )
| `TRUE` if the model has a default sort function.

#### Virtual methods

###### Gtk.TreeSortable.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.TreeSortable.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.TreeSortable.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.TreeSortable.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.TreeSortable.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.TreeSortable.sort_column_changed

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

deprecated: 4.10