birb/birbcustomfilter.h

Fri, 27 Sep 2024 01:24:36 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 27 Sep 2024 01:24:36 -0500
changeset 27
466b74cf323e
parent 25
f084b7328595
permissions
-rw-r--r--

Update the gi-docgen subproject to 2024.1

Testing Done:
Updated subprojects and called in the turtles.

Reviewed at https://reviews.imfreedom.org/r/3546/

/*
 * Copyright (C) 2024 Birb Developers
 *
 * Birb is the legal property of its developers, whose names are too
 * numerous to list here. Please refer to the AUTHORS file distributed
 * with this source distribution
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <https://www.gnu.org/licenses/>.
 */

#if !defined(BIRB_GLOBAL_HEADER_INSIDE) && !defined(BIRB_COMPILATION)
# error "only <birb.h> may be included directly"
#endif

#ifndef BIRB_CUSTOM_FILTER_H
#define BIRB_CUSTOM_FILTER_H

#include <gio/gio.h>

#include "birbfilter.h"
#include "birbversion.h"

G_BEGIN_DECLS

#define BIRB_TYPE_CUSTOM_FILTER (birb_custom_filter_get_type())

/**
 * BirbCustomFilterFunc:
 * @item: The item.
 * @data: User supplied data.
 *
 * User function that is called to determine if item should be put into a
 * list or not.
 *
 * Returns: %TRUE to keep the item in the list, or %FALSE to ignore it.
 *
 * Since: 0.3
 */
typedef gboolean (*BirbCustomFilterFunc)(GObject *item, gpointer data);

/**
 * BirbCustomFilter:
 *
 * A [class@Filter] that uses a [callback@CustomFilterFunc] to determine which
 * items should be kept.
 *
 * Since: 0.3
 */
BIRB_AVAILABLE_IN_0_3
G_DECLARE_FINAL_TYPE(BirbCustomFilter, birb_custom_filter, BIRB, CUSTOM_FILTER,
                     BirbFilter)

/**
 * birb_custom_filter_new:
 * @match_func: (nullable): The function used for matching.
 * @data: (nullable): User data to pass to @match_func.
 * @destroy_notify: (nullable): A destroy notify for @data.
 *
 * Creates a new filter using @match_func to determine what to filter.
 *
 * If @match_func is %NULL, the filter will match all items.
 *
 * Returns: (transfer full): The new instance.
 *
 * Since: 0.3
 */
BIRB_AVAILABLE_IN_0_3
BirbCustomFilter *birb_custom_filter_new(BirbCustomFilterFunc match_func, gpointer data, GDestroyNotify destroy_notify);

/**
 * birb_custom_filter_set_filter_func:
 * @filter: The instance.
 * @match_func: (nullable): The new function used for matching.
 * @data: (nullable): User data to pass to @match_func.
 * @destroy_notify: (nullable): A destroy notify for @data.
 *
 * Sets a new matching function for @filter.
 *
 * If @match_func is %NULL, the filter will match all items.
 *
 * If a previous function was set, its %destroy_notify will be called now.
 *
 * Since: 0.3
 */
BIRB_AVAILABLE_IN_0_3
void birb_custom_filter_set_filter_func(BirbCustomFilter *filter, BirbCustomFilterFunc match_func, gpointer data, GDestroyNotify destroy_notify);

G_END_DECLS

#endif /* BIRB_CUSTOM_FILTER_H */

mercurial