Gtk.ColumnViewSorter

g GObject.Object GObject.Object Gtk.Sorter Gtk.Sorter GObject.Object->Gtk.Sorter Gtk.ColumnViewSorter Gtk.ColumnViewSorter Gtk.Sorter->Gtk.ColumnViewSorter

Subclasses:

None

Methods

Inherited:

Gtk.Sorter (3), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_n_sort_columns ()

get_nth_sort_column (position)

get_primary_sort_column ()

get_primary_sort_order ()

Virtual Methods

Inherited:

Gtk.Sorter (2), GObject.Object (7)

Properties

Name

Type

Flags

Short Description

primary-sort-column

Gtk.ColumnViewColumn

r

primary-sort-order

Gtk.SortType

r

Signals

Inherited:

Gtk.Sorter (1), GObject.Object (1)

Fields

Inherited:

Gtk.Sorter (1), GObject.Object (1)

Class Details

class Gtk.ColumnViewSorter(**kwargs)
Bases:

Gtk.Sorter

Abstract:

No

Structure:

Gtk.ColumnViewSorterClass

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

The sorter returned by [method`Gtk`.ColumnView.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 [property`Gtk`.ColumnViewSorter:primary-sort-column] and [property`Gtk`.ColumnViewSorter: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 [method`Gtk`.ColumnViewSorter.get_nth_sort_column]. To get notified about changes, use [signal`Gtk`.Sorter::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);

}

``

New in version 4.10.

get_n_sort_columns()[source]
Returns:

the number of sort columns

Return type:

int

Returns the number of columns by which the sorter sorts.

If the sorter of the primary sort column does not determine a total order, then the secondary sorters are consulted to break the ties.

Use the [signal`Gtk`.Sorter::changed] signal to get notified when the number of sort columns changes.

New in version 4.10.

get_nth_sort_column(position)[source]
Parameters:

position (int) – the position of the sort column to retrieve (0 for the primary sort column)

Returns:

the positions sort column

sort_order:

return location for the sort order

Return type:

(Gtk.ColumnViewColumn or None, sort_order: Gtk.SortType)

Gets the position'th sort column and its associated sort order.

Use the [signal`Gtk`.Sorter::changed] signal to get notified when sort columns change.

New in version 4.10.

get_primary_sort_column()[source]
Returns:

the primary sort column

Return type:

Gtk.ColumnViewColumn or None

Returns the primary sort column.

The primary sort column is the one that displays the triangle in a column view header.

New in version 4.10.

get_primary_sort_order()[source]
Returns:

the primary sort order

Return type:

Gtk.SortType

Returns the primary sort order.

The primary sort order determines whether the triangle displayed in the column view header of the primary sort column points upwards or downwards.

If there is no primary sort column, then this function returns GTK_SORT_ASCENDING.

New in version 4.10.

Property Details

Gtk.ColumnViewSorter.props.primary_sort_column
Name:

primary-sort-column

Type:

Gtk.ColumnViewColumn

Default Value:

None

Flags:

READABLE

The primary sort column.

The primary sort column is the one that displays the triangle in a column view header.

New in version 4.10.

Gtk.ColumnViewSorter.props.primary_sort_order
Name:

primary-sort-order

Type:

Gtk.SortType

Default Value:

Gtk.SortType.ASCENDING

Flags:

READABLE

The primary sort order.

The primary sort order determines whether the triangle displayed in the column view header of the primary sort column points upwards or downwards.

New in version 4.10.