Sorts [classGtk.ColumnView] columns.
The sorter returned by [methodGtk.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 [propertyGtk.ColumnViewSorter:primary-sort-column] and [propertyGtk.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 [methodGtk.ColumnViewSorter.get_nth_sort_column]. To get notified about changes, use [signalGtk.Sorter::changed].
To restore a saved sort configuration on a GtkColumnView, use code like:
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); } ```
function Get_N_Sort_Columns
(Self : not null access Gtk_Column_View_Sorter_Record) return Guint
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 [signalGtk.Sorter::changed] signal to get notified when the number of sort columns changes. Since: gtk+ 4.10
the number of sort columns
function Get_Nth_Sort_Column
(Self : not null access Gtk_Column_View_Sorter_Record;
Position : Guint;
Sort_Order : out Gtk.Enums.Gtk_Sort_Type)
return Gtk.Column_View_Column.Gtk_Column_View_Column
Gets the Position'th sort column and its associated sort order. Use the [signalGtk.Sorter::changed] signal to get notified when sort columns change. Since: gtk+ 4.10
the position of the sort column to retrieve (0 for the primary sort column)
return location for the sort order
the sort column at the Position. Has transfer-ownership='none'.
function Get_Primary_Sort_Column
(Self : not null access Gtk_Column_View_Sorter_Record)
return Gtk.Column_View_Column.Gtk_Column_View_Column
Returns the primary sort column. The primary sort column is the one that displays the triangle in a column view header. Since: gtk+ 4.10
the primary sort column. Has transfer-ownership='none'.
function Get_Primary_Sort_Order
(Self : not null access Gtk_Column_View_Sorter_Record)
return Gtk.Enums.Gtk_Sort_Type
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. Since: gtk+ 4.10
the primary sort order
function Get_Type return Glib.GType
type Gtk_Column_View_Sorter is access all Gtk_Column_View_Sorter_Record'Class;
type Gtk_Column_View_Sorter_Record is new Gtk_Sorter_Record with null record;
Primary_Sort_Column_Property : constant Glib.Properties.Property_Object;
Type: Gtk.Column_View_Column.Gtk_Column_View_Column The primary sort column.
The primary sort column is the one that displays the triangle in a column view header.
Primary_Sort_Order_Property : constant Gtk.Enums.Property_Gtk_Sort_Type;
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.