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

/*
 * Copyright © 2025 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 <gee.h>
#include "planify.h"
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.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 UTILS_TYPE_TASK_UTILS (utils_task_utils_get_type ())
#define UTILS_TASK_UTILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UTILS_TYPE_TASK_UTILS, UtilsTaskUtils))
#define UTILS_TASK_UTILS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UTILS_TYPE_TASK_UTILS, UtilsTaskUtilsClass))
#define UTILS_IS_TASK_UTILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UTILS_TYPE_TASK_UTILS))
#define UTILS_IS_TASK_UTILS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UTILS_TYPE_TASK_UTILS))
#define UTILS_TASK_UTILS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UTILS_TYPE_TASK_UTILS, UtilsTaskUtilsClass))

typedef struct _UtilsTaskUtils UtilsTaskUtils;
typedef struct _UtilsTaskUtilsClass UtilsTaskUtilsClass;
typedef struct _UtilsTaskUtilsPrivate UtilsTaskUtilsPrivate;

#define LAYOUTS_TYPE_ITEM_BASE (layouts_item_base_get_type ())
#define LAYOUTS_ITEM_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_ITEM_BASE, LayoutsItemBase))
#define LAYOUTS_ITEM_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_ITEM_BASE, LayoutsItemBaseClass))
#define LAYOUTS_IS_ITEM_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_ITEM_BASE))
#define LAYOUTS_IS_ITEM_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_ITEM_BASE))
#define LAYOUTS_ITEM_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_ITEM_BASE, LayoutsItemBaseClass))

typedef struct _LayoutsItemBase LayoutsItemBase;
typedef struct _LayoutsItemBaseClass LayoutsItemBaseClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _UtilsParamSpecTaskUtils UtilsParamSpecTaskUtils;

struct _UtilsTaskUtils {
	GTypeInstance parent_instance;
	volatile int ref_count;
	UtilsTaskUtilsPrivate * priv;
};

struct _UtilsTaskUtilsClass {
	GTypeClass parent_class;
	void (*finalize) (UtilsTaskUtils *self);
};

struct _UtilsParamSpecTaskUtils {
	GParamSpec parent_instance;
};

static gpointer utils_task_utils_parent_class = NULL;

VALA_EXTERN gpointer utils_task_utils_ref (gpointer instance);
VALA_EXTERN void utils_task_utils_unref (gpointer instance);
VALA_EXTERN GParamSpec* utils_param_spec_task_utils (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags);
VALA_EXTERN void utils_value_set_task_utils (GValue* value,
                                 gpointer v_object);
VALA_EXTERN void utils_value_take_task_utils (GValue* value,
                                  gpointer v_object);
VALA_EXTERN gpointer utils_value_get_task_utils (const GValue* value);
VALA_EXTERN GType utils_task_utils_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UtilsTaskUtils, utils_task_utils_unref)
VALA_EXTERN GType layouts_item_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsItemBase, g_object_unref)
VALA_EXTERN void utils_task_utils_update_single_item_order (GtkListBox* listbox,
                                                LayoutsItemBase* moved_row,
                                                gint new_index);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN ObjectsItem* layouts_item_base_get_item (LayoutsItemBase* self);
VALA_EXTERN void utils_task_utils_normalize_orders (GeeArrayList* rows);
VALA_EXTERN gboolean utils_task_utils_items_filter_func (ObjectsItem* item,
                                             GeeHashMap* filters);
VALA_EXTERN UtilsTaskUtils* utils_task_utils_new (void);
VALA_EXTERN UtilsTaskUtils* utils_task_utils_construct (GType object_type);
static void utils_task_utils_finalize (UtilsTaskUtils * obj);
static GType utils_task_utils_get_type_once (void);

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

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

void
utils_task_utils_update_single_item_order (GtkListBox* listbox,
                                           LayoutsItemBase* moved_row,
                                           gint new_index)
{
	GeeArrayList* rows = NULL;
	GeeArrayList* _tmp0_;
	LayoutsItemBase* prev = NULL;
	LayoutsItemBase* next = NULL;
	GeeArrayList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gboolean _tmp20_ = FALSE;
	LayoutsItemBase* _tmp21_;
	ObjectsItem* _tmp57_;
	ObjectsItem* _tmp58_;
	gboolean _tmp59_ = FALSE;
	gboolean _tmp60_ = FALSE;
	LayoutsItemBase* _tmp61_;
	g_return_if_fail (listbox != NULL);
	g_return_if_fail (moved_row != NULL);
	_tmp0_ = gee_array_list_new (LAYOUTS_TYPE_ITEM_BASE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	rows = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				Util* _tmp3_;
				Util* _tmp4_;
				GList* _tmp5_;
				GList* _tmp6_;
				gboolean _tmp7_;
				LayoutsItemBase* row = NULL;
				GtkListBoxRow* _tmp8_;
				LayoutsItemBase* _tmp9_;
				LayoutsItemBase* _tmp10_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = util_get_default ();
				_tmp4_ = _tmp3_;
				_tmp5_ = util_get_children (_tmp4_, listbox);
				_tmp6_ = _tmp5_;
				_tmp7_ = !(((guint) i) < g_list_length (_tmp6_));
				(_tmp6_ == NULL) ? NULL : (_tmp6_ = (_g_list_free__g_object_unref0_ (_tmp6_), NULL));
				_g_object_unref0 (_tmp4_);
				if (_tmp7_) {
					break;
				}
				_tmp8_ = gtk_list_box_get_row_at_index (listbox, i);
				_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, LAYOUTS_TYPE_ITEM_BASE, LayoutsItemBase));
				row = _tmp9_;
				_tmp10_ = row;
				if (_tmp10_ != NULL) {
					GeeArrayList* _tmp11_;
					LayoutsItemBase* _tmp12_;
					_tmp11_ = rows;
					_tmp12_ = row;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, _tmp12_);
				}
				_g_object_unref0 (row);
			}
		}
	}
	prev = NULL;
	next = NULL;
	if (new_index > 0) {
		GeeArrayList* _tmp13_;
		gpointer _tmp14_;
		_tmp13_ = rows;
		_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp13_, new_index - 1);
		_g_object_unref0 (prev);
		prev = (LayoutsItemBase*) _tmp14_;
	}
	_tmp15_ = rows;
	_tmp16_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp15_);
	_tmp17_ = _tmp16_;
	if (new_index < (_tmp17_ - 1)) {
		GeeArrayList* _tmp18_;
		gpointer _tmp19_;
		_tmp18_ = rows;
		_tmp19_ = gee_abstract_list_get ((GeeAbstractList*) _tmp18_, new_index + 1);
		_g_object_unref0 (next);
		next = (LayoutsItemBase*) _tmp19_;
	}
	_tmp21_ = prev;
	if (_tmp21_ == NULL) {
		LayoutsItemBase* _tmp22_;
		_tmp22_ = next;
		_tmp20_ = _tmp22_ != NULL;
	} else {
		_tmp20_ = FALSE;
	}
	if (_tmp20_) {
		ObjectsItem* _tmp23_;
		ObjectsItem* _tmp24_;
		LayoutsItemBase* _tmp25_;
		ObjectsItem* _tmp26_;
		ObjectsItem* _tmp27_;
		gint _tmp28_;
		gint _tmp29_;
		_tmp23_ = layouts_item_base_get_item (moved_row);
		_tmp24_ = _tmp23_;
		_tmp25_ = next;
		_tmp26_ = layouts_item_base_get_item (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = objects_item_get_child_order (_tmp27_);
		_tmp29_ = _tmp28_;
		objects_item_set_child_order (_tmp24_, (gint) (_tmp29_ - 1000));
	} else {
		gboolean _tmp30_ = FALSE;
		LayoutsItemBase* _tmp31_;
		_tmp31_ = prev;
		if (_tmp31_ != NULL) {
			LayoutsItemBase* _tmp32_;
			_tmp32_ = next;
			_tmp30_ = _tmp32_ == NULL;
		} else {
			_tmp30_ = FALSE;
		}
		if (_tmp30_) {
			ObjectsItem* _tmp33_;
			ObjectsItem* _tmp34_;
			LayoutsItemBase* _tmp35_;
			ObjectsItem* _tmp36_;
			ObjectsItem* _tmp37_;
			gint _tmp38_;
			gint _tmp39_;
			_tmp33_ = layouts_item_base_get_item (moved_row);
			_tmp34_ = _tmp33_;
			_tmp35_ = prev;
			_tmp36_ = layouts_item_base_get_item (_tmp35_);
			_tmp37_ = _tmp36_;
			_tmp38_ = objects_item_get_child_order (_tmp37_);
			_tmp39_ = _tmp38_;
			objects_item_set_child_order (_tmp34_, _tmp39_ + 1000);
		} else {
			gboolean _tmp40_ = FALSE;
			LayoutsItemBase* _tmp41_;
			_tmp41_ = prev;
			if (_tmp41_ != NULL) {
				LayoutsItemBase* _tmp42_;
				_tmp42_ = next;
				_tmp40_ = _tmp42_ != NULL;
			} else {
				_tmp40_ = FALSE;
			}
			if (_tmp40_) {
				ObjectsItem* _tmp43_;
				ObjectsItem* _tmp44_;
				LayoutsItemBase* _tmp45_;
				ObjectsItem* _tmp46_;
				ObjectsItem* _tmp47_;
				gint _tmp48_;
				gint _tmp49_;
				LayoutsItemBase* _tmp50_;
				ObjectsItem* _tmp51_;
				ObjectsItem* _tmp52_;
				gint _tmp53_;
				gint _tmp54_;
				_tmp43_ = layouts_item_base_get_item (moved_row);
				_tmp44_ = _tmp43_;
				_tmp45_ = prev;
				_tmp46_ = layouts_item_base_get_item (_tmp45_);
				_tmp47_ = _tmp46_;
				_tmp48_ = objects_item_get_child_order (_tmp47_);
				_tmp49_ = _tmp48_;
				_tmp50_ = next;
				_tmp51_ = layouts_item_base_get_item (_tmp50_);
				_tmp52_ = _tmp51_;
				_tmp53_ = objects_item_get_child_order (_tmp52_);
				_tmp54_ = _tmp53_;
				objects_item_set_child_order (_tmp44_, (gint) ((_tmp49_ + _tmp54_) / 2));
			} else {
				ObjectsItem* _tmp55_;
				ObjectsItem* _tmp56_;
				_tmp55_ = layouts_item_base_get_item (moved_row);
				_tmp56_ = _tmp55_;
				objects_item_set_child_order (_tmp56_, 1000);
			}
		}
	}
	_tmp57_ = layouts_item_base_get_item (moved_row);
	_tmp58_ = _tmp57_;
	objects_item_update_async (_tmp58_, "");
	_tmp61_ = prev;
	if (_tmp61_ != NULL) {
		LayoutsItemBase* _tmp62_;
		_tmp62_ = next;
		_tmp60_ = _tmp62_ != NULL;
	} else {
		_tmp60_ = FALSE;
	}
	if (_tmp60_) {
		ObjectsItem* _tmp63_;
		ObjectsItem* _tmp64_;
		gint _tmp65_;
		gint _tmp66_;
		LayoutsItemBase* _tmp67_;
		ObjectsItem* _tmp68_;
		ObjectsItem* _tmp69_;
		gint _tmp70_;
		gint _tmp71_;
		_tmp63_ = layouts_item_base_get_item (moved_row);
		_tmp64_ = _tmp63_;
		_tmp65_ = objects_item_get_child_order (_tmp64_);
		_tmp66_ = _tmp65_;
		_tmp67_ = prev;
		_tmp68_ = layouts_item_base_get_item (_tmp67_);
		_tmp69_ = _tmp68_;
		_tmp70_ = objects_item_get_child_order (_tmp69_);
		_tmp71_ = _tmp70_;
		_tmp59_ = _tmp66_ == _tmp71_;
	} else {
		_tmp59_ = FALSE;
	}
	if (_tmp59_) {
		GeeArrayList* _tmp72_;
		_tmp72_ = rows;
		utils_task_utils_normalize_orders (_tmp72_);
	}
	_g_object_unref0 (next);
	_g_object_unref0 (prev);
	_g_object_unref0 (rows);
}

void
utils_task_utils_normalize_orders (GeeArrayList* rows)
{
	gint spacing = 0;
	gint order = 0;
	g_return_if_fail (rows != NULL);
	spacing = 1000;
	order = spacing;
	{
		GeeArrayList* _row_list = NULL;
		gint _row_size = 0;
		GeeArrayList* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gint _row_index = 0;
		_row_list = rows;
		_tmp0_ = _row_list;
		_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
		_tmp2_ = _tmp1_;
		_row_size = _tmp2_;
		_row_index = -1;
		while (TRUE) {
			gint _tmp3_;
			gint _tmp4_;
			LayoutsItemBase* row = NULL;
			GeeArrayList* _tmp5_;
			gpointer _tmp6_;
			LayoutsItemBase* _tmp7_;
			ObjectsItem* _tmp8_;
			ObjectsItem* _tmp9_;
			LayoutsItemBase* _tmp10_;
			ObjectsItem* _tmp11_;
			ObjectsItem* _tmp12_;
			_row_index = _row_index + 1;
			_tmp3_ = _row_index;
			_tmp4_ = _row_size;
			if (!(_tmp3_ < _tmp4_)) {
				break;
			}
			_tmp5_ = _row_list;
			_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, _row_index);
			row = (LayoutsItemBase*) _tmp6_;
			_tmp7_ = row;
			_tmp8_ = layouts_item_base_get_item (_tmp7_);
			_tmp9_ = _tmp8_;
			objects_item_set_child_order (_tmp9_, order);
			order += spacing;
			_tmp10_ = row;
			_tmp11_ = layouts_item_base_get_item (_tmp10_);
			_tmp12_ = _tmp11_;
			objects_item_update_async (_tmp12_, "");
			_g_object_unref0 (row);
		}
	}
}

gboolean
utils_task_utils_items_filter_func (ObjectsItem* item,
                                    GeeHashMap* filters)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean return_value = FALSE;
	gboolean result;
	g_return_val_if_fail (item != NULL, FALSE);
	g_return_val_if_fail (filters != NULL, FALSE);
	_tmp0_ = gee_abstract_map_get_size ((GeeAbstractMap*) filters);
	_tmp1_ = _tmp0_;
	if (_tmp1_ <= 0) {
		result = TRUE;
		return result;
	}
	return_value = FALSE;
	{
		GeeIterator* _filter_it = NULL;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeCollection* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp2_ = gee_abstract_map_get_values ((GeeAbstractMap*) filters);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_filter_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			ObjectsFiltersFilterItem* filter = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			ObjectsFiltersFilterItem* _tmp10_;
			FilterItemType _tmp11_;
			FilterItemType _tmp12_;
			_tmp7_ = _filter_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _filter_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			filter = (ObjectsFiltersFilterItem*) _tmp9_;
			_tmp10_ = filter;
			_tmp11_ = objects_filters_filter_item_get_filter_type (_tmp10_);
			_tmp12_ = _tmp11_;
			if (_tmp12_ == FILTER_ITEM_TYPE_PRIORITY) {
				gboolean _tmp13_ = FALSE;
				if (return_value) {
					_tmp13_ = TRUE;
				} else {
					gint _tmp14_;
					gint _tmp15_;
					ObjectsFiltersFilterItem* _tmp16_;
					const gchar* _tmp17_;
					const gchar* _tmp18_;
					_tmp14_ = objects_item_get_priority (item);
					_tmp15_ = _tmp14_;
					_tmp16_ = filter;
					_tmp17_ = objects_filters_filter_item_get_value (_tmp16_);
					_tmp18_ = _tmp17_;
					_tmp13_ = _tmp15_ == atoi (_tmp18_);
				}
				return_value = _tmp13_;
			} else {
				ObjectsFiltersFilterItem* _tmp19_;
				FilterItemType _tmp20_;
				FilterItemType _tmp21_;
				_tmp19_ = filter;
				_tmp20_ = objects_filters_filter_item_get_filter_type (_tmp19_);
				_tmp21_ = _tmp20_;
				if (_tmp21_ == FILTER_ITEM_TYPE_LABEL) {
					gboolean _tmp22_ = FALSE;
					if (return_value) {
						_tmp22_ = TRUE;
					} else {
						ObjectsFiltersFilterItem* _tmp23_;
						const gchar* _tmp24_;
						const gchar* _tmp25_;
						_tmp23_ = filter;
						_tmp24_ = objects_filters_filter_item_get_value (_tmp23_);
						_tmp25_ = _tmp24_;
						_tmp22_ = objects_item_has_label (item, _tmp25_);
					}
					return_value = _tmp22_;
				} else {
					ObjectsFiltersFilterItem* _tmp26_;
					FilterItemType _tmp27_;
					FilterItemType _tmp28_;
					_tmp26_ = filter;
					_tmp27_ = objects_filters_filter_item_get_filter_type (_tmp26_);
					_tmp28_ = _tmp27_;
					if (_tmp28_ == FILTER_ITEM_TYPE_DUE_DATE) {
						ObjectsFiltersFilterItem* _tmp29_;
						const gchar* _tmp30_;
						const gchar* _tmp31_;
						_tmp29_ = filter;
						_tmp30_ = objects_filters_filter_item_get_value (_tmp29_);
						_tmp31_ = _tmp30_;
						if (g_strcmp0 (_tmp31_, "1") == 0) {
							gboolean _tmp32_ = FALSE;
							if (return_value) {
								_tmp32_ = TRUE;
							} else {
								gboolean _tmp33_ = FALSE;
								gboolean _tmp34_;
								gboolean _tmp35_;
								_tmp34_ = objects_item_get_has_due (item);
								_tmp35_ = _tmp34_;
								if (_tmp35_) {
									ObjectsDueDate* _tmp36_;
									ObjectsDueDate* _tmp37_;
									GDateTime* _tmp38_;
									GDateTime* _tmp39_;
									_tmp36_ = objects_item_get_due (item);
									_tmp37_ = _tmp36_;
									_tmp38_ = objects_due_date_get_datetime (_tmp37_);
									_tmp39_ = _tmp38_;
									_tmp33_ = utils_datetime_is_today (_tmp39_);
								} else {
									_tmp33_ = FALSE;
								}
								_tmp32_ = _tmp33_;
							}
							return_value = _tmp32_;
						} else {
							ObjectsFiltersFilterItem* _tmp40_;
							const gchar* _tmp41_;
							const gchar* _tmp42_;
							_tmp40_ = filter;
							_tmp41_ = objects_filters_filter_item_get_value (_tmp40_);
							_tmp42_ = _tmp41_;
							if (g_strcmp0 (_tmp42_, "2") == 0) {
								gboolean _tmp43_ = FALSE;
								if (return_value) {
									_tmp43_ = TRUE;
								} else {
									gboolean _tmp44_ = FALSE;
									gboolean _tmp45_;
									gboolean _tmp46_;
									_tmp45_ = objects_item_get_has_due (item);
									_tmp46_ = _tmp45_;
									if (_tmp46_) {
										ObjectsDueDate* _tmp47_;
										ObjectsDueDate* _tmp48_;
										GDateTime* _tmp49_;
										GDateTime* _tmp50_;
										_tmp47_ = objects_item_get_due (item);
										_tmp48_ = _tmp47_;
										_tmp49_ = objects_due_date_get_datetime (_tmp48_);
										_tmp50_ = _tmp49_;
										_tmp44_ = utils_datetime_is_this_week (_tmp50_);
									} else {
										_tmp44_ = FALSE;
									}
									_tmp43_ = _tmp44_;
								}
								return_value = _tmp43_;
							} else {
								ObjectsFiltersFilterItem* _tmp51_;
								const gchar* _tmp52_;
								const gchar* _tmp53_;
								_tmp51_ = filter;
								_tmp52_ = objects_filters_filter_item_get_value (_tmp51_);
								_tmp53_ = _tmp52_;
								if (g_strcmp0 (_tmp53_, "3") == 0) {
									gboolean _tmp54_ = FALSE;
									if (return_value) {
										_tmp54_ = TRUE;
									} else {
										gboolean _tmp55_ = FALSE;
										gboolean _tmp56_;
										gboolean _tmp57_;
										_tmp56_ = objects_item_get_has_due (item);
										_tmp57_ = _tmp56_;
										if (_tmp57_) {
											ObjectsDueDate* _tmp58_;
											ObjectsDueDate* _tmp59_;
											GDateTime* _tmp60_;
											GDateTime* _tmp61_;
											_tmp58_ = objects_item_get_due (item);
											_tmp59_ = _tmp58_;
											_tmp60_ = objects_due_date_get_datetime (_tmp59_);
											_tmp61_ = _tmp60_;
											_tmp55_ = utils_datetime_is_next_x_week (_tmp61_, 7);
										} else {
											_tmp55_ = FALSE;
										}
										_tmp54_ = _tmp55_;
									}
									return_value = _tmp54_;
								} else {
									ObjectsFiltersFilterItem* _tmp62_;
									const gchar* _tmp63_;
									const gchar* _tmp64_;
									_tmp62_ = filter;
									_tmp63_ = objects_filters_filter_item_get_value (_tmp62_);
									_tmp64_ = _tmp63_;
									if (g_strcmp0 (_tmp64_, "4") == 0) {
										gboolean _tmp65_ = FALSE;
										if (return_value) {
											_tmp65_ = TRUE;
										} else {
											gboolean _tmp66_ = FALSE;
											gboolean _tmp67_;
											gboolean _tmp68_;
											_tmp67_ = objects_item_get_has_due (item);
											_tmp68_ = _tmp67_;
											if (_tmp68_) {
												ObjectsDueDate* _tmp69_;
												ObjectsDueDate* _tmp70_;
												GDateTime* _tmp71_;
												GDateTime* _tmp72_;
												_tmp69_ = objects_item_get_due (item);
												_tmp70_ = _tmp69_;
												_tmp71_ = objects_due_date_get_datetime (_tmp70_);
												_tmp72_ = _tmp71_;
												_tmp66_ = utils_datetime_is_this_month (_tmp72_);
											} else {
												_tmp66_ = FALSE;
											}
											_tmp65_ = _tmp66_;
										}
										return_value = _tmp65_;
									} else {
										ObjectsFiltersFilterItem* _tmp73_;
										const gchar* _tmp74_;
										const gchar* _tmp75_;
										_tmp73_ = filter;
										_tmp74_ = objects_filters_filter_item_get_value (_tmp73_);
										_tmp75_ = _tmp74_;
										if (g_strcmp0 (_tmp75_, "5") == 0) {
											gboolean _tmp76_ = FALSE;
											if (return_value) {
												_tmp76_ = TRUE;
											} else {
												gboolean _tmp77_ = FALSE;
												gboolean _tmp78_;
												gboolean _tmp79_;
												_tmp78_ = objects_item_get_has_due (item);
												_tmp79_ = _tmp78_;
												if (_tmp79_) {
													ObjectsDueDate* _tmp80_;
													ObjectsDueDate* _tmp81_;
													GDateTime* _tmp82_;
													GDateTime* _tmp83_;
													_tmp80_ = objects_item_get_due (item);
													_tmp81_ = _tmp80_;
													_tmp82_ = objects_due_date_get_datetime (_tmp81_);
													_tmp83_ = _tmp82_;
													_tmp77_ = utils_datetime_is_next_x_week (_tmp83_, 30);
												} else {
													_tmp77_ = FALSE;
												}
												_tmp76_ = _tmp77_;
											}
											return_value = _tmp76_;
										} else {
											ObjectsFiltersFilterItem* _tmp84_;
											const gchar* _tmp85_;
											const gchar* _tmp86_;
											_tmp84_ = filter;
											_tmp85_ = objects_filters_filter_item_get_value (_tmp84_);
											_tmp86_ = _tmp85_;
											if (g_strcmp0 (_tmp86_, "6") == 0) {
												gboolean _tmp87_ = FALSE;
												if (return_value) {
													_tmp87_ = TRUE;
												} else {
													gboolean _tmp88_;
													gboolean _tmp89_;
													_tmp88_ = objects_item_get_has_due (item);
													_tmp89_ = _tmp88_;
													_tmp87_ = !_tmp89_;
												}
												return_value = _tmp87_;
											}
										}
									}
								}
							}
						}
					}
				}
			}
			_g_object_unref0 (filter);
		}
		_g_object_unref0 (_filter_it);
	}
	result = return_value;
	return result;
}

UtilsTaskUtils*
utils_task_utils_construct (GType object_type)
{
	UtilsTaskUtils* self = NULL;
	self = (UtilsTaskUtils*) g_type_create_instance (object_type);
	return self;
}

UtilsTaskUtils*
utils_task_utils_new (void)
{
	return utils_task_utils_construct (UTILS_TYPE_TASK_UTILS);
}

static void
utils_value_task_utils_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
utils_value_task_utils_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		utils_task_utils_unref (value->data[0].v_pointer);
	}
}

static void
utils_value_task_utils_copy_value (const GValue* src_value,
                                   GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = utils_task_utils_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
utils_value_task_utils_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
utils_value_task_utils_collect_value (GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		UtilsTaskUtils * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = utils_task_utils_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
utils_value_task_utils_lcopy_value (const GValue* value,
                                    guint n_collect_values,
                                    GTypeCValue* collect_values,
                                    guint collect_flags)
{
	UtilsTaskUtils ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = utils_task_utils_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
utils_param_spec_task_utils (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags)
{
	UtilsParamSpecTaskUtils* spec;
	g_return_val_if_fail (g_type_is_a (object_type, UTILS_TYPE_TASK_UTILS), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
utils_value_get_task_utils (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UTILS_TYPE_TASK_UTILS), NULL);
	return value->data[0].v_pointer;
}

void
utils_value_set_task_utils (GValue* value,
                            gpointer v_object)
{
	UtilsTaskUtils * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UTILS_TYPE_TASK_UTILS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UTILS_TYPE_TASK_UTILS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		utils_task_utils_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		utils_task_utils_unref (old);
	}
}

void
utils_value_take_task_utils (GValue* value,
                             gpointer v_object)
{
	UtilsTaskUtils * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UTILS_TYPE_TASK_UTILS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UTILS_TYPE_TASK_UTILS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		utils_task_utils_unref (old);
	}
}

static void
utils_task_utils_class_init (UtilsTaskUtilsClass * klass,
                             gpointer klass_data)
{
	utils_task_utils_parent_class = g_type_class_peek_parent (klass);
	((UtilsTaskUtilsClass *) klass)->finalize = utils_task_utils_finalize;
}

static void
utils_task_utils_instance_init (UtilsTaskUtils * self,
                                gpointer klass)
{
	self->ref_count = 1;
}

static void
utils_task_utils_finalize (UtilsTaskUtils * obj)
{
	UtilsTaskUtils * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, UTILS_TYPE_TASK_UTILS, UtilsTaskUtils);
	g_signal_handlers_destroy (self);
}

static GType
utils_task_utils_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { utils_value_task_utils_init, utils_value_task_utils_free_value, utils_value_task_utils_copy_value, utils_value_task_utils_peek_pointer, "p", utils_value_task_utils_collect_value, "p", utils_value_task_utils_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (UtilsTaskUtilsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) utils_task_utils_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UtilsTaskUtils), 0, (GInstanceInitFunc) utils_task_utils_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType utils_task_utils_type_id;
	utils_task_utils_type_id = g_type_register_fundamental (g_type_fundamental_next (), "UtilsTaskUtils", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return utils_task_utils_type_id;
}

GType
utils_task_utils_get_type (void)
{
	static volatile gsize utils_task_utils_type_id__once = 0;
	if (g_once_init_enter (&utils_task_utils_type_id__once)) {
		GType utils_task_utils_type_id;
		utils_task_utils_type_id = utils_task_utils_get_type_once ();
		g_once_init_leave (&utils_task_utils_type_id__once, utils_task_utils_type_id);
	}
	return utils_task_utils_type_id__once;
}

gpointer
utils_task_utils_ref (gpointer instance)
{
	UtilsTaskUtils * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
utils_task_utils_unref (gpointer instance)
{
	UtilsTaskUtils * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		UTILS_TASK_UTILS_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

