## GtkCustomFilter GtkCustomFilter — Filtering with callbacks |

## Functions

gboolean | (*GtkCustomFilterFunc) ()
GtkCustomFilter * | gtk_custom_filter_new ()
void | gtk_custom_filter_set_filter_func ()

## Types and Values

| GtkCustomFilter

## Object Hierarchy

        GObject
        ╰── GtkFilter
            ╰── GtkCustomFilter

## Includes

    #include <gtk/gtk.h>

## Description

GtkCustomFilter is a GtkFilter that uses a callback to determine whether to include an item or not.

## Functions

### GtkCustomFilterFunc ()

    gboolean
    (*GtkCustomFilterFunc) (gpointer item,
                            gpointer user_data);

User function that is called to determine if the `item` should be matched. If the filter matches the item, this function must return `TRUE`. If the item should be filtered out, `FALSE` must be returned.

#### Parameters

item | The item to be matched. | [type GObject]
user_data | user data |

#### Returns

`TRUE` to keep the item around

### gtk_custom_filter_new ()

    GtkCustomFilter *
    gtk_custom_filter_new (GtkCustomFilterFunc match_func,
                           gpointer user_data,
                           GDestroyNotify user_destroy);

Creates a new filter using the given `match_func` to filter items.

If `match_func` is `NULL`, the filter matches all items.

If the filter func changes its filtering behavior, `gtk_filter_changed()` needs to be called.

#### Parameters

match_func | function to filter items. | [nullable]
user_data | user data to pass to `match_func` . | [nullable]
user_destroy | destroy notify for `user_data` |

#### Returns

a new GtkCustomFilter

### gtk_custom_filter_set_filter_func ()

    void
    gtk_custom_filter_set_filter_func (GtkCustomFilter *self,
                                       GtkCustomFilterFunc match_func,
                                       gpointer user_data,
                                       GDestroyNotify user_destroy);

Sets (or unsets) the function used for filtering items.

If `match_func` is `NULL`, the filter matches all items.

If the filter func changes its filtering behavior, `gtk_filter_changed()` needs to be called.

If a previous function was set, its `user_destroy` will be called now.

#### Parameters

self | a GtkCustomFilter |
match_func | function to filter items. | [nullable]
user_data | user data to pass to `match_func` . | [nullable]
user_destroy | destroy notify for `user_data` |

## Types and Values

### GtkCustomFilter

    typedef struct _GtkCustomFilter GtkCustomFilter;