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

/*
 * Copyright © 2024 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 "planify.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <libedataserver/libedataserver.h>
#include <libecal/libecal.h>
#include <libical-glib/libical-glib.h>
#include <gio/gio.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

enum  {
	SERVICES_STORE_0_PROPERTY,
	SERVICES_STORE_SOURCES_PROPERTY,
	SERVICES_STORE_PROJECTS_PROPERTY,
	SERVICES_STORE_SECTIONS_PROPERTY,
	SERVICES_STORE_ITEMS_PROPERTY,
	SERVICES_STORE_LABELS_PROPERTY,
	SERVICES_STORE_REMINDERS_PROPERTY,
	SERVICES_STORE_ATTACHMENTS_PROPERTY,
	SERVICES_STORE_NUM_PROPERTIES
};
static GParamSpec* services_store_properties[SERVICES_STORE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ServicesStoreDeleteSourceData ServicesStoreDeleteSourceData;
typedef struct _ServicesStoreDeleteProjectData ServicesStoreDeleteProjectData;
typedef struct _ServicesStoreCreateCalendarEventData ServicesStoreCreateCalendarEventData;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
enum  {
	SERVICES_STORE_SOURCE_ADDED_SIGNAL,
	SERVICES_STORE_SOURCE_DELETED_SIGNAL,
	SERVICES_STORE_SOURCE_UPDATED_SIGNAL,
	SERVICES_STORE_PROJECT_ADDED_SIGNAL,
	SERVICES_STORE_PROJECT_UPDATED_SIGNAL,
	SERVICES_STORE_PROJECT_DELETED_SIGNAL,
	SERVICES_STORE_PROJECT_ARCHIVED_SIGNAL,
	SERVICES_STORE_PROJECT_UNARCHIVED_SIGNAL,
	SERVICES_STORE_LABEL_ADDED_SIGNAL,
	SERVICES_STORE_LABEL_UPDATED_SIGNAL,
	SERVICES_STORE_LABEL_DELETED_SIGNAL,
	SERVICES_STORE_SECTION_DELETED_SIGNAL,
	SERVICES_STORE_SECTION_MOVED_SIGNAL,
	SERVICES_STORE_SECTION_ARCHIVED_SIGNAL,
	SERVICES_STORE_SECTION_UNARCHIVED_SIGNAL,
	SERVICES_STORE_ITEM_DELETED_SIGNAL,
	SERVICES_STORE_ITEM_ADDED_SIGNAL,
	SERVICES_STORE_ITEM_UPDATED_SIGNAL,
	SERVICES_STORE_ITEM_ARCHIVED_SIGNAL,
	SERVICES_STORE_ITEM_UNARCHIVED_SIGNAL,
	SERVICES_STORE_ITEM_PIN_CHANGE_SIGNAL,
	SERVICES_STORE_ITEM_MOVED_SIGNAL,
	SERVICES_STORE_ITEM_LABEL_ADDED_SIGNAL,
	SERVICES_STORE_ITEM_LABEL_DELETED_SIGNAL,
	SERVICES_STORE_REMINDER_ADDED_SIGNAL,
	SERVICES_STORE_REMINDER_DELETED_SIGNAL,
	SERVICES_STORE_ATTACHMENT_DELETED_SIGNAL,
	SERVICES_STORE_NUM_SIGNALS
};
static guint services_store_signals[SERVICES_STORE_NUM_SIGNALS] = {0};

struct _ServicesStorePrivate {
	GeeHashMap* _items_by_project_cache;
	GeeArrayList* _sources;
	GRecMutex __lock__sources;
	GeeArrayList* _projects;
	GRecMutex __lock__projects;
	GeeArrayList* _sections;
	GRecMutex __lock__sections;
	GeeArrayList* _items;
	GRecMutex __lock__items;
	GeeArrayList* _labels;
	GRecMutex __lock__labels;
	GeeArrayList* _reminders;
	GRecMutex __lock__reminders;
	GeeArrayList* _attachments;
	GRecMutex __lock__attachments;
};

struct _ServicesStoreDeleteSourceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesStore* self;
	ObjectsSource* source;
	GeeArrayList* projects;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GeeArrayList* _tmp2_;
	gint i;
	gboolean _tmp3_;
	GeeArrayList* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gint batch_end;
	GeeArrayList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint j;
	gboolean _tmp10_;
	gint _tmp11_;
	GeeArrayList* _tmp12_;
	gpointer _tmp13_;
	ObjectsProject* _tmp14_;
	ServicesDatabase* _tmp15_;
	ServicesDatabase* _tmp16_;
	gboolean _tmp17_;
	GeeArrayList* _label_list;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	GeeArrayList* _tmp20_;
	gint _label_size;
	GeeArrayList* _tmp21_;
	gint _tmp22_;
	gint _tmp23_;
	gint _label_index;
	gint _tmp24_;
	gint _tmp25_;
	ObjectsLabel* label;
	GeeArrayList* _tmp26_;
	gpointer _tmp27_;
	ObjectsLabel* _tmp28_;
	GeeArrayList* _tmp29_;
};

struct _ServicesStoreDeleteProjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesStore* self;
	ObjectsProject* project;
	GeeArrayList* sections;
	GeeArrayList* _tmp0_;
	GeeArrayList* items;
	GeeArrayList* _tmp1_;
	GeeArrayList* subprojects;
	GeeArrayList* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GeeArrayList* _item_list;
	GeeArrayList* _tmp5_;
	gint _item_size;
	GeeArrayList* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gint _item_index;
	gint _tmp9_;
	gint _tmp10_;
	ObjectsItem* item;
	GeeArrayList* _tmp11_;
	gpointer _tmp12_;
	ObjectsItem* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	ServicesCalendarEvents* _tmp16_;
	ServicesCalendarEvents* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	ObjectsItem* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	ServicesDatabase* _tmp23_;
	ServicesDatabase* _tmp24_;
	GeeArrayList* _vala1__item_list;
	GeeArrayList* _tmp25_;
	gint _vala1__item_size;
	GeeArrayList* _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	gint _vala1__item_index;
	gint _tmp29_;
	gint _tmp30_;
	ObjectsItem* _vala1_item;
	GeeArrayList* _tmp31_;
	gpointer _tmp32_;
	GeeHashMap* _tmp33_;
	ObjectsItem* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	ObjectsItem* _tmp37_;
	GeeArrayList* _tmp38_;
	ObjectsItem* _tmp39_;
	ObjectsItem* _tmp40_;
	GeeArrayList* _section_list;
	GeeArrayList* _tmp41_;
	gint _section_size;
	GeeArrayList* _tmp42_;
	gint _tmp43_;
	gint _tmp44_;
	gint _section_index;
	gint _tmp45_;
	gint _tmp46_;
	ObjectsSection* section;
	GeeArrayList* _tmp47_;
	gpointer _tmp48_;
	ServicesDatabase* _tmp49_;
	ServicesDatabase* _tmp50_;
	ObjectsSection* _tmp51_;
	ObjectsSection* _tmp52_;
	ObjectsSection* _tmp53_;
	GeeArrayList* _tmp54_;
	ObjectsSection* _tmp55_;
	GeeArrayList* _subproject_list;
	GeeArrayList* _tmp56_;
	gint _subproject_size;
	GeeArrayList* _tmp57_;
	gint _tmp58_;
	gint _tmp59_;
	gint _subproject_index;
	gint _tmp60_;
	gint _tmp61_;
	ObjectsProject* subproject;
	GeeArrayList* _tmp62_;
	gpointer _tmp63_;
	ObjectsProject* _tmp64_;
	ServicesDatabase* _tmp65_;
	ServicesDatabase* _tmp66_;
	gboolean _tmp67_;
	GeeArrayList* _tmp68_;
};

struct _ServicesStoreCreateCalendarEventData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesStore* self;
	ObjectsItem* item;
	gchar* event_uid;
	ServicesCalendarEvents* _tmp0_;
	ServicesCalendarEvents* _tmp1_;
	ObjectsProject* _tmp2_;
	ObjectsProject* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	ServicesDatabase* _tmp10_;
	ServicesDatabase* _tmp11_;
};

static gint ServicesStore_private_offset;
static gpointer services_store_parent_class = NULL;
static GOnce services_store__instance;
static GOnce services_store__instance = G_ONCE_INIT;

static ServicesStore* __lambda6_ (void);
static gpointer ___lambda6__gthread_func (gpointer self);
static void __lambda72_ (ServicesStore* self,
                  ESource* source,
                  GeeCollection* components);
static void ___lambda72__services_calendar_events_components_removed (ServicesCalendarEvents* _sender,
                                                               ESource* source,
                                                               GeeCollection* components,
                                                               gpointer self);
static void services_store_delete_source_data_free (gpointer _data);
static gboolean services_store_delete_source_co (ServicesStoreDeleteSourceData* _data_);
static void services_store_delete_source_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
static gint __lambda73_ (ServicesStore* self,
                  ObjectsSource* a,
                  ObjectsSource* b);
static gint ___lambda73__gcompare_data_func (gconstpointer a,
                                      gconstpointer b,
                                      gpointer self);
static void services_store_delete_project_data_free (gpointer _data);
static gboolean services_store_delete_project_co (ServicesStoreDeleteProjectData* _data_);
static void services_store_delete_project_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void services_store_create_calendar_event (ServicesStore* self,
                                           ObjectsItem* item,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void services_store_create_calendar_event_finish (ServicesStore* self,
                                                  GAsyncResult* _res_);
static void services_store_create_calendar_event_data_free (gpointer _data);
static gboolean services_store_create_calendar_event_co (ServicesStoreCreateCalendarEventData* _data_);
static void services_store_create_calendar_event_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void g_cclosure_user_marshal_VOID__OBJECT_STRING (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_STRING_STRING_STRING (GClosure * closure,
                                                                GValue * return_value,
                                                                guint n_param_values,
                                                                const GValue * param_values,
                                                                gpointer invocation_hint,
                                                                gpointer marshal_data);
static void services_store_finalize (GObject * obj);
static GType services_store_get_type_once (void);
static void _vala_services_store_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
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 gssize _vala_array_length (gpointer array);

static inline gpointer
services_store_get_instance_private (ServicesStore* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesStore_private_offset);
}

static ServicesStore*
__lambda6_ (void)
{
	ServicesStore* _tmp0_;
	ServicesStore* result;
	_tmp0_ = services_store_new ();
	result = _tmp0_;
	return result;
}

static gpointer
___lambda6__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda6_ ();
	return result;
}

ServicesStore*
services_store_instance (void)
{
	gconstpointer _tmp0_;
	ServicesStore* result;
	_tmp0_ = g_once (&services_store__instance, ___lambda6__gthread_func, NULL);
	result = (ServicesStore*) _tmp0_;
	return result;
}

static void
__lambda72_ (ServicesStore* self,
             ESource* source,
             GeeCollection* components)
{
	g_return_if_fail (source != NULL);
	g_return_if_fail (components != NULL);
	{
		GeeIterator* _component_it = NULL;
		GeeIterator* _tmp0_;
		_tmp0_ = gee_iterable_iterator ((GeeIterable*) components);
		_component_it = _tmp0_;
		while (TRUE) {
			GeeIterator* _tmp1_;
			ECalComponent* component = NULL;
			GeeIterator* _tmp2_;
			gpointer _tmp3_;
			ICalComponent* ical = NULL;
			ECalComponent* _tmp4_;
			ICalComponent* _tmp5_;
			gchar* event_uid = NULL;
			ICalComponent* _tmp6_;
			const gchar* _tmp7_;
			gchar* _tmp8_;
			_tmp1_ = _component_it;
			if (!gee_iterator_next (_tmp1_)) {
				break;
			}
			_tmp2_ = _component_it;
			_tmp3_ = gee_iterator_get (_tmp2_);
			component = (ECalComponent*) _tmp3_;
			_tmp4_ = component;
			_tmp5_ = e_cal_component_get_icalcomponent (_tmp4_);
			ical = _tmp5_;
			_tmp6_ = ical;
			_tmp7_ = i_cal_component_get_uid (_tmp6_);
			_tmp8_ = g_strdup (_tmp7_);
			event_uid = _tmp8_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp9_;
				GeeArrayList* _tmp10_;
				gint _item_size = 0;
				GeeArrayList* _tmp11_;
				gint _tmp12_;
				gint _tmp13_;
				gint _item_index = 0;
				_tmp9_ = services_store_get_items (self);
				_tmp10_ = _tmp9_;
				_item_list = _tmp10_;
				_tmp11_ = _item_list;
				_tmp12_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp11_);
				_tmp13_ = _tmp12_;
				_item_size = _tmp13_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp14_;
					gint _tmp15_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp16_;
					gpointer _tmp17_;
					ObjectsItem* _tmp18_;
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp21_;
					_item_index = _item_index + 1;
					_tmp14_ = _item_index;
					_tmp15_ = _item_size;
					if (!(_tmp14_ < _tmp15_)) {
						break;
					}
					_tmp16_ = _item_list;
					_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, _item_index);
					item = (ObjectsItem*) _tmp17_;
					_tmp18_ = item;
					_tmp19_ = objects_item_get_calendar_event_uid (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = event_uid;
					if (g_strcmp0 (_tmp20_, _tmp21_) == 0) {
						ObjectsItem* _tmp22_;
						ServicesDatabase* _tmp23_;
						ServicesDatabase* _tmp24_;
						ObjectsItem* _tmp25_;
						_tmp22_ = item;
						objects_item_set_calendar_event_uid (_tmp22_, "");
						_tmp23_ = services_database_get_default ();
						_tmp24_ = _tmp23_;
						_tmp25_ = item;
						services_database_update_item (_tmp24_, _tmp25_, "");
						_g_object_unref0 (_tmp24_);
						_g_object_unref0 (item);
						break;
					}
					_g_object_unref0 (item);
				}
			}
			_g_free0 (event_uid);
			_g_object_unref0 (component);
		}
		_g_object_unref0 (_component_it);
	}
}

static void
___lambda72__services_calendar_events_components_removed (ServicesCalendarEvents* _sender,
                                                          ESource* source,
                                                          GeeCollection* components,
                                                          gpointer self)
{
	__lambda72_ ((ServicesStore*) self, source, components);
}

void
services_store_setup_calendar_events (ServicesStore* self)
{
	ServicesCalendarEvents* _tmp0_;
	ServicesCalendarEvents* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_calendar_events_get_default ();
	_tmp1_ = _tmp0_;
	g_signal_connect_object (_tmp1_, "components-removed", (GCallback) ___lambda72__services_calendar_events_components_removed, self, 0);
	_g_object_unref0 (_tmp1_);
}

gboolean
services_store_is_database_empty (ServicesStore* self)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = services_store_get_projects (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_ <= 0;
	return result;
}

gboolean
services_store_is_sources_empty (ServicesStore* self)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = services_store_get_sources (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_ <= 0;
	return result;
}

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

GeeArrayList*
services_store_get_collection_by_type (ServicesStore* self,
                                       ObjectsBaseObject* base_object)
{
	GeeArrayList* _tmp12_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (base_object != NULL, NULL);
	if (OBJECTS_IS_PROJECT (base_object)) {
		GeeArrayList* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		_tmp0_ = services_store_get_projects (self);
		_tmp1_ = _tmp0_;
		_tmp2_ = _g_object_ref0 (_tmp1_);
		result = _tmp2_;
		return result;
	} else {
		if (OBJECTS_IS_SECTION (base_object)) {
			GeeArrayList* _tmp3_;
			GeeArrayList* _tmp4_;
			GeeArrayList* _tmp5_;
			_tmp3_ = services_store_get_sections (self);
			_tmp4_ = _tmp3_;
			_tmp5_ = _g_object_ref0 (_tmp4_);
			result = _tmp5_;
			return result;
		} else {
			if (OBJECTS_IS_ITEM (base_object)) {
				GeeArrayList* _tmp6_;
				GeeArrayList* _tmp7_;
				GeeArrayList* _tmp8_;
				_tmp6_ = services_store_get_items (self);
				_tmp7_ = _tmp6_;
				_tmp8_ = _g_object_ref0 (_tmp7_);
				result = _tmp8_;
				return result;
			} else {
				if (OBJECTS_IS_LABEL (base_object)) {
					GeeArrayList* _tmp9_;
					GeeArrayList* _tmp10_;
					GeeArrayList* _tmp11_;
					_tmp9_ = services_store_get_labels (self);
					_tmp10_ = _tmp9_;
					_tmp11_ = _g_object_ref0 (_tmp10_);
					result = _tmp11_;
					return result;
				}
			}
		}
	}
	_tmp12_ = gee_array_list_new (OBJECTS_TYPE_BASE_OBJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	result = _tmp12_;
	return result;
}

void
services_store_insert_source (ServicesStore* self,
                              ObjectsSource* source)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	ServicesDatabase* _tmp4_;
	ServicesDatabase* _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_tmp0_ = services_store_get_sources (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	objects_source_set_child_order (source, _tmp3_ + 1);
	_tmp4_ = services_database_get_default ();
	_tmp5_ = _tmp4_;
	_tmp6_ = services_database_insert_source (_tmp5_, source);
	_g_object_unref0 (_tmp5_);
	if (_tmp6_) {
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		_tmp7_ = services_store_get_sources (self);
		_tmp8_ = _tmp7_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp8_, source);
		g_signal_emit (self, services_store_signals[SERVICES_STORE_SOURCE_ADDED_SIGNAL], 0, source);
	}
}

static void
services_store_delete_source_data_free (gpointer _data)
{
	ServicesStoreDeleteSourceData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->source);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesStoreDeleteSourceData, _data_);
}

void
services_store_delete_source (ServicesStore* self,
                              ObjectsSource* source,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	ServicesStoreDeleteSourceData* _data_;
	ServicesStore* _tmp0_;
	ObjectsSource* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_data_ = g_slice_new0 (ServicesStoreDeleteSourceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_store_delete_source_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp1_;
	services_store_delete_source_co (_data_);
}

void
services_store_delete_source_finish (ServicesStore* self,
                                     GAsyncResult* _res_)
{
	ServicesStoreDeleteSourceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
services_store_delete_source_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	ServicesStoreDeleteSourceData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_store_delete_source_co (_data_);
}

static gboolean
services_store_delete_source_co (ServicesStoreDeleteSourceData* _data_)
{
	static const gint BATCH_SIZE = 5;
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->source);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = services_store_get_projects_by_source (_data_->self, _data_->_tmp1_);
	_data_->projects = _data_->_tmp2_;
	{
		_data_->i = 0;
		{
			_data_->_tmp3_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp3_) {
					_data_->i += BATCH_SIZE;
				}
				_data_->_tmp3_ = FALSE;
				_data_->_tmp4_ = _data_->projects;
				_data_->_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp4_);
				_data_->_tmp6_ = _data_->_tmp5_;
				if (!(_data_->i < _data_->_tmp6_)) {
					break;
				}
				_data_->_tmp7_ = _data_->projects;
				_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp7_);
				_data_->_tmp9_ = _data_->_tmp8_;
				_data_->batch_end = MIN (_data_->i + BATCH_SIZE, _data_->_tmp9_);
				{
					_data_->j = _data_->i;
					{
						_data_->_tmp10_ = TRUE;
						while (TRUE) {
							if (!_data_->_tmp10_) {
								_data_->_tmp11_ = _data_->j;
								_data_->j = _data_->_tmp11_ + 1;
							}
							_data_->_tmp10_ = FALSE;
							if (!(_data_->j < _data_->batch_end)) {
								break;
							}
							_data_->_tmp12_ = _data_->projects;
							_data_->_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp12_, _data_->j);
							_data_->_tmp14_ = (ObjectsProject*) _data_->_tmp13_;
							_data_->_state_ = 1;
							services_store_delete_project (_data_->self, _data_->_tmp14_, services_store_delete_source_ready, _data_);
							return FALSE;
							_state_1:
							services_store_delete_project_finish (_data_->self, _data_->_res_);
							_g_object_unref0 (_data_->_tmp14_);
						}
					}
				}
				_data_->_state_ = 2;
				util_nap ((guint) 10, G_PRIORITY_DEFAULT, services_store_delete_source_ready, _data_);
				return FALSE;
				_state_2:
				util_nap_finish (_data_->_res_);
			}
		}
	}
	_data_->_tmp15_ = services_database_get_default ();
	_data_->_tmp16_ = _data_->_tmp15_;
	_data_->_tmp17_ = services_database_delete_source (_data_->_tmp16_, _data_->source);
	_g_object_unref0 (_data_->_tmp16_);
	if (_data_->_tmp17_) {
		{
			_data_->_tmp18_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->source);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp20_ = services_store_get_labels_by_source (_data_->self, _data_->_tmp19_);
			_data_->_label_list = _data_->_tmp20_;
			_data_->_tmp21_ = _data_->_label_list;
			_data_->_tmp22_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp21_);
			_data_->_tmp23_ = _data_->_tmp22_;
			_data_->_label_size = _data_->_tmp23_;
			_data_->_label_index = -1;
			while (TRUE) {
				_data_->_label_index = _data_->_label_index + 1;
				_data_->_tmp24_ = _data_->_label_index;
				_data_->_tmp25_ = _data_->_label_size;
				if (!(_data_->_tmp24_ < _data_->_tmp25_)) {
					break;
				}
				_data_->_tmp26_ = _data_->_label_list;
				_data_->_tmp27_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp26_, _data_->_label_index);
				_data_->label = (ObjectsLabel*) _data_->_tmp27_;
				_data_->_tmp28_ = _data_->label;
				services_store_delete_label (_data_->self, _data_->_tmp28_);
				_g_object_unref0 (_data_->label);
			}
			_g_object_unref0 (_data_->_label_list);
		}
		g_signal_emit_by_name ((ObjectsBaseObject*) _data_->source, "deleted");
		g_signal_emit (_data_->self, services_store_signals[SERVICES_STORE_SOURCE_DELETED_SIGNAL], 0, _data_->source);
		_data_->_tmp29_ = _data_->self->priv->_sources;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _data_->_tmp29_, _data_->source);
	}
	_g_object_unref0 (_data_->projects);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
services_store_update_source (ServicesStore* self,
                              ObjectsSource* source)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_source (_tmp1_, source);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		g_signal_emit_by_name ((ObjectsBaseObject*) source, "updated", "");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_SOURCE_UPDATED_SIGNAL], 0, source);
	}
}

ObjectsSource*
services_store_get_source (ServicesStore* self,
                           const gchar* id)
{
	ObjectsSource* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsSource* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_sources;
		g_rec_mutex_lock (&self->priv->__lock__sources);
		{
			ObjectsSource* _tmp15_;
			ObjectsSource* _tmp16_;
			{
				GeeArrayList* _source_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _source_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _source_index = 0;
				_tmp1_ = services_store_get_sources (self);
				_tmp2_ = _tmp1_;
				_source_list = _tmp2_;
				_tmp3_ = _source_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_source_size = _tmp5_;
				_source_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsSource* source = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsSource* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_source_index = _source_index + 1;
					_tmp6_ = _source_index;
					_tmp7_ = _source_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _source_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _source_index);
					source = (ObjectsSource*) _tmp9_;
					_tmp10_ = source;
					_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, id) == 0) {
						ObjectsSource* _tmp13_;
						ObjectsSource* _tmp14_;
						_tmp13_ = source;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (source);
						break;
					}
					_g_object_unref0 (source);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_sources;
				g_rec_mutex_unlock (&self->priv->__lock__sources);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_sources;
			g_rec_mutex_unlock (&self->priv->__lock__sources);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

static gint
__lambda73_ (ServicesStore* self,
             ObjectsSource* a,
             ObjectsSource* b)
{
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = objects_source_get_child_order (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_source_get_child_order (b);
	_tmp3_ = _tmp2_;
	result = _tmp1_ - _tmp3_;
	return result;
}

static gint
___lambda73__gcompare_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gint result;
	result = __lambda73_ ((ServicesStore*) self, (ObjectsSource*) a, (ObjectsSource*) b);
	return result;
}

ObjectsSource*
services_store_get_default_source (ServicesStore* self)
{
	GeeArrayList* visible_sources = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp15_;
	ObjectsSource* _tmp16_ = NULL;
	GeeArrayList* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	ObjectsSource* _tmp22_;
	ObjectsSource* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_SOURCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	visible_sources = _tmp0_;
	{
		GeeArrayList* _source_list = NULL;
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		gint _source_size = 0;
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _source_index = 0;
		_tmp1_ = services_store_get_sources (self);
		_tmp2_ = _tmp1_;
		_source_list = _tmp2_;
		_tmp3_ = _source_list;
		_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_source_size = _tmp5_;
		_source_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			ObjectsSource* source = NULL;
			GeeArrayList* _tmp8_;
			gpointer _tmp9_;
			ObjectsSource* _tmp10_;
			gboolean _tmp11_;
			gboolean _tmp12_;
			_source_index = _source_index + 1;
			_tmp6_ = _source_index;
			_tmp7_ = _source_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _source_list;
			_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _source_index);
			source = (ObjectsSource*) _tmp9_;
			_tmp10_ = source;
			_tmp11_ = objects_source_get_is_visible (_tmp10_);
			_tmp12_ = _tmp11_;
			if (_tmp12_) {
				GeeArrayList* _tmp13_;
				ObjectsSource* _tmp14_;
				_tmp13_ = visible_sources;
				_tmp14_ = source;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp13_, _tmp14_);
			}
			_g_object_unref0 (source);
		}
	}
	_tmp15_ = visible_sources;
	gee_list_sort ((GeeList*) _tmp15_, ___lambda73__gcompare_data_func, g_object_ref (self), g_object_unref);
	_tmp17_ = visible_sources;
	_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_ > 0) {
		GeeArrayList* _tmp20_;
		gpointer _tmp21_;
		_tmp20_ = visible_sources;
		_tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _tmp20_, 0);
		_g_object_unref0 (_tmp16_);
		_tmp16_ = (ObjectsSource*) _tmp21_;
	} else {
		_g_object_unref0 (_tmp16_);
		_tmp16_ = NULL;
	}
	_tmp22_ = _tmp16_;
	_tmp16_ = NULL;
	result = _tmp22_;
	_g_object_unref0 (_tmp16_);
	_g_object_unref0 (visible_sources);
	return result;
}

gboolean
services_store_source_todoist_exists (ServicesStore* self,
                                      const gchar* email)
{
	gboolean return_value = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (email != NULL, FALSE);
	return_value = FALSE;
	{
		GeeArrayList* _tmp0_;
		gboolean _tmp21_ = FALSE;
		_tmp0_ = self->priv->_sources;
		g_rec_mutex_lock (&self->priv->__lock__sources);
		{
			{
				GeeArrayList* _source_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _source_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _source_index = 0;
				_tmp1_ = services_store_get_sources (self);
				_tmp2_ = _tmp1_;
				_source_list = _tmp2_;
				_tmp3_ = _source_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_source_size = _tmp5_;
				_source_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsSource* source = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					gboolean _tmp10_ = FALSE;
					ObjectsSource* _tmp11_;
					SourceType _tmp12_;
					SourceType _tmp13_;
					_source_index = _source_index + 1;
					_tmp6_ = _source_index;
					_tmp7_ = _source_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _source_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _source_index);
					source = (ObjectsSource*) _tmp9_;
					_tmp11_ = source;
					_tmp12_ = objects_source_get_source_type (_tmp11_);
					_tmp13_ = _tmp12_;
					if (_tmp13_ == SOURCE_TYPE_TODOIST) {
						ObjectsSource* _tmp14_;
						ObjectsSourceTodoistData* _tmp15_;
						ObjectsSourceTodoistData* _tmp16_;
						const gchar* _tmp17_;
						const gchar* _tmp18_;
						_tmp14_ = source;
						_tmp15_ = objects_source_get_todoist_data (_tmp14_);
						_tmp16_ = _tmp15_;
						_tmp17_ = objects_source_todoist_data_get_user_email (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp10_ = g_strcmp0 (_tmp18_, email) == 0;
					} else {
						_tmp10_ = FALSE;
					}
					if (_tmp10_) {
						return_value = TRUE;
						_g_object_unref0 (source);
						break;
					}
					_g_object_unref0 (source);
				}
			}
			result = return_value;
			{
				GeeArrayList* _tmp19_;
				_tmp19_ = self->priv->_sources;
				g_rec_mutex_unlock (&self->priv->__lock__sources);
			}
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp20_;
			_tmp20_ = self->priv->_sources;
			g_rec_mutex_unlock (&self->priv->__lock__sources);
		}
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp21_;
	}
}

gboolean
services_store_source_caldav_exists (ServicesStore* self,
                                     const gchar* server_url,
                                     const gchar* username)
{
	gboolean return_value = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (server_url != NULL, FALSE);
	g_return_val_if_fail (username != NULL, FALSE);
	return_value = FALSE;
	{
		GeeArrayList* _tmp0_;
		gboolean _tmp27_ = FALSE;
		_tmp0_ = self->priv->_sources;
		g_rec_mutex_lock (&self->priv->__lock__sources);
		{
			{
				GeeArrayList* _source_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _source_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _source_index = 0;
				_tmp1_ = services_store_get_sources (self);
				_tmp2_ = _tmp1_;
				_source_list = _tmp2_;
				_tmp3_ = _source_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_source_size = _tmp5_;
				_source_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsSource* source = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					gboolean _tmp10_ = FALSE;
					gboolean _tmp11_ = FALSE;
					ObjectsSource* _tmp12_;
					SourceType _tmp13_;
					SourceType _tmp14_;
					_source_index = _source_index + 1;
					_tmp6_ = _source_index;
					_tmp7_ = _source_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _source_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _source_index);
					source = (ObjectsSource*) _tmp9_;
					_tmp12_ = source;
					_tmp13_ = objects_source_get_source_type (_tmp12_);
					_tmp14_ = _tmp13_;
					if (_tmp14_ == SOURCE_TYPE_CALDAV) {
						ObjectsSource* _tmp15_;
						ObjectsSourceCalDAVData* _tmp16_;
						ObjectsSourceCalDAVData* _tmp17_;
						const gchar* _tmp18_;
						const gchar* _tmp19_;
						_tmp15_ = source;
						_tmp16_ = objects_source_get_caldav_data (_tmp15_);
						_tmp17_ = _tmp16_;
						_tmp18_ = objects_source_cal_dav_data_get_server_url (_tmp17_);
						_tmp19_ = _tmp18_;
						_tmp11_ = g_strcmp0 (_tmp19_, server_url) == 0;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						ObjectsSource* _tmp20_;
						ObjectsSourceCalDAVData* _tmp21_;
						ObjectsSourceCalDAVData* _tmp22_;
						const gchar* _tmp23_;
						const gchar* _tmp24_;
						_tmp20_ = source;
						_tmp21_ = objects_source_get_caldav_data (_tmp20_);
						_tmp22_ = _tmp21_;
						_tmp23_ = objects_source_cal_dav_data_get_username (_tmp22_);
						_tmp24_ = _tmp23_;
						_tmp10_ = g_strcmp0 (_tmp24_, username) == 0;
					} else {
						_tmp10_ = FALSE;
					}
					if (_tmp10_) {
						return_value = TRUE;
						_g_object_unref0 (source);
						break;
					}
					_g_object_unref0 (source);
				}
			}
			result = return_value;
			{
				GeeArrayList* _tmp25_;
				_tmp25_ = self->priv->_sources;
				g_rec_mutex_unlock (&self->priv->__lock__sources);
			}
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp26_;
			_tmp26_ = self->priv->_sources;
			g_rec_mutex_unlock (&self->priv->__lock__sources);
		}
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp27_;
	}
}

void
services_store_insert_project (ServicesStore* self,
                               ObjectsProject* project)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_insert_project (_tmp1_, project);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		ObjectsProject* _tmp5_;
		ObjectsProject* _tmp6_;
		_tmp3_ = services_store_get_projects (self);
		_tmp4_ = _tmp3_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, project);
		_tmp5_ = objects_project_get_parent (project);
		_tmp6_ = _tmp5_;
		if (_tmp6_ == NULL) {
			g_signal_emit (self, services_store_signals[SERVICES_STORE_PROJECT_ADDED_SIGNAL], 0, project);
		} else {
			ObjectsProject* _tmp7_;
			ObjectsProject* _tmp8_;
			_tmp7_ = objects_project_get_parent (project);
			_tmp8_ = _tmp7_;
			g_signal_emit_by_name (_tmp8_, "subproject-added", project);
		}
	}
}

GeeArrayList*
services_store_get_projects_by_source (ServicesStore* self,
                                       const gchar* source_id)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (source_id != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_PROJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			GeeArrayList* _tmp16_;
			GeeArrayList* _tmp17_;
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _project_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _project_index = 0;
				_tmp2_ = services_store_get_projects (self);
				_tmp3_ = _tmp2_;
				_project_list = _tmp3_;
				_tmp4_ = _project_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_project_size = _tmp6_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsProject* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					_project_index = _project_index + 1;
					_tmp7_ = _project_index;
					_tmp8_ = _project_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _project_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _project_index);
					project = (ObjectsProject*) _tmp10_;
					_tmp11_ = project;
					_tmp12_ = objects_project_get_source_id (_tmp11_);
					_tmp13_ = _tmp12_;
					if (g_strcmp0 (_tmp13_, source_id) == 0) {
						GeeArrayList* _tmp14_;
						ObjectsProject* _tmp15_;
						_tmp14_ = return_value;
						_tmp15_ = project;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
					}
					_g_object_unref0 (project);
				}
			}
			_tmp16_ = return_value;
			_tmp17_ = _g_object_ref0 (_tmp16_);
			result = _tmp17_;
			{
				GeeArrayList* _tmp18_;
				_tmp18_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp19_;
			_tmp19_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

static void
services_store_delete_project_data_free (gpointer _data)
{
	ServicesStoreDeleteProjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesStoreDeleteProjectData, _data_);
}

void
services_store_delete_project (ServicesStore* self,
                               ObjectsProject* project,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	ServicesStoreDeleteProjectData* _data_;
	ServicesStore* _tmp0_;
	ObjectsProject* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_data_ = g_slice_new0 (ServicesStoreDeleteProjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_store_delete_project_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	services_store_delete_project_co (_data_);
}

void
services_store_delete_project_finish (ServicesStore* self,
                                      GAsyncResult* _res_)
{
	ServicesStoreDeleteProjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
services_store_delete_project_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	ServicesStoreDeleteProjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_store_delete_project_co (_data_);
}

static gboolean
services_store_delete_project_co (ServicesStoreDeleteProjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_store_get_sections_by_project (_data_->self, _data_->project);
	_data_->sections = _data_->_tmp0_;
	_data_->_tmp1_ = services_store_get_items_by_project (_data_->self, _data_->project);
	_data_->items = _data_->_tmp1_;
	_data_->_tmp2_ = services_store_get_subprojects (_data_->self, _data_->project);
	_data_->subprojects = _data_->_tmp2_;
	objects_project_set_freeze_update (_data_->project, TRUE);
	_data_->_tmp3_ = objects_project_get_calendar_source_uid (_data_->project);
	_data_->_tmp4_ = _data_->_tmp3_;
	if (g_strcmp0 (_data_->_tmp4_, "") != 0) {
		{
			_data_->_tmp5_ = _data_->items;
			_data_->_item_list = _data_->_tmp5_;
			_data_->_tmp6_ = _data_->_item_list;
			_data_->_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp6_);
			_data_->_tmp8_ = _data_->_tmp7_;
			_data_->_item_size = _data_->_tmp8_;
			_data_->_item_index = -1;
			while (TRUE) {
				_data_->_item_index = _data_->_item_index + 1;
				_data_->_tmp9_ = _data_->_item_index;
				_data_->_tmp10_ = _data_->_item_size;
				if (!(_data_->_tmp9_ < _data_->_tmp10_)) {
					break;
				}
				_data_->_tmp11_ = _data_->_item_list;
				_data_->_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp11_, _data_->_item_index);
				_data_->item = (ObjectsItem*) _data_->_tmp12_;
				_data_->_tmp13_ = _data_->item;
				_data_->_tmp14_ = objects_item_get_calendar_event_uid (_data_->_tmp13_);
				_data_->_tmp15_ = _data_->_tmp14_;
				if (g_strcmp0 (_data_->_tmp15_, "") != 0) {
					_data_->_tmp16_ = services_calendar_events_get_default ();
					_data_->_tmp17_ = _data_->_tmp16_;
					_data_->_tmp18_ = objects_project_get_calendar_source_uid (_data_->project);
					_data_->_tmp19_ = _data_->_tmp18_;
					_data_->_tmp20_ = _data_->item;
					_data_->_tmp21_ = objects_item_get_calendar_event_uid (_data_->_tmp20_);
					_data_->_tmp22_ = _data_->_tmp21_;
					services_calendar_events_delete_event (_data_->_tmp17_, _data_->_tmp19_, _data_->_tmp22_, NULL, NULL);
					_g_object_unref0 (_data_->_tmp17_);
				}
				_g_object_unref0 (_data_->item);
			}
		}
	}
	_data_->_tmp23_ = services_database_get_default ();
	_data_->_tmp24_ = _data_->_tmp23_;
	services_database_delete_all_items_by_project (_data_->_tmp24_, _data_->project);
	_g_object_unref0 (_data_->_tmp24_);
	{
		_data_->_tmp25_ = _data_->items;
		_data_->_vala1__item_list = _data_->_tmp25_;
		_data_->_tmp26_ = _data_->_vala1__item_list;
		_data_->_tmp27_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp26_);
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_vala1__item_size = _data_->_tmp28_;
		_data_->_vala1__item_index = -1;
		while (TRUE) {
			_data_->_vala1__item_index = _data_->_vala1__item_index + 1;
			_data_->_tmp29_ = _data_->_vala1__item_index;
			_data_->_tmp30_ = _data_->_vala1__item_size;
			if (!(_data_->_tmp29_ < _data_->_tmp30_)) {
				break;
			}
			_data_->_tmp31_ = _data_->_vala1__item_list;
			_data_->_tmp32_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp31_, _data_->_vala1__item_index);
			_data_->_vala1_item = (ObjectsItem*) _data_->_tmp32_;
			_data_->_tmp33_ = _data_->self->priv->_items_by_project_cache;
			_data_->_tmp34_ = _data_->_vala1_item;
			_data_->_tmp35_ = objects_item_get_project_id (_data_->_tmp34_);
			_data_->_tmp36_ = _data_->_tmp35_;
			gee_abstract_map_unset ((GeeAbstractMap*) _data_->_tmp33_, _data_->_tmp36_, NULL);
			_data_->_tmp37_ = _data_->_vala1_item;
			g_signal_emit_by_name ((ObjectsBaseObject*) _data_->_tmp37_, "deleted");
			_data_->_tmp38_ = _data_->self->priv->_items;
			_data_->_tmp39_ = _data_->_vala1_item;
			gee_abstract_collection_remove ((GeeAbstractCollection*) _data_->_tmp38_, _data_->_tmp39_);
			_data_->_tmp40_ = _data_->_vala1_item;
			g_signal_emit (_data_->self, services_store_signals[SERVICES_STORE_ITEM_DELETED_SIGNAL], 0, _data_->_tmp40_);
			_g_object_unref0 (_data_->_vala1_item);
		}
	}
	{
		_data_->_tmp41_ = _data_->sections;
		_data_->_section_list = _data_->_tmp41_;
		_data_->_tmp42_ = _data_->_section_list;
		_data_->_tmp43_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp42_);
		_data_->_tmp44_ = _data_->_tmp43_;
		_data_->_section_size = _data_->_tmp44_;
		_data_->_section_index = -1;
		while (TRUE) {
			_data_->_section_index = _data_->_section_index + 1;
			_data_->_tmp45_ = _data_->_section_index;
			_data_->_tmp46_ = _data_->_section_size;
			if (!(_data_->_tmp45_ < _data_->_tmp46_)) {
				break;
			}
			_data_->_tmp47_ = _data_->_section_list;
			_data_->_tmp48_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp47_, _data_->_section_index);
			_data_->section = (ObjectsSection*) _data_->_tmp48_;
			_data_->_tmp49_ = services_database_get_default ();
			_data_->_tmp50_ = _data_->_tmp49_;
			_data_->_tmp51_ = _data_->section;
			services_database_delete_section (_data_->_tmp50_, _data_->_tmp51_);
			_g_object_unref0 (_data_->_tmp50_);
			_data_->_tmp52_ = _data_->section;
			g_signal_emit_by_name ((ObjectsBaseObject*) _data_->_tmp52_, "deleted");
			_data_->_tmp53_ = _data_->section;
			g_signal_emit (_data_->self, services_store_signals[SERVICES_STORE_SECTION_DELETED_SIGNAL], 0, _data_->_tmp53_);
			_data_->_tmp54_ = _data_->self->priv->_sections;
			_data_->_tmp55_ = _data_->section;
			gee_abstract_collection_remove ((GeeAbstractCollection*) _data_->_tmp54_, _data_->_tmp55_);
			_g_object_unref0 (_data_->section);
		}
	}
	{
		_data_->_tmp56_ = _data_->subprojects;
		_data_->_subproject_list = _data_->_tmp56_;
		_data_->_tmp57_ = _data_->_subproject_list;
		_data_->_tmp58_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp57_);
		_data_->_tmp59_ = _data_->_tmp58_;
		_data_->_subproject_size = _data_->_tmp59_;
		_data_->_subproject_index = -1;
		while (TRUE) {
			_data_->_subproject_index = _data_->_subproject_index + 1;
			_data_->_tmp60_ = _data_->_subproject_index;
			_data_->_tmp61_ = _data_->_subproject_size;
			if (!(_data_->_tmp60_ < _data_->_tmp61_)) {
				break;
			}
			_data_->_tmp62_ = _data_->_subproject_list;
			_data_->_tmp63_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp62_, _data_->_subproject_index);
			_data_->subproject = (ObjectsProject*) _data_->_tmp63_;
			_data_->_tmp64_ = _data_->subproject;
			_data_->_state_ = 1;
			services_store_delete_project (_data_->self, _data_->_tmp64_, services_store_delete_project_ready, _data_);
			return FALSE;
			_state_1:
			services_store_delete_project_finish (_data_->self, _data_->_res_);
			_g_object_unref0 (_data_->subproject);
		}
	}
	objects_project_set_freeze_update (_data_->project, FALSE);
	objects_base_object_count_update ((ObjectsBaseObject*) _data_->project);
	services_store_update_project (_data_->self, _data_->project);
	_data_->_tmp65_ = services_database_get_default ();
	_data_->_tmp66_ = _data_->_tmp65_;
	_data_->_tmp67_ = services_database_delete_project (_data_->_tmp66_, _data_->project);
	_g_object_unref0 (_data_->_tmp66_);
	if (_data_->_tmp67_) {
		g_signal_emit_by_name ((ObjectsBaseObject*) _data_->project, "deleted");
		g_signal_emit (_data_->self, services_store_signals[SERVICES_STORE_PROJECT_DELETED_SIGNAL], 0, _data_->project);
		_data_->_tmp68_ = _data_->self->priv->_projects;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _data_->_tmp68_, _data_->project);
	}
	_g_object_unref0 (_data_->subprojects);
	_g_object_unref0 (_data_->items);
	_g_object_unref0 (_data_->sections);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
services_store_archive_project (ServicesStore* self,
                                ObjectsProject* project)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_archive_project (_tmp1_, project);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		gboolean _tmp28_;
		gboolean _tmp29_;
		{
			GeeArrayList* _item_list = NULL;
			GeeArrayList* _tmp3_;
			GeeArrayList* _tmp4_;
			gint _item_size = 0;
			GeeArrayList* _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			gint _item_index = 0;
			_tmp3_ = objects_project_get_items (project);
			_tmp4_ = _tmp3_;
			_item_list = _tmp4_;
			_tmp5_ = _item_list;
			_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
			_tmp7_ = _tmp6_;
			_item_size = _tmp7_;
			_item_index = -1;
			while (TRUE) {
				gint _tmp8_;
				gint _tmp9_;
				ObjectsItem* item = NULL;
				GeeArrayList* _tmp10_;
				gpointer _tmp11_;
				ObjectsItem* _tmp12_;
				gboolean _tmp13_;
				gboolean _tmp14_;
				_item_index = _item_index + 1;
				_tmp8_ = _item_index;
				_tmp9_ = _item_size;
				if (!(_tmp8_ < _tmp9_)) {
					break;
				}
				_tmp10_ = _item_list;
				_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _item_index);
				item = (ObjectsItem*) _tmp11_;
				_tmp12_ = item;
				_tmp13_ = objects_project_get_is_archived (project);
				_tmp14_ = _tmp13_;
				services_store_archive_item (self, _tmp12_, _tmp14_);
				_g_object_unref0 (item);
			}
		}
		{
			GeeArrayList* _section_list = NULL;
			GeeArrayList* _tmp15_;
			GeeArrayList* _tmp16_;
			gint _section_size = 0;
			GeeArrayList* _tmp17_;
			gint _tmp18_;
			gint _tmp19_;
			gint _section_index = 0;
			_tmp15_ = objects_project_get_sections (project);
			_tmp16_ = _tmp15_;
			_section_list = _tmp16_;
			_tmp17_ = _section_list;
			_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
			_tmp19_ = _tmp18_;
			_section_size = _tmp19_;
			_section_index = -1;
			while (TRUE) {
				gint _tmp20_;
				gint _tmp21_;
				ObjectsSection* section = NULL;
				GeeArrayList* _tmp22_;
				gpointer _tmp23_;
				ObjectsSection* _tmp24_;
				gboolean _tmp25_;
				gboolean _tmp26_;
				ObjectsSection* _tmp27_;
				_section_index = _section_index + 1;
				_tmp20_ = _section_index;
				_tmp21_ = _section_size;
				if (!(_tmp20_ < _tmp21_)) {
					break;
				}
				_tmp22_ = _section_list;
				_tmp23_ = gee_abstract_list_get ((GeeAbstractList*) _tmp22_, _section_index);
				section = (ObjectsSection*) _tmp23_;
				_tmp24_ = section;
				_tmp25_ = objects_project_get_is_archived (project);
				_tmp26_ = _tmp25_;
				objects_section_set_is_archived (_tmp24_, _tmp26_);
				_tmp27_ = section;
				services_store_archive_section (self, _tmp27_);
				_g_object_unref0 (section);
			}
		}
		_tmp28_ = objects_project_get_is_archived (project);
		_tmp29_ = _tmp28_;
		if (_tmp29_) {
			g_signal_emit_by_name ((ObjectsBaseObject*) project, "archived");
			g_signal_emit (self, services_store_signals[SERVICES_STORE_PROJECT_ARCHIVED_SIGNAL], 0, project);
		} else {
			g_signal_emit_by_name ((ObjectsBaseObject*) project, "unarchived");
			g_signal_emit (self, services_store_signals[SERVICES_STORE_PROJECT_UNARCHIVED_SIGNAL], 0, project);
		}
	}
}

void
services_store_update_project (ServicesStore* self,
                               ObjectsProject* project)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_project (_tmp1_, project);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		g_signal_emit_by_name ((ObjectsBaseObject*) project, "updated", "");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_PROJECT_UPDATED_SIGNAL], 0, project);
	}
}

void
services_store_update_project_id (ServicesStore* self,
                                  const gchar* current_id,
                                  const gchar* new_id)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (current_id != NULL);
	g_return_if_fail (new_id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_project_id (_tmp1_, current_id, new_id);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		ObjectsProject* project = NULL;
		ObjectsProject* _tmp3_;
		ObjectsProject* _tmp4_;
		ServicesDatabase* _tmp6_;
		ServicesDatabase* _tmp7_;
		gboolean _tmp8_;
		_tmp3_ = services_store_get_project (self, current_id);
		project = _tmp3_;
		_tmp4_ = project;
		if (_tmp4_ != NULL) {
			ObjectsProject* _tmp5_;
			_tmp5_ = project;
			objects_base_object_set_id ((ObjectsBaseObject*) _tmp5_, new_id);
		}
		_tmp6_ = services_database_get_default ();
		_tmp7_ = _tmp6_;
		_tmp8_ = services_database_update_project_section_id (_tmp7_, current_id, new_id);
		_g_object_unref0 (_tmp7_);
		if (_tmp8_) {
			ServicesDatabase* _tmp22_;
			ServicesDatabase* _tmp23_;
			gboolean _tmp24_;
			{
				GeeArrayList* _section_list = NULL;
				GeeArrayList* _tmp9_;
				GeeArrayList* _tmp10_;
				gint _section_size = 0;
				GeeArrayList* _tmp11_;
				gint _tmp12_;
				gint _tmp13_;
				gint _section_index = 0;
				_tmp9_ = services_store_get_sections (self);
				_tmp10_ = _tmp9_;
				_section_list = _tmp10_;
				_tmp11_ = _section_list;
				_tmp12_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp11_);
				_tmp13_ = _tmp12_;
				_section_size = _tmp13_;
				_section_index = -1;
				while (TRUE) {
					gint _tmp14_;
					gint _tmp15_;
					ObjectsSection* section = NULL;
					GeeArrayList* _tmp16_;
					gpointer _tmp17_;
					ObjectsSection* _tmp18_;
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					_section_index = _section_index + 1;
					_tmp14_ = _section_index;
					_tmp15_ = _section_size;
					if (!(_tmp14_ < _tmp15_)) {
						break;
					}
					_tmp16_ = _section_list;
					_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, _section_index);
					section = (ObjectsSection*) _tmp17_;
					_tmp18_ = section;
					_tmp19_ = objects_section_get_project_id (_tmp18_);
					_tmp20_ = _tmp19_;
					if (g_strcmp0 (_tmp20_, current_id) == 0) {
						ObjectsSection* _tmp21_;
						_tmp21_ = section;
						objects_section_set_project_id (_tmp21_, new_id);
					}
					_g_object_unref0 (section);
				}
			}
			_tmp22_ = services_database_get_default ();
			_tmp23_ = _tmp22_;
			_tmp24_ = services_database_update_project_item_id (_tmp23_, current_id, new_id);
			_g_object_unref0 (_tmp23_);
			if (_tmp24_) {
				{
					GeeArrayList* _item_list = NULL;
					GeeArrayList* _tmp25_;
					GeeArrayList* _tmp26_;
					gint _item_size = 0;
					GeeArrayList* _tmp27_;
					gint _tmp28_;
					gint _tmp29_;
					gint _item_index = 0;
					_tmp25_ = services_store_get_items (self);
					_tmp26_ = _tmp25_;
					_item_list = _tmp26_;
					_tmp27_ = _item_list;
					_tmp28_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp27_);
					_tmp29_ = _tmp28_;
					_item_size = _tmp29_;
					_item_index = -1;
					while (TRUE) {
						gint _tmp30_;
						gint _tmp31_;
						ObjectsItem* item = NULL;
						GeeArrayList* _tmp32_;
						gpointer _tmp33_;
						ObjectsItem* _tmp34_;
						const gchar* _tmp35_;
						const gchar* _tmp36_;
						_item_index = _item_index + 1;
						_tmp30_ = _item_index;
						_tmp31_ = _item_size;
						if (!(_tmp30_ < _tmp31_)) {
							break;
						}
						_tmp32_ = _item_list;
						_tmp33_ = gee_abstract_list_get ((GeeAbstractList*) _tmp32_, _item_index);
						item = (ObjectsItem*) _tmp33_;
						_tmp34_ = item;
						_tmp35_ = objects_item_get_project_id (_tmp34_);
						_tmp36_ = _tmp35_;
						if (g_strcmp0 (_tmp36_, current_id) == 0) {
							ObjectsItem* _tmp37_;
							_tmp37_ = item;
							objects_item_set_project_id (_tmp37_, new_id);
						}
						_g_object_unref0 (item);
					}
				}
			}
		}
		_g_object_unref0 (project);
	}
}

ObjectsProject*
services_store_get_inbox_project (ServicesStore* self)
{
	ObjectsProject* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsProject* result;
	g_return_val_if_fail (self != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			ObjectsProject* _tmp15_;
			ObjectsProject* _tmp16_;
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _project_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _project_index = 0;
				_tmp1_ = services_store_get_projects (self);
				_tmp2_ = _tmp1_;
				_project_list = _tmp2_;
				_tmp3_ = _project_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_project_size = _tmp5_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsProject* _tmp10_;
					gboolean _tmp11_;
					gboolean _tmp12_;
					_project_index = _project_index + 1;
					_tmp6_ = _project_index;
					_tmp7_ = _project_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _project_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _project_index);
					project = (ObjectsProject*) _tmp9_;
					_tmp10_ = project;
					_tmp11_ = objects_project_get_is_inbox_project (_tmp10_);
					_tmp12_ = _tmp11_;
					if (_tmp12_) {
						ObjectsProject* _tmp13_;
						ObjectsProject* _tmp14_;
						_tmp13_ = project;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (project);
						break;
					}
					_g_object_unref0 (project);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

ObjectsProject*
services_store_get_project (ServicesStore* self,
                            const gchar* id)
{
	ObjectsProject* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsProject* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			ObjectsProject* _tmp15_;
			ObjectsProject* _tmp16_;
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _project_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _project_index = 0;
				_tmp1_ = services_store_get_projects (self);
				_tmp2_ = _tmp1_;
				_project_list = _tmp2_;
				_tmp3_ = _project_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_project_size = _tmp5_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsProject* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_project_index = _project_index + 1;
					_tmp6_ = _project_index;
					_tmp7_ = _project_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _project_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _project_index);
					project = (ObjectsProject*) _tmp9_;
					_tmp10_ = project;
					_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, id) == 0) {
						ObjectsProject* _tmp13_;
						ObjectsProject* _tmp14_;
						_tmp13_ = project;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (project);
						break;
					}
					_g_object_unref0 (project);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

ObjectsProject*
services_store_get_project_via_url (ServicesStore* self,
                                    const gchar* calendar_url)
{
	ObjectsProject* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsProject* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (calendar_url != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			ObjectsProject* _tmp15_;
			ObjectsProject* _tmp16_;
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _project_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _project_index = 0;
				_tmp1_ = services_store_get_projects (self);
				_tmp2_ = _tmp1_;
				_project_list = _tmp2_;
				_tmp3_ = _project_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_project_size = _tmp5_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsProject* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_project_index = _project_index + 1;
					_tmp6_ = _project_index;
					_tmp7_ = _project_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _project_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _project_index);
					project = (ObjectsProject*) _tmp9_;
					_tmp10_ = project;
					_tmp11_ = objects_project_get_calendar_url (_tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, calendar_url) == 0) {
						ObjectsProject* _tmp13_;
						ObjectsProject* _tmp14_;
						_tmp13_ = project;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (project);
						break;
					}
					_g_object_unref0 (project);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_subprojects (ServicesStore* self,
                                ObjectsProject* _project)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (_project != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_PROJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _project_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _project_index = 0;
				_tmp2_ = services_store_get_projects (self);
				_tmp3_ = _tmp2_;
				_project_list = _tmp3_;
				_tmp4_ = _project_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_project_size = _tmp6_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsProject* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					_project_index = _project_index + 1;
					_tmp7_ = _project_index;
					_tmp8_ = _project_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _project_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _project_index);
					project = (ObjectsProject*) _tmp10_;
					_tmp11_ = project;
					_tmp12_ = objects_project_get_parent_id (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) _project);
					_tmp15_ = _tmp14_;
					if (g_strcmp0 (_tmp13_, _tmp15_) == 0) {
						GeeArrayList* _tmp16_;
						ObjectsProject* _tmp17_;
						_tmp16_ = return_value;
						_tmp17_ = project;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
					}
					_g_object_unref0 (project);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (return_value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = return_value;
	return result;
}

gint
services_store_next_project_child_order (ServicesStore* self,
                                         ObjectsSource* source)
{
	gint child_order = 0;
	GError* _inner_error0_ = NULL;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (source != NULL, -1);
	child_order = 0;
	{
		GeeArrayList* _tmp0_;
		gint _tmp22_ = -1;
		_tmp0_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _project_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _project_index = 0;
				_tmp1_ = services_store_get_projects (self);
				_tmp2_ = _tmp1_;
				_project_list = _tmp2_;
				_tmp3_ = _project_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_project_size = _tmp5_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					gboolean _tmp10_ = FALSE;
					ObjectsProject* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					_project_index = _project_index + 1;
					_tmp6_ = _project_index;
					_tmp7_ = _project_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _project_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _project_index);
					project = (ObjectsProject*) _tmp9_;
					_tmp11_ = project;
					_tmp12_ = objects_project_get_source_id (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) source);
					_tmp15_ = _tmp14_;
					if (g_strcmp0 (_tmp13_, _tmp15_) == 0) {
						ObjectsProject* _tmp16_;
						gboolean _tmp17_;
						gboolean _tmp18_;
						_tmp16_ = project;
						_tmp17_ = objects_project_get_is_deleted (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp10_ = !_tmp18_;
					} else {
						_tmp10_ = FALSE;
					}
					if (_tmp10_) {
						gint _tmp19_;
						_tmp19_ = child_order;
						child_order = _tmp19_ + 1;
					}
					_g_object_unref0 (project);
				}
			}
			result = child_order;
			{
				GeeArrayList* _tmp20_;
				_tmp20_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp21_;
			_tmp21_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp22_;
	}
}

void
services_store_insert_section (ServicesStore* self,
                               ObjectsSection* section)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_insert_section (_tmp1_, section);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		ObjectsProject* _tmp5_;
		ObjectsProject* _tmp6_;
		_tmp3_ = services_store_get_sections (self);
		_tmp4_ = _tmp3_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, section);
		_tmp5_ = objects_section_get_project (section);
		_tmp6_ = _tmp5_;
		g_signal_emit_by_name (_tmp6_, "section-added", section);
	}
}

void
services_store_update_section (ServicesStore* self,
                               ObjectsSection* section)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_section (_tmp1_, section);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		g_signal_emit_by_name ((ObjectsBaseObject*) section, "updated", "");
	}
}

void
services_store_delete_section (ServicesStore* self,
                               ObjectsSection* section)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_delete_section (_tmp1_, section);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		ObjectsProject* project = NULL;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		ObjectsProject* _tmp15_;
		ObjectsProject* _tmp16_;
		GeeArrayList* _tmp18_;
		{
			GeeArrayList* _item_list = NULL;
			GeeArrayList* _tmp3_;
			GeeArrayList* _tmp4_;
			gint _item_size = 0;
			GeeArrayList* _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			gint _item_index = 0;
			_tmp3_ = objects_section_get_items (section);
			_tmp4_ = _tmp3_;
			_item_list = _tmp4_;
			_tmp5_ = _item_list;
			_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
			_tmp7_ = _tmp6_;
			_item_size = _tmp7_;
			_item_index = -1;
			while (TRUE) {
				gint _tmp8_;
				gint _tmp9_;
				ObjectsItem* item = NULL;
				GeeArrayList* _tmp10_;
				gpointer _tmp11_;
				ObjectsItem* _tmp12_;
				_item_index = _item_index + 1;
				_tmp8_ = _item_index;
				_tmp9_ = _item_size;
				if (!(_tmp8_ < _tmp9_)) {
					break;
				}
				_tmp10_ = _item_list;
				_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _item_index);
				item = (ObjectsItem*) _tmp11_;
				_tmp12_ = item;
				services_store_delete_item (self, _tmp12_);
				_g_object_unref0 (item);
			}
		}
		_tmp13_ = objects_section_get_project_id (section);
		_tmp14_ = _tmp13_;
		_tmp15_ = services_store_get_project (self, _tmp14_);
		project = _tmp15_;
		_tmp16_ = project;
		if (_tmp16_ != NULL) {
			ObjectsProject* _tmp17_;
			_tmp17_ = project;
			objects_project_remove_section (_tmp17_, section);
		}
		g_signal_emit_by_name ((ObjectsBaseObject*) section, "deleted");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_SECTION_DELETED_SIGNAL], 0, section);
		_tmp18_ = self->priv->_sections;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp18_, section);
		_g_object_unref0 (project);
	}
}

void
services_store_move_section (ServicesStore* self,
                             ObjectsSection* section,
                             const gchar* old_project_id)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	g_return_if_fail (old_project_id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_move_section (_tmp1_, section, old_project_id);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeHashMap* _tmp3_;
		GeeHashMap* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		ServicesDatabase* _tmp7_;
		ServicesDatabase* _tmp8_;
		gboolean _tmp9_;
		_tmp3_ = self->priv->_items_by_project_cache;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp3_, old_project_id, NULL);
		_tmp4_ = self->priv->_items_by_project_cache;
		_tmp5_ = objects_section_get_project_id (section);
		_tmp6_ = _tmp5_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp4_, _tmp6_, NULL);
		_tmp7_ = services_database_get_default ();
		_tmp8_ = _tmp7_;
		_tmp9_ = services_database_move_section_items (_tmp8_, section);
		_g_object_unref0 (_tmp8_);
		if (_tmp9_) {
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp10_;
				GeeArrayList* _tmp11_;
				gint _item_size = 0;
				GeeArrayList* _tmp12_;
				gint _tmp13_;
				gint _tmp14_;
				gint _item_index = 0;
				_tmp10_ = objects_section_get_items (section);
				_tmp11_ = _tmp10_;
				_item_list = _tmp11_;
				_tmp12_ = _item_list;
				_tmp13_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp12_);
				_tmp14_ = _tmp13_;
				_item_size = _tmp14_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp15_;
					gint _tmp16_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp17_;
					gpointer _tmp18_;
					ObjectsItem* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp21_;
					_item_index = _item_index + 1;
					_tmp15_ = _item_index;
					_tmp16_ = _item_size;
					if (!(_tmp15_ < _tmp16_)) {
						break;
					}
					_tmp17_ = _item_list;
					_tmp18_ = gee_abstract_list_get ((GeeAbstractList*) _tmp17_, _item_index);
					item = (ObjectsItem*) _tmp18_;
					_tmp19_ = item;
					_tmp20_ = objects_section_get_project_id (section);
					_tmp21_ = _tmp20_;
					objects_item_set_project_id (_tmp19_, _tmp21_);
					_g_object_unref0 (item);
				}
			}
			g_signal_emit (self, services_store_signals[SERVICES_STORE_SECTION_MOVED_SIGNAL], 0, section, old_project_id);
		}
	}
}

void
services_store_update_section_id (ServicesStore* self,
                                  const gchar* current_id,
                                  const gchar* new_id)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (current_id != NULL);
	g_return_if_fail (new_id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_section_id (_tmp1_, current_id, new_id);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		ServicesDatabase* _tmp16_;
		ServicesDatabase* _tmp17_;
		gboolean _tmp18_;
		{
			GeeArrayList* _section_list = NULL;
			GeeArrayList* _tmp3_;
			GeeArrayList* _tmp4_;
			gint _section_size = 0;
			GeeArrayList* _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			gint _section_index = 0;
			_tmp3_ = services_store_get_sections (self);
			_tmp4_ = _tmp3_;
			_section_list = _tmp4_;
			_tmp5_ = _section_list;
			_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
			_tmp7_ = _tmp6_;
			_section_size = _tmp7_;
			_section_index = -1;
			while (TRUE) {
				gint _tmp8_;
				gint _tmp9_;
				ObjectsSection* section = NULL;
				GeeArrayList* _tmp10_;
				gpointer _tmp11_;
				ObjectsSection* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_section_index = _section_index + 1;
				_tmp8_ = _section_index;
				_tmp9_ = _section_size;
				if (!(_tmp8_ < _tmp9_)) {
					break;
				}
				_tmp10_ = _section_list;
				_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _section_index);
				section = (ObjectsSection*) _tmp11_;
				_tmp12_ = section;
				_tmp13_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp12_);
				_tmp14_ = _tmp13_;
				if (g_strcmp0 (_tmp14_, current_id) == 0) {
					ObjectsSection* _tmp15_;
					_tmp15_ = section;
					objects_base_object_set_id ((ObjectsBaseObject*) _tmp15_, new_id);
					_g_object_unref0 (section);
					break;
				}
				_g_object_unref0 (section);
			}
		}
		_tmp16_ = services_database_get_default ();
		_tmp17_ = _tmp16_;
		_tmp18_ = services_database_update_section_item_id (_tmp17_, current_id, new_id);
		_g_object_unref0 (_tmp17_);
		if (_tmp18_) {
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp19_;
				GeeArrayList* _tmp20_;
				gint _item_size = 0;
				GeeArrayList* _tmp21_;
				gint _tmp22_;
				gint _tmp23_;
				gint _item_index = 0;
				_tmp19_ = services_store_get_items (self);
				_tmp20_ = _tmp19_;
				_item_list = _tmp20_;
				_tmp21_ = _item_list;
				_tmp22_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp21_);
				_tmp23_ = _tmp22_;
				_item_size = _tmp23_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp24_;
					gint _tmp25_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp26_;
					gpointer _tmp27_;
					ObjectsItem* _tmp28_;
					const gchar* _tmp29_;
					const gchar* _tmp30_;
					_item_index = _item_index + 1;
					_tmp24_ = _item_index;
					_tmp25_ = _item_size;
					if (!(_tmp24_ < _tmp25_)) {
						break;
					}
					_tmp26_ = _item_list;
					_tmp27_ = gee_abstract_list_get ((GeeAbstractList*) _tmp26_, _item_index);
					item = (ObjectsItem*) _tmp27_;
					_tmp28_ = item;
					_tmp29_ = objects_item_get_section_id (_tmp28_);
					_tmp30_ = _tmp29_;
					if (g_strcmp0 (_tmp30_, current_id) == 0) {
						ObjectsItem* _tmp31_;
						_tmp31_ = item;
						objects_item_set_section_id (_tmp31_, new_id);
						_g_object_unref0 (item);
						break;
					}
					_g_object_unref0 (item);
				}
			}
		}
	}
}

void
services_store_archive_section (ServicesStore* self,
                                ObjectsSection* section)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_archive_section (_tmp1_, section);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		gboolean _tmp15_;
		gboolean _tmp16_;
		{
			GeeArrayList* _item_list = NULL;
			GeeArrayList* _tmp3_;
			GeeArrayList* _tmp4_;
			gint _item_size = 0;
			GeeArrayList* _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			gint _item_index = 0;
			_tmp3_ = objects_section_get_items (section);
			_tmp4_ = _tmp3_;
			_item_list = _tmp4_;
			_tmp5_ = _item_list;
			_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
			_tmp7_ = _tmp6_;
			_item_size = _tmp7_;
			_item_index = -1;
			while (TRUE) {
				gint _tmp8_;
				gint _tmp9_;
				ObjectsItem* item = NULL;
				GeeArrayList* _tmp10_;
				gpointer _tmp11_;
				ObjectsItem* _tmp12_;
				gboolean _tmp13_;
				gboolean _tmp14_;
				_item_index = _item_index + 1;
				_tmp8_ = _item_index;
				_tmp9_ = _item_size;
				if (!(_tmp8_ < _tmp9_)) {
					break;
				}
				_tmp10_ = _item_list;
				_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _item_index);
				item = (ObjectsItem*) _tmp11_;
				_tmp12_ = item;
				_tmp13_ = objects_section_get_is_archived (section);
				_tmp14_ = _tmp13_;
				services_store_archive_item (self, _tmp12_, _tmp14_);
				_g_object_unref0 (item);
			}
		}
		_tmp15_ = objects_section_get_is_archived (section);
		_tmp16_ = _tmp15_;
		if (_tmp16_) {
			g_signal_emit_by_name ((ObjectsBaseObject*) section, "archived");
			g_signal_emit (self, services_store_signals[SERVICES_STORE_SECTION_ARCHIVED_SIGNAL], 0, section);
		} else {
			g_signal_emit_by_name ((ObjectsBaseObject*) section, "unarchived");
			g_signal_emit (self, services_store_signals[SERVICES_STORE_SECTION_UNARCHIVED_SIGNAL], 0, section);
		}
	}
}

GeeArrayList*
services_store_get_sections_by_project (ServicesStore* self,
                                        ObjectsProject* project)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (project != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_SECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_sections;
		g_rec_mutex_lock (&self->priv->__lock__sections);
		{
			{
				GeeArrayList* _section_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _section_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _section_index = 0;
				_tmp2_ = services_store_get_sections (self);
				_tmp3_ = _tmp2_;
				_section_list = _tmp3_;
				_tmp4_ = _section_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_section_size = _tmp6_;
				_section_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsSection* section = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsSection* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					_section_index = _section_index + 1;
					_tmp7_ = _section_index;
					_tmp8_ = _section_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _section_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _section_index);
					section = (ObjectsSection*) _tmp10_;
					_tmp11_ = section;
					_tmp12_ = objects_section_get_project_id (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
					_tmp15_ = _tmp14_;
					if (g_strcmp0 (_tmp13_, _tmp15_) == 0) {
						GeeArrayList* _tmp16_;
						ObjectsSection* _tmp17_;
						_tmp16_ = return_value;
						_tmp17_ = section;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
					}
					_g_object_unref0 (section);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_sections;
			g_rec_mutex_unlock (&self->priv->__lock__sections);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (return_value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = return_value;
	return result;
}

GeeArrayList*
services_store_get_sections_archived_by_project (ServicesStore* self,
                                                 ObjectsProject* project)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (project != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_SECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_sections;
		g_rec_mutex_lock (&self->priv->__lock__sections);
		{
			{
				GeeArrayList* _section_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _section_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _section_index = 0;
				_tmp2_ = services_store_get_sections (self);
				_tmp3_ = _tmp2_;
				_section_list = _tmp3_;
				_tmp4_ = _section_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_section_size = _tmp6_;
				_section_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsSection* section = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsSection* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					const gchar* _tmp16_;
					_section_index = _section_index + 1;
					_tmp7_ = _section_index;
					_tmp8_ = _section_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _section_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _section_index);
					section = (ObjectsSection*) _tmp10_;
					_tmp12_ = section;
					_tmp13_ = objects_section_get_project_id (_tmp12_);
					_tmp14_ = _tmp13_;
					_tmp15_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
					_tmp16_ = _tmp15_;
					if (g_strcmp0 (_tmp14_, _tmp16_) == 0) {
						ObjectsSection* _tmp17_;
						_tmp17_ = section;
						_tmp11_ = objects_section_was_archived (_tmp17_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp18_;
						ObjectsSection* _tmp19_;
						_tmp18_ = return_value;
						_tmp19_ = section;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp19_);
					}
					_g_object_unref0 (section);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp20_;
			_tmp20_ = self->priv->_sections;
			g_rec_mutex_unlock (&self->priv->__lock__sections);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (return_value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = return_value;
	return result;
}

ObjectsSection*
services_store_get_section (ServicesStore* self,
                            const gchar* id)
{
	ObjectsSection* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsSection* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_sections;
		g_rec_mutex_lock (&self->priv->__lock__sections);
		{
			ObjectsSection* _tmp15_;
			ObjectsSection* _tmp16_;
			{
				GeeArrayList* _section_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _section_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _section_index = 0;
				_tmp1_ = services_store_get_sections (self);
				_tmp2_ = _tmp1_;
				_section_list = _tmp2_;
				_tmp3_ = _section_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_section_size = _tmp5_;
				_section_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsSection* section = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsSection* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_section_index = _section_index + 1;
					_tmp6_ = _section_index;
					_tmp7_ = _section_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _section_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _section_index);
					section = (ObjectsSection*) _tmp9_;
					_tmp10_ = section;
					_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, id) == 0) {
						ObjectsSection* _tmp13_;
						ObjectsSection* _tmp14_;
						_tmp13_ = section;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (section);
						break;
					}
					_g_object_unref0 (section);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_sections;
				g_rec_mutex_unlock (&self->priv->__lock__sections);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_sections;
			g_rec_mutex_unlock (&self->priv->__lock__sections);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

void
services_store_insert_item (ServicesStore* self,
                            ObjectsItem* item,
                            gboolean insert,
                            gboolean persist)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	if (!persist) {
		_tmp0_ = TRUE;
	} else {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp0_ = services_database_insert_item (_tmp2_, item);
		_g_object_unref0 (_tmp2_);
	}
	if (_tmp0_) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		GeeArrayList* _tmp5_;
		GeeArrayList* _tmp6_;
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_ = FALSE;
		gboolean _tmp19_ = FALSE;
		_tmp3_ = objects_item_get_project_id (item);
		_tmp4_ = _tmp3_;
		services_store_clear_project_cache (self, _tmp4_);
		_tmp5_ = services_store_get_items (self);
		_tmp6_ = _tmp5_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, item);
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_ADDED_SIGNAL], 0, item, insert);
		if (insert) {
			const gchar* _tmp7_;
			const gchar* _tmp8_;
			_tmp7_ = objects_item_get_parent_id (item);
			_tmp8_ = _tmp7_;
			if (g_strcmp0 (_tmp8_, "") != 0) {
				ObjectsItem* _tmp9_;
				ObjectsItem* _tmp10_;
				_tmp9_ = objects_item_get_parent (item);
				_tmp10_ = _tmp9_;
				g_signal_emit_by_name (_tmp10_, "item-added", item);
			} else {
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				_tmp11_ = objects_item_get_section_id (item);
				_tmp12_ = _tmp11_;
				if (g_strcmp0 (_tmp12_, "") == 0) {
					ObjectsProject* _tmp13_;
					ObjectsProject* _tmp14_;
					_tmp13_ = objects_item_get_project (item);
					_tmp14_ = _tmp13_;
					g_signal_emit_by_name (_tmp14_, "item-added", item);
				} else {
					ObjectsSection* _tmp15_;
					ObjectsSection* _tmp16_;
					_tmp15_ = objects_item_get_section (item);
					_tmp16_ = _tmp15_;
					g_signal_emit_by_name (_tmp16_, "item-added", item);
				}
			}
		}
		if (persist) {
			ObjectsProject* _tmp20_;
			ObjectsProject* _tmp21_;
			_tmp20_ = objects_item_get_project (item);
			_tmp21_ = _tmp20_;
			_tmp19_ = _tmp21_ != NULL;
		} else {
			_tmp19_ = FALSE;
		}
		if (_tmp19_) {
			ObjectsProject* _tmp22_;
			ObjectsProject* _tmp23_;
			const gchar* _tmp24_;
			const gchar* _tmp25_;
			_tmp22_ = objects_item_get_project (item);
			_tmp23_ = _tmp22_;
			_tmp24_ = objects_project_get_calendar_source_uid (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp18_ = g_strcmp0 (_tmp25_, "") != 0;
		} else {
			_tmp18_ = FALSE;
		}
		if (_tmp18_) {
			gboolean _tmp26_;
			gboolean _tmp27_;
			_tmp26_ = objects_item_get_has_due (item);
			_tmp27_ = _tmp26_;
			_tmp17_ = _tmp27_;
		} else {
			_tmp17_ = FALSE;
		}
		if (_tmp17_) {
			services_store_create_calendar_event (self, item, NULL, NULL);
		}
	}
}

gboolean
services_store_insert_items_transaction (ServicesStore* self,
                                         GeeArrayList* items,
                                         gboolean insert)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (items != NULL, FALSE);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_insert_items_transaction (_tmp1_, items);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		{
			GeeArrayList* _item_list = NULL;
			gint _item_size = 0;
			GeeArrayList* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			gint _item_index = 0;
			_item_list = items;
			_tmp3_ = _item_list;
			_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
			_tmp5_ = _tmp4_;
			_item_size = _tmp5_;
			_item_index = -1;
			while (TRUE) {
				gint _tmp6_;
				gint _tmp7_;
				ObjectsItem* item = NULL;
				GeeArrayList* _tmp8_;
				gpointer _tmp9_;
				ObjectsItem* _tmp10_;
				gboolean _tmp11_ = FALSE;
				gboolean _tmp12_ = FALSE;
				ObjectsItem* _tmp13_;
				ObjectsProject* _tmp14_;
				ObjectsProject* _tmp15_;
				_item_index = _item_index + 1;
				_tmp6_ = _item_index;
				_tmp7_ = _item_size;
				if (!(_tmp6_ < _tmp7_)) {
					break;
				}
				_tmp8_ = _item_list;
				_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _item_index);
				item = (ObjectsItem*) _tmp9_;
				_tmp10_ = item;
				services_store_insert_item (self, _tmp10_, insert, FALSE);
				_tmp13_ = item;
				_tmp14_ = objects_item_get_project (_tmp13_);
				_tmp15_ = _tmp14_;
				if (_tmp15_ != NULL) {
					ObjectsItem* _tmp16_;
					ObjectsProject* _tmp17_;
					ObjectsProject* _tmp18_;
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					_tmp16_ = item;
					_tmp17_ = objects_item_get_project (_tmp16_);
					_tmp18_ = _tmp17_;
					_tmp19_ = objects_project_get_calendar_source_uid (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp12_ = g_strcmp0 (_tmp20_, "") != 0;
				} else {
					_tmp12_ = FALSE;
				}
				if (_tmp12_) {
					ObjectsItem* _tmp21_;
					gboolean _tmp22_;
					gboolean _tmp23_;
					_tmp21_ = item;
					_tmp22_ = objects_item_get_has_due (_tmp21_);
					_tmp23_ = _tmp22_;
					_tmp11_ = _tmp23_;
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					ObjectsItem* _tmp24_;
					_tmp24_ = item;
					services_store_create_calendar_event (self, _tmp24_, NULL, NULL);
				}
				_g_object_unref0 (item);
			}
		}
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static void
services_store_create_calendar_event_data_free (gpointer _data)
{
	ServicesStoreCreateCalendarEventData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesStoreCreateCalendarEventData, _data_);
}

static void
services_store_create_calendar_event (ServicesStore* self,
                                      ObjectsItem* item,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	ServicesStoreCreateCalendarEventData* _data_;
	ServicesStore* _tmp0_;
	ObjectsItem* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesStoreCreateCalendarEventData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_store_create_calendar_event_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	services_store_create_calendar_event_co (_data_);
}

static void
services_store_create_calendar_event_finish (ServicesStore* self,
                                             GAsyncResult* _res_)
{
	ServicesStoreCreateCalendarEventData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
services_store_create_calendar_event_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	ServicesStoreCreateCalendarEventData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_store_create_calendar_event_co (_data_);
}

static gboolean
services_store_create_calendar_event_co (ServicesStoreCreateCalendarEventData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_calendar_events_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = objects_item_get_project (_data_->item);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = objects_project_get_calendar_source_uid (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_state_ = 1;
	services_calendar_events_create_event (_data_->_tmp1_, _data_->_tmp5_, _data_->item, services_store_create_calendar_event_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp6_ = services_calendar_events_create_event_finish (_data_->_tmp1_, _data_->_res_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_g_object_unref0 (_data_->_tmp1_);
	_data_->event_uid = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->event_uid;
	if (_data_->_tmp8_ != NULL) {
		_data_->_tmp9_ = _data_->event_uid;
		objects_item_set_calendar_event_uid (_data_->item, _data_->_tmp9_);
		_data_->_tmp10_ = services_database_get_default ();
		_data_->_tmp11_ = _data_->_tmp10_;
		services_database_update_item (_data_->_tmp11_, _data_->item, "");
		_g_object_unref0 (_data_->_tmp11_);
	}
	_g_free0 (_data_->event_uid);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
services_store_update_item (ServicesStore* self,
                            ObjectsItem* item,
                            const gchar* update_id)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (update_id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_item (_tmp1_, item, update_id);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		gboolean _tmp3_ = FALSE;
		ObjectsProject* _tmp4_;
		ObjectsProject* _tmp5_;
		_tmp4_ = objects_item_get_project (item);
		_tmp5_ = _tmp4_;
		if (_tmp5_ != NULL) {
			ObjectsProject* _tmp6_;
			ObjectsProject* _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			_tmp6_ = objects_item_get_project (item);
			_tmp7_ = _tmp6_;
			_tmp8_ = objects_project_get_calendar_source_uid (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp3_ = g_strcmp0 (_tmp9_, "") != 0;
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			gboolean _tmp10_ = FALSE;
			gboolean _tmp11_;
			gboolean _tmp12_;
			_tmp11_ = objects_item_get_has_due (item);
			_tmp12_ = _tmp11_;
			if (!_tmp12_) {
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_tmp13_ = objects_item_get_calendar_event_uid (item);
				_tmp14_ = _tmp13_;
				_tmp10_ = g_strcmp0 (_tmp14_, "") != 0;
			} else {
				_tmp10_ = FALSE;
			}
			if (_tmp10_) {
				ServicesCalendarEvents* _tmp15_;
				ServicesCalendarEvents* _tmp16_;
				ObjectsProject* _tmp17_;
				ObjectsProject* _tmp18_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				const gchar* _tmp21_;
				const gchar* _tmp22_;
				ServicesDatabase* _tmp23_;
				ServicesDatabase* _tmp24_;
				_tmp15_ = services_calendar_events_get_default ();
				_tmp16_ = _tmp15_;
				_tmp17_ = objects_item_get_project (item);
				_tmp18_ = _tmp17_;
				_tmp19_ = objects_project_get_calendar_source_uid (_tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = objects_item_get_calendar_event_uid (item);
				_tmp22_ = _tmp21_;
				services_calendar_events_delete_event (_tmp16_, _tmp20_, _tmp22_, NULL, NULL);
				_g_object_unref0 (_tmp16_);
				objects_item_set_calendar_event_uid (item, "");
				_tmp23_ = services_database_get_default ();
				_tmp24_ = _tmp23_;
				services_database_update_item (_tmp24_, item, "");
				_g_object_unref0 (_tmp24_);
			} else {
				gboolean _tmp25_ = FALSE;
				gboolean _tmp26_;
				gboolean _tmp27_;
				_tmp26_ = objects_item_get_has_due (item);
				_tmp27_ = _tmp26_;
				if (_tmp27_) {
					const gchar* _tmp28_;
					const gchar* _tmp29_;
					_tmp28_ = objects_item_get_calendar_event_uid (item);
					_tmp29_ = _tmp28_;
					_tmp25_ = g_strcmp0 (_tmp29_, "") != 0;
				} else {
					_tmp25_ = FALSE;
				}
				if (_tmp25_) {
					ServicesCalendarEvents* _tmp30_;
					ServicesCalendarEvents* _tmp31_;
					ObjectsProject* _tmp32_;
					ObjectsProject* _tmp33_;
					const gchar* _tmp34_;
					const gchar* _tmp35_;
					const gchar* _tmp36_;
					const gchar* _tmp37_;
					_tmp30_ = services_calendar_events_get_default ();
					_tmp31_ = _tmp30_;
					_tmp32_ = objects_item_get_project (item);
					_tmp33_ = _tmp32_;
					_tmp34_ = objects_project_get_calendar_source_uid (_tmp33_);
					_tmp35_ = _tmp34_;
					_tmp36_ = objects_item_get_calendar_event_uid (item);
					_tmp37_ = _tmp36_;
					services_calendar_events_update_event (_tmp31_, _tmp35_, _tmp37_, item, NULL, NULL);
					_g_object_unref0 (_tmp31_);
				} else {
					gboolean _tmp38_ = FALSE;
					gboolean _tmp39_;
					gboolean _tmp40_;
					_tmp39_ = objects_item_get_has_due (item);
					_tmp40_ = _tmp39_;
					if (_tmp40_) {
						const gchar* _tmp41_;
						const gchar* _tmp42_;
						_tmp41_ = objects_item_get_calendar_event_uid (item);
						_tmp42_ = _tmp41_;
						_tmp38_ = g_strcmp0 (_tmp42_, "") == 0;
					} else {
						_tmp38_ = FALSE;
					}
					if (_tmp38_) {
						services_store_create_calendar_event (self, item, NULL, NULL);
					}
				}
			}
		}
		g_signal_emit_by_name ((ObjectsBaseObject*) item, "updated", update_id);
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_UPDATED_SIGNAL], 0, item, update_id);
	}
}

void
services_store_update_item_pin (ServicesStore* self,
                                ObjectsItem* item)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_item (_tmp1_, item, "");
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_PIN_CHANGE_SIGNAL], 0, item);
		g_signal_emit_by_name (item, "pin-updated");
		g_signal_emit_by_name ((ObjectsBaseObject*) item, "updated", "");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_UPDATED_SIGNAL], 0, item, "");
	}
}

void
services_store_delete_item (ServicesStore* self,
                            ObjectsItem* item)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_delete_item (_tmp1_, item);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeHashMap* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		GeeArrayList* _tmp33_;
		ObjectsProject* _tmp34_;
		ObjectsProject* _tmp35_;
		gboolean _tmp38_ = FALSE;
		gboolean _tmp39_;
		gboolean _tmp40_;
		_tmp3_ = self->priv->_items_by_project_cache;
		_tmp4_ = objects_item_get_project_id (item);
		_tmp5_ = _tmp4_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp3_, _tmp5_, NULL);
		_tmp8_ = objects_item_get_calendar_event_uid (item);
		_tmp9_ = _tmp8_;
		if (g_strcmp0 (_tmp9_, "") != 0) {
			ObjectsProject* _tmp10_;
			ObjectsProject* _tmp11_;
			_tmp10_ = objects_item_get_project (item);
			_tmp11_ = _tmp10_;
			_tmp7_ = _tmp11_ != NULL;
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			ObjectsProject* _tmp12_;
			ObjectsProject* _tmp13_;
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			_tmp12_ = objects_item_get_project (item);
			_tmp13_ = _tmp12_;
			_tmp14_ = objects_project_get_calendar_source_uid (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp6_ = g_strcmp0 (_tmp15_, "") != 0;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			ServicesCalendarEvents* _tmp16_;
			ServicesCalendarEvents* _tmp17_;
			ObjectsProject* _tmp18_;
			ObjectsProject* _tmp19_;
			const gchar* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			_tmp16_ = services_calendar_events_get_default ();
			_tmp17_ = _tmp16_;
			_tmp18_ = objects_item_get_project (item);
			_tmp19_ = _tmp18_;
			_tmp20_ = objects_project_get_calendar_source_uid (_tmp19_);
			_tmp21_ = _tmp20_;
			_tmp22_ = objects_item_get_calendar_event_uid (item);
			_tmp23_ = _tmp22_;
			services_calendar_events_delete_event (_tmp17_, _tmp21_, _tmp23_, NULL, NULL);
			_g_object_unref0 (_tmp17_);
		}
		{
			GeeArrayList* _subitem_list = NULL;
			GeeArrayList* _tmp24_;
			gint _subitem_size = 0;
			GeeArrayList* _tmp25_;
			gint _tmp26_;
			gint _tmp27_;
			gint _subitem_index = 0;
			_tmp24_ = services_store_get_subitems (self, item);
			_subitem_list = _tmp24_;
			_tmp25_ = _subitem_list;
			_tmp26_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp25_);
			_tmp27_ = _tmp26_;
			_subitem_size = _tmp27_;
			_subitem_index = -1;
			while (TRUE) {
				gint _tmp28_;
				gint _tmp29_;
				ObjectsItem* subitem = NULL;
				GeeArrayList* _tmp30_;
				gpointer _tmp31_;
				ObjectsItem* _tmp32_;
				_subitem_index = _subitem_index + 1;
				_tmp28_ = _subitem_index;
				_tmp29_ = _subitem_size;
				if (!(_tmp28_ < _tmp29_)) {
					break;
				}
				_tmp30_ = _subitem_list;
				_tmp31_ = gee_abstract_list_get ((GeeAbstractList*) _tmp30_, _subitem_index);
				subitem = (ObjectsItem*) _tmp31_;
				_tmp32_ = subitem;
				services_store_delete_item (self, _tmp32_);
				_g_object_unref0 (subitem);
			}
			_g_object_unref0 (_subitem_list);
		}
		g_signal_emit_by_name ((ObjectsBaseObject*) item, "deleted");
		_tmp33_ = self->priv->_items;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp33_, item);
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_DELETED_SIGNAL], 0, item);
		_tmp34_ = objects_item_get_project (item);
		_tmp35_ = _tmp34_;
		if (_tmp35_ != NULL) {
			ObjectsProject* _tmp36_;
			ObjectsProject* _tmp37_;
			_tmp36_ = objects_item_get_project (item);
			_tmp37_ = _tmp36_;
			g_signal_emit_by_name (_tmp37_, "item-deleted", item);
		}
		_tmp39_ = objects_item_get_has_section (item);
		_tmp40_ = _tmp39_;
		if (_tmp40_) {
			ObjectsSection* _tmp41_;
			ObjectsSection* _tmp42_;
			_tmp41_ = objects_item_get_section (item);
			_tmp42_ = _tmp41_;
			_tmp38_ = _tmp42_ != NULL;
		} else {
			_tmp38_ = FALSE;
		}
		if (_tmp38_) {
			ObjectsSection* _tmp43_;
			ObjectsSection* _tmp44_;
			_tmp43_ = objects_item_get_section (item);
			_tmp44_ = _tmp43_;
			g_signal_emit_by_name (_tmp44_, "item-deleted", item);
		}
	}
}

void
services_store_move_item (ServicesStore* self,
                          ObjectsItem* item,
                          const gchar* old_project_id,
                          const gchar* old_section_id,
                          const gchar* old_parent_id)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (old_project_id != NULL);
	g_return_if_fail (old_section_id != NULL);
	g_return_if_fail (old_parent_id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_move_item (_tmp1_, item);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeHashMap* _tmp3_;
		GeeHashMap* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		ObjectsSection* current_section = NULL;
		const gchar* _tmp65_;
		const gchar* _tmp66_;
		ObjectsSection* _tmp67_;
		ObjectsSection* _tmp68_;
		ObjectsSection* old_section = NULL;
		ObjectsSection* _tmp70_;
		ObjectsSection* _tmp71_;
		_tmp3_ = self->priv->_items_by_project_cache;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp3_, old_project_id, NULL);
		_tmp4_ = self->priv->_items_by_project_cache;
		_tmp5_ = objects_item_get_project_id (item);
		_tmp6_ = _tmp5_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp4_, _tmp6_, NULL);
		_tmp7_ = objects_item_get_has_due (item);
		_tmp8_ = _tmp7_;
		if (_tmp8_) {
			ObjectsProject* old_project = NULL;
			ObjectsProject* _tmp9_;
			ObjectsProject* new_project = NULL;
			ObjectsProject* _tmp10_;
			ObjectsProject* _tmp11_;
			ObjectsProject* _tmp12_;
			const gchar* _tmp13_ = NULL;
			ObjectsProject* _tmp14_;
			gchar* old_calendar = NULL;
			gchar* _tmp18_;
			const gchar* _tmp19_ = NULL;
			ObjectsProject* _tmp20_;
			gchar* new_calendar = NULL;
			gchar* _tmp24_;
			gboolean _tmp25_ = FALSE;
			gboolean _tmp26_ = FALSE;
			const gchar* _tmp27_;
			_tmp9_ = services_store_get_project (self, old_project_id);
			old_project = _tmp9_;
			_tmp10_ = objects_item_get_project (item);
			_tmp11_ = _tmp10_;
			_tmp12_ = _g_object_ref0 (_tmp11_);
			new_project = _tmp12_;
			_tmp14_ = old_project;
			if (_tmp14_ != NULL) {
				ObjectsProject* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				_tmp15_ = old_project;
				_tmp16_ = objects_project_get_calendar_source_uid (_tmp15_);
				_tmp17_ = _tmp16_;
				_tmp13_ = _tmp17_;
			} else {
				_tmp13_ = "";
			}
			_tmp18_ = g_strdup (_tmp13_);
			old_calendar = _tmp18_;
			_tmp20_ = new_project;
			if (_tmp20_ != NULL) {
				ObjectsProject* _tmp21_;
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				_tmp21_ = new_project;
				_tmp22_ = objects_project_get_calendar_source_uid (_tmp21_);
				_tmp23_ = _tmp22_;
				_tmp19_ = _tmp23_;
			} else {
				_tmp19_ = "";
			}
			_tmp24_ = g_strdup (_tmp19_);
			new_calendar = _tmp24_;
			_tmp27_ = old_calendar;
			if (g_strcmp0 (_tmp27_, "") != 0) {
				const gchar* _tmp28_;
				_tmp28_ = new_calendar;
				_tmp26_ = g_strcmp0 (_tmp28_, "") == 0;
			} else {
				_tmp26_ = FALSE;
			}
			if (_tmp26_) {
				const gchar* _tmp29_;
				const gchar* _tmp30_;
				_tmp29_ = objects_item_get_calendar_event_uid (item);
				_tmp30_ = _tmp29_;
				_tmp25_ = g_strcmp0 (_tmp30_, "") != 0;
			} else {
				_tmp25_ = FALSE;
			}
			if (_tmp25_) {
				ServicesCalendarEvents* _tmp31_;
				ServicesCalendarEvents* _tmp32_;
				const gchar* _tmp33_;
				const gchar* _tmp34_;
				const gchar* _tmp35_;
				ServicesDatabase* _tmp36_;
				ServicesDatabase* _tmp37_;
				_tmp31_ = services_calendar_events_get_default ();
				_tmp32_ = _tmp31_;
				_tmp33_ = old_calendar;
				_tmp34_ = objects_item_get_calendar_event_uid (item);
				_tmp35_ = _tmp34_;
				services_calendar_events_delete_event (_tmp32_, _tmp33_, _tmp35_, NULL, NULL);
				_g_object_unref0 (_tmp32_);
				objects_item_set_calendar_event_uid (item, "");
				_tmp36_ = services_database_get_default ();
				_tmp37_ = _tmp36_;
				services_database_update_item (_tmp37_, item, "");
				_g_object_unref0 (_tmp37_);
			} else {
				gboolean _tmp38_ = FALSE;
				const gchar* _tmp39_;
				_tmp39_ = old_calendar;
				if (g_strcmp0 (_tmp39_, "") == 0) {
					const gchar* _tmp40_;
					_tmp40_ = new_calendar;
					_tmp38_ = g_strcmp0 (_tmp40_, "") != 0;
				} else {
					_tmp38_ = FALSE;
				}
				if (_tmp38_) {
					services_store_create_calendar_event (self, item, NULL, NULL);
				} else {
					gboolean _tmp41_ = FALSE;
					gboolean _tmp42_ = FALSE;
					const gchar* _tmp43_;
					const gchar* _tmp44_;
					_tmp43_ = old_calendar;
					_tmp44_ = new_calendar;
					if (g_strcmp0 (_tmp43_, _tmp44_) != 0) {
						const gchar* _tmp45_;
						_tmp45_ = new_calendar;
						_tmp42_ = g_strcmp0 (_tmp45_, "") != 0;
					} else {
						_tmp42_ = FALSE;
					}
					if (_tmp42_) {
						const gchar* _tmp46_;
						const gchar* _tmp47_;
						_tmp46_ = objects_item_get_calendar_event_uid (item);
						_tmp47_ = _tmp46_;
						_tmp41_ = g_strcmp0 (_tmp47_, "") != 0;
					} else {
						_tmp41_ = FALSE;
					}
					if (_tmp41_) {
						ServicesCalendarEvents* _tmp48_;
						ServicesCalendarEvents* _tmp49_;
						const gchar* _tmp50_;
						const gchar* _tmp51_;
						const gchar* _tmp52_;
						_tmp48_ = services_calendar_events_get_default ();
						_tmp49_ = _tmp48_;
						_tmp50_ = old_calendar;
						_tmp51_ = objects_item_get_calendar_event_uid (item);
						_tmp52_ = _tmp51_;
						services_calendar_events_delete_event (_tmp49_, _tmp50_, _tmp52_, NULL, NULL);
						_g_object_unref0 (_tmp49_);
						services_store_create_calendar_event (self, item, NULL, NULL);
					}
				}
			}
			_g_free0 (new_calendar);
			_g_free0 (old_calendar);
			_g_object_unref0 (new_project);
			_g_object_unref0 (old_project);
		}
		{
			GeeArrayList* _subitem_list = NULL;
			GeeArrayList* _tmp53_;
			gint _subitem_size = 0;
			GeeArrayList* _tmp54_;
			gint _tmp55_;
			gint _tmp56_;
			gint _subitem_index = 0;
			_tmp53_ = services_store_get_subitems (self, item);
			_subitem_list = _tmp53_;
			_tmp54_ = _subitem_list;
			_tmp55_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp54_);
			_tmp56_ = _tmp55_;
			_subitem_size = _tmp56_;
			_subitem_index = -1;
			while (TRUE) {
				gint _tmp57_;
				gint _tmp58_;
				ObjectsItem* subitem = NULL;
				GeeArrayList* _tmp59_;
				gpointer _tmp60_;
				ObjectsItem* _tmp61_;
				const gchar* _tmp62_;
				const gchar* _tmp63_;
				ObjectsItem* _tmp64_;
				_subitem_index = _subitem_index + 1;
				_tmp57_ = _subitem_index;
				_tmp58_ = _subitem_size;
				if (!(_tmp57_ < _tmp58_)) {
					break;
				}
				_tmp59_ = _subitem_list;
				_tmp60_ = gee_abstract_list_get ((GeeAbstractList*) _tmp59_, _subitem_index);
				subitem = (ObjectsItem*) _tmp60_;
				_tmp61_ = subitem;
				_tmp62_ = objects_item_get_project_id (item);
				_tmp63_ = _tmp62_;
				objects_item_set_project_id (_tmp61_, _tmp63_);
				_tmp64_ = subitem;
				services_store_move_item (self, _tmp64_, "", "", "");
				_g_object_unref0 (subitem);
			}
			_g_object_unref0 (_subitem_list);
		}
		_tmp65_ = objects_item_get_section_id (item);
		_tmp66_ = _tmp65_;
		_tmp67_ = services_store_get_section (self, _tmp66_);
		current_section = _tmp67_;
		_tmp68_ = current_section;
		if (_tmp68_ != NULL) {
			ObjectsSection* _tmp69_;
			_tmp69_ = current_section;
			objects_section_update_count (_tmp69_);
		}
		_tmp70_ = services_store_get_section (self, old_section_id);
		old_section = _tmp70_;
		_tmp71_ = old_section;
		if (_tmp71_ != NULL) {
			ObjectsSection* _tmp72_;
			_tmp72_ = old_section;
			objects_section_update_count (_tmp72_);
		}
		g_signal_emit_by_name ((ObjectsBaseObject*) item, "updated", "");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_UPDATED_SIGNAL], 0, item, "");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_MOVED_SIGNAL], 0, item, old_project_id, old_section_id, old_parent_id);
		_g_object_unref0 (old_section);
		_g_object_unref0 (current_section);
	}
}

void
services_store_complete_item (ServicesStore* self,
                              ObjectsItem* item,
                              gboolean old_checked,
                              gboolean complete_subitems)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_complete_item (_tmp1_, item, old_checked);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeHashMap* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		ServicesEventBus* _tmp21_;
		ServicesEventBus* _tmp22_;
		gboolean _tmp23_ = FALSE;
		gboolean _tmp24_ = FALSE;
		gboolean _tmp25_;
		gboolean _tmp26_;
		_tmp3_ = self->priv->_items_by_project_cache;
		_tmp4_ = objects_item_get_project_id (item);
		_tmp5_ = _tmp4_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp3_, _tmp5_, NULL);
		if (complete_subitems) {
			{
				GeeArrayList* _subitem_list = NULL;
				GeeArrayList* _tmp6_;
				gint _subitem_size = 0;
				GeeArrayList* _tmp7_;
				gint _tmp8_;
				gint _tmp9_;
				gint _subitem_index = 0;
				_tmp6_ = services_store_get_subitems (self, item);
				_subitem_list = _tmp6_;
				_tmp7_ = _subitem_list;
				_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp7_);
				_tmp9_ = _tmp8_;
				_subitem_size = _tmp9_;
				_subitem_index = -1;
				while (TRUE) {
					gint _tmp10_;
					gint _tmp11_;
					ObjectsItem* subitem = NULL;
					GeeArrayList* _tmp12_;
					gpointer _tmp13_;
					ObjectsItem* _tmp14_;
					gboolean _tmp15_;
					gboolean _tmp16_;
					ObjectsItem* _tmp17_;
					const gchar* _tmp18_;
					const gchar* _tmp19_;
					ObjectsItem* _tmp20_;
					_subitem_index = _subitem_index + 1;
					_tmp10_ = _subitem_index;
					_tmp11_ = _subitem_size;
					if (!(_tmp10_ < _tmp11_)) {
						break;
					}
					_tmp12_ = _subitem_list;
					_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _tmp12_, _subitem_index);
					subitem = (ObjectsItem*) _tmp13_;
					_tmp14_ = subitem;
					_tmp15_ = objects_item_get_checked (item);
					_tmp16_ = _tmp15_;
					objects_item_set_checked (_tmp14_, _tmp16_);
					_tmp17_ = subitem;
					_tmp18_ = objects_item_get_completed_at (item);
					_tmp19_ = _tmp18_;
					objects_item_set_completed_at (_tmp17_, _tmp19_);
					_tmp20_ = subitem;
					services_store_complete_item (self, _tmp20_, old_checked, TRUE);
					_g_object_unref0 (subitem);
				}
				_g_object_unref0 (_subitem_list);
			}
		}
		g_signal_emit_by_name ((ObjectsBaseObject*) item, "updated", "");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_UPDATED_SIGNAL], 0, item, "");
		_tmp21_ = services_event_bus_get_default ();
		_tmp22_ = _tmp21_;
		g_signal_emit_by_name (_tmp22_, "checked-toggled", item, old_checked);
		_g_object_unref0 (_tmp22_);
		_tmp25_ = objects_item_get_has_parent (item);
		_tmp26_ = _tmp25_;
		if (_tmp26_) {
			gboolean _tmp27_;
			gboolean _tmp28_;
			_tmp27_ = objects_item_get_checked (item);
			_tmp28_ = _tmp27_;
			_tmp24_ = !_tmp28_;
		} else {
			_tmp24_ = FALSE;
		}
		if (_tmp24_) {
			ObjectsItem* _tmp29_;
			ObjectsItem* _tmp30_;
			_tmp29_ = objects_item_get_parent (item);
			_tmp30_ = _tmp29_;
			_tmp23_ = _tmp30_ != NULL;
		} else {
			_tmp23_ = FALSE;
		}
		if (_tmp23_) {
			ObjectsItem* _tmp31_;
			ObjectsItem* _tmp32_;
			gboolean _tmp33_;
			gboolean _tmp34_;
			ObjectsItem* _tmp35_;
			ObjectsItem* _tmp36_;
			const gchar* _tmp37_;
			const gchar* _tmp38_;
			ObjectsItem* _tmp39_;
			ObjectsItem* _tmp40_;
			_tmp31_ = objects_item_get_parent (item);
			_tmp32_ = _tmp31_;
			_tmp33_ = objects_item_get_checked (item);
			_tmp34_ = _tmp33_;
			objects_item_set_checked (_tmp32_, _tmp34_);
			_tmp35_ = objects_item_get_parent (item);
			_tmp36_ = _tmp35_;
			_tmp37_ = objects_item_get_completed_at (item);
			_tmp38_ = _tmp37_;
			objects_item_set_completed_at (_tmp36_, _tmp38_);
			_tmp39_ = objects_item_get_parent (item);
			_tmp40_ = _tmp39_;
			services_store_complete_item (self, _tmp40_, old_checked, FALSE);
		}
	}
}

void
services_store_archive_item (ServicesStore* self,
                             ObjectsItem* item,
                             gboolean is_archived)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	if (is_archived) {
		g_signal_emit_by_name ((ObjectsBaseObject*) item, "archived");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_ARCHIVED_SIGNAL], 0, item);
	} else {
		g_signal_emit_by_name ((ObjectsBaseObject*) item, "unarchived");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ITEM_UNARCHIVED_SIGNAL], 0, item);
	}
	{
		GeeArrayList* _subitem_list = NULL;
		GeeArrayList* _tmp0_;
		gint _subitem_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _subitem_index = 0;
		_tmp0_ = services_store_get_subitems (self, item);
		_subitem_list = _tmp0_;
		_tmp1_ = _subitem_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_subitem_size = _tmp3_;
		_subitem_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ObjectsItem* subitem = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			ObjectsItem* _tmp8_;
			_subitem_index = _subitem_index + 1;
			_tmp4_ = _subitem_index;
			_tmp5_ = _subitem_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _subitem_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _subitem_index);
			subitem = (ObjectsItem*) _tmp7_;
			_tmp8_ = subitem;
			services_store_archive_item (self, _tmp8_, is_archived);
			_g_object_unref0 (subitem);
		}
		_g_object_unref0 (_subitem_list);
	}
}

void
services_store_update_item_id (ServicesStore* self,
                               const gchar* current_id,
                               const gchar* new_id)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (current_id != NULL);
	g_return_if_fail (new_id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_item_id (_tmp1_, current_id, new_id);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		ServicesDatabase* _tmp16_;
		ServicesDatabase* _tmp17_;
		gboolean _tmp18_;
		{
			GeeArrayList* _item_list = NULL;
			GeeArrayList* _tmp3_;
			GeeArrayList* _tmp4_;
			gint _item_size = 0;
			GeeArrayList* _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			gint _item_index = 0;
			_tmp3_ = services_store_get_items (self);
			_tmp4_ = _tmp3_;
			_item_list = _tmp4_;
			_tmp5_ = _item_list;
			_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
			_tmp7_ = _tmp6_;
			_item_size = _tmp7_;
			_item_index = -1;
			while (TRUE) {
				gint _tmp8_;
				gint _tmp9_;
				ObjectsItem* item = NULL;
				GeeArrayList* _tmp10_;
				gpointer _tmp11_;
				ObjectsItem* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_item_index = _item_index + 1;
				_tmp8_ = _item_index;
				_tmp9_ = _item_size;
				if (!(_tmp8_ < _tmp9_)) {
					break;
				}
				_tmp10_ = _item_list;
				_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _item_index);
				item = (ObjectsItem*) _tmp11_;
				_tmp12_ = item;
				_tmp13_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp12_);
				_tmp14_ = _tmp13_;
				if (g_strcmp0 (_tmp14_, current_id) == 0) {
					ObjectsItem* _tmp15_;
					_tmp15_ = item;
					objects_base_object_set_id ((ObjectsBaseObject*) _tmp15_, new_id);
					_g_object_unref0 (item);
					break;
				}
				_g_object_unref0 (item);
			}
		}
		_tmp16_ = services_database_get_default ();
		_tmp17_ = _tmp16_;
		_tmp18_ = services_database_update_item_child_id (_tmp17_, current_id, new_id);
		_g_object_unref0 (_tmp17_);
		if (_tmp18_) {
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp19_;
				GeeArrayList* _tmp20_;
				gint _item_size = 0;
				GeeArrayList* _tmp21_;
				gint _tmp22_;
				gint _tmp23_;
				gint _item_index = 0;
				_tmp19_ = services_store_get_items (self);
				_tmp20_ = _tmp19_;
				_item_list = _tmp20_;
				_tmp21_ = _item_list;
				_tmp22_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp21_);
				_tmp23_ = _tmp22_;
				_item_size = _tmp23_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp24_;
					gint _tmp25_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp26_;
					gpointer _tmp27_;
					ObjectsItem* _tmp28_;
					const gchar* _tmp29_;
					const gchar* _tmp30_;
					_item_index = _item_index + 1;
					_tmp24_ = _item_index;
					_tmp25_ = _item_size;
					if (!(_tmp24_ < _tmp25_)) {
						break;
					}
					_tmp26_ = _item_list;
					_tmp27_ = gee_abstract_list_get ((GeeAbstractList*) _tmp26_, _item_index);
					item = (ObjectsItem*) _tmp27_;
					_tmp28_ = item;
					_tmp29_ = objects_item_get_parent_id (_tmp28_);
					_tmp30_ = _tmp29_;
					if (g_strcmp0 (_tmp30_, current_id) == 0) {
						ObjectsItem* _tmp31_;
						_tmp31_ = item;
						objects_item_set_parent_id (_tmp31_, new_id);
					}
					_g_object_unref0 (item);
				}
			}
		}
	}
}

gint
services_store_next_item_child_order (ServicesStore* self,
                                      const gchar* project_id,
                                      const gchar* section_id)
{
	gint child_order = 0;
	GError* _inner_error0_ = NULL;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (project_id != NULL, -1);
	g_return_val_if_fail (section_id != NULL, -1);
	child_order = 0;
	{
		GeeArrayList* _tmp0_;
		gint _tmp20_ = -1;
		_tmp0_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _item_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _item_index = 0;
				_tmp1_ = services_store_get_items (self);
				_tmp2_ = _tmp1_;
				_item_list = _tmp2_;
				_tmp3_ = _item_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_item_size = _tmp5_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					gboolean _tmp10_ = FALSE;
					ObjectsItem* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					_item_index = _item_index + 1;
					_tmp6_ = _item_index;
					_tmp7_ = _item_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _item_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _item_index);
					item = (ObjectsItem*) _tmp9_;
					_tmp11_ = item;
					_tmp12_ = objects_item_get_project_id (_tmp11_);
					_tmp13_ = _tmp12_;
					if (g_strcmp0 (_tmp13_, project_id) == 0) {
						ObjectsItem* _tmp14_;
						const gchar* _tmp15_;
						const gchar* _tmp16_;
						_tmp14_ = item;
						_tmp15_ = objects_item_get_section_id (_tmp14_);
						_tmp16_ = _tmp15_;
						_tmp10_ = g_strcmp0 (_tmp16_, section_id) == 0;
					} else {
						_tmp10_ = FALSE;
					}
					if (_tmp10_) {
						gint _tmp17_;
						_tmp17_ = child_order;
						child_order = _tmp17_ + 1;
					}
					_g_object_unref0 (item);
				}
			}
			result = child_order;
			{
				GeeArrayList* _tmp18_;
				_tmp18_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp19_;
			_tmp19_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp20_;
	}
}

ObjectsItem*
services_store_get_item (ServicesStore* self,
                         const gchar* id)
{
	ObjectsItem* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			ObjectsItem* _tmp15_;
			ObjectsItem* _tmp16_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _item_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _item_index = 0;
				_tmp1_ = services_store_get_items (self);
				_tmp2_ = _tmp1_;
				_item_list = _tmp2_;
				_tmp3_ = _item_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_item_size = _tmp5_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsItem* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_item_index = _item_index + 1;
					_tmp6_ = _item_index;
					_tmp7_ = _item_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _item_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _item_index);
					item = (ObjectsItem*) _tmp9_;
					_tmp10_ = item;
					_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, id) == 0) {
						ObjectsItem* _tmp13_;
						ObjectsItem* _tmp14_;
						_tmp13_ = item;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (item);
						break;
					}
					_g_object_unref0 (item);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

ObjectsItem*
services_store_get_item_by_ical_url (ServicesStore* self,
                                     const gchar* ical_url)
{
	ObjectsItem* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (ical_url != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			ObjectsItem* _tmp24_;
			ObjectsItem* _tmp25_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _item_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _item_index = 0;
				_tmp1_ = services_store_get_items (self);
				_tmp2_ = _tmp1_;
				_item_list = _tmp2_;
				_tmp3_ = _item_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_item_size = _tmp5_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					gboolean _tmp10_ = FALSE;
					ObjectsItem* _tmp11_;
					ObjectsSource* _tmp12_;
					ObjectsSource* _tmp13_;
					_item_index = _item_index + 1;
					_tmp6_ = _item_index;
					_tmp7_ = _item_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _item_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _item_index);
					item = (ObjectsItem*) _tmp9_;
					_tmp11_ = item;
					_tmp12_ = objects_base_object_get_source ((ObjectsBaseObject*) _tmp11_);
					_tmp13_ = _tmp12_;
					if (_tmp13_ != NULL) {
						ObjectsItem* _tmp14_;
						ObjectsSource* _tmp15_;
						ObjectsSource* _tmp16_;
						SourceType _tmp17_;
						SourceType _tmp18_;
						_tmp14_ = item;
						_tmp15_ = objects_base_object_get_source ((ObjectsBaseObject*) _tmp14_);
						_tmp16_ = _tmp15_;
						_tmp17_ = objects_source_get_source_type (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp10_ = _tmp18_ == SOURCE_TYPE_CALDAV;
					} else {
						_tmp10_ = FALSE;
					}
					if (_tmp10_) {
						ObjectsItem* _tmp19_;
						const gchar* _tmp20_;
						const gchar* _tmp21_;
						_tmp19_ = item;
						_tmp20_ = objects_item_get_ical_url (_tmp19_);
						_tmp21_ = _tmp20_;
						if (g_strcmp0 (_tmp21_, ical_url) == 0) {
							ObjectsItem* _tmp22_;
							ObjectsItem* _tmp23_;
							_tmp22_ = item;
							_tmp23_ = _g_object_ref0 (_tmp22_);
							_g_object_unref0 (return_value);
							return_value = _tmp23_;
							_g_object_unref0 (item);
							break;
						}
					}
					_g_object_unref0 (item);
				}
			}
			_tmp24_ = return_value;
			_tmp25_ = _g_object_ref0 (_tmp24_);
			result = _tmp25_;
			{
				GeeArrayList* _tmp26_;
				_tmp26_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp27_;
			_tmp27_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_by_baseobject (ServicesStore* self,
                                        ObjectsBaseObject* object)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (object != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					if (OBJECTS_IS_PROJECT (object)) {
						gboolean _tmp11_ = FALSE;
						gboolean _tmp12_ = FALSE;
						ObjectsItem* _tmp13_;
						const gchar* _tmp14_;
						const gchar* _tmp15_;
						const gchar* _tmp16_;
						const gchar* _tmp17_;
						_tmp13_ = item;
						_tmp14_ = objects_item_get_project_id (_tmp13_);
						_tmp15_ = _tmp14_;
						_tmp16_ = objects_base_object_get_id (object);
						_tmp17_ = _tmp16_;
						if (g_strcmp0 (_tmp15_, _tmp17_) == 0) {
							ObjectsItem* _tmp18_;
							const gchar* _tmp19_;
							const gchar* _tmp20_;
							_tmp18_ = item;
							_tmp19_ = objects_item_get_section_id (_tmp18_);
							_tmp20_ = _tmp19_;
							_tmp12_ = g_strcmp0 (_tmp20_, "") == 0;
						} else {
							_tmp12_ = FALSE;
						}
						if (_tmp12_) {
							ObjectsItem* _tmp21_;
							gboolean _tmp22_;
							gboolean _tmp23_;
							_tmp21_ = item;
							_tmp22_ = objects_item_get_has_parent (_tmp21_);
							_tmp23_ = _tmp22_;
							_tmp11_ = !_tmp23_;
						} else {
							_tmp11_ = FALSE;
						}
						if (_tmp11_) {
							GeeArrayList* _tmp24_;
							ObjectsItem* _tmp25_;
							_tmp24_ = return_value;
							_tmp25_ = item;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp24_, _tmp25_);
						}
					}
					if (OBJECTS_IS_SECTION (object)) {
						gboolean _tmp26_ = FALSE;
						ObjectsItem* _tmp27_;
						const gchar* _tmp28_;
						const gchar* _tmp29_;
						const gchar* _tmp30_;
						const gchar* _tmp31_;
						_tmp27_ = item;
						_tmp28_ = objects_item_get_section_id (_tmp27_);
						_tmp29_ = _tmp28_;
						_tmp30_ = objects_base_object_get_id (object);
						_tmp31_ = _tmp30_;
						if (g_strcmp0 (_tmp29_, _tmp31_) == 0) {
							ObjectsItem* _tmp32_;
							gboolean _tmp33_;
							gboolean _tmp34_;
							_tmp32_ = item;
							_tmp33_ = objects_item_get_has_parent (_tmp32_);
							_tmp34_ = _tmp33_;
							_tmp26_ = !_tmp34_;
						} else {
							_tmp26_ = FALSE;
						}
						if (_tmp26_) {
							GeeArrayList* _tmp35_;
							ObjectsItem* _tmp36_;
							_tmp35_ = return_value;
							_tmp36_ = item;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp35_, _tmp36_);
						}
					}
					if (OBJECTS_IS_ITEM (object)) {
						ObjectsItem* _tmp37_;
						const gchar* _tmp38_;
						const gchar* _tmp39_;
						const gchar* _tmp40_;
						const gchar* _tmp41_;
						_tmp37_ = item;
						_tmp38_ = objects_item_get_parent_id (_tmp37_);
						_tmp39_ = _tmp38_;
						_tmp40_ = objects_base_object_get_id (object);
						_tmp41_ = _tmp40_;
						if (g_strcmp0 (_tmp39_, _tmp41_) == 0) {
							GeeArrayList* _tmp42_;
							ObjectsItem* _tmp43_;
							_tmp42_ = return_value;
							_tmp43_ = item;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp42_, _tmp43_);
						}
					}
					_g_object_unref0 (item);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp44_;
			_tmp44_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (return_value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = return_value;
	return result;
}

GeeArrayList*
services_store_get_items_checked (ServicesStore* self)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp16_;
			GeeArrayList* _tmp17_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsItem* _tmp11_;
					gboolean _tmp12_;
					gboolean _tmp13_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp11_ = item;
					_tmp12_ = objects_item_get_checked (_tmp11_);
					_tmp13_ = _tmp12_;
					if (_tmp13_) {
						GeeArrayList* _tmp14_;
						ObjectsItem* _tmp15_;
						_tmp14_ = return_value;
						_tmp15_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp16_ = return_value;
			_tmp17_ = _g_object_ref0 (_tmp16_);
			result = _tmp17_;
			{
				GeeArrayList* _tmp18_;
				_tmp18_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp19_;
			_tmp19_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_checked_by_project (ServicesStore* self,
                                             ObjectsProject* project)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (project != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp22_;
			GeeArrayList* _tmp23_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsItem* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					const gchar* _tmp16_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp12_ = item;
					_tmp13_ = objects_item_get_project_id (_tmp12_);
					_tmp14_ = _tmp13_;
					_tmp15_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
					_tmp16_ = _tmp15_;
					if (g_strcmp0 (_tmp14_, _tmp16_) == 0) {
						ObjectsItem* _tmp17_;
						gboolean _tmp18_;
						gboolean _tmp19_;
						_tmp17_ = item;
						_tmp18_ = objects_item_get_checked (_tmp17_);
						_tmp19_ = _tmp18_;
						_tmp11_ = _tmp19_;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp20_;
						ObjectsItem* _tmp21_;
						_tmp20_ = return_value;
						_tmp21_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, _tmp21_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp22_ = return_value;
			_tmp23_ = _g_object_ref0 (_tmp22_);
			result = _tmp23_;
			{
				GeeArrayList* _tmp24_;
				_tmp24_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp25_;
			_tmp25_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_subitems (ServicesStore* self,
                             ObjectsItem* i)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (i != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsItem* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp11_ = item;
					_tmp12_ = objects_item_get_parent_id (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) i);
					_tmp15_ = _tmp14_;
					if (g_strcmp0 (_tmp13_, _tmp15_) == 0) {
						GeeArrayList* _tmp16_;
						ObjectsItem* _tmp17_;
						_tmp16_ = return_value;
						_tmp17_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
					}
					_g_object_unref0 (item);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (return_value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = return_value;
	return result;
}

GeeArrayList*
services_store_get_subitems_uncomplete (ServicesStore* self,
                                        ObjectsItem* i)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (i != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsItem* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					const gchar* _tmp16_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp12_ = item;
					_tmp13_ = objects_item_get_parent_id (_tmp12_);
					_tmp14_ = _tmp13_;
					_tmp15_ = objects_base_object_get_id ((ObjectsBaseObject*) i);
					_tmp16_ = _tmp15_;
					if (g_strcmp0 (_tmp14_, _tmp16_) == 0) {
						ObjectsItem* _tmp17_;
						gboolean _tmp18_;
						gboolean _tmp19_;
						_tmp17_ = item;
						_tmp18_ = objects_item_get_checked (_tmp17_);
						_tmp19_ = _tmp18_;
						_tmp11_ = !_tmp19_;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp20_;
						ObjectsItem* _tmp21_;
						_tmp20_ = return_value;
						_tmp21_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, _tmp21_);
					}
					_g_object_unref0 (item);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp22_;
			_tmp22_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (return_value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = return_value;
	return result;
}

GeeArrayList*
services_store_get_items_by_project (ServicesStore* self,
                                     ObjectsProject* project)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GeeHashMap* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gpointer _tmp27_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (project != NULL, NULL);
	_tmp0_ = self->priv->_items_by_project_cache;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp2_ = _tmp1_;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		GeeArrayList* filtered_items = NULL;
		GeeArrayList* _tmp3_;
		GeeHashMap* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		GeeArrayList* _tmp23_;
		_tmp3_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		filtered_items = _tmp3_;
		{
			GeeArrayList* _item_list = NULL;
			GeeArrayList* _tmp4_;
			GeeArrayList* _tmp5_;
			gint _item_size = 0;
			GeeArrayList* _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			gint _item_index = 0;
			_tmp4_ = services_store_get_items (self);
			_tmp5_ = _tmp4_;
			_item_list = _tmp5_;
			_tmp6_ = _item_list;
			_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
			_tmp8_ = _tmp7_;
			_item_size = _tmp8_;
			_item_index = -1;
			while (TRUE) {
				gint _tmp9_;
				gint _tmp10_;
				ObjectsItem* item = NULL;
				GeeArrayList* _tmp11_;
				gpointer _tmp12_;
				ObjectsItem* _tmp13_;
				const gchar* _tmp14_;
				const gchar* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				_item_index = _item_index + 1;
				_tmp9_ = _item_index;
				_tmp10_ = _item_size;
				if (!(_tmp9_ < _tmp10_)) {
					break;
				}
				_tmp11_ = _item_list;
				_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _item_index);
				item = (ObjectsItem*) _tmp12_;
				_tmp13_ = item;
				_tmp14_ = objects_item_get_project_id (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
				_tmp17_ = _tmp16_;
				if (g_strcmp0 (_tmp15_, _tmp17_) == 0) {
					GeeArrayList* _tmp18_;
					ObjectsItem* _tmp19_;
					_tmp18_ = filtered_items;
					_tmp19_ = item;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp19_);
				}
				_g_object_unref0 (item);
			}
		}
		_tmp20_ = self->priv->_items_by_project_cache;
		_tmp21_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
		_tmp22_ = _tmp21_;
		_tmp23_ = filtered_items;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp20_, _tmp22_, _tmp23_);
		_g_object_unref0 (filtered_items);
	}
	_tmp24_ = self->priv->_items_by_project_cache;
	_tmp25_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp26_ = _tmp25_;
	_tmp27_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp24_, _tmp26_);
	result = (GeeArrayList*) _tmp27_;
	return result;
}

GeeArrayList*
services_store_get_items_by_project_pinned (ServicesStore* self,
                                            ObjectsProject* project)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (project != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp18_;
			GeeArrayList* _tmp19_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsItem* _tmp12_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp12_ = item;
					if (objects_item_exists_project (_tmp12_, project)) {
						ObjectsItem* _tmp13_;
						gboolean _tmp14_;
						gboolean _tmp15_;
						_tmp13_ = item;
						_tmp14_ = objects_item_get_pinned (_tmp13_);
						_tmp15_ = _tmp14_;
						_tmp11_ = _tmp15_;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp16_;
						ObjectsItem* _tmp17_;
						_tmp16_ = return_value;
						_tmp17_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp18_ = return_value;
			_tmp19_ = _g_object_ref0 (_tmp18_);
			result = _tmp19_;
			{
				GeeArrayList* _tmp20_;
				_tmp20_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp21_;
			_tmp21_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_by_date (ServicesStore* self,
                                  GDateTime* date,
                                  gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (date != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp14_;
			GeeArrayList* _tmp15_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsItem* _tmp11_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp11_ = item;
					if (services_store_valid_item_by_date (self, _tmp11_, date, checked)) {
						GeeArrayList* _tmp12_;
						ObjectsItem* _tmp13_;
						_tmp12_ = return_value;
						_tmp13_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp13_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp14_ = return_value;
			_tmp15_ = _g_object_ref0 (_tmp14_);
			result = _tmp15_;
			{
				GeeArrayList* _tmp16_;
				_tmp16_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp17_;
			_tmp17_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_no_date (ServicesStore* self,
                                  gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp20_;
			GeeArrayList* _tmp21_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsItem* _tmp12_;
					gboolean _tmp13_;
					gboolean _tmp14_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp12_ = item;
					_tmp13_ = objects_item_get_has_due (_tmp12_);
					_tmp14_ = _tmp13_;
					if (!_tmp14_) {
						ObjectsItem* _tmp15_;
						gboolean _tmp16_;
						gboolean _tmp17_;
						_tmp15_ = item;
						_tmp16_ = objects_item_get_checked (_tmp15_);
						_tmp17_ = _tmp16_;
						_tmp11_ = _tmp17_ == checked;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp18_;
						ObjectsItem* _tmp19_;
						_tmp18_ = return_value;
						_tmp19_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp19_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp20_ = return_value;
			_tmp21_ = _g_object_ref0 (_tmp20_);
			result = _tmp21_;
			{
				GeeArrayList* _tmp22_;
				_tmp22_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp23_;
			_tmp23_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_repeating (ServicesStore* self,
                                    gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp30_;
			GeeArrayList* _tmp31_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					gboolean _tmp14_ = FALSE;
					ObjectsItem* _tmp15_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp15_ = item;
					if (_tmp15_ != NULL) {
						ObjectsItem* _tmp16_;
						gboolean _tmp17_;
						gboolean _tmp18_;
						_tmp16_ = item;
						_tmp17_ = objects_item_get_has_due (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp14_ = _tmp18_;
					} else {
						_tmp14_ = FALSE;
					}
					if (_tmp14_) {
						ObjectsItem* _tmp19_;
						ObjectsDueDate* _tmp20_;
						ObjectsDueDate* _tmp21_;
						gboolean _tmp22_;
						gboolean _tmp23_;
						_tmp19_ = item;
						_tmp20_ = objects_item_get_due (_tmp19_);
						_tmp21_ = _tmp20_;
						_tmp22_ = objects_due_date_get_is_recurring (_tmp21_);
						_tmp23_ = _tmp22_;
						_tmp13_ = _tmp23_;
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp24_;
						gboolean _tmp25_;
						gboolean _tmp26_;
						_tmp24_ = item;
						_tmp25_ = objects_item_get_checked (_tmp24_);
						_tmp26_ = _tmp25_;
						_tmp12_ = _tmp26_ == checked;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp27_;
						_tmp27_ = item;
						_tmp11_ = !objects_item_was_archived (_tmp27_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp28_;
						ObjectsItem* _tmp29_;
						_tmp28_ = return_value;
						_tmp29_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp28_, _tmp29_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp30_ = return_value;
			_tmp31_ = _g_object_ref0 (_tmp30_);
			result = _tmp31_;
			{
				GeeArrayList* _tmp32_;
				_tmp32_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp33_;
			_tmp33_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_by_date_range (ServicesStore* self,
                                        GDateTime* start_date,
                                        GDateTime* end_date,
                                        gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (start_date != NULL, NULL);
	g_return_val_if_fail (end_date != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp14_;
			GeeArrayList* _tmp15_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsItem* _tmp11_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp11_ = item;
					if (services_store_valid_item_by_date_range (self, _tmp11_, start_date, end_date, checked)) {
						GeeArrayList* _tmp12_;
						ObjectsItem* _tmp13_;
						_tmp12_ = return_value;
						_tmp13_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp13_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp14_ = return_value;
			_tmp15_ = _g_object_ref0 (_tmp14_);
			result = _tmp15_;
			{
				GeeArrayList* _tmp16_;
				_tmp16_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp17_;
			_tmp17_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_by_month (ServicesStore* self,
                                   GDateTime* date,
                                   gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (date != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp14_;
			GeeArrayList* _tmp15_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsItem* _tmp11_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp11_ = item;
					if (services_store_valid_item_by_month (self, _tmp11_, date, checked)) {
						GeeArrayList* _tmp12_;
						ObjectsItem* _tmp13_;
						_tmp12_ = return_value;
						_tmp13_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp13_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp14_ = return_value;
			_tmp15_ = _g_object_ref0 (_tmp14_);
			result = _tmp15_;
			{
				GeeArrayList* _tmp16_;
				_tmp16_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp17_;
			_tmp17_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_pinned (ServicesStore* self,
                                 gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp24_;
			GeeArrayList* _tmp25_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					ObjectsItem* _tmp14_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp14_ = item;
					if (_tmp14_ != NULL) {
						ObjectsItem* _tmp15_;
						gboolean _tmp16_;
						gboolean _tmp17_;
						_tmp15_ = item;
						_tmp16_ = objects_item_get_pinned (_tmp15_);
						_tmp17_ = _tmp16_;
						_tmp13_ = _tmp17_;
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp18_;
						gboolean _tmp19_;
						gboolean _tmp20_;
						_tmp18_ = item;
						_tmp19_ = objects_item_get_checked (_tmp18_);
						_tmp20_ = _tmp19_;
						_tmp12_ = _tmp20_ == checked;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp21_;
						_tmp21_ = item;
						_tmp11_ = !objects_item_was_archived (_tmp21_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp22_;
						ObjectsItem* _tmp23_;
						_tmp22_ = return_value;
						_tmp23_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp23_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp24_ = return_value;
			_tmp25_ = _g_object_ref0 (_tmp24_);
			result = _tmp25_;
			{
				GeeArrayList* _tmp26_;
				_tmp26_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp27_;
			_tmp27_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_by_priority (ServicesStore* self,
                                      gint priority,
                                      gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp24_;
			GeeArrayList* _tmp25_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					ObjectsItem* _tmp14_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp14_ = item;
					if (_tmp14_ != NULL) {
						ObjectsItem* _tmp15_;
						gint _tmp16_;
						gint _tmp17_;
						_tmp15_ = item;
						_tmp16_ = objects_item_get_priority (_tmp15_);
						_tmp17_ = _tmp16_;
						_tmp13_ = _tmp17_ == priority;
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp18_;
						gboolean _tmp19_;
						gboolean _tmp20_;
						_tmp18_ = item;
						_tmp19_ = objects_item_get_checked (_tmp18_);
						_tmp20_ = _tmp19_;
						_tmp12_ = _tmp20_ == checked;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp21_;
						_tmp21_ = item;
						_tmp11_ = !objects_item_was_archived (_tmp21_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp22_;
						ObjectsItem* _tmp23_;
						_tmp22_ = return_value;
						_tmp23_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp23_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp24_ = return_value;
			_tmp25_ = _g_object_ref0 (_tmp24_);
			result = _tmp25_;
			{
				GeeArrayList* _tmp26_;
				_tmp26_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp27_;
			_tmp27_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_completed (ServicesStore* self)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp20_;
			GeeArrayList* _tmp21_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					ObjectsItem* _tmp13_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp13_ = item;
					if (_tmp13_ != NULL) {
						ObjectsItem* _tmp14_;
						gboolean _tmp15_;
						gboolean _tmp16_;
						_tmp14_ = item;
						_tmp15_ = objects_item_get_checked (_tmp14_);
						_tmp16_ = _tmp15_;
						_tmp12_ = _tmp16_;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp17_;
						_tmp17_ = item;
						_tmp11_ = !objects_item_was_archived (_tmp17_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp18_;
						ObjectsItem* _tmp19_;
						_tmp18_ = return_value;
						_tmp19_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp19_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp20_ = return_value;
			_tmp21_ = _g_object_ref0 (_tmp20_);
			result = _tmp21_;
			{
				GeeArrayList* _tmp22_;
				_tmp22_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp23_;
			_tmp23_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_by_label (ServicesStore* self,
                                   ObjectsLabel* label,
                                   gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp24_;
			GeeArrayList* _tmp25_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					ObjectsItem* _tmp14_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp14_ = item;
					if (_tmp14_ != NULL) {
						ObjectsItem* _tmp15_;
						const gchar* _tmp16_;
						const gchar* _tmp17_;
						_tmp15_ = item;
						_tmp16_ = objects_base_object_get_id ((ObjectsBaseObject*) label);
						_tmp17_ = _tmp16_;
						_tmp13_ = objects_item_has_label (_tmp15_, _tmp17_);
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp18_;
						gboolean _tmp19_;
						gboolean _tmp20_;
						_tmp18_ = item;
						_tmp19_ = objects_item_get_checked (_tmp18_);
						_tmp20_ = _tmp19_;
						_tmp12_ = _tmp20_ == checked;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp21_;
						_tmp21_ = item;
						_tmp11_ = !objects_item_was_archived (_tmp21_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp22_;
						ObjectsItem* _tmp23_;
						_tmp22_ = return_value;
						_tmp23_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp23_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp24_ = return_value;
			_tmp25_ = _g_object_ref0 (_tmp24_);
			result = _tmp25_;
			{
				GeeArrayList* _tmp26_;
				_tmp26_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp27_;
			_tmp27_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_unlabeled (ServicesStore* self,
                                    gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp26_;
			GeeArrayList* _tmp27_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					ObjectsItem* _tmp14_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp14_ = item;
					if (_tmp14_ != NULL) {
						ObjectsItem* _tmp15_;
						GeeArrayList* _tmp16_;
						GeeArrayList* _tmp17_;
						gint _tmp18_;
						gint _tmp19_;
						_tmp15_ = item;
						_tmp16_ = objects_item_get_labels (_tmp15_);
						_tmp17_ = _tmp16_;
						_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
						_tmp19_ = _tmp18_;
						_tmp13_ = _tmp19_ <= 0;
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp20_;
						gboolean _tmp21_;
						gboolean _tmp22_;
						_tmp20_ = item;
						_tmp21_ = objects_item_get_checked (_tmp20_);
						_tmp22_ = _tmp21_;
						_tmp12_ = _tmp22_ == checked;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp23_;
						_tmp23_ = item;
						_tmp11_ = !objects_item_was_archived (_tmp23_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp24_;
						ObjectsItem* _tmp25_;
						_tmp24_ = return_value;
						_tmp25_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp24_, _tmp25_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp26_ = return_value;
			_tmp27_ = _g_object_ref0 (_tmp26_);
			result = _tmp27_;
			{
				GeeArrayList* _tmp28_;
				_tmp28_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp29_;
			_tmp29_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_by_scheduled (ServicesStore* self,
                                       gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp32_;
			GeeArrayList* _tmp33_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					gboolean _tmp14_ = FALSE;
					ObjectsItem* _tmp15_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp15_ = item;
					if (_tmp15_ != NULL) {
						ObjectsItem* _tmp16_;
						gboolean _tmp17_;
						gboolean _tmp18_;
						_tmp16_ = item;
						_tmp17_ = objects_item_get_has_due (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp14_ = _tmp18_;
					} else {
						_tmp14_ = FALSE;
					}
					if (_tmp14_) {
						ObjectsItem* _tmp19_;
						_tmp19_ = item;
						_tmp13_ = !objects_item_was_archived (_tmp19_);
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp20_;
						gboolean _tmp21_;
						gboolean _tmp22_;
						_tmp20_ = item;
						_tmp21_ = objects_item_get_checked (_tmp20_);
						_tmp22_ = _tmp21_;
						_tmp12_ = _tmp22_ == checked;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp23_;
						ObjectsDueDate* _tmp24_;
						ObjectsDueDate* _tmp25_;
						GDateTime* _tmp26_;
						GDateTime* _tmp27_;
						GDateTime* _tmp28_;
						GDateTime* _tmp29_;
						_tmp23_ = item;
						_tmp24_ = objects_item_get_due (_tmp23_);
						_tmp25_ = _tmp24_;
						_tmp26_ = objects_due_date_get_datetime (_tmp25_);
						_tmp27_ = _tmp26_;
						_tmp28_ = g_date_time_new_now_local ();
						_tmp29_ = _tmp28_;
						_tmp11_ = g_date_time_compare (_tmp27_, _tmp29_) > 0;
						_g_date_time_unref0 (_tmp29_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp30_;
						ObjectsItem* _tmp31_;
						_tmp30_ = return_value;
						_tmp31_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp30_, _tmp31_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp32_ = return_value;
			_tmp33_ = _g_object_ref0 (_tmp32_);
			result = _tmp33_;
			{
				GeeArrayList* _tmp34_;
				_tmp34_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp35_;
			_tmp35_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_items_no_parent (ServicesStore* self,
                                    gboolean checked)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp24_;
			GeeArrayList* _tmp25_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					ObjectsItem* _tmp14_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp14_ = item;
					if (_tmp14_ != NULL) {
						ObjectsItem* _tmp15_;
						_tmp15_ = item;
						_tmp13_ = !objects_item_was_archived (_tmp15_);
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp16_;
						gboolean _tmp17_;
						gboolean _tmp18_;
						_tmp16_ = item;
						_tmp17_ = objects_item_get_checked (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp12_ = _tmp18_ == checked;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp19_;
						gboolean _tmp20_;
						gboolean _tmp21_;
						_tmp19_ = item;
						_tmp20_ = objects_item_get_has_parent (_tmp19_);
						_tmp21_ = _tmp20_;
						_tmp11_ = !_tmp21_;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp22_;
						ObjectsItem* _tmp23_;
						_tmp22_ = return_value;
						_tmp23_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp23_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp24_ = return_value;
			_tmp25_ = _g_object_ref0 (_tmp24_);
			result = _tmp25_;
			{
				GeeArrayList* _tmp26_;
				_tmp26_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp27_;
			_tmp27_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

gboolean
services_store_valid_item_by_date (ServicesStore* self,
                                   ObjectsItem* item,
                                   GDateTime* date,
                                   gboolean checked)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (item != NULL, FALSE);
	g_return_val_if_fail (date != NULL, FALSE);
	if (item == NULL) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = objects_item_get_has_due (item);
		_tmp3_ = _tmp2_;
		_tmp1_ = !_tmp3_;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = objects_item_was_archived (item);
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp5_ = objects_item_get_checked (item);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == checked) {
		ObjectsDueDate* _tmp7_;
		ObjectsDueDate* _tmp8_;
		GDateTime* _tmp9_;
		GDateTime* _tmp10_;
		_tmp7_ = objects_item_get_due (item);
		_tmp8_ = _tmp7_;
		_tmp9_ = objects_due_date_get_datetime (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp4_ = utils_datetime_is_same_day (_tmp10_, date);
	} else {
		_tmp4_ = FALSE;
	}
	result = _tmp4_;
	return result;
}

gboolean
services_store_valid_item_by_date_range (ServicesStore* self,
                                         ObjectsItem* item,
                                         GDateTime* start_date,
                                         GDateTime* end_date,
                                         gboolean checked)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GDateTime* date = NULL;
	ObjectsDueDate* _tmp4_;
	ObjectsDueDate* _tmp5_;
	GDateTime* _tmp6_;
	GDateTime* _tmp7_;
	GDateTime* _tmp8_;
	GDateTime* start = NULL;
	GDateTime* _tmp9_;
	GDateTime* end = NULL;
	GDateTime* _tmp10_;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_;
	gboolean _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (item != NULL, FALSE);
	g_return_val_if_fail (start_date != NULL, FALSE);
	g_return_val_if_fail (end_date != NULL, FALSE);
	if (item == NULL) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = objects_item_get_has_due (item);
		_tmp3_ = _tmp2_;
		_tmp1_ = !_tmp3_;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = objects_item_was_archived (item);
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp4_ = objects_item_get_due (item);
	_tmp5_ = _tmp4_;
	_tmp6_ = objects_due_date_get_datetime (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = utils_datetime_get_date_only (_tmp7_);
	date = _tmp8_;
	_tmp9_ = utils_datetime_get_date_only (start_date);
	start = _tmp9_;
	_tmp10_ = utils_datetime_get_date_only (end_date);
	end = _tmp10_;
	_tmp13_ = objects_item_get_checked (item);
	_tmp14_ = _tmp13_;
	if (_tmp14_ == checked) {
		GDateTime* _tmp15_;
		GDateTime* _tmp16_;
		_tmp15_ = date;
		_tmp16_ = start;
		_tmp12_ = g_date_time_compare (_tmp15_, _tmp16_) >= 0;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		GDateTime* _tmp17_;
		GDateTime* _tmp18_;
		_tmp17_ = date;
		_tmp18_ = end;
		_tmp11_ = g_date_time_compare (_tmp17_, _tmp18_) <= 0;
	} else {
		_tmp11_ = FALSE;
	}
	result = _tmp11_;
	_g_date_time_unref0 (end);
	_g_date_time_unref0 (start);
	_g_date_time_unref0 (date);
	return result;
}

gboolean
services_store_valid_item_by_month (ServicesStore* self,
                                    ObjectsItem* item,
                                    GDateTime* date,
                                    gboolean checked)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (item != NULL, FALSE);
	g_return_val_if_fail (date != NULL, FALSE);
	if (item == NULL) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = objects_item_get_has_due (item);
		_tmp3_ = _tmp2_;
		_tmp1_ = !_tmp3_;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = objects_item_was_archived (item);
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp6_ = objects_item_get_checked (item);
	_tmp7_ = _tmp6_;
	if (_tmp7_ == checked) {
		ObjectsDueDate* _tmp8_;
		ObjectsDueDate* _tmp9_;
		GDateTime* _tmp10_;
		GDateTime* _tmp11_;
		_tmp8_ = objects_item_get_due (item);
		_tmp9_ = _tmp8_;
		_tmp10_ = objects_due_date_get_datetime (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp5_ = g_date_time_get_month (_tmp11_) == g_date_time_get_month (date);
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		ObjectsDueDate* _tmp12_;
		ObjectsDueDate* _tmp13_;
		GDateTime* _tmp14_;
		GDateTime* _tmp15_;
		_tmp12_ = objects_item_get_due (item);
		_tmp13_ = _tmp12_;
		_tmp14_ = objects_due_date_get_datetime (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp4_ = g_date_time_get_year (_tmp15_) == g_date_time_get_year (date);
	} else {
		_tmp4_ = FALSE;
	}
	result = _tmp4_;
	return result;
}

GeeArrayList*
services_store_get_items_by_overdue_view (ServicesStore* self,
                                          gboolean checked)
{
	GDateTime* date_now = NULL;
	GDateTime* _tmp0_;
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp1_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_date_time_new_now_local ();
	date_now = _tmp0_;
	_tmp1_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp1_;
	{
		GeeArrayList* _tmp2_;
		_tmp2_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp39_;
			GeeArrayList* _tmp40_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp3_;
				GeeArrayList* _tmp4_;
				gint _item_size = 0;
				GeeArrayList* _tmp5_;
				gint _tmp6_;
				gint _tmp7_;
				gint _item_index = 0;
				_tmp3_ = services_store_get_items (self);
				_tmp4_ = _tmp3_;
				_item_list = _tmp4_;
				_tmp5_ = _item_list;
				_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
				_tmp7_ = _tmp6_;
				_item_size = _tmp7_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp8_;
					gint _tmp9_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp10_;
					gpointer _tmp11_;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					gboolean _tmp14_ = FALSE;
					gboolean _tmp15_ = FALSE;
					gboolean _tmp16_ = FALSE;
					ObjectsItem* _tmp17_;
					_item_index = _item_index + 1;
					_tmp8_ = _item_index;
					_tmp9_ = _item_size;
					if (!(_tmp8_ < _tmp9_)) {
						break;
					}
					_tmp10_ = _item_list;
					_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _item_index);
					item = (ObjectsItem*) _tmp11_;
					_tmp17_ = item;
					if (_tmp17_ != NULL) {
						ObjectsItem* _tmp18_;
						gboolean _tmp19_;
						gboolean _tmp20_;
						_tmp18_ = item;
						_tmp19_ = objects_item_get_has_due (_tmp18_);
						_tmp20_ = _tmp19_;
						_tmp16_ = _tmp20_;
					} else {
						_tmp16_ = FALSE;
					}
					if (_tmp16_) {
						ObjectsItem* _tmp21_;
						_tmp21_ = item;
						_tmp15_ = !objects_item_was_archived (_tmp21_);
					} else {
						_tmp15_ = FALSE;
					}
					if (_tmp15_) {
						ObjectsItem* _tmp22_;
						gboolean _tmp23_;
						gboolean _tmp24_;
						_tmp22_ = item;
						_tmp23_ = objects_item_get_checked (_tmp22_);
						_tmp24_ = _tmp23_;
						_tmp14_ = _tmp24_ == checked;
					} else {
						_tmp14_ = FALSE;
					}
					if (_tmp14_) {
						ObjectsItem* _tmp25_;
						ObjectsDueDate* _tmp26_;
						ObjectsDueDate* _tmp27_;
						GDateTime* _tmp28_;
						GDateTime* _tmp29_;
						GDateTime* _tmp30_;
						_tmp25_ = item;
						_tmp26_ = objects_item_get_due (_tmp25_);
						_tmp27_ = _tmp26_;
						_tmp28_ = objects_due_date_get_datetime (_tmp27_);
						_tmp29_ = _tmp28_;
						_tmp30_ = date_now;
						_tmp13_ = g_date_time_compare (_tmp29_, _tmp30_) < 0;
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp31_;
						ObjectsDueDate* _tmp32_;
						ObjectsDueDate* _tmp33_;
						GDateTime* _tmp34_;
						GDateTime* _tmp35_;
						GDateTime* _tmp36_;
						_tmp31_ = item;
						_tmp32_ = objects_item_get_due (_tmp31_);
						_tmp33_ = _tmp32_;
						_tmp34_ = objects_due_date_get_datetime (_tmp33_);
						_tmp35_ = _tmp34_;
						_tmp36_ = date_now;
						_tmp12_ = !utils_datetime_is_same_day (_tmp35_, _tmp36_);
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						GeeArrayList* _tmp37_;
						ObjectsItem* _tmp38_;
						_tmp37_ = return_value;
						_tmp38_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp37_, _tmp38_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp39_ = return_value;
			_tmp40_ = _g_object_ref0 (_tmp39_);
			result = _tmp40_;
			{
				GeeArrayList* _tmp41_;
				_tmp41_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			_g_date_time_unref0 (date_now);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp42_;
			_tmp42_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		_g_date_time_unref0 (date_now);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

gboolean
services_store_valid_item_by_overdue (ServicesStore* self,
                                      ObjectsItem* item,
                                      GDateTime* date,
                                      gboolean checked)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GDateTime* now = NULL;
	GDateTime* _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (item != NULL, FALSE);
	g_return_val_if_fail (date != NULL, FALSE);
	if (item == NULL) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = objects_item_get_has_due (item);
		_tmp3_ = _tmp2_;
		_tmp1_ = !_tmp3_;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = objects_item_was_archived (item);
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp4_ = g_date_time_new_now_local ();
	now = _tmp4_;
	_tmp7_ = objects_item_get_checked (item);
	_tmp8_ = _tmp7_;
	if (_tmp8_ == checked) {
		ObjectsDueDate* _tmp9_;
		ObjectsDueDate* _tmp10_;
		GDateTime* _tmp11_;
		GDateTime* _tmp12_;
		GDateTime* _tmp13_;
		_tmp9_ = objects_item_get_due (item);
		_tmp10_ = _tmp9_;
		_tmp11_ = objects_due_date_get_datetime (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = now;
		_tmp6_ = g_date_time_compare (_tmp12_, _tmp13_) < 0;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		ObjectsDueDate* _tmp14_;
		ObjectsDueDate* _tmp15_;
		GDateTime* _tmp16_;
		GDateTime* _tmp17_;
		GDateTime* _tmp18_;
		_tmp14_ = objects_item_get_due (item);
		_tmp15_ = _tmp14_;
		_tmp16_ = objects_due_date_get_datetime (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = now;
		_tmp5_ = !utils_datetime_is_same_day (_tmp17_, _tmp18_);
	} else {
		_tmp5_ = FALSE;
	}
	result = _tmp5_;
	_g_date_time_unref0 (now);
	return result;
}

void
services_store_insert_label (ServicesStore* self,
                             ObjectsLabel* label)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_insert_label (_tmp1_, label);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		_tmp3_ = services_store_get_labels (self);
		_tmp4_ = _tmp3_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, label);
		g_signal_emit (self, services_store_signals[SERVICES_STORE_LABEL_ADDED_SIGNAL], 0, label);
	}
}

void
services_store_delete_label (ServicesStore* self,
                             ObjectsLabel* label)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_delete_label (_tmp1_, label);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		g_signal_emit_by_name ((ObjectsBaseObject*) label, "deleted");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_LABEL_DELETED_SIGNAL], 0, label);
		_tmp3_ = self->priv->_labels;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp3_, label);
	}
}

void
services_store_update_label (ServicesStore* self,
                             ObjectsLabel* label)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_update_label (_tmp1_, label);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		g_signal_emit_by_name ((ObjectsBaseObject*) label, "updated", "");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_LABEL_UPDATED_SIGNAL], 0, label);
	}
}

GeeArrayList*
services_store_get_labels_by_item_labels (ServicesStore* self,
                                          const gchar* labels)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (labels != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	_tmp2_ = _tmp1_ = g_strsplit (labels, ";", 0);
	{
		gchar** id_collection = NULL;
		gint id_collection_length1 = 0;
		gint _id_collection_size_ = 0;
		gint id_it = 0;
		id_collection = _tmp2_;
		id_collection_length1 = _vala_array_length (_tmp1_);
		for (id_it = 0; id_it < id_collection_length1; id_it = id_it + 1) {
			gchar* _tmp3_;
			gchar* id = NULL;
			_tmp3_ = g_strdup (id_collection[id_it]);
			id = _tmp3_;
			{
				ObjectsLabel* label = NULL;
				const gchar* _tmp4_;
				ObjectsLabel* _tmp5_;
				ObjectsLabel* _tmp6_;
				_tmp4_ = id;
				_tmp5_ = services_store_get_label (self, _tmp4_);
				label = _tmp5_;
				_tmp6_ = label;
				if (_tmp6_ != NULL) {
					GeeArrayList* _tmp7_;
					ObjectsLabel* _tmp8_;
					_tmp7_ = return_value;
					_tmp8_ = label;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, _tmp8_);
				}
				_g_object_unref0 (label);
				_g_free0 (id);
			}
		}
		id_collection = (_vala_array_free (id_collection, id_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	result = return_value;
	return result;
}

GeeArrayList*
services_store_get_items_has_labels (ServicesStore* self)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp22_;
			GeeArrayList* _tmp23_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					gboolean _tmp13_ = FALSE;
					ObjectsItem* _tmp14_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp14_ = item;
					if (_tmp14_ != NULL) {
						ObjectsItem* _tmp15_;
						_tmp15_ = item;
						_tmp13_ = objects_item_has_labels (_tmp15_);
					} else {
						_tmp13_ = FALSE;
					}
					if (_tmp13_) {
						ObjectsItem* _tmp16_;
						gboolean _tmp17_;
						gboolean _tmp18_;
						_tmp16_ = item;
						_tmp17_ = objects_item_get_completed (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp12_ = !_tmp18_;
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						ObjectsItem* _tmp19_;
						_tmp19_ = item;
						_tmp11_ = !objects_item_was_archived (_tmp19_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp20_;
						ObjectsItem* _tmp21_;
						_tmp20_ = return_value;
						_tmp21_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, _tmp21_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp22_ = return_value;
			_tmp23_ = _g_object_ref0 (_tmp22_);
			result = _tmp23_;
			{
				GeeArrayList* _tmp24_;
				_tmp24_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp25_;
			_tmp25_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

gboolean
services_store_label_exists (ServicesStore* self,
                             const gchar* id)
{
	gboolean return_value = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (id != NULL, FALSE);
	return_value = FALSE;
	{
		GeeArrayList* _tmp0_;
		gboolean _tmp14_ = FALSE;
		_tmp0_ = self->priv->_labels;
		g_rec_mutex_lock (&self->priv->__lock__labels);
		{
			{
				GeeArrayList* _label_list = NULL;
				GeeArrayList* _tmp1_;
				gint _label_size = 0;
				GeeArrayList* _tmp2_;
				gint _tmp3_;
				gint _tmp4_;
				gint _label_index = 0;
				_tmp1_ = self->priv->_labels;
				_label_list = _tmp1_;
				_tmp2_ = _label_list;
				_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
				_tmp4_ = _tmp3_;
				_label_size = _tmp4_;
				_label_index = -1;
				while (TRUE) {
					gint _tmp5_;
					gint _tmp6_;
					ObjectsLabel* label = NULL;
					GeeArrayList* _tmp7_;
					gpointer _tmp8_;
					ObjectsLabel* _tmp9_;
					const gchar* _tmp10_;
					const gchar* _tmp11_;
					_label_index = _label_index + 1;
					_tmp5_ = _label_index;
					_tmp6_ = _label_size;
					if (!(_tmp5_ < _tmp6_)) {
						break;
					}
					_tmp7_ = _label_list;
					_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _label_index);
					label = (ObjectsLabel*) _tmp8_;
					_tmp9_ = label;
					_tmp10_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp9_);
					_tmp11_ = _tmp10_;
					if (g_strcmp0 (_tmp11_, id) == 0) {
						return_value = TRUE;
						_g_object_unref0 (label);
						break;
					}
					_g_object_unref0 (label);
				}
			}
			result = return_value;
			{
				GeeArrayList* _tmp12_;
				_tmp12_ = self->priv->_labels;
				g_rec_mutex_unlock (&self->priv->__lock__labels);
			}
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp13_;
			_tmp13_ = self->priv->_labels;
			g_rec_mutex_unlock (&self->priv->__lock__labels);
		}
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp14_;
	}
}

ObjectsLabel*
services_store_get_label (ServicesStore* self,
                          const gchar* id)
{
	ObjectsLabel* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_labels;
		g_rec_mutex_lock (&self->priv->__lock__labels);
		{
			ObjectsLabel* _tmp15_;
			ObjectsLabel* _tmp16_;
			{
				GeeArrayList* _label_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _label_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _label_index = 0;
				_tmp1_ = services_store_get_labels (self);
				_tmp2_ = _tmp1_;
				_label_list = _tmp2_;
				_tmp3_ = _label_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_label_size = _tmp5_;
				_label_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsLabel* label = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsLabel* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_label_index = _label_index + 1;
					_tmp6_ = _label_index;
					_tmp7_ = _label_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _label_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _label_index);
					label = (ObjectsLabel*) _tmp9_;
					_tmp10_ = label;
					_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, id) == 0) {
						ObjectsLabel* _tmp13_;
						ObjectsLabel* _tmp14_;
						_tmp13_ = label;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (label);
						break;
					}
					_g_object_unref0 (label);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_labels;
				g_rec_mutex_unlock (&self->priv->__lock__labels);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_labels;
			g_rec_mutex_unlock (&self->priv->__lock__labels);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

ObjectsLabel*
services_store_get_label_by_name (ServicesStore* self,
                                  const gchar* name,
                                  gboolean lowercase,
                                  const gchar* source_id)
{
	GError* _inner_error0_ = NULL;
	ObjectsLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (source_id != NULL, NULL);
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_labels;
		g_rec_mutex_lock (&self->priv->__lock__labels);
		{
			gchar* _tmp1_ = NULL;
			gchar* compare_name = NULL;
			gchar* _tmp4_;
			if (lowercase) {
				gchar* _tmp2_;
				_tmp2_ = g_utf8_strdown (name, (gssize) -1);
				_g_free0 (_tmp1_);
				_tmp1_ = _tmp2_;
			} else {
				gchar* _tmp3_;
				_tmp3_ = g_strdup (name);
				_g_free0 (_tmp1_);
				_tmp1_ = _tmp3_;
			}
			_tmp4_ = _tmp1_;
			_tmp1_ = NULL;
			compare_name = _tmp4_;
			{
				GeeArrayList* _label_list = NULL;
				GeeArrayList* _tmp5_;
				GeeArrayList* _tmp6_;
				gint _label_size = 0;
				GeeArrayList* _tmp7_;
				gint _tmp8_;
				gint _tmp9_;
				gint _label_index = 0;
				_tmp5_ = services_store_get_labels (self);
				_tmp6_ = _tmp5_;
				_label_list = _tmp6_;
				_tmp7_ = _label_list;
				_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp7_);
				_tmp9_ = _tmp8_;
				_label_size = _tmp9_;
				_label_index = -1;
				while (TRUE) {
					gint _tmp10_;
					gint _tmp11_;
					ObjectsLabel* label = NULL;
					GeeArrayList* _tmp12_;
					gpointer _tmp13_;
					gchar* _tmp14_ = NULL;
					gchar* label_name = NULL;
					gchar* _tmp23_;
					gboolean _tmp24_ = FALSE;
					ObjectsLabel* _tmp25_;
					const gchar* _tmp26_;
					const gchar* _tmp27_;
					_label_index = _label_index + 1;
					_tmp10_ = _label_index;
					_tmp11_ = _label_size;
					if (!(_tmp10_ < _tmp11_)) {
						break;
					}
					_tmp12_ = _label_list;
					_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _tmp12_, _label_index);
					label = (ObjectsLabel*) _tmp13_;
					if (lowercase) {
						ObjectsLabel* _tmp15_;
						const gchar* _tmp16_;
						const gchar* _tmp17_;
						gchar* _tmp18_;
						_tmp15_ = label;
						_tmp16_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp15_);
						_tmp17_ = _tmp16_;
						_tmp18_ = g_utf8_strdown (_tmp17_, (gssize) -1);
						_g_free0 (_tmp14_);
						_tmp14_ = _tmp18_;
					} else {
						ObjectsLabel* _tmp19_;
						const gchar* _tmp20_;
						const gchar* _tmp21_;
						gchar* _tmp22_;
						_tmp19_ = label;
						_tmp20_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp19_);
						_tmp21_ = _tmp20_;
						_tmp22_ = g_strdup (_tmp21_);
						_g_free0 (_tmp14_);
						_tmp14_ = _tmp22_;
					}
					_tmp23_ = _tmp14_;
					_tmp14_ = NULL;
					label_name = _tmp23_;
					_tmp25_ = label;
					_tmp26_ = objects_label_get_source_id (_tmp25_);
					_tmp27_ = _tmp26_;
					if (g_strcmp0 (_tmp27_, source_id) == 0) {
						const gchar* _tmp28_;
						const gchar* _tmp29_;
						_tmp28_ = label_name;
						_tmp29_ = compare_name;
						_tmp24_ = g_strcmp0 (_tmp28_, _tmp29_) == 0;
					} else {
						_tmp24_ = FALSE;
					}
					if (_tmp24_) {
						result = label;
						_g_free0 (label_name);
						_g_free0 (_tmp14_);
						_g_free0 (compare_name);
						_g_free0 (_tmp1_);
						{
							GeeArrayList* _tmp30_;
							_tmp30_ = self->priv->_labels;
							g_rec_mutex_unlock (&self->priv->__lock__labels);
						}
						return result;
					}
					_g_free0 (label_name);
					_g_free0 (_tmp14_);
					_g_object_unref0 (label);
				}
			}
			result = NULL;
			_g_free0 (compare_name);
			_g_free0 (_tmp1_);
			{
				GeeArrayList* _tmp31_;
				_tmp31_ = self->priv->_labels;
				g_rec_mutex_unlock (&self->priv->__lock__labels);
			}
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp32_;
			_tmp32_ = self->priv->_labels;
			g_rec_mutex_unlock (&self->priv->__lock__labels);
		}
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_labels_by_source (ServicesStore* self,
                                     const gchar* source_id)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (source_id != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_labels;
		g_rec_mutex_lock (&self->priv->__lock__labels);
		{
			GeeArrayList* _tmp16_;
			GeeArrayList* _tmp17_;
			{
				GeeArrayList* _label_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _label_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _label_index = 0;
				_tmp2_ = services_store_get_labels (self);
				_tmp3_ = _tmp2_;
				_label_list = _tmp3_;
				_tmp4_ = _label_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_label_size = _tmp6_;
				_label_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsLabel* label = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsLabel* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					_label_index = _label_index + 1;
					_tmp7_ = _label_index;
					_tmp8_ = _label_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _label_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _label_index);
					label = (ObjectsLabel*) _tmp10_;
					_tmp11_ = label;
					_tmp12_ = objects_label_get_source_id (_tmp11_);
					_tmp13_ = _tmp12_;
					if (g_strcmp0 (_tmp13_, source_id) == 0) {
						GeeArrayList* _tmp14_;
						ObjectsLabel* _tmp15_;
						_tmp14_ = return_value;
						_tmp15_ = label;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
					}
					_g_object_unref0 (label);
				}
			}
			_tmp16_ = return_value;
			_tmp17_ = _g_object_ref0 (_tmp16_);
			result = _tmp17_;
			{
				GeeArrayList* _tmp18_;
				_tmp18_ = self->priv->_labels;
				g_rec_mutex_unlock (&self->priv->__lock__labels);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp19_;
			_tmp19_ = self->priv->_labels;
			g_rec_mutex_unlock (&self->priv->__lock__labels);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

GeeArrayList*
services_store_get_all_labels_by_search (ServicesStore* self,
                                         const gchar* search_text)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (search_text != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_labels;
		g_rec_mutex_lock (&self->priv->__lock__labels);
		{
			GeeArrayList* _tmp21_;
			GeeArrayList* _tmp22_;
			{
				GeeArrayList* _label_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _label_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _label_index = 0;
				_tmp2_ = services_store_get_labels (self);
				_tmp3_ = _tmp2_;
				_label_list = _tmp3_;
				_tmp4_ = _label_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_label_size = _tmp6_;
				_label_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsLabel* label = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsLabel* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					gchar* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					gboolean _tmp18_;
					_label_index = _label_index + 1;
					_tmp7_ = _label_index;
					_tmp8_ = _label_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _label_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _label_index);
					label = (ObjectsLabel*) _tmp10_;
					_tmp11_ = label;
					_tmp12_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = g_utf8_strdown (_tmp13_, (gssize) -1);
					_tmp15_ = _tmp14_;
					_tmp16_ = g_utf8_strdown (search_text, (gssize) -1);
					_tmp17_ = _tmp16_;
					_tmp18_ = string_contains (_tmp15_, _tmp17_);
					_g_free0 (_tmp17_);
					_g_free0 (_tmp15_);
					if (_tmp18_) {
						GeeArrayList* _tmp19_;
						ObjectsLabel* _tmp20_;
						_tmp19_ = return_value;
						_tmp20_ = label;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp20_);
					}
					_g_object_unref0 (label);
				}
			}
			_tmp21_ = return_value;
			_tmp22_ = _g_object_ref0 (_tmp21_);
			result = _tmp22_;
			{
				GeeArrayList* _tmp23_;
				_tmp23_ = self->priv->_labels;
				g_rec_mutex_unlock (&self->priv->__lock__labels);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp24_;
			_tmp24_ = self->priv->_labels;
			g_rec_mutex_unlock (&self->priv->__lock__labels);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_all_projects_by_search (ServicesStore* self,
                                           const gchar* search_text)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (search_text != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_PROJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			GeeArrayList* _tmp25_;
			GeeArrayList* _tmp26_;
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _project_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _project_index = 0;
				_tmp2_ = services_store_get_projects (self);
				_tmp3_ = _tmp2_;
				_project_list = _tmp3_;
				_tmp4_ = _project_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_project_size = _tmp6_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsProject* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					gchar* _tmp18_;
					gboolean _tmp19_;
					_project_index = _project_index + 1;
					_tmp7_ = _project_index;
					_tmp8_ = _project_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _project_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _project_index);
					project = (ObjectsProject*) _tmp10_;
					_tmp12_ = project;
					_tmp13_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp15_ = g_utf8_strdown (_tmp14_, (gssize) -1);
					_tmp16_ = _tmp15_;
					_tmp17_ = g_utf8_strdown (search_text, (gssize) -1);
					_tmp18_ = _tmp17_;
					_tmp19_ = string_contains (_tmp16_, _tmp18_);
					_g_free0 (_tmp18_);
					_g_free0 (_tmp16_);
					if (_tmp19_) {
						ObjectsProject* _tmp20_;
						gboolean _tmp21_;
						gboolean _tmp22_;
						_tmp20_ = project;
						_tmp21_ = objects_project_get_is_archived (_tmp20_);
						_tmp22_ = _tmp21_;
						_tmp11_ = !_tmp22_;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp23_;
						ObjectsProject* _tmp24_;
						_tmp23_ = return_value;
						_tmp24_ = project;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp23_, _tmp24_);
					}
					_g_object_unref0 (project);
				}
			}
			_tmp25_ = return_value;
			_tmp26_ = _g_object_ref0 (_tmp25_);
			result = _tmp26_;
			{
				GeeArrayList* _tmp27_;
				_tmp27_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp28_;
			_tmp28_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_all_sections_by_search (ServicesStore* self,
                                           const gchar* search_text)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (search_text != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_SECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_sections;
		g_rec_mutex_lock (&self->priv->__lock__sections);
		{
			GeeArrayList* _tmp23_;
			GeeArrayList* _tmp24_;
			{
				GeeArrayList* _section_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _section_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _section_index = 0;
				_tmp2_ = services_store_get_sections (self);
				_tmp3_ = _tmp2_;
				_section_list = _tmp3_;
				_tmp4_ = _section_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_section_size = _tmp6_;
				_section_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsSection* section = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsSection* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					gchar* _tmp18_;
					gboolean _tmp19_;
					_section_index = _section_index + 1;
					_tmp7_ = _section_index;
					_tmp8_ = _section_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _section_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _section_index);
					section = (ObjectsSection*) _tmp10_;
					_tmp12_ = section;
					_tmp13_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp15_ = g_utf8_strdown (_tmp14_, (gssize) -1);
					_tmp16_ = _tmp15_;
					_tmp17_ = g_utf8_strdown (search_text, (gssize) -1);
					_tmp18_ = _tmp17_;
					_tmp19_ = string_contains (_tmp16_, _tmp18_);
					_g_free0 (_tmp18_);
					_g_free0 (_tmp16_);
					if (_tmp19_) {
						ObjectsSection* _tmp20_;
						_tmp20_ = section;
						_tmp11_ = !objects_section_was_archived (_tmp20_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp21_;
						ObjectsSection* _tmp22_;
						_tmp21_ = return_value;
						_tmp22_ = section;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp21_, _tmp22_);
					}
					_g_object_unref0 (section);
				}
			}
			_tmp23_ = return_value;
			_tmp24_ = _g_object_ref0 (_tmp23_);
			result = _tmp24_;
			{
				GeeArrayList* _tmp25_;
				_tmp25_ = self->priv->_sections;
				g_rec_mutex_unlock (&self->priv->__lock__sections);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp26_;
			_tmp26_ = self->priv->_sections;
			g_rec_mutex_unlock (&self->priv->__lock__sections);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_all_projects_archived (ServicesStore* self)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_PROJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			GeeArrayList* _tmp16_;
			GeeArrayList* _tmp17_;
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _project_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _project_index = 0;
				_tmp2_ = services_store_get_projects (self);
				_tmp3_ = _tmp2_;
				_project_list = _tmp3_;
				_tmp4_ = _project_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_project_size = _tmp6_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsProject* _tmp11_;
					gboolean _tmp12_;
					gboolean _tmp13_;
					_project_index = _project_index + 1;
					_tmp7_ = _project_index;
					_tmp8_ = _project_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _project_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _project_index);
					project = (ObjectsProject*) _tmp10_;
					_tmp11_ = project;
					_tmp12_ = objects_project_get_is_archived (_tmp11_);
					_tmp13_ = _tmp12_;
					if (_tmp13_) {
						GeeArrayList* _tmp14_;
						ObjectsProject* _tmp15_;
						_tmp14_ = return_value;
						_tmp15_ = project;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
					}
					_g_object_unref0 (project);
				}
			}
			_tmp16_ = return_value;
			_tmp17_ = _g_object_ref0 (_tmp16_);
			result = _tmp17_;
			{
				GeeArrayList* _tmp18_;
				_tmp18_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp19_;
			_tmp19_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_all_items_by_search (ServicesStore* self,
                                        const gchar* search_text)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (search_text != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			GeeArrayList* _tmp35_;
			GeeArrayList* _tmp36_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _item_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _item_index = 0;
				_tmp2_ = services_store_get_items (self);
				_tmp3_ = _tmp2_;
				_item_list = _tmp3_;
				_tmp4_ = _item_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_item_size = _tmp6_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsItem* item = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					gboolean _tmp12_ = FALSE;
					ObjectsItem* _tmp13_;
					gboolean _tmp14_;
					gboolean _tmp15_;
					_item_index = _item_index + 1;
					_tmp7_ = _item_index;
					_tmp8_ = _item_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _item_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _item_index);
					item = (ObjectsItem*) _tmp10_;
					_tmp13_ = item;
					_tmp14_ = objects_item_get_checked (_tmp13_);
					_tmp15_ = _tmp14_;
					if (!_tmp15_) {
						ObjectsItem* _tmp16_;
						_tmp16_ = item;
						_tmp12_ = !objects_item_was_archived (_tmp16_);
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						gboolean _tmp17_ = FALSE;
						ObjectsItem* _tmp18_;
						const gchar* _tmp19_;
						const gchar* _tmp20_;
						gchar* _tmp21_;
						gchar* _tmp22_;
						gchar* _tmp23_;
						gchar* _tmp24_;
						gboolean _tmp25_;
						_tmp18_ = item;
						_tmp19_ = objects_item_get_content (_tmp18_);
						_tmp20_ = _tmp19_;
						_tmp21_ = g_utf8_strdown (_tmp20_, (gssize) -1);
						_tmp22_ = _tmp21_;
						_tmp23_ = g_utf8_strdown (search_text, (gssize) -1);
						_tmp24_ = _tmp23_;
						_tmp25_ = string_contains (_tmp22_, _tmp24_);
						_g_free0 (_tmp24_);
						_g_free0 (_tmp22_);
						if (_tmp25_) {
							_tmp17_ = TRUE;
						} else {
							ObjectsItem* _tmp26_;
							const gchar* _tmp27_;
							const gchar* _tmp28_;
							gchar* _tmp29_;
							gchar* _tmp30_;
							gchar* _tmp31_;
							gchar* _tmp32_;
							_tmp26_ = item;
							_tmp27_ = objects_item_get_description (_tmp26_);
							_tmp28_ = _tmp27_;
							_tmp29_ = g_utf8_strdown (_tmp28_, (gssize) -1);
							_tmp30_ = _tmp29_;
							_tmp31_ = g_utf8_strdown (search_text, (gssize) -1);
							_tmp32_ = _tmp31_;
							_tmp17_ = string_contains (_tmp30_, _tmp32_);
							_g_free0 (_tmp32_);
							_g_free0 (_tmp30_);
						}
						_tmp11_ = _tmp17_;
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp33_;
						ObjectsItem* _tmp34_;
						_tmp33_ = return_value;
						_tmp34_ = item;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp33_, _tmp34_);
					}
					_g_object_unref0 (item);
				}
			}
			_tmp35_ = return_value;
			_tmp36_ = _g_object_ref0 (_tmp35_);
			result = _tmp36_;
			{
				GeeArrayList* _tmp37_;
				_tmp37_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp38_;
			_tmp38_ = self->priv->_items;
			g_rec_mutex_unlock (&self->priv->__lock__items);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

void
services_store_insert_reminder (ServicesStore* self,
                                ObjectsReminder* reminder)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reminder != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_insert_reminder (_tmp1_, reminder);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		ObjectsItem* _tmp5_;
		ObjectsItem* _tmp6_;
		_tmp3_ = services_store_get_reminders (self);
		_tmp4_ = _tmp3_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, reminder);
		g_signal_emit (self, services_store_signals[SERVICES_STORE_REMINDER_ADDED_SIGNAL], 0, reminder);
		_tmp5_ = objects_reminder_get_item (reminder);
		_tmp6_ = _tmp5_;
		g_signal_emit_by_name (_tmp6_, "reminder-added", reminder);
	}
}

void
services_store_delete_reminder (ServicesStore* self,
                                ObjectsReminder* reminder)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reminder != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_delete_reminder (_tmp1_, reminder);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		ObjectsItem* _tmp4_;
		ObjectsItem* _tmp5_;
		g_signal_emit_by_name ((ObjectsBaseObject*) reminder, "deleted");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_REMINDER_DELETED_SIGNAL], 0, reminder);
		_tmp3_ = self->priv->_reminders;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp3_, reminder);
		_tmp4_ = objects_reminder_get_item (reminder);
		_tmp5_ = _tmp4_;
		g_signal_emit_by_name (_tmp5_, "reminder-deleted", reminder);
	}
}

GeeArrayList*
services_store_get_reminders_by_item (ServicesStore* self,
                                      ObjectsItem* item)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_REMINDER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_reminders;
		g_rec_mutex_lock (&self->priv->__lock__reminders);
		{
			GeeArrayList* _tmp18_;
			GeeArrayList* _tmp19_;
			{
				GeeArrayList* _reminder_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _reminder_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _reminder_index = 0;
				_tmp2_ = services_store_get_reminders (self);
				_tmp3_ = _tmp2_;
				_reminder_list = _tmp3_;
				_tmp4_ = _reminder_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_reminder_size = _tmp6_;
				_reminder_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsReminder* reminder = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsReminder* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					_reminder_index = _reminder_index + 1;
					_tmp7_ = _reminder_index;
					_tmp8_ = _reminder_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _reminder_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _reminder_index);
					reminder = (ObjectsReminder*) _tmp10_;
					_tmp11_ = reminder;
					_tmp12_ = objects_reminder_get_item_id (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
					_tmp15_ = _tmp14_;
					if (g_strcmp0 (_tmp13_, _tmp15_) == 0) {
						GeeArrayList* _tmp16_;
						ObjectsReminder* _tmp17_;
						_tmp16_ = return_value;
						_tmp17_ = reminder;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
					}
					_g_object_unref0 (reminder);
				}
			}
			_tmp18_ = return_value;
			_tmp19_ = _g_object_ref0 (_tmp18_);
			result = _tmp19_;
			{
				GeeArrayList* _tmp20_;
				_tmp20_ = self->priv->_reminders;
				g_rec_mutex_unlock (&self->priv->__lock__reminders);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp21_;
			_tmp21_ = self->priv->_reminders;
			g_rec_mutex_unlock (&self->priv->__lock__reminders);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

ObjectsReminder*
services_store_get_reminder (ServicesStore* self,
                             const gchar* id)
{
	ObjectsReminder* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsReminder* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_reminders;
		g_rec_mutex_lock (&self->priv->__lock__reminders);
		{
			ObjectsReminder* _tmp15_;
			ObjectsReminder* _tmp16_;
			{
				GeeArrayList* _reminder_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _reminder_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _reminder_index = 0;
				_tmp1_ = services_store_get_reminders (self);
				_tmp2_ = _tmp1_;
				_reminder_list = _tmp2_;
				_tmp3_ = _reminder_list;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				_reminder_size = _tmp5_;
				_reminder_index = -1;
				while (TRUE) {
					gint _tmp6_;
					gint _tmp7_;
					ObjectsReminder* reminder = NULL;
					GeeArrayList* _tmp8_;
					gpointer _tmp9_;
					ObjectsReminder* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					_reminder_index = _reminder_index + 1;
					_tmp6_ = _reminder_index;
					_tmp7_ = _reminder_size;
					if (!(_tmp6_ < _tmp7_)) {
						break;
					}
					_tmp8_ = _reminder_list;
					_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _reminder_index);
					reminder = (ObjectsReminder*) _tmp9_;
					_tmp10_ = reminder;
					_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp10_);
					_tmp12_ = _tmp11_;
					if (g_strcmp0 (_tmp12_, id) == 0) {
						ObjectsReminder* _tmp13_;
						ObjectsReminder* _tmp14_;
						_tmp13_ = reminder;
						_tmp14_ = _g_object_ref0 (_tmp13_);
						_g_object_unref0 (return_value);
						return_value = _tmp14_;
						_g_object_unref0 (reminder);
						break;
					}
					_g_object_unref0 (reminder);
				}
			}
			_tmp15_ = return_value;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			result = _tmp16_;
			{
				GeeArrayList* _tmp17_;
				_tmp17_ = self->priv->_reminders;
				g_rec_mutex_unlock (&self->priv->__lock__reminders);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp18_;
			_tmp18_ = self->priv->_reminders;
			g_rec_mutex_unlock (&self->priv->__lock__reminders);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

void
services_store_insert_attachment (ServicesStore* self,
                                  ObjectsAttachment* attachment)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (attachment != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_insert_attachment (_tmp1_, attachment);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		ObjectsItem* _tmp5_;
		ObjectsItem* _tmp6_;
		_tmp3_ = services_store_get_attachments (self);
		_tmp4_ = _tmp3_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, attachment);
		_tmp5_ = objects_attachment_get_item (attachment);
		_tmp6_ = _tmp5_;
		g_signal_emit_by_name (_tmp6_, "attachment-added", attachment);
	}
}

void
services_store_delete_attachment (ServicesStore* self,
                                  ObjectsAttachment* attachment)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (attachment != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_delete_attachment (_tmp1_, attachment);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GeeArrayList* _tmp3_;
		ObjectsItem* _tmp4_;
		ObjectsItem* _tmp5_;
		g_signal_emit_by_name (attachment, "deleted");
		g_signal_emit (self, services_store_signals[SERVICES_STORE_ATTACHMENT_DELETED_SIGNAL], 0, attachment);
		_tmp3_ = self->priv->_attachments;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp3_, attachment);
		_tmp4_ = objects_attachment_get_item (attachment);
		_tmp5_ = _tmp4_;
		g_signal_emit_by_name (_tmp5_, "attachment-deleted", attachment);
	}
}

GeeArrayList*
services_store_get_attachments_by_item (ServicesStore* self,
                                        ObjectsItem* item)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_ATTACHMENT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_attachments;
		g_rec_mutex_lock (&self->priv->__lock__attachments);
		{
			GeeArrayList* _tmp18_;
			GeeArrayList* _tmp19_;
			{
				GeeArrayList* _attachment_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _attachment_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _attachment_index = 0;
				_tmp2_ = services_store_get_attachments (self);
				_tmp3_ = _tmp2_;
				_attachment_list = _tmp3_;
				_tmp4_ = _attachment_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_attachment_size = _tmp6_;
				_attachment_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsAttachment* attachment = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					ObjectsAttachment* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					_attachment_index = _attachment_index + 1;
					_tmp7_ = _attachment_index;
					_tmp8_ = _attachment_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _attachment_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _attachment_index);
					attachment = (ObjectsAttachment*) _tmp10_;
					_tmp11_ = attachment;
					_tmp12_ = objects_attachment_get_item_id (_tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
					_tmp15_ = _tmp14_;
					if (g_strcmp0 (_tmp13_, _tmp15_) == 0) {
						GeeArrayList* _tmp16_;
						ObjectsAttachment* _tmp17_;
						_tmp16_ = return_value;
						_tmp17_ = attachment;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
					}
					_g_object_unref0 (attachment);
				}
			}
			_tmp18_ = return_value;
			_tmp19_ = _g_object_ref0 (_tmp18_);
			result = _tmp19_;
			{
				GeeArrayList* _tmp20_;
				_tmp20_ = self->priv->_attachments;
				g_rec_mutex_unlock (&self->priv->__lock__attachments);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp21_;
			_tmp21_ = self->priv->_attachments;
			g_rec_mutex_unlock (&self->priv->__lock__attachments);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GeeArrayList*
services_store_get_used_calendar_sources (ServicesStore* self)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->_projects;
		g_rec_mutex_lock (&self->priv->__lock__projects);
		{
			GeeArrayList* _tmp23_;
			GeeArrayList* _tmp24_;
			{
				GeeArrayList* _project_list = NULL;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				gint _project_size = 0;
				GeeArrayList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gint _project_index = 0;
				_tmp2_ = services_store_get_projects (self);
				_tmp3_ = _tmp2_;
				_project_list = _tmp3_;
				_tmp4_ = _project_list;
				_tmp5_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_project_size = _tmp6_;
				_project_index = -1;
				while (TRUE) {
					gint _tmp7_;
					gint _tmp8_;
					ObjectsProject* project = NULL;
					GeeArrayList* _tmp9_;
					gpointer _tmp10_;
					gboolean _tmp11_ = FALSE;
					ObjectsProject* _tmp12_;
					const gchar* _tmp13_;
					const gchar* _tmp14_;
					_project_index = _project_index + 1;
					_tmp7_ = _project_index;
					_tmp8_ = _project_size;
					if (!(_tmp7_ < _tmp8_)) {
						break;
					}
					_tmp9_ = _project_list;
					_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _project_index);
					project = (ObjectsProject*) _tmp10_;
					_tmp12_ = project;
					_tmp13_ = objects_project_get_calendar_source_uid (_tmp12_);
					_tmp14_ = _tmp13_;
					if (g_strcmp0 (_tmp14_, "") != 0) {
						GeeArrayList* _tmp15_;
						ObjectsProject* _tmp16_;
						const gchar* _tmp17_;
						const gchar* _tmp18_;
						_tmp15_ = return_value;
						_tmp16_ = project;
						_tmp17_ = objects_project_get_calendar_source_uid (_tmp16_);
						_tmp18_ = _tmp17_;
						_tmp11_ = !gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp15_, _tmp18_);
					} else {
						_tmp11_ = FALSE;
					}
					if (_tmp11_) {
						GeeArrayList* _tmp19_;
						ObjectsProject* _tmp20_;
						const gchar* _tmp21_;
						const gchar* _tmp22_;
						_tmp19_ = return_value;
						_tmp20_ = project;
						_tmp21_ = objects_project_get_calendar_source_uid (_tmp20_);
						_tmp22_ = _tmp21_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp22_);
					}
					_g_object_unref0 (project);
				}
			}
			_tmp23_ = return_value;
			_tmp24_ = _g_object_ref0 (_tmp23_);
			result = _tmp24_;
			{
				GeeArrayList* _tmp25_;
				_tmp25_ = self->priv->_projects;
				g_rec_mutex_unlock (&self->priv->__lock__projects);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp26_;
			_tmp26_ = self->priv->_projects;
			g_rec_mutex_unlock (&self->priv->__lock__projects);
		}
		_g_object_unref0 (return_value);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

void
services_store_clear_project_cache (ServicesStore* self,
                                    const gchar* project_id)
{
	GeeHashMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project_id != NULL);
	_tmp0_ = self->priv->_items_by_project_cache;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp0_, project_id, NULL);
}

ServicesStore*
services_store_construct (GType object_type)
{
	ServicesStore * self = NULL;
	self = (ServicesStore*) g_object_new (object_type, NULL);
	return self;
}

ServicesStore*
services_store_new (void)
{
	return services_store_construct (SERVICES_TYPE_STORE);
}

GeeArrayList*
services_store_get_sources (ServicesStore* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sources;
	if (_tmp0_ == NULL) {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_database_get_sources_collection (_tmp2_);
		_g_object_unref0 (self->priv->_sources);
		self->priv->_sources = _tmp3_;
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = self->priv->_sources;
	result = _tmp4_;
	return result;
}

GeeArrayList*
services_store_get_projects (ServicesStore* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_projects;
	if (_tmp0_ == NULL) {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_database_get_projects_collection (_tmp2_);
		_g_object_unref0 (self->priv->_projects);
		self->priv->_projects = _tmp3_;
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = self->priv->_projects;
	result = _tmp4_;
	return result;
}

GeeArrayList*
services_store_get_sections (ServicesStore* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sections;
	if (_tmp0_ == NULL) {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_database_get_sections_collection (_tmp2_);
		_g_object_unref0 (self->priv->_sections);
		self->priv->_sections = _tmp3_;
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = self->priv->_sections;
	result = _tmp4_;
	return result;
}

GeeArrayList*
services_store_get_items (ServicesStore* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_items;
	if (_tmp0_ == NULL) {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_database_get_items_collection (_tmp2_);
		_g_object_unref0 (self->priv->_items);
		self->priv->_items = _tmp3_;
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = self->priv->_items;
	result = _tmp4_;
	return result;
}

GeeArrayList*
services_store_get_labels (ServicesStore* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_labels;
	if (_tmp0_ == NULL) {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_database_get_labels_collection (_tmp2_);
		_g_object_unref0 (self->priv->_labels);
		self->priv->_labels = _tmp3_;
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = self->priv->_labels;
	result = _tmp4_;
	return result;
}

GeeArrayList*
services_store_get_reminders (ServicesStore* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_reminders;
	if (_tmp0_ == NULL) {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_database_get_reminders_collection (_tmp2_);
		_g_object_unref0 (self->priv->_reminders);
		self->priv->_reminders = _tmp3_;
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = self->priv->_reminders;
	result = _tmp4_;
	return result;
}

GeeArrayList*
services_store_get_attachments (ServicesStore* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_attachments;
	if (_tmp0_ == NULL) {
		ServicesDatabase* _tmp1_;
		ServicesDatabase* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp1_ = services_database_get_default ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_database_get_attachments_collection (_tmp2_);
		_g_object_unref0 (self->priv->_attachments);
		self->priv->_attachments = _tmp3_;
		_g_object_unref0 (_tmp2_);
	}
	_tmp4_ = self->priv->_attachments;
	result = _tmp4_;
	return result;
}

static void
g_cclosure_user_marshal_VOID__OBJECT_STRING (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_string (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_BOOLEAN) (gpointer data1, gpointer arg_1, gboolean arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_boolean (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_STRING_STRING_STRING (GClosure * closure,
                                                           GValue * return_value,
                                                           guint n_param_values,
                                                           const GValue * param_values,
                                                           gpointer invocation_hint,
                                                           gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_STRING_STRING_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, const char* arg_3, const char* arg_4, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_STRING_STRING_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 5);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_STRING_STRING_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_string (param_values + 2), g_value_get_string (param_values + 3), g_value_get_string (param_values + 4), data2);
}

static void
services_store_class_init (ServicesStoreClass * klass,
                           gpointer klass_data)
{
	services_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesStore_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_services_store_get_property;
	G_OBJECT_CLASS (klass)->finalize = services_store_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_STORE_SOURCES_PROPERTY, services_store_properties[SERVICES_STORE_SOURCES_PROPERTY] = g_param_spec_object ("sources", "sources", "sources", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_STORE_PROJECTS_PROPERTY, services_store_properties[SERVICES_STORE_PROJECTS_PROPERTY] = g_param_spec_object ("projects", "projects", "projects", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_STORE_SECTIONS_PROPERTY, services_store_properties[SERVICES_STORE_SECTIONS_PROPERTY] = g_param_spec_object ("sections", "sections", "sections", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_STORE_ITEMS_PROPERTY, services_store_properties[SERVICES_STORE_ITEMS_PROPERTY] = g_param_spec_object ("items", "items", "items", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_STORE_LABELS_PROPERTY, services_store_properties[SERVICES_STORE_LABELS_PROPERTY] = g_param_spec_object ("labels", "labels", "labels", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_STORE_REMINDERS_PROPERTY, services_store_properties[SERVICES_STORE_REMINDERS_PROPERTY] = g_param_spec_object ("reminders", "reminders", "reminders", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_STORE_ATTACHMENTS_PROPERTY, services_store_properties[SERVICES_STORE_ATTACHMENTS_PROPERTY] = g_param_spec_object ("attachments", "attachments", "attachments", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	services_store_signals[SERVICES_STORE_SOURCE_ADDED_SIGNAL] = g_signal_new ("source-added", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_SOURCE);
	services_store_signals[SERVICES_STORE_SOURCE_DELETED_SIGNAL] = g_signal_new ("source-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_SOURCE);
	services_store_signals[SERVICES_STORE_SOURCE_UPDATED_SIGNAL] = g_signal_new ("source-updated", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_SOURCE);
	services_store_signals[SERVICES_STORE_PROJECT_ADDED_SIGNAL] = g_signal_new ("project-added", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_PROJECT);
	services_store_signals[SERVICES_STORE_PROJECT_UPDATED_SIGNAL] = g_signal_new ("project-updated", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_PROJECT);
	services_store_signals[SERVICES_STORE_PROJECT_DELETED_SIGNAL] = g_signal_new ("project-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_PROJECT);
	services_store_signals[SERVICES_STORE_PROJECT_ARCHIVED_SIGNAL] = g_signal_new ("project-archived", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_PROJECT);
	services_store_signals[SERVICES_STORE_PROJECT_UNARCHIVED_SIGNAL] = g_signal_new ("project-unarchived", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_PROJECT);
	services_store_signals[SERVICES_STORE_LABEL_ADDED_SIGNAL] = g_signal_new ("label-added", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
	services_store_signals[SERVICES_STORE_LABEL_UPDATED_SIGNAL] = g_signal_new ("label-updated", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
	services_store_signals[SERVICES_STORE_LABEL_DELETED_SIGNAL] = g_signal_new ("label-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
	services_store_signals[SERVICES_STORE_SECTION_DELETED_SIGNAL] = g_signal_new ("section-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_SECTION);
	services_store_signals[SERVICES_STORE_SECTION_MOVED_SIGNAL] = g_signal_new ("section-moved", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, OBJECTS_TYPE_SECTION, G_TYPE_STRING);
	services_store_signals[SERVICES_STORE_SECTION_ARCHIVED_SIGNAL] = g_signal_new ("section-archived", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_SECTION);
	services_store_signals[SERVICES_STORE_SECTION_UNARCHIVED_SIGNAL] = g_signal_new ("section-unarchived", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_SECTION);
	services_store_signals[SERVICES_STORE_ITEM_DELETED_SIGNAL] = g_signal_new ("item-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ITEM);
	services_store_signals[SERVICES_STORE_ITEM_ADDED_SIGNAL] = g_signal_new ("item-added", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, OBJECTS_TYPE_ITEM, G_TYPE_BOOLEAN);
	services_store_signals[SERVICES_STORE_ITEM_UPDATED_SIGNAL] = g_signal_new ("item-updated", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, OBJECTS_TYPE_ITEM, G_TYPE_STRING);
	services_store_signals[SERVICES_STORE_ITEM_ARCHIVED_SIGNAL] = g_signal_new ("item-archived", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ITEM);
	services_store_signals[SERVICES_STORE_ITEM_UNARCHIVED_SIGNAL] = g_signal_new ("item-unarchived", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ITEM);
	services_store_signals[SERVICES_STORE_ITEM_PIN_CHANGE_SIGNAL] = g_signal_new ("item-pin-change", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ITEM);
	services_store_signals[SERVICES_STORE_ITEM_MOVED_SIGNAL] = g_signal_new ("item-moved", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING_STRING_STRING, G_TYPE_NONE, 4, OBJECTS_TYPE_ITEM, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
	services_store_signals[SERVICES_STORE_ITEM_LABEL_ADDED_SIGNAL] = g_signal_new ("item-label-added", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
	services_store_signals[SERVICES_STORE_ITEM_LABEL_DELETED_SIGNAL] = g_signal_new ("item-label-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
	services_store_signals[SERVICES_STORE_REMINDER_ADDED_SIGNAL] = g_signal_new ("reminder-added", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_REMINDER);
	services_store_signals[SERVICES_STORE_REMINDER_DELETED_SIGNAL] = g_signal_new ("reminder-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_REMINDER);
	services_store_signals[SERVICES_STORE_ATTACHMENT_DELETED_SIGNAL] = g_signal_new ("attachment-deleted", SERVICES_TYPE_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ATTACHMENT);
}

static void
services_store_instance_init (ServicesStore * self,
                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = services_store_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->_items_by_project_cache = _tmp0_;
	g_rec_mutex_init (&self->priv->__lock__sources);
	self->priv->_sources = NULL;
	g_rec_mutex_init (&self->priv->__lock__projects);
	self->priv->_projects = NULL;
	g_rec_mutex_init (&self->priv->__lock__sections);
	self->priv->_sections = NULL;
	g_rec_mutex_init (&self->priv->__lock__items);
	self->priv->_items = NULL;
	g_rec_mutex_init (&self->priv->__lock__labels);
	self->priv->_labels = NULL;
	g_rec_mutex_init (&self->priv->__lock__reminders);
	self->priv->_reminders = NULL;
	g_rec_mutex_init (&self->priv->__lock__attachments);
	self->priv->_attachments = NULL;
}

static void
services_store_finalize (GObject * obj)
{
	ServicesStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_TYPE_STORE, ServicesStore);
	_g_object_unref0 (self->priv->_items_by_project_cache);
	g_rec_mutex_clear (&self->priv->__lock__sources);
	_g_object_unref0 (self->priv->_sources);
	g_rec_mutex_clear (&self->priv->__lock__projects);
	_g_object_unref0 (self->priv->_projects);
	g_rec_mutex_clear (&self->priv->__lock__sections);
	_g_object_unref0 (self->priv->_sections);
	g_rec_mutex_clear (&self->priv->__lock__items);
	_g_object_unref0 (self->priv->_items);
	g_rec_mutex_clear (&self->priv->__lock__labels);
	_g_object_unref0 (self->priv->_labels);
	g_rec_mutex_clear (&self->priv->__lock__reminders);
	_g_object_unref0 (self->priv->_reminders);
	g_rec_mutex_clear (&self->priv->__lock__attachments);
	_g_object_unref0 (self->priv->_attachments);
	G_OBJECT_CLASS (services_store_parent_class)->finalize (obj);
}

static GType
services_store_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesStore), 0, (GInstanceInitFunc) services_store_instance_init, NULL };
	GType services_store_type_id;
	services_store_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesStore", &g_define_type_info, 0);
	ServicesStore_private_offset = g_type_add_instance_private (services_store_type_id, sizeof (ServicesStorePrivate));
	return services_store_type_id;
}

GType
services_store_get_type (void)
{
	static volatile gsize services_store_type_id__once = 0;
	if (g_once_init_enter (&services_store_type_id__once)) {
		GType services_store_type_id;
		services_store_type_id = services_store_get_type_once ();
		g_once_init_leave (&services_store_type_id__once, services_store_type_id);
	}
	return services_store_type_id__once;
}

static void
_vala_services_store_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	ServicesStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_TYPE_STORE, ServicesStore);
	switch (property_id) {
		case SERVICES_STORE_SOURCES_PROPERTY:
		g_value_set_object (value, services_store_get_sources (self));
		break;
		case SERVICES_STORE_PROJECTS_PROPERTY:
		g_value_set_object (value, services_store_get_projects (self));
		break;
		case SERVICES_STORE_SECTIONS_PROPERTY:
		g_value_set_object (value, services_store_get_sections (self));
		break;
		case SERVICES_STORE_ITEMS_PROPERTY:
		g_value_set_object (value, services_store_get_items (self));
		break;
		case SERVICES_STORE_LABELS_PROPERTY:
		g_value_set_object (value, services_store_get_labels (self));
		break;
		case SERVICES_STORE_REMINDERS_PROPERTY:
		g_value_set_object (value, services_store_get_reminders (self));
		break;
		case SERVICES_STORE_ATTACHMENTS_PROPERTY:
		g_value_set_object (value, services_store_get_attachments (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

