Gtk.Sorter
Description: Reference for Gtk.Sorter

### Class

# GtkSorter

#### Description [src]

    class Gtk.Sorter : GObject.Object
    {
      /* No available fields */
    }

Describes sorting criteria for a `GtkSortListModel`.

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.

#### Ancestors

- GObject

#### Descendants

- GtkColumnViewSorter
- GtkCustomSorter
- GtkMultiSorter
- GtkNumericSorter
- GtkStringSorter
- GtkTreeListRowSorter

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

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

Please see GObject for a full list of methods.

#### Signals

###### Gtk.Sorter::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 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
      );

    }

The virtual table for `GtkSorter`.

###### Class members

`parent_class: GObjectClass`

  No description available.

`compare: GtkOrdering (* compare) ( GtkSorter* self, GObject* item1, GObject* item2 )`

  Compare two items. See `gtk_sorter_compare()` for details.

`get_order: GtkSorterOrder (* get_order) ( GtkSorter* self )`

  Get the `GtkSorderOrder` that applies to the current sorter. If unimplemented, it returns `GTK_SORTER_ORDER_PARTIAL`.

`_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.