### Class

# Gtk Sorter

#### Description [src]

    class Gtk.Sorter : GObject.Object {
      parent_instance: GObject
    }

`GtkSorter` is an object to describe sorting criteria.

Its primary user is `GtkSortListModel`

The model will use a sorter to determine the order in which its items should appear by calling gtk_sorter_compare() for pairs of items.

Sorters may change their sorting behavior through their lifetime. In that case, they will emit the `GtkSorter::changed` signal to notify that the sort order is no longer valid and should be updated by calling gtk_sorter_compare() again.

GTK provides various pre-made sorter implementations for common sorting operations. `GtkColumnView` has built-in support for sorting lists via the `GtkColumnViewColumn:sorter` property, where the user can change the sorting by clicking on list headers.

Of course, in particular for large lists, it is also possible to subclass `GtkSorter` and provide one’s own sorter.

#### Hierarchy

#### Ancestors

- GObject

#### Instance methods

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

#### Signals

###### Gtk.Sorter::changed

Emitted whenever the sorter changed.

#### Class structure

    struct GtkSorterClass {
      GObjectClass parent_class;
      GtkOrdering (* compare) (
        GtkSorter* self,
        GObject* item1,
        GObject* item2
      );
      GtkSorterOrder (* get_order) (
        GtkSorter* self
      );
      void (* _gtk_reserved1) (
    void
      );
      void (* _gtk_reserved2) (
    void
      );
      void (* _gtk_reserved3) (
    void
      );
      void (* _gtk_reserved4) (
    void
      );
      void (* _gtk_reserved5) (
    void
      );
      void (* _gtk_reserved6) (
    void
      );
      void (* _gtk_reserved7) (
    void
      );
      void (* _gtk_reserved8) (
    void
      );

    }

###### Class members

`parent_class` |
    GObjectClass
| No description available.
`compare` |
    GtkOrdering (* compare) (
        GtkSorter* self,
        GObject* item1,
        GObject* item2
      )
| No description available.
`get_order` |
    GtkSorterOrder (* get_order) (
        GtkSorter* self
      )
| No description available.
`_gtk_reserved1` |
    void (* _gtk_reserved1) (
    void
      )
| No description available.
`_gtk_reserved2` |
    void (* _gtk_reserved2) (
    void
      )
| No description available.
`_gtk_reserved3` |
    void (* _gtk_reserved3) (
    void
      )
| No description available.
`_gtk_reserved4` |
    void (* _gtk_reserved4) (
    void
      )
| No description available.
`_gtk_reserved5` |
    void (* _gtk_reserved5) (
    void
      )
| No description available.
`_gtk_reserved6` |
    void (* _gtk_reserved6) (
    void
      )
| No description available.
`_gtk_reserved7` |
    void (* _gtk_reserved7) (
    void
      )
| No description available.
`_gtk_reserved8` |
    void (* _gtk_reserved8) (
    void
      )
| No description available.

#### Virtual methods

###### Gtk.SorterClass.compare

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

###### Gtk.SorterClass.get_order

Gets the order that `self` conforms to.