Dee.Filter¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
destroy |
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 |
r/w |
The #DeeModelMapFunc used to construct the initial contents of a |
|
map_notify |
r/w |
Callback invoked when the original model changes |
|
userdata |
r/w |
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
Details¶
- class Dee.Filter¶
Structure encapsulating the mapping logic used to construct a
Dee.FilterModel
- classmethod new(map_func, map_notify, *userdata)¶
- Parameters:
map_func (
Dee.FilterMapFunc
) – TheDee.FilterMapFunc
to use for the filtermap_notify (
Dee.FilterMapNotify
) – TheDee.FilterMapNotify
to use for the filteruserdata (
object
orNone
) – The user data to pass to map_func and map_notify
- 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 aDee.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 aDee.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 matchvalue (
GLib.Variant
) – AGLib.Variant
value columns must match exactly. The matching semantics are those ofGLib.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. ADee.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:
- 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. ADee.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 matchregex (
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. ADee.FilterModel
created with this filter will be ordered in accordance with its parent model.
- classmethod new_sort(cmp_row, *cmp_user_data)¶
- Parameters:
cmp_row (
Dee.CompareRowFunc
) – ADee.CompareRowFunc
to use for sortingcmp_user_data (
object
orNone
) – User data passed to cmp_row
- 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 aDee.CompareRowFunc
.
- map(orig_model, filter_model)¶
- Parameters:
orig_model (
Dee.Model
) – The model that is being filteredfilter_model (
Dee.FilterModel
) – TheDee.FilterModel
that holds the filtered subset of orig_model
Call the
Dee.FilterMapFunc
function of aDee.Filter
. When using aDee.FilterModel
you should not call this method yourself.
- notify(orig_iter, orig_model, filter_model)¶
- Parameters:
orig_iter (
Dee.ModelIter
) – TheDee.ModelIter
added to orig_modelorig_model (
Dee.Model
) – The model that is being filteredfilter_model (
Dee.FilterModel
) – TheDee.FilterModel
that holds the filtered subset of orig_model
- Returns:
The return value from the
Dee.FilterMapNotify
. That is;True
if orig_iter was added to filter_model- Return type:
Call the
Dee.FilterMapNotify
function of aDee.Filter
. When using aDee.FilterModel
you should not call this method yourself.