GtkFilterListModel

GtkFilterListModel — a GListModel that filters its items

Functions

Types and Values

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

Functions

gtk_filter_list_model_new ()

GtkFilterListModel *
gtk_filter_list_model_new (GListModel *model,
                           GtkFilterListModelFilterFunc filter_func,
                           gpointer user_data,
                           GDestroyNotify user_destroy);

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

Parameters

model

the model to sort

 

filter_func

filter function or NULL to not filter items.

[allow-none]

user_data

user data passed to filter_func

 

user_destroy

destroy notifier for user_data

 

Returns

a new GtkFilterListModel


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_func ()

void
gtk_filter_list_model_set_filter_func (GtkFilterListModel *self,
                                       GtkFilterListModelFilterFunc filter_func,
                                       gpointer user_data,
                                       GDestroyNotify user_destroy);

Sets the function used to filter items. The function will be called for every item and if it returns TRUE the item is considered visible.

Parameters

self

a GtkFilterListModel

 

filter_func

filter function or NULL to not filter items.

[allow-none]

user_data

user data passed to filter_func

 

user_destroy

destroy notifier for user_data

 

gtk_filter_list_model_has_filter ()

gboolean
gtk_filter_list_model_has_filter (GtkFilterListModel *self);

Checks if a filter function is currently set on self

Parameters

self

a GtkFilterListModel

 

Returns

TRUE if a filter function is set


gtk_filter_list_model_refilter ()

void
gtk_filter_list_model_refilter (GtkFilterListModel *self);

Causes self to refilter all items in the model.

Calling this function is necessary when data used by the filter function has changed.

Parameters

self

a GtkFilterListModel

 

Types and Values

GtkFilterListModel

typedef struct _GtkFilterListModel GtkFilterListModel;

See Also

GListModel