1.69 <GtkFilter>

Class: <GtkFilter>

It derives from <GObject>.

Describes the filtering to be performed by a <GtkFilterListModel>.

The model will use the filter to determine if it should include items or not by calling filter:match? for each item and only keeping the ones that the function returns true for.

Filters may change what items they match through their lifetime. In that case, they will emit the filter:changed signal to notify that previous filter results are no longer valid and that items should be checked again via filter:match?.

GTK provides various pre-made filter implementations for common filtering operations. These filters often include properties that can be linked to various widgets to easily allow searches.

However, in particular for large lists or complex search methods, it is also possible to subclass <GtkFilter> and provide one’s own filter.

Fields

parent-instance

Procedures

Method: filter:changed self change
Method: changed self change

Notifies all users of the filter that it has changed.

This emits the filter:changed signal. Users of the filter should then check items again via filter:match?.

Depending on the change parameter, not all items need to be changed, but only some. Refer to the <GtkFilterChange> documentation for details.

This function is intended for implementers of <GtkFilter> subclasses and should not be called from other functions.

self

Passed: a <GtkFilter>.

a filter

change

Passed: a <GtkFilterChange>, or one of its symbols.

how the filter changed

Method: filter:get-strictness self ⇒ %return
Method: get-strictness self ⇒ %return

Gets the known strictness of a filter.

If the strictness is not known, Gtk.FilterMatch.some is returned.

This value may change after emission of the filter:changed signal.

This function is meant purely for optimization purposes. Filters can choose to omit implementing it, but <GtkFilterListModel> uses it.

self

Passed: a <GtkFilter>.

a filter

%return

Returned: a <GtkFilterMatch>.

the strictness of self

Method: filter:match? self item ⇒ %return
Method: match? self item ⇒ %return

Checks if the given item is matched by the filter or not.

self

Passed: a <GtkFilter>.

a filter

item

Passed: a <GObject>.

The item to check

%return

Returned: a boolean.

true if the filter matches the item

Signals

Signal: filter:changed

Connect a handler with (connect object filter:changed handler). It is called as (handler self change).

Emitted whenever the filter changed.

Users of the filter should then check items again via filter:match?.

<GtkFilterListModel> handles this signal automatically.

Depending on the change parameter, not all items need to be checked, but only some. Refer to the <GtkFilterChange> documentation for details.

self

Passed: a <GtkFilter>.

change

Passed: a <GtkFilterChange>.

how the filter changed

Virtual methods

Virtual method: filter:do-get-strictness implementor self ⇒ %return

Gets the known strictness of a filter.

If the strictness is not known, Gtk.FilterMatch.some is returned.

This value may change after emission of the filter:changed signal.

This function is meant purely for optimization purposes. Filters can choose to omit implementing it, but <GtkFilterListModel> uses it.

To override it in a new class, give register-type #:vfuncs `((get-strictness . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkFilter>, or a class that derives from it, or its GType number.

self

Passed: a <GtkFilter>.

a filter

%return

Returned: a <GtkFilterMatch>.

the strictness of self

Virtual method: filter:do-match implementor self [item] ⇒ %return

Checks if the given item is matched by the filter or not.

To override it in a new class, give register-type #:vfuncs `((match . ,procedure)). The procedure is called as (procedure self item) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkFilter>, or a class that derives from it, or its GType number.

self

Passed: a <GtkFilter>.

a filter

item

Passed, or left out: a <GObject>, or #f.

The item to check

%return

Returned: a boolean.

true if the filter matches the item