### Class

# GtkColumnViewSorter

since: 4.10

#### Description [src]

    final class Gtk.ColumnViewSorter : Gtk.Sorter
    {
      /* No available fields */
    }

`GtkColumnViewSorter` is a sorter implementation that is geared towards the needs of `GtkColumnView`.

The sorter returned by `gtk_column_view_get_sorter()` is a `GtkColumnViewSorter`.

In column views, sorting can be configured by associating sorters with columns, and users can invert sort order by clicking on column headers. The API of `GtkColumnViewSorter` is designed to allow saving and restoring this configuration.

If you are only interested in the primary sort column (i.e. the column where a sort indicator is shown in the header), then you can just look at `GtkColumnViewSorter:primary-sort-column` and `GtkColumnViewSorter:primary-sort-order`.

If you want to store the full sort configuration, including secondary sort columns that are used for tie breaking, then you can use `gtk_column_view_sorter_get_nth_sort_column()`. To get notified about changes, use `GtkSorter::changed`.

To restore a saved sort configuration on a `GtkColumnView`, use code like:

    sorter = gtk_column_view_get_sorter (view);
    for (i = gtk_column_view_sorter_get_n_sort_columns (sorter) - 1; i >= 0; i--)
      {
        column = gtk_column_view_sorter_get_nth_sort_column (sorter, i, &order);
        gtk_column_view_sort_by_column (view, column, order);
      }

Available since: 4.10

#### Hierarchy

#### Ancestors

- GtkSorter
- GObject

#### Instance methods

###### gtk_column_view_sorter_get_n_sort_columns

Returns the number of columns by which the sorter sorts.

since: 4.10

###### gtk_column_view_sorter_get_nth_sort_column

Gets the `position`‘th sort column and its associated sort order.

since: 4.10

###### gtk_column_view_sorter_get_primary_sort_column

Returns the primary sort column.

since: 4.10

###### gtk_column_view_sorter_get_primary_sort_order

Returns the primary sort order.

since: 4.10

##### Methods inherited from GtkSorter (3)

###### gtk_sorter_changed

Notifies all users of the sorter that it has changed.

###### gtk_sorter_compare

Compares two given items according to the sort order implemented by the sorter.

###### gtk_sorter_get_order

Gets the order that `self` conforms to.

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

Please see GObject for a full list of methods.

#### Properties

###### Gtk.ColumnViewSorter:primary-sort-column

The primary sort column.

since: 4.10

###### Gtk.ColumnViewSorter:primary-sort-order

The primary sort order.

since: 4.10

#### Signals

##### Signals inherited from GtkSorter (1)

###### GtkSorter::changed

Emitted whenever the sorter changed.

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

#### Class structure

    struct GtkColumnViewSorterClass {
      GtkSorterClass parent_class;

    }

No description available.

###### Class members

`parent_class: GtkSorterClass`
  No description available.