/* QuickFindFactory.c generated by valac 0.56.19, the Vala compiler
 * generated from QuickFindFactory.vala, do not modify */

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * 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 3 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, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include "planify.h"
#include <stdlib.h>
#include <string.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>
#include <gee.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_FACTORY (dialogs_quick_find_quick_find_factory_get_type ())
#define DIALOGS_QUICK_FIND_QUICK_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_FACTORY, DialogsQuickFindQuickFindFactory))
#define DIALOGS_QUICK_FIND_QUICK_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_FACTORY, DialogsQuickFindQuickFindFactoryClass))
#define DIALOGS_QUICK_FIND_IS_QUICK_FIND_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_FACTORY))
#define DIALOGS_QUICK_FIND_IS_QUICK_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_FACTORY))
#define DIALOGS_QUICK_FIND_QUICK_FIND_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_FACTORY, DialogsQuickFindQuickFindFactoryClass))

typedef struct _DialogsQuickFindQuickFindFactory DialogsQuickFindQuickFindFactory;
typedef struct _DialogsQuickFindQuickFindFactoryClass DialogsQuickFindQuickFindFactoryClass;
typedef struct _DialogsQuickFindQuickFindFactoryPrivate DialogsQuickFindQuickFindFactoryPrivate;
enum  {
	DIALOGS_QUICK_FIND_QUICK_FIND_FACTORY_0_PROPERTY,
	DIALOGS_QUICK_FIND_QUICK_FIND_FACTORY_NUM_PROPERTIES
};
static GParamSpec* dialogs_quick_find_quick_find_factory_properties[DIALOGS_QUICK_FIND_QUICK_FIND_FACTORY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM (dialogs_quick_find_quick_find_item_get_type ())
#define DIALOGS_QUICK_FIND_QUICK_FIND_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM, DialogsQuickFindQuickFindItem))
#define DIALOGS_QUICK_FIND_QUICK_FIND_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM, DialogsQuickFindQuickFindItemClass))
#define DIALOGS_QUICK_FIND_IS_QUICK_FIND_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM))
#define DIALOGS_QUICK_FIND_IS_QUICK_FIND_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM))
#define DIALOGS_QUICK_FIND_QUICK_FIND_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM, DialogsQuickFindQuickFindItemClass))

typedef struct _DialogsQuickFindQuickFindItem DialogsQuickFindQuickFindItem;
typedef struct _DialogsQuickFindQuickFindItemClass DialogsQuickFindQuickFindItemClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef enum  {
	SYNAPSE_MATCHER_FLAGS_NO_REVERSED = 1 << 0,
	SYNAPSE_MATCHER_FLAGS_NO_SUBSTRING = 1 << 1,
	SYNAPSE_MATCHER_FLAGS_NO_PARTIAL = 1 << 2,
	SYNAPSE_MATCHER_FLAGS_NO_FUZZY = 1 << 3
} SynapseMatcherFlags;

#define SYNAPSE_TYPE_MATCHER_FLAGS (synapse_matcher_flags_get_type ())
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

struct _DialogsQuickFindQuickFindFactory {
	GObject parent_instance;
	DialogsQuickFindQuickFindFactoryPrivate * priv;
};

struct _DialogsQuickFindQuickFindFactoryClass {
	GObjectClass parent_class;
};

static gpointer dialogs_quick_find_quick_find_factory_parent_class = NULL;

VALA_EXTERN GType dialogs_quick_find_quick_find_factory_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsQuickFindQuickFindFactory, g_object_unref)
VALA_EXTERN GtkSignalListItemFactory* dialogs_quick_find_quick_find_factory_create_list_item_factory (void);
static void dialogs_quick_find_quick_find_factory_on_list_item_setup (GtkSignalListItemFactory* factory,
                                                               GObject* list_item_obj);
static void _dialogs_quick_find_quick_find_factory_on_list_item_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender,
                                                                                                   GObject* object,
                                                                                                   gpointer self);
static void dialogs_quick_find_quick_find_factory_on_list_item_bind (GtkSignalListItemFactory* factory,
                                                              GObject* list_item_obj);
static void _dialogs_quick_find_quick_find_factory_on_list_item_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                                                                 GObject* object,
                                                                                                 gpointer self);
static void dialogs_quick_find_quick_find_factory_on_list_item_unbind (GtkSignalListItemFactory* factory,
                                                                GObject* list_item_obj);
static void _dialogs_quick_find_quick_find_factory_on_list_item_unbind_gtk_signal_list_item_factory_unbind (GtkSignalListItemFactory* _sender,
                                                                                                     GObject* object,
                                                                                                     gpointer self);
static void dialogs_quick_find_quick_find_factory_on_list_item_teardown (GtkSignalListItemFactory* factory,
                                                                  GObject* list_item_obj);
static void _dialogs_quick_find_quick_find_factory_on_list_item_teardown_gtk_signal_list_item_factory_teardown (GtkSignalListItemFactory* _sender,
                                                                                                         GObject* object,
                                                                                                         gpointer self);
VALA_EXTERN GtkSignalListItemFactory* dialogs_quick_find_quick_find_factory_create_header_factory (void);
static void dialogs_quick_find_quick_find_factory_on_header_setup (GObject* object);
static void _dialogs_quick_find_quick_find_factory_on_header_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender,
                                                                                                GObject* object,
                                                                                                gpointer self);
static void dialogs_quick_find_quick_find_factory_on_header_bind (GObject* object);
static void _dialogs_quick_find_quick_find_factory_on_header_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                                                              GObject* object,
                                                                                              gpointer self);
VALA_EXTERN GType dialogs_quick_find_quick_find_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsQuickFindQuickFindItem, g_object_unref)
VALA_EXTERN ObjectsBaseObject* dialogs_quick_find_quick_find_item_get_base_object (DialogsQuickFindQuickFindItem* self);
static void dialogs_quick_find_quick_find_factory_bind_project (DialogsQuickFindQuickFindItem* item,
                                                         GtkGrid* main_grid);
static void dialogs_quick_find_quick_find_factory_bind_section (DialogsQuickFindQuickFindItem* item,
                                                         GtkGrid* main_grid);
static void dialogs_quick_find_quick_find_factory_bind_item (DialogsQuickFindQuickFindItem* item,
                                                      GtkGrid* main_grid);
static void dialogs_quick_find_quick_find_factory_bind_label (DialogsQuickFindQuickFindItem* item,
                                                       GtkGrid* main_grid);
static void dialogs_quick_find_quick_find_factory_bind_priority (DialogsQuickFindQuickFindItem* item,
                                                          GtkGrid* main_grid);
static gboolean dialogs_quick_find_quick_find_factory_is_filter_type (ObjectsBaseObject* base_object);
static void dialogs_quick_find_quick_find_factory_bind_filter (DialogsQuickFindQuickFindItem* item,
                                                        GtkGrid* main_grid);
static gchar* dialogs_quick_find_quick_find_factory_markup_string_with_search (const gchar* text,
                                                                        const gchar* pattern);
VALA_EXTERN const gchar* dialogs_quick_find_quick_find_item_get_pattern (DialogsQuickFindQuickFindItem* self);
VALA_EXTERN GType synapse_matcher_flags_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GeeList* synapse_query_get_matchers_for_query (const gchar* query,
                                               SynapseMatcherFlags match_flags,
                                               GRegexCompileFlags flags);
VALA_EXTERN DialogsQuickFindQuickFindFactory* dialogs_quick_find_quick_find_factory_new (void);
VALA_EXTERN DialogsQuickFindQuickFindFactory* dialogs_quick_find_quick_find_factory_construct (GType object_type);
static GType dialogs_quick_find_quick_find_factory_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static void
_dialogs_quick_find_quick_find_factory_on_list_item_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender,
                                                                                              GObject* object,
                                                                                              gpointer self)
{
	dialogs_quick_find_quick_find_factory_on_list_item_setup (_sender, object);
}

static void
_dialogs_quick_find_quick_find_factory_on_list_item_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                                                            GObject* object,
                                                                                            gpointer self)
{
	dialogs_quick_find_quick_find_factory_on_list_item_bind (_sender, object);
}

static void
_dialogs_quick_find_quick_find_factory_on_list_item_unbind_gtk_signal_list_item_factory_unbind (GtkSignalListItemFactory* _sender,
                                                                                                GObject* object,
                                                                                                gpointer self)
{
	dialogs_quick_find_quick_find_factory_on_list_item_unbind (_sender, object);
}

static void
_dialogs_quick_find_quick_find_factory_on_list_item_teardown_gtk_signal_list_item_factory_teardown (GtkSignalListItemFactory* _sender,
                                                                                                    GObject* object,
                                                                                                    gpointer self)
{
	dialogs_quick_find_quick_find_factory_on_list_item_teardown (_sender, object);
}

GtkSignalListItemFactory*
dialogs_quick_find_quick_find_factory_create_list_item_factory (void)
{
	GtkSignalListItemFactory* factory = NULL;
	GtkSignalListItemFactory* _tmp0_;
	GtkSignalListItemFactory* result;
	_tmp0_ = (GtkSignalListItemFactory*) gtk_signal_list_item_factory_new ();
	factory = _tmp0_;
	g_signal_connect (factory, "setup", (GCallback) _dialogs_quick_find_quick_find_factory_on_list_item_setup_gtk_signal_list_item_factory_setup, NULL);
	g_signal_connect (factory, "bind", (GCallback) _dialogs_quick_find_quick_find_factory_on_list_item_bind_gtk_signal_list_item_factory_bind, NULL);
	g_signal_connect (factory, "unbind", (GCallback) _dialogs_quick_find_quick_find_factory_on_list_item_unbind_gtk_signal_list_item_factory_unbind, NULL);
	g_signal_connect (factory, "teardown", (GCallback) _dialogs_quick_find_quick_find_factory_on_list_item_teardown_gtk_signal_list_item_factory_teardown, NULL);
	result = factory;
	return result;
}

static void
_dialogs_quick_find_quick_find_factory_on_header_setup_gtk_signal_list_item_factory_setup (GtkSignalListItemFactory* _sender,
                                                                                           GObject* object,
                                                                                           gpointer self)
{
	dialogs_quick_find_quick_find_factory_on_header_setup (object);
}

static void
_dialogs_quick_find_quick_find_factory_on_header_bind_gtk_signal_list_item_factory_bind (GtkSignalListItemFactory* _sender,
                                                                                         GObject* object,
                                                                                         gpointer self)
{
	dialogs_quick_find_quick_find_factory_on_header_bind (object);
}

GtkSignalListItemFactory*
dialogs_quick_find_quick_find_factory_create_header_factory (void)
{
	GtkSignalListItemFactory* factory = NULL;
	GtkSignalListItemFactory* _tmp0_;
	GtkSignalListItemFactory* result;
	_tmp0_ = (GtkSignalListItemFactory*) gtk_signal_list_item_factory_new ();
	factory = _tmp0_;
	g_signal_connect (factory, "setup", (GCallback) _dialogs_quick_find_quick_find_factory_on_header_setup_gtk_signal_list_item_factory_setup, NULL);
	g_signal_connect (factory, "bind", (GCallback) _dialogs_quick_find_quick_find_factory_on_header_bind_gtk_signal_list_item_factory_bind, NULL);
	result = factory;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
dialogs_quick_find_quick_find_factory_on_list_item_setup (GtkSignalListItemFactory* factory,
                                                          GObject* list_item_obj)
{
	GtkListItem* list_item = NULL;
	GtkListItem* _tmp0_;
	GtkGrid* main_grid = NULL;
	GtkGrid* _tmp1_ = NULL;
	g_return_if_fail (factory != NULL);
	g_return_if_fail (list_item_obj != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (list_item_obj, gtk_list_item_get_type (), GtkListItem));
	list_item = _tmp0_;
	_tmp1_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp1_, 9);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp1_, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 3);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp1_, 3);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, 3);
	g_object_ref_sink (_tmp1_);
	main_grid = _tmp1_;
	gtk_list_item_set_child (list_item, (GtkWidget*) main_grid);
	_g_object_unref0 (main_grid);
	_g_object_unref0 (list_item);
}

static void
dialogs_quick_find_quick_find_factory_on_list_item_unbind (GtkSignalListItemFactory* factory,
                                                           GObject* list_item_obj)
{
	GtkListItem* list_item = NULL;
	GtkListItem* _tmp0_;
	GtkGrid* main_grid = NULL;
	GtkListItem* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GtkGrid* _tmp4_;
	GtkWidget* child = NULL;
	GtkGrid* _tmp5_;
	GtkWidget* _tmp6_;
	GtkWidget* _tmp7_;
	g_return_if_fail (factory != NULL);
	g_return_if_fail (list_item_obj != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (list_item_obj, gtk_list_item_get_type (), GtkListItem));
	list_item = _tmp0_;
	_tmp1_ = list_item;
	_tmp2_ = gtk_list_item_get_child (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_grid_get_type (), GtkGrid));
	main_grid = _tmp4_;
	_tmp5_ = main_grid;
	_tmp6_ = gtk_widget_get_first_child ((GtkWidget*) _tmp5_);
	_tmp7_ = _g_object_ref0 (_tmp6_);
	child = _tmp7_;
	while (TRUE) {
		GtkWidget* _tmp8_;
		GtkWidget* next = NULL;
		GtkWidget* _tmp9_;
		GtkWidget* _tmp10_;
		GtkWidget* _tmp11_;
		GtkGrid* _tmp12_;
		GtkWidget* _tmp13_;
		GtkWidget* _tmp14_;
		GtkWidget* _tmp15_;
		_tmp8_ = child;
		if (!(_tmp8_ != NULL)) {
			break;
		}
		_tmp9_ = child;
		_tmp10_ = gtk_widget_get_next_sibling (_tmp9_);
		_tmp11_ = _g_object_ref0 (_tmp10_);
		next = _tmp11_;
		_tmp12_ = main_grid;
		_tmp13_ = child;
		gtk_grid_remove (_tmp12_, _tmp13_);
		_tmp14_ = next;
		_tmp15_ = _g_object_ref0 (_tmp14_);
		_g_object_unref0 (child);
		child = _tmp15_;
		_g_object_unref0 (next);
	}
	_g_object_unref0 (child);
	_g_object_unref0 (main_grid);
	_g_object_unref0 (list_item);
}

static void
dialogs_quick_find_quick_find_factory_on_list_item_teardown (GtkSignalListItemFactory* factory,
                                                             GObject* list_item_obj)
{
	g_return_if_fail (factory != NULL);
	g_return_if_fail (list_item_obj != NULL);
}

static void
dialogs_quick_find_quick_find_factory_on_list_item_bind (GtkSignalListItemFactory* factory,
                                                         GObject* list_item_obj)
{
	GtkListItem* list_item = NULL;
	GtkListItem* _tmp0_;
	DialogsQuickFindQuickFindItem* item = NULL;
	GtkListItem* _tmp1_;
	GObject* _tmp2_;
	GObject* _tmp3_;
	DialogsQuickFindQuickFindItem* _tmp4_;
	GtkGrid* main_grid = NULL;
	GtkListItem* _tmp5_;
	GtkWidget* _tmp6_;
	GtkWidget* _tmp7_;
	GtkGrid* _tmp8_;
	DialogsQuickFindQuickFindItem* _tmp9_;
	ObjectsBaseObject* _tmp10_;
	ObjectsBaseObject* _tmp11_;
	g_return_if_fail (factory != NULL);
	g_return_if_fail (list_item_obj != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (list_item_obj, gtk_list_item_get_type (), GtkListItem));
	list_item = _tmp0_;
	_tmp1_ = list_item;
	_tmp2_ = gtk_list_item_get_item (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM, DialogsQuickFindQuickFindItem));
	item = _tmp4_;
	_tmp5_ = list_item;
	_tmp6_ = gtk_list_item_get_child (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_grid_get_type (), GtkGrid));
	main_grid = _tmp8_;
	_tmp9_ = item;
	_tmp10_ = dialogs_quick_find_quick_find_item_get_base_object (_tmp9_);
	_tmp11_ = _tmp10_;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, OBJECTS_TYPE_PROJECT)) {
		DialogsQuickFindQuickFindItem* _tmp12_;
		GtkGrid* _tmp13_;
		_tmp12_ = item;
		_tmp13_ = main_grid;
		dialogs_quick_find_quick_find_factory_bind_project (_tmp12_, _tmp13_);
	} else {
		DialogsQuickFindQuickFindItem* _tmp14_;
		ObjectsBaseObject* _tmp15_;
		ObjectsBaseObject* _tmp16_;
		_tmp14_ = item;
		_tmp15_ = dialogs_quick_find_quick_find_item_get_base_object (_tmp14_);
		_tmp16_ = _tmp15_;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, OBJECTS_TYPE_SECTION)) {
			DialogsQuickFindQuickFindItem* _tmp17_;
			GtkGrid* _tmp18_;
			_tmp17_ = item;
			_tmp18_ = main_grid;
			dialogs_quick_find_quick_find_factory_bind_section (_tmp17_, _tmp18_);
		} else {
			DialogsQuickFindQuickFindItem* _tmp19_;
			ObjectsBaseObject* _tmp20_;
			ObjectsBaseObject* _tmp21_;
			_tmp19_ = item;
			_tmp20_ = dialogs_quick_find_quick_find_item_get_base_object (_tmp19_);
			_tmp21_ = _tmp20_;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp21_, OBJECTS_TYPE_ITEM)) {
				DialogsQuickFindQuickFindItem* _tmp22_;
				GtkGrid* _tmp23_;
				_tmp22_ = item;
				_tmp23_ = main_grid;
				dialogs_quick_find_quick_find_factory_bind_item (_tmp22_, _tmp23_);
			} else {
				DialogsQuickFindQuickFindItem* _tmp24_;
				ObjectsBaseObject* _tmp25_;
				ObjectsBaseObject* _tmp26_;
				_tmp24_ = item;
				_tmp25_ = dialogs_quick_find_quick_find_item_get_base_object (_tmp24_);
				_tmp26_ = _tmp25_;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp26_, OBJECTS_TYPE_LABEL)) {
					DialogsQuickFindQuickFindItem* _tmp27_;
					GtkGrid* _tmp28_;
					_tmp27_ = item;
					_tmp28_ = main_grid;
					dialogs_quick_find_quick_find_factory_bind_label (_tmp27_, _tmp28_);
				} else {
					DialogsQuickFindQuickFindItem* _tmp29_;
					ObjectsBaseObject* _tmp30_;
					ObjectsBaseObject* _tmp31_;
					_tmp29_ = item;
					_tmp30_ = dialogs_quick_find_quick_find_item_get_base_object (_tmp29_);
					_tmp31_ = _tmp30_;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp31_, OBJECTS_FILTERS_TYPE_PRIORITY)) {
						DialogsQuickFindQuickFindItem* _tmp32_;
						GtkGrid* _tmp33_;
						_tmp32_ = item;
						_tmp33_ = main_grid;
						dialogs_quick_find_quick_find_factory_bind_priority (_tmp32_, _tmp33_);
					} else {
						DialogsQuickFindQuickFindItem* _tmp34_;
						ObjectsBaseObject* _tmp35_;
						ObjectsBaseObject* _tmp36_;
						_tmp34_ = item;
						_tmp35_ = dialogs_quick_find_quick_find_item_get_base_object (_tmp34_);
						_tmp36_ = _tmp35_;
						if (dialogs_quick_find_quick_find_factory_is_filter_type (_tmp36_)) {
							DialogsQuickFindQuickFindItem* _tmp37_;
							GtkGrid* _tmp38_;
							_tmp37_ = item;
							_tmp38_ = main_grid;
							dialogs_quick_find_quick_find_factory_bind_filter (_tmp37_, _tmp38_);
						}
					}
				}
			}
		}
	}
	_g_object_unref0 (main_grid);
	_g_object_unref0 (item);
	_g_object_unref0 (list_item);
}

static void
dialogs_quick_find_quick_find_factory_bind_project (DialogsQuickFindQuickFindItem* item,
                                                    GtkGrid* main_grid)
{
	ObjectsProject* project = NULL;
	ObjectsBaseObject* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	ObjectsProject* _tmp2_;
	WidgetsIconColorProject* icon_project = NULL;
	WidgetsIconColorProject* _tmp3_;
	GtkLabel* name_label = NULL;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	GtkLabel* _tmp10_ = NULL;
	GtkLabel* _tmp11_;
	g_return_if_fail (item != NULL);
	g_return_if_fail (main_grid != NULL);
	_tmp0_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, OBJECTS_TYPE_PROJECT, ObjectsProject));
	project = _tmp2_;
	_tmp3_ = widgets_icon_color_project_new (18);
	g_object_ref_sink (_tmp3_);
	icon_project = _tmp3_;
	widgets_icon_color_project_set_project (icon_project, project);
	_tmp4_ = objects_base_object_get_name ((ObjectsBaseObject*) project);
	_tmp5_ = _tmp4_;
	_tmp6_ = dialogs_quick_find_quick_find_item_get_pattern (item);
	_tmp7_ = _tmp6_;
	_tmp8_ = dialogs_quick_find_quick_find_factory_markup_string_with_search (_tmp5_, _tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = (GtkLabel*) gtk_label_new (_tmp9_);
	gtk_label_set_ellipsize (_tmp10_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp10_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp10_, TRUE);
	g_object_ref_sink (_tmp10_);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	name_label = _tmp11_;
	gtk_grid_set_column_spacing (main_grid, 6);
	gtk_widget_set_margin_start ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_end ((GtkWidget*) main_grid, 3);
	gtk_widget_set_margin_top ((GtkWidget*) main_grid, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) main_grid, 3);
	gtk_grid_attach (main_grid, (GtkWidget*) icon_project, 0, 0, 1, 1);
	gtk_grid_attach (main_grid, (GtkWidget*) name_label, 1, 0, 1, 1);
	_g_object_unref0 (name_label);
	_g_object_unref0 (icon_project);
	_g_object_unref0 (project);
}

static void
dialogs_quick_find_quick_find_factory_bind_section (DialogsQuickFindQuickFindItem* item,
                                                    GtkGrid* main_grid)
{
	ObjectsSection* section = NULL;
	ObjectsBaseObject* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	ObjectsSection* _tmp2_;
	GtkImage* section_icon = NULL;
	GtkImage* _tmp3_ = NULL;
	GtkLabel* name_label = NULL;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	GtkLabel* _tmp10_ = NULL;
	GtkLabel* _tmp11_;
	GtkLabel* project_label = NULL;
	ObjectsProject* _tmp12_;
	ObjectsProject* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar** _tmp18_;
	GtkLabel* _tmp19_ = NULL;
	g_return_if_fail (item != NULL);
	g_return_if_fail (main_grid != NULL);
	_tmp0_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, OBJECTS_TYPE_SECTION, ObjectsSection));
	section = _tmp2_;
	_tmp3_ = (GtkImage*) gtk_image_new_from_icon_name ("carousel-symbolic");
	gtk_widget_set_valign ((GtkWidget*) _tmp3_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp3_);
	section_icon = _tmp3_;
	_tmp4_ = objects_base_object_get_name ((ObjectsBaseObject*) section);
	_tmp5_ = _tmp4_;
	_tmp6_ = dialogs_quick_find_quick_find_item_get_pattern (item);
	_tmp7_ = _tmp6_;
	_tmp8_ = dialogs_quick_find_quick_find_factory_markup_string_with_search (_tmp5_, _tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = (GtkLabel*) gtk_label_new (_tmp9_);
	gtk_label_set_ellipsize (_tmp10_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp10_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp10_, TRUE);
	g_object_ref_sink (_tmp10_);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	name_label = _tmp11_;
	_tmp12_ = objects_section_get_project (section);
	_tmp13_ = _tmp12_;
	_tmp14_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strdup ("dimmed");
	_tmp17_ = g_strdup ("caption");
	_tmp18_ = g_new0 (gchar*, 2 + 1);
	_tmp18_[0] = _tmp16_;
	_tmp18_[1] = _tmp17_;
	_tmp19_ = (GtkLabel*) gtk_label_new (_tmp15_);
	gtk_label_set_ellipsize (_tmp19_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp19_, (gfloat) 0);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp19_, _tmp18_);
	_tmp18_ = (_vala_array_free (_tmp18_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp19_);
	project_label = _tmp19_;
	gtk_widget_set_margin_start ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_end ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_top ((GtkWidget*) main_grid, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) main_grid, 3);
	gtk_grid_attach (main_grid, (GtkWidget*) section_icon, 0, 0, 1, 2);
	gtk_grid_attach (main_grid, (GtkWidget*) name_label, 1, 0, 1, 1);
	gtk_grid_attach (main_grid, (GtkWidget*) project_label, 1, 1, 1, 1);
	_g_object_unref0 (project_label);
	_g_object_unref0 (name_label);
	_g_object_unref0 (section_icon);
	_g_object_unref0 (section);
}

static void
dialogs_quick_find_quick_find_factory_bind_item (DialogsQuickFindQuickFindItem* item,
                                                 GtkGrid* main_grid)
{
	ObjectsItem* item_obj = NULL;
	ObjectsBaseObject* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	ObjectsItem* _tmp2_;
	GtkCheckButton* checked_button = NULL;
	GtkCheckButton* _tmp3_ = NULL;
	GtkCheckButton* _tmp4_;
	Util* _tmp5_;
	Util* _tmp6_;
	ObjectsItem* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	GtkCheckButton* _tmp10_;
	GtkLabel* content_label = NULL;
	ObjectsItem* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GtkLabel* _tmp18_ = NULL;
	GtkLabel* _tmp19_;
	GtkLabel* project_label = NULL;
	ObjectsItem* _tmp20_;
	ObjectsProject* _tmp21_;
	ObjectsProject* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar** _tmp27_;
	GtkLabel* _tmp28_ = NULL;
	ObjectsItem* _tmp29_;
	gboolean _tmp30_;
	gboolean _tmp31_;
	GtkCheckButton* _tmp48_;
	GtkLabel* _tmp49_;
	GtkLabel* _tmp50_;
	g_return_if_fail (item != NULL);
	g_return_if_fail (main_grid != NULL);
	_tmp0_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, OBJECTS_TYPE_ITEM, ObjectsItem));
	item_obj = _tmp2_;
	_tmp3_ = (GtkCheckButton*) gtk_check_button_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp3_, GTK_ALIGN_CENTER);
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, FALSE);
	g_object_ref_sink (_tmp3_);
	checked_button = _tmp3_;
	_tmp4_ = checked_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "priority-color");
	_tmp5_ = util_get_default ();
	_tmp6_ = _tmp5_;
	_tmp7_ = item_obj;
	_tmp8_ = objects_item_get_priority (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = checked_button;
	util_set_widget_priority (_tmp6_, _tmp9_, (GtkWidget*) _tmp10_);
	_g_object_unref0 (_tmp6_);
	_tmp11_ = item_obj;
	_tmp12_ = objects_item_get_content (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = dialogs_quick_find_quick_find_item_get_pattern (item);
	_tmp15_ = _tmp14_;
	_tmp16_ = dialogs_quick_find_quick_find_factory_markup_string_with_search (_tmp13_, _tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = (GtkLabel*) gtk_label_new (_tmp17_);
	gtk_label_set_ellipsize (_tmp18_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp18_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp18_, TRUE);
	g_object_ref_sink (_tmp18_);
	_tmp19_ = _tmp18_;
	_g_free0 (_tmp17_);
	content_label = _tmp19_;
	_tmp20_ = item_obj;
	_tmp21_ = objects_item_get_project (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = g_strdup ("dimmed");
	_tmp26_ = g_strdup ("caption");
	_tmp27_ = g_new0 (gchar*, 2 + 1);
	_tmp27_[0] = _tmp25_;
	_tmp27_[1] = _tmp26_;
	_tmp28_ = (GtkLabel*) gtk_label_new (_tmp24_);
	gtk_label_set_ellipsize (_tmp28_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp28_, (gfloat) 0);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp28_, _tmp27_);
	_tmp27_ = (_vala_array_free (_tmp27_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp28_);
	project_label = _tmp28_;
	_tmp29_ = item_obj;
	_tmp30_ = objects_item_get_has_section (_tmp29_);
	_tmp31_ = _tmp30_;
	if (_tmp31_) {
		GtkLabel* _tmp32_;
		GtkLabel* _tmp33_;
		const gchar* _tmp34_;
		const gchar* _tmp35_;
		GtkLabel* _tmp36_;
		const gchar* _tmp37_;
		const gchar* _tmp38_;
		ObjectsItem* _tmp39_;
		ObjectsSection* _tmp40_;
		ObjectsSection* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp43_;
		gchar* _tmp44_;
		gchar* _tmp45_;
		gchar* _tmp46_;
		gchar* _tmp47_;
		_tmp32_ = project_label;
		_tmp33_ = project_label;
		_tmp34_ = gtk_label_get_label (_tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = project_label;
		_tmp37_ = gtk_label_get_label (_tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = item_obj;
		_tmp40_ = objects_item_get_section (_tmp39_);
		_tmp41_ = _tmp40_;
		_tmp42_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp41_);
		_tmp43_ = _tmp42_;
		_tmp44_ = g_strdup_printf ("%s / %s", _tmp38_, _tmp43_);
		_tmp45_ = _tmp44_;
		_tmp46_ = g_strconcat (_tmp35_, _tmp45_, NULL);
		_tmp47_ = _tmp46_;
		gtk_label_set_label (_tmp33_, _tmp47_);
		_g_free0 (_tmp47_);
		_g_free0 (_tmp45_);
	}
	gtk_widget_set_margin_start ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_end ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_top ((GtkWidget*) main_grid, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) main_grid, 3);
	_tmp48_ = checked_button;
	gtk_grid_attach (main_grid, (GtkWidget*) _tmp48_, 0, 0, 1, 2);
	_tmp49_ = content_label;
	gtk_grid_attach (main_grid, (GtkWidget*) _tmp49_, 1, 0, 1, 1);
	_tmp50_ = project_label;
	gtk_grid_attach (main_grid, (GtkWidget*) _tmp50_, 1, 1, 1, 1);
	_g_object_unref0 (project_label);
	_g_object_unref0 (content_label);
	_g_object_unref0 (checked_button);
	_g_object_unref0 (item_obj);
}

static void
dialogs_quick_find_quick_find_factory_bind_label (DialogsQuickFindQuickFindItem* item,
                                                  GtkGrid* main_grid)
{
	ObjectsLabel* label = NULL;
	ObjectsBaseObject* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	ObjectsLabel* _tmp2_;
	GtkGrid* widget_color = NULL;
	GtkGrid* _tmp3_ = NULL;
	Util* _tmp4_;
	Util* _tmp5_;
	Util* _tmp6_;
	Util* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GtkLabel* name_label = NULL;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GtkLabel* _tmp18_ = NULL;
	GtkLabel* _tmp19_;
	g_return_if_fail (item != NULL);
	g_return_if_fail (main_grid != NULL);
	_tmp0_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, OBJECTS_TYPE_LABEL, ObjectsLabel));
	label = _tmp2_;
	_tmp3_ = (GtkGrid*) gtk_grid_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp3_, GTK_ALIGN_CENTER);
	g_object_set ((GtkWidget*) _tmp3_, "height-request", 16, NULL);
	g_object_set ((GtkWidget*) _tmp3_, "width-request", 16, NULL);
	g_object_ref_sink (_tmp3_);
	widget_color = _tmp3_;
	gtk_widget_add_css_class ((GtkWidget*) widget_color, "circle-color");
	_tmp4_ = util_get_default ();
	_tmp5_ = _tmp4_;
	_tmp6_ = util_get_default ();
	_tmp7_ = _tmp6_;
	_tmp8_ = objects_base_object_get_color ((ObjectsBaseObject*) label);
	_tmp9_ = _tmp8_;
	_tmp10_ = util_get_color (_tmp7_, _tmp9_);
	_tmp11_ = _tmp10_;
	util_set_widget_color (_tmp5_, _tmp11_, (GtkWidget*) widget_color);
	_g_free0 (_tmp11_);
	_g_object_unref0 (_tmp7_);
	_g_object_unref0 (_tmp5_);
	_tmp12_ = objects_base_object_get_name ((ObjectsBaseObject*) label);
	_tmp13_ = _tmp12_;
	_tmp14_ = dialogs_quick_find_quick_find_item_get_pattern (item);
	_tmp15_ = _tmp14_;
	_tmp16_ = dialogs_quick_find_quick_find_factory_markup_string_with_search (_tmp13_, _tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = (GtkLabel*) gtk_label_new (_tmp17_);
	gtk_label_set_ellipsize (_tmp18_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp18_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp18_, TRUE);
	g_object_ref_sink (_tmp18_);
	_tmp19_ = _tmp18_;
	_g_free0 (_tmp17_);
	name_label = _tmp19_;
	gtk_widget_set_margin_start ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_end ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_top ((GtkWidget*) main_grid, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) main_grid, 3);
	gtk_grid_attach (main_grid, (GtkWidget*) widget_color, 0, 0, 1, 1);
	gtk_grid_attach (main_grid, (GtkWidget*) name_label, 1, 0, 1, 1);
	_g_object_unref0 (name_label);
	_g_object_unref0 (widget_color);
	_g_object_unref0 (label);
}

static void
dialogs_quick_find_quick_find_factory_bind_priority (DialogsQuickFindQuickFindItem* item,
                                                     GtkGrid* main_grid)
{
	ObjectsFiltersPriority* priority = NULL;
	ObjectsBaseObject* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	ObjectsFiltersPriority* _tmp2_;
	GtkImage* priority_icon = NULL;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GtkImage* _tmp5_;
	Util* _tmp6_;
	Util* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	GtkLabel* name_label = NULL;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	GtkLabel* _tmp16_ = NULL;
	GtkLabel* _tmp17_;
	g_return_if_fail (item != NULL);
	g_return_if_fail (main_grid != NULL);
	_tmp0_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, OBJECTS_FILTERS_TYPE_PRIORITY, ObjectsFiltersPriority));
	priority = _tmp2_;
	_tmp3_ = objects_filters_priority_get_icon (priority);
	_tmp4_ = _tmp3_;
	_tmp5_ = (GtkImage*) gtk_image_new_from_icon_name (_tmp4_);
	g_object_ref_sink (_tmp5_);
	priority_icon = _tmp5_;
	gtk_widget_add_css_class ((GtkWidget*) priority_icon, "view-icon");
	_tmp6_ = util_get_default ();
	_tmp7_ = _tmp6_;
	_tmp8_ = objects_filters_priority_get_color (priority);
	_tmp9_ = _tmp8_;
	util_set_widget_color (_tmp7_, _tmp9_, (GtkWidget*) priority_icon);
	_g_object_unref0 (_tmp7_);
	_tmp10_ = objects_filters_priority_get_title (priority);
	_tmp11_ = _tmp10_;
	_tmp12_ = dialogs_quick_find_quick_find_item_get_pattern (item);
	_tmp13_ = _tmp12_;
	_tmp14_ = dialogs_quick_find_quick_find_factory_markup_string_with_search (_tmp11_, _tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = (GtkLabel*) gtk_label_new (_tmp15_);
	gtk_label_set_ellipsize (_tmp16_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp16_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp16_, TRUE);
	g_object_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	_g_free0 (_tmp15_);
	name_label = _tmp17_;
	gtk_widget_set_margin_start ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_end ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_top ((GtkWidget*) main_grid, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) main_grid, 3);
	gtk_grid_attach (main_grid, (GtkWidget*) priority_icon, 0, 0, 1, 1);
	gtk_grid_attach (main_grid, (GtkWidget*) name_label, 1, 0, 1, 1);
	_g_object_unref0 (name_label);
	_g_object_unref0 (priority_icon);
	_g_object_unref0 (priority);
}

static void
dialogs_quick_find_quick_find_factory_bind_filter (DialogsQuickFindQuickFindItem* item,
                                                   GtkGrid* main_grid)
{
	GtkImage* filter_icon = NULL;
	ObjectsBaseObject* _tmp0_;
	ObjectsBaseObject* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GtkImage* _tmp4_ = NULL;
	GtkLabel* name_label = NULL;
	ObjectsBaseObject* _tmp5_;
	ObjectsBaseObject* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GtkLabel* _tmp13_ = NULL;
	GtkLabel* _tmp14_;
	g_return_if_fail (item != NULL);
	g_return_if_fail (main_grid != NULL);
	_tmp0_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_base_object_get_icon_name (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = (GtkImage*) gtk_image_new_from_icon_name (_tmp3_);
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_CENTER);
	gtk_image_set_pixel_size (_tmp4_, 16);
	g_object_ref_sink (_tmp4_);
	filter_icon = _tmp4_;
	_tmp5_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp6_ = _tmp5_;
	_tmp7_ = objects_base_object_get_name (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = dialogs_quick_find_quick_find_item_get_pattern (item);
	_tmp10_ = _tmp9_;
	_tmp11_ = dialogs_quick_find_quick_find_factory_markup_string_with_search (_tmp8_, _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = (GtkLabel*) gtk_label_new (_tmp12_);
	gtk_label_set_ellipsize (_tmp13_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp13_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp13_, TRUE);
	g_object_ref_sink (_tmp13_);
	_tmp14_ = _tmp13_;
	_g_free0 (_tmp12_);
	name_label = _tmp14_;
	gtk_widget_set_margin_start ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_end ((GtkWidget*) main_grid, 6);
	gtk_widget_set_margin_top ((GtkWidget*) main_grid, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) main_grid, 3);
	gtk_grid_attach (main_grid, (GtkWidget*) filter_icon, 0, 0, 1, 1);
	gtk_grid_attach (main_grid, (GtkWidget*) name_label, 1, 0, 1, 1);
	_g_object_unref0 (name_label);
	_g_object_unref0 (filter_icon);
}

static gboolean
dialogs_quick_find_quick_find_factory_is_filter_type (ObjectsBaseObject* base_object)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean result;
	g_return_val_if_fail (base_object != NULL, FALSE);
	if (G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_TODAY)) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_SCHEDULED);
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		_tmp8_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_COMPLETED);
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_TOMORROW);
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_LABELS);
	}
	if (_tmp6_) {
		_tmp5_ = TRUE;
	} else {
		_tmp5_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_PINBOARD);
	}
	if (_tmp5_) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_ANYTIME);
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_REPEATING);
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_UNLABELED);
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_ALL_ITEMS);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (base_object, OBJECTS_FILTERS_TYPE_INBOX);
	}
	result = _tmp0_;
	return result;
}

static void
dialogs_quick_find_quick_find_factory_on_header_setup (GObject* object)
{
	GtkListHeader* header = NULL;
	GtkListHeader* _tmp0_;
	GtkLabel* header_label = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	GtkLabel* _tmp4_ = NULL;
	g_return_if_fail (object != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, gtk_list_header_get_type (), GtkListHeader));
	header = _tmp0_;
	_tmp1_ = g_strdup ("caption");
	_tmp2_ = g_strdup ("font-bold");
	_tmp3_ = g_new0 (gchar*, 2 + 1);
	_tmp3_[0] = _tmp1_;
	_tmp3_[1] = _tmp2_;
	_tmp4_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp4_, _tmp3_);
	_tmp3_ = (_vala_array_free (_tmp3_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_START);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp4_, 9);
	g_object_ref_sink (_tmp4_);
	header_label = _tmp4_;
	gtk_list_header_set_child (header, (GtkWidget*) header_label);
	_g_object_unref0 (header_label);
	_g_object_unref0 (header);
}

static void
dialogs_quick_find_quick_find_factory_on_header_bind (GObject* object)
{
	GtkListHeader* header = NULL;
	GtkListHeader* _tmp0_;
	GtkLabel* label = NULL;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkLabel* _tmp3_;
	DialogsQuickFindQuickFindItem* item = NULL;
	GObject* _tmp4_;
	GObject* _tmp5_;
	DialogsQuickFindQuickFindItem* _tmp6_;
	ObjectsBaseObject* _tmp7_;
	ObjectsBaseObject* _tmp8_;
	ObjectType _tmp9_;
	ObjectType _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	g_return_if_fail (object != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, gtk_list_header_get_type (), GtkListHeader));
	header = _tmp0_;
	_tmp1_ = gtk_list_header_get_child (header);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_label_get_type (), GtkLabel));
	label = _tmp3_;
	_tmp4_ = gtk_list_header_get_item (header);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_ITEM, DialogsQuickFindQuickFindItem));
	item = _tmp6_;
	_tmp7_ = dialogs_quick_find_quick_find_item_get_base_object (item);
	_tmp8_ = _tmp7_;
	_tmp9_ = objects_base_object_get_object_type (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = object_type_get_header (_tmp10_);
	_tmp12_ = _tmp11_;
	gtk_label_set_label (label, _tmp12_);
	_g_free0 (_tmp12_);
	_g_object_unref0 (item);
	_g_object_unref0 (label);
	_g_object_unref0 (header);
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gchar*
dialogs_quick_find_quick_find_factory_markup_string_with_search (const gchar* text,
                                                                 const gchar* pattern)
{
	static const char MARKUP[] = "%s";
	GeeList* matchers = NULL;
	GeeList* _tmp8_;
	gchar* highlighted = NULL;
	const gchar* _tmp49_;
	gchar* result;
	g_return_val_if_fail (text != NULL, NULL);
	g_return_val_if_fail (pattern != NULL, NULL);
	if (g_strcmp0 (pattern, "") == 0) {
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp0_ = g_markup_escape_text (text, (gssize) -1);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_strdup_printf (MARKUP, _tmp1_);
		_tmp3_ = _tmp2_;
		_g_free0 (_tmp1_);
		result = _tmp3_;
		return result;
	}
	if (g_strcmp0 (text, "") == 0) {
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp4_ = g_markup_escape_text (pattern, (gssize) -1);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strdup_printf (MARKUP, _tmp5_);
		_tmp7_ = _tmp6_;
		_g_free0 (_tmp5_);
		result = _tmp7_;
		return result;
	}
	_tmp8_ = synapse_query_get_matchers_for_query (pattern, 0, G_REGEX_OPTIMIZE | G_REGEX_CASELESS);
	matchers = _tmp8_;
	highlighted = NULL;
	{
		GeeList* _matcher_list = NULL;
		GeeList* _tmp9_;
		gint _matcher_size = 0;
		GeeList* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		gint _matcher_index = 0;
		_tmp9_ = matchers;
		_matcher_list = _tmp9_;
		_tmp10_ = _matcher_list;
		_tmp11_ = gee_collection_get_size ((GeeCollection*) _tmp10_);
		_tmp12_ = _tmp11_;
		_matcher_size = _tmp12_;
		_matcher_index = -1;
		while (TRUE) {
			gint _tmp13_;
			gint _tmp14_;
			GeeMapEntry* matcher = NULL;
			GeeList* _tmp15_;
			gpointer _tmp16_;
			GMatchInfo* mi = NULL;
			GeeMapEntry* _tmp17_;
			gconstpointer _tmp18_;
			gconstpointer _tmp19_;
			GMatchInfo* _tmp20_ = NULL;
			gboolean _tmp21_;
			_matcher_index = _matcher_index + 1;
			_tmp13_ = _matcher_index;
			_tmp14_ = _matcher_size;
			if (!(_tmp13_ < _tmp14_)) {
				break;
			}
			_tmp15_ = _matcher_list;
			_tmp16_ = gee_list_get (_tmp15_, _matcher_index);
			matcher = (GeeMapEntry*) _tmp16_;
			_tmp17_ = matcher;
			_tmp18_ = gee_map_entry_get_key (_tmp17_);
			_tmp19_ = _tmp18_;
			_tmp21_ = g_regex_match ((GRegex*) _tmp19_, text, 0, &_tmp20_);
			_g_match_info_unref0 (mi);
			mi = _tmp20_;
			if (_tmp21_) {
				gint start_pos = 0;
				gint end_pos = 0;
				gint last_pos = 0;
				gint cnt = 0;
				GMatchInfo* _tmp22_;
				GString* res = NULL;
				GString* _tmp23_;
				GString* _tmp46_;
				const gchar* _tmp47_;
				gchar* _tmp48_;
				last_pos = 0;
				_tmp22_ = mi;
				cnt = g_match_info_get_match_count (_tmp22_);
				_tmp23_ = g_string_new ("");
				res = _tmp23_;
				{
					gint i = 0;
					i = 1;
					{
						gboolean _tmp24_ = FALSE;
						_tmp24_ = TRUE;
						while (TRUE) {
							GMatchInfo* _tmp26_;
							gint _tmp27_ = 0;
							gint _tmp28_ = 0;
							gboolean _tmp29_ = FALSE;
							GString* _tmp30_;
							gchar* _tmp31_;
							gchar* _tmp32_;
							gchar* _tmp33_;
							gchar* _tmp34_;
							GString* _tmp35_;
							GMatchInfo* _tmp36_;
							gchar* _tmp37_;
							gchar* _tmp38_;
							gchar* _tmp39_;
							gchar* _tmp40_;
							if (!_tmp24_) {
								gint _tmp25_;
								_tmp25_ = i;
								i = _tmp25_ + 1;
							}
							_tmp24_ = FALSE;
							if (!(i < cnt)) {
								break;
							}
							_tmp26_ = mi;
							g_match_info_fetch_pos (_tmp26_, i, &_tmp27_, &_tmp28_);
							start_pos = _tmp27_;
							end_pos = _tmp28_;
							if (start_pos >= 0) {
								_tmp29_ = end_pos >= 0;
							} else {
								_tmp29_ = FALSE;
							}
							g_warn_if_fail (_tmp29_);
							_tmp30_ = res;
							_tmp31_ = string_substring (text, (glong) last_pos, (glong) (start_pos - last_pos));
							_tmp32_ = _tmp31_;
							_tmp33_ = g_markup_escape_text (_tmp32_, (gssize) -1);
							_tmp34_ = _tmp33_;
							g_string_append (_tmp30_, _tmp34_);
							_g_free0 (_tmp34_);
							_g_free0 (_tmp32_);
							last_pos = end_pos;
							_tmp35_ = res;
							_tmp36_ = mi;
							_tmp37_ = g_match_info_fetch (_tmp36_, i);
							_tmp38_ = _tmp37_;
							_tmp39_ = g_markup_printf_escaped ("<b>%s</b>", _tmp38_);
							_tmp40_ = _tmp39_;
							g_string_append (_tmp35_, _tmp40_);
							_g_free0 (_tmp40_);
							_g_free0 (_tmp38_);
							if (i == (cnt - 1)) {
								GString* _tmp41_;
								gchar* _tmp42_;
								gchar* _tmp43_;
								gchar* _tmp44_;
								gchar* _tmp45_;
								_tmp41_ = res;
								_tmp42_ = string_substring (text, (glong) last_pos, (glong) -1);
								_tmp43_ = _tmp42_;
								_tmp44_ = g_markup_escape_text (_tmp43_, (gssize) -1);
								_tmp45_ = _tmp44_;
								g_string_append (_tmp41_, _tmp45_);
								_g_free0 (_tmp45_);
								_g_free0 (_tmp43_);
							}
						}
					}
				}
				_tmp46_ = res;
				_tmp47_ = _tmp46_->str;
				_tmp48_ = g_strdup (_tmp47_);
				_g_free0 (highlighted);
				highlighted = _tmp48_;
				_g_string_free0 (res);
				_g_match_info_unref0 (mi);
				_g_object_unref0 (matcher);
				break;
			}
			_g_match_info_unref0 (mi);
			_g_object_unref0 (matcher);
		}
	}
	_tmp49_ = highlighted;
	if (_tmp49_ != NULL) {
		const gchar* _tmp50_;
		gchar* _tmp51_;
		_tmp50_ = highlighted;
		_tmp51_ = g_strdup_printf (MARKUP, _tmp50_);
		result = _tmp51_;
		_g_free0 (highlighted);
		_g_object_unref0 (matchers);
		return result;
	} else {
		gchar* _tmp52_;
		gchar* _tmp53_;
		gchar* _tmp54_;
		gchar* _tmp55_;
		_tmp52_ = g_markup_escape_text (text, (gssize) -1);
		_tmp53_ = _tmp52_;
		_tmp54_ = g_strdup_printf (MARKUP, _tmp53_);
		_tmp55_ = _tmp54_;
		_g_free0 (_tmp53_);
		result = _tmp55_;
		_g_free0 (highlighted);
		_g_object_unref0 (matchers);
		return result;
	}
}

DialogsQuickFindQuickFindFactory*
dialogs_quick_find_quick_find_factory_construct (GType object_type)
{
	DialogsQuickFindQuickFindFactory * self = NULL;
	self = (DialogsQuickFindQuickFindFactory*) g_object_new (object_type, NULL);
	return self;
}

DialogsQuickFindQuickFindFactory*
dialogs_quick_find_quick_find_factory_new (void)
{
	return dialogs_quick_find_quick_find_factory_construct (DIALOGS_QUICK_FIND_TYPE_QUICK_FIND_FACTORY);
}

static void
dialogs_quick_find_quick_find_factory_class_init (DialogsQuickFindQuickFindFactoryClass * klass,
                                                  gpointer klass_data)
{
	dialogs_quick_find_quick_find_factory_parent_class = g_type_class_peek_parent (klass);
}

static void
dialogs_quick_find_quick_find_factory_instance_init (DialogsQuickFindQuickFindFactory * self,
                                                     gpointer klass)
{
}

static GType
dialogs_quick_find_quick_find_factory_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsQuickFindQuickFindFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_quick_find_quick_find_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsQuickFindQuickFindFactory), 0, (GInstanceInitFunc) dialogs_quick_find_quick_find_factory_instance_init, NULL };
	GType dialogs_quick_find_quick_find_factory_type_id;
	dialogs_quick_find_quick_find_factory_type_id = g_type_register_static (G_TYPE_OBJECT, "DialogsQuickFindQuickFindFactory", &g_define_type_info, 0);
	return dialogs_quick_find_quick_find_factory_type_id;
}

GType
dialogs_quick_find_quick_find_factory_get_type (void)
{
	static volatile gsize dialogs_quick_find_quick_find_factory_type_id__once = 0;
	if (g_once_init_enter (&dialogs_quick_find_quick_find_factory_type_id__once)) {
		GType dialogs_quick_find_quick_find_factory_type_id;
		dialogs_quick_find_quick_find_factory_type_id = dialogs_quick_find_quick_find_factory_get_type_once ();
		g_once_init_leave (&dialogs_quick_find_quick_find_factory_type_id__once, dialogs_quick_find_quick_find_factory_type_id);
	}
	return dialogs_quick_find_quick_find_factory_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

