Dee.Filter

Fields

Name

Type

Access

Description

destroy

GLib.DestroyNotify

r/w

Callback for freeing the user_data userdata (closure): Free form user data associated with the filter. This pointer will be passed to map_func and map_notify

map_func

Dee.FilterMapFunc

r/w

The #DeeModelMapFunc used to construct the initial contents of a Dee.FilterModel

map_notify

Dee.FilterMapNotify

r/w

Callback invoked when the original model changes

userdata

object

r/w

Methods

class

new (map_func, map_notify, *userdata)

class

new_collator (column)

class

new_collator_desc (column)

class

new_for_any_column (column, value)

class

new_for_key_column (column, key)

class

new_regex (column, regex)

class

new_sort (cmp_row, *cmp_user_data)

map (orig_model, filter_model)

notify (orig_iter, orig_model, filter_model)

Details

class Dee.Filter

Structure encapsulating the mapping logic used to construct a Dee.FilterModel

classmethod new(map_func, map_notify, *userdata)
Parameters:
Returns:

A pointer to an uninitialized Dee.Filter struct. This struct will zeroed and configured with the filter parameters

Return type:

out_filter: Dee.Filter

Create a new Dee.Filter with the given parameters. This call will zero the out_filter struct.

classmethod new_collator(column)
Parameters:

column (int) – The index of a column containing the strings to sort after

Returns:

A pointer to an uninitialized Dee.Filter struct. This struct will zeroed and configured with the filter parameters

Return type:

out_filter: Dee.Filter

Create a Dee.Filter that takes string values from a column in the model and builds a Dee.FilterModel with the rows sorted according to the collation rules of the current locale.

classmethod new_collator_desc(column)
Parameters:

column (int) – The index of a column containing the strings to sort after

Returns:

A pointer to an uninitialized Dee.Filter struct. This struct will zeroed and configured with the filter parameters

Return type:

out_filter: Dee.Filter

Create a Dee.Filter that takes string values from a column in the model and builds a Dee.FilterModel with the rows sorted descending according to the collation rules of the current locale.

classmethod new_for_any_column(column, value)
Parameters:
  • column (int) – The index of a column containing the string to match

  • value (GLib.Variant) – A GLib.Variant value columns must match exactly. The matching semantics are those of GLib.Variant.equal(). If value is floating the ownership will be transfered to the filter

Returns:

A pointer to an uninitialized Dee.Filter struct. This struct will zeroed and configured with the filter parameters

Return type:

out_filter: Dee.Filter

Create a Dee.Filter that only includes rows from the original model which match a variant value in a given column. A Dee.FilterModel created with this filter will be ordered in accordance with its parent model.

This method will work on any column, disregarding its schema, since the value comparison is done using GLib.Variant.equal(). This means you can use this filter as a convenient fallback when there is no predefined filter for your column type if raw performance is not paramount.

classmethod new_for_key_column(column, key)
Parameters:
  • column (int) – The index of a column containing the string key to match

  • key (str) –

Returns:

A pointer to an uninitialized Dee.Filter struct. This struct will zeroed and configured with the filter parameters

Return type:

out_filter: Dee.Filter

Create a Dee.Filter that only includes rows from the original model which has an exact match on some string column. A Dee.FilterModel created with this filter will be ordered in accordance with its parent model.

classmethod new_regex(column, regex)
Parameters:
  • column (int) – The index of a column containing the string to match

  • regex (GLib.Regex) – The regular expression column must match

Returns:

A pointer to an uninitialized Dee.Filter struct. This struct will zeroed and configured with the filter parameters

Return type:

out_filter: Dee.Filter

Create a Dee.Filter that only includes rows from the original model which match a regular expression on some string column. A Dee.FilterModel created with this filter will be ordered in accordance with its parent model.

classmethod new_sort(cmp_row, *cmp_user_data)
Parameters:
Returns:

A pointer to an uninitialized Dee.Filter struct. This struct will zeroed and configured with the filter parameters

Return type:

out_filter: Dee.Filter

Create a new Dee.Filter sorting a model according to a Dee.CompareRowFunc.

map(orig_model, filter_model)
Parameters:

Call the Dee.FilterMapFunc function of a Dee.Filter. When using a Dee.FilterModel you should not call this method yourself.

notify(orig_iter, orig_model, filter_model)
Parameters:
Returns:

The return value from the Dee.FilterMapNotify. That is; True if orig_iter was added to filter_model

Return type:

bool

Call the Dee.FilterMapNotify function of a Dee.Filter. When using a Dee.FilterModel you should not call this method yourself.