GtkFilterListModel

GtkFilterListModel — A list model that filters its items

Properties

GtkFilter * filter Read / Write
GType * item-type Read / Write / Construct Only
GListModel * model Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GtkFilterListModel

Implemented Interfaces

GtkFilterListModel implements GListModel.

Includes

#include <gtk/gtk.h>

Description

GtkFilterListModel is a list model that filters a given other listmodel. It hides some elements from the other model according to criteria given by a GtkFilter.

Functions

gtk_filter_list_model_new ()

GtkFilterListModel *
gtk_filter_list_model_new (GListModel *model,
                           GtkFilter *filter);

Creates a new GtkFilterListModel that will filter model using the given filter .

Parameters

model

the model to sort

 

filter

filter or NULL to not filter items.

[allow-none]

Returns

a new GtkFilterListModel


gtk_filter_list_model_new_for_type ()

GtkFilterListModel *
gtk_filter_list_model_new_for_type (GType item_type);

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

Parameters

item_type

the type of the items that will be returned

 

Returns

a new GtkFilterListModel


gtk_filter_list_model_set_model ()

void
gtk_filter_list_model_set_model (GtkFilterListModel *self,
                                 GListModel *model);

Sets the model to be filtered.

Note that GTK makes no effort to ensure that model conforms to the item type of self . It assumes that the caller knows what they are doing and have set up an appropriate filter to ensure that item types match.

Parameters

self

a GtkFilterListModel

 

model

The model to be filtered.

[allow-none]

gtk_filter_list_model_get_model ()

GListModel *
gtk_filter_list_model_get_model (GtkFilterListModel *self);

Gets the model currently filtered or NULL if none.

Parameters

self

a GtkFilterListModel

 

Returns

The model that gets filtered.

[nullable][transfer none]


gtk_filter_list_model_set_filter ()

void
gtk_filter_list_model_set_filter (GtkFilterListModel *self,
                                  GtkFilter *filter);

Sets the filter used to filter items.

Parameters

self

a GtkFilterListModel

 

filter

filter to use or NULL to not filter items.

[allow-none][transfer none]

gtk_filter_list_model_get_filter ()

GtkFilter *
gtk_filter_list_model_get_filter (GtkFilterListModel *self);

Gets the GtkFilter currently set on self .

Parameters

self

a GtkFilterListModel

 

Returns

The filter currently in use or NULL if the list isn't filtered.

[nullable][transfer none]

Types and Values

GtkFilterListModel

typedef struct _GtkFilterListModel GtkFilterListModel;

Property Details

The “filter” property

  “filter”                   GtkFilter *

The filter for this model

Owner: GtkFilterListModel

Flags: Read / Write


The “item-type” property

  “item-type”                GType *

The GType for elements of this object

Owner: GtkFilterListModel

Flags: Read / Write / Construct Only

Allowed values: GObject


The “model” property

  “model”                    GListModel *

The model being filtered

Owner: GtkFilterListModel

Flags: Read / Write / Construct Only

See Also

GListModel, GtkFilter