GtkSortListModel

GtkSortListModel — A list model that sorts its items

Properties

GType * item-type Read / Write / Construct Only
GListModel * model Read / Write / Construct Only
GtkSorter * sorter Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GtkSortListModel

Implemented Interfaces

GtkSortListModel implements GListModel.

Includes

#include <gtk/gtk.h>

Description

GtkSortListModel is a list model that takes a list model and sorts its elements according to a GtkSorter.

GtkSortListModel is a generic model and because of that it cannot take advantage of any external knowledge when sorting. If you run into performance issues with GtkSortListModel, it is strongly recommended that you write your own sorting list model.

Functions

gtk_sort_list_model_new ()

GtkSortListModel *
gtk_sort_list_model_new (GListModel *model,
                         GtkSorter *sorter);

Creates a new sort list model that uses the sorter to sort model .

Parameters

model

the model to sort

 

sorter

the GtkSorter to sort model with.

[allow-none]

Returns

a new GtkSortListModel


gtk_sort_list_model_new_for_type ()

GtkSortListModel *
gtk_sort_list_model_new_for_type (GType item_type);

Creates a new empty sort list model set up to return items of type item_type . It is up to the application to set a proper sort function and model to ensure the item type is matched.

Parameters

item_type

the type of the items that will be returned

 

Returns

a new GtkSortListModel


gtk_sort_list_model_set_sorter ()

void
gtk_sort_list_model_set_sorter (GtkSortListModel *self,
                                GtkSorter *sorter);

Sets a new sorter on self .

Parameters

self

a GtkSortListModel

 

sorter

the GtkSorter to sort model with.

[allow-none]

gtk_sort_list_model_get_sorter ()

GtkSorter *
gtk_sort_list_model_get_sorter (GtkSortListModel *self);

Gets the sorter that is used to sort self .

Parameters

self

a GtkSortLisTModel

 

Returns

the sorter of self.

[nullable][transfer none]


gtk_sort_list_model_set_model ()

void
gtk_sort_list_model_set_model (GtkSortListModel *self,
                               GListModel *model);

Sets the model to be sorted. The model 's item type must conform to the item type of self .

Parameters

self

a GtkSortListModel

 

model

The model to be sorted.

[allow-none]

gtk_sort_list_model_get_model ()

GListModel *
gtk_sort_list_model_get_model (GtkSortListModel *self);

Gets the model currently sorted or NULL if none.

Parameters

self

a GtkSortListModel

 

Returns

The model that gets sorted.

[nullable][transfer none]

Types and Values

GtkSortListModel

typedef struct _GtkSortListModel GtkSortListModel;

Property Details

The “item-type” property

  “item-type”                GType *

The GType for items of this model

Owner: GtkSortListModel

Flags: Read / Write / Construct Only

Allowed values: GObject


The “model” property

  “model”                    GListModel *

The model being sorted

Owner: GtkSortListModel

Flags: Read / Write / Construct Only


The “sorter” property

  “sorter”                   GtkSorter *

The sorter for this model

Owner: GtkSortListModel

Flags: Read / Write

See Also

GListModel, GtkSorter