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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include <json-glib/json-glib.h>
#include <libical-glib/libical-glib.h>
#include <libecal/libecal.h>
#include <gio/gio.h>
#include <time.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <adwaita.h>
#include <gtk/gtk.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  {
	OBJECTS_ITEM_0_PROPERTY,
	OBJECTS_ITEM_CONTENT_PROPERTY,
	OBJECTS_ITEM_DESCRIPTION_PROPERTY,
	OBJECTS_ITEM_ADDED_AT_PROPERTY,
	OBJECTS_ITEM_COMPLETED_AT_PROPERTY,
	OBJECTS_ITEM_UPDATED_AT_PROPERTY,
	OBJECTS_ITEM_CALENDAR_EVENT_UID_PROPERTY,
	OBJECTS_ITEM_DEADLINE_DATE_PROPERTY,
	OBJECTS_ITEM_SECTION_ID_PROPERTY,
	OBJECTS_ITEM_PROJECT_ID_PROPERTY,
	OBJECTS_ITEM_PARENT_ID_PROPERTY,
	OBJECTS_ITEM_EXTRA_DATA_PROPERTY,
	OBJECTS_ITEM_ITEM_TYPE_PROPERTY,
	OBJECTS_ITEM_RESPONSIBLE_UID_PROPERTY,
	OBJECTS_ITEM_DUE_PROPERTY,
	OBJECTS_ITEM_LABELS_PROPERTY,
	OBJECTS_ITEM_PRIORITY_PROPERTY,
	OBJECTS_ITEM_ACTIVATE_NAME_EDITABLE_PROPERTY,
	OBJECTS_ITEM_SHORT_CONTENT_PROPERTY,
	OBJECTS_ITEM_PRIORITY_ICON_PROPERTY,
	OBJECTS_ITEM_PRIORITY_COLOR_PROPERTY,
	OBJECTS_ITEM_PRIORITY_TEXT_PROPERTY,
	OBJECTS_ITEM_CHILD_ORDER_PROPERTY,
	OBJECTS_ITEM_DAY_ORDER_PROPERTY,
	OBJECTS_ITEM_CHECKED_PROPERTY,
	OBJECTS_ITEM_IS_DELETED_PROPERTY,
	OBJECTS_ITEM_COLLAPSED_PROPERTY,
	OBJECTS_ITEM_PINNED_PROPERTY,
	OBJECTS_ITEM_PINNED_ICON_PROPERTY,
	OBJECTS_ITEM_COMPLETED_PROPERTY,
	OBJECTS_ITEM_HAS_DUE_PROPERTY,
	OBJECTS_ITEM_HAS_TIME_PROPERTY,
	OBJECTS_ITEM_COMPLETED_DATE_PROPERTY,
	OBJECTS_ITEM_HAS_PARENT_PROPERTY,
	OBJECTS_ITEM_HAS_SECTION_PROPERTY,
	OBJECTS_ITEM_SHOW_ITEM_PROPERTY,
	OBJECTS_ITEM_ICAL_URL_PROPERTY,
	OBJECTS_ITEM_CALENDAR_DATA_PROPERTY,
	OBJECTS_ITEM_ETAG_PROPERTY,
	OBJECTS_ITEM_ADDED_DATETIME_PROPERTY,
	OBJECTS_ITEM_UPDATED_DATETIME_PROPERTY,
	OBJECTS_ITEM_DEADLINE_DATETIME_PROPERTY,
	OBJECTS_ITEM_HAS_DEADLINE_PROPERTY,
	OBJECTS_ITEM_BUILDER_PROPERTY,
	OBJECTS_ITEM_PARENT_PROPERTY,
	OBJECTS_ITEM_PROJECT_PROPERTY,
	OBJECTS_ITEM_SECTION_PROPERTY,
	OBJECTS_ITEM_ITEMS_PROPERTY,
	OBJECTS_ITEM_ITEMS_UNCOMPLETE_PROPERTY,
	OBJECTS_ITEM_REMINDERS_PROPERTY,
	OBJECTS_ITEM_ATTACHMENTS_PROPERTY,
	OBJECTS_ITEM_NUM_PROPERTIES
};
static GParamSpec* objects_item_properties[OBJECTS_ITEM_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _Block46Data Block46Data;
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))
typedef struct _Block47Data Block47Data;
typedef struct _Block48Data Block48Data;
typedef struct _Block49Data Block49Data;
typedef struct _Block50Data Block50Data;
typedef struct _Block51Data Block51Data;
typedef struct _Block52Data Block52Data;
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _Block53Data Block53Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ObjectsItemDeleteCaldavData ObjectsItemDeleteCaldavData;
typedef struct _ObjectsItemDeleteSubitemsCaldavData ObjectsItemDeleteSubitemsCaldavData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _ObjectsItemUpdateNextRecurrencyData ObjectsItemUpdateNextRecurrencyData;
typedef struct _Block54Data Block54Data;
typedef struct _ObjectsItemMoveCaldavRecursiveData ObjectsItemMoveCaldavRecursiveData;
typedef struct _ObjectsItemMoveAllSubitemsCaldavData ObjectsItemMoveAllSubitemsCaldavData;
typedef struct _Block55Data Block55Data;
typedef struct _ObjectsItemCompleteItemData ObjectsItemCompleteItemData;
#define _g_time_zone_unref0(var) ((var == NULL) ? NULL : (var = (g_time_zone_unref (var), NULL)))
enum  {
	OBJECTS_ITEM_ITEM_LABEL_ADDED_SIGNAL,
	OBJECTS_ITEM_ITEM_LABEL_DELETED_SIGNAL,
	OBJECTS_ITEM_ITEM_ADDED_SIGNAL,
	OBJECTS_ITEM_REMINDER_ADDED_SIGNAL,
	OBJECTS_ITEM_REMINDER_DELETED_SIGNAL,
	OBJECTS_ITEM_SHOW_ITEM_CHANGED_SIGNAL,
	OBJECTS_ITEM_COLLAPSED_CHANGE_SIGNAL,
	OBJECTS_ITEM_ATTACHMENT_ADDED_SIGNAL,
	OBJECTS_ITEM_ATTACHMENT_DELETED_SIGNAL,
	OBJECTS_ITEM_PIN_UPDATED_SIGNAL,
	OBJECTS_ITEM_NUM_SIGNALS
};
static guint objects_item_signals[OBJECTS_ITEM_NUM_SIGNALS] = {0};

struct _ObjectsItemPrivate {
	gchar* _content;
	gchar* _description;
	gchar* _added_at;
	gchar* _completed_at;
	gchar* _updated_at;
	gchar* _calendar_event_uid;
	gchar* _deadline_date;
	gchar* _section_id;
	gchar* _project_id;
	gchar* _parent_id;
	gchar* _extra_data;
	ItemType _item_type;
	gchar* _responsible_uid;
	ObjectsDueDate* _due;
	GeeArrayList* _labels;
	gint _priority;
	gboolean _activate_name_editable;
	gchar* _short_content;
	gint _child_order;
	gint _day_order;
	gboolean _checked;
	gboolean _is_deleted;
	gboolean _collapsed;
	gboolean _pinned;
	GDateTime* _completed_date;
	gboolean _show_item;
	gchar* _ical_url;
	gchar* _calendar_data;
	gchar* _etag;
	GDateTime* _added_datetime;
	GDateTime* _updated_datetime;
	GDateTime* _deadline_datetime;
	JsonBuilder* _builder;
	ObjectsItem* _parent;
	ObjectsProject* _project;
	ObjectsSection* _section;
	GeeArrayList* _items;
	GRecMutex __lock__items;
	GeeArrayList* _items_uncomplete;
	GeeArrayList* _reminders;
	GRecMutex __lock__reminders;
	GeeArrayList* _attachments;
	GRecMutex __lock__attachments;
};

struct _Block46Data {
	int _ref_count_;
	ObjectsItem* self;
	gchar* update_id;
};

struct _Block47Data {
	int _ref_count_;
	Block46Data * _data46_;
	ServicesCalDAVCalDAVClient* caldav_client;
};

struct _Block48Data {
	int _ref_count_;
	ObjectsItem* self;
	gchar* update_id;
};

struct _Block49Data {
	int _ref_count_;
	Block48Data * _data48_;
	ServicesCalDAVCalDAVClient* caldav_client;
};

struct _Block50Data {
	int _ref_count_;
	ObjectsItem* self;
	gchar* update_id;
};

struct _Block51Data {
	int _ref_count_;
	Block50Data * _data50_;
	ServicesCalDAVCalDAVClient* caldav_client;
};

struct _Block52Data {
	int _ref_count_;
	ObjectsItem* self;
	ServicesCalDAVCalDAVClient* caldav_client;
};

struct _Block53Data {
	int _ref_count_;
	ObjectsItem* self;
	gchar* content;
	GtkFileDialog* file_dialog;
};

struct _ObjectsItemDeleteCaldavData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ObjectsItem* self;
	ServicesCalDAVCalDAVClient* caldav_client;
	ServicesCalDAVCore* _tmp0_;
	ServicesCalDAVCore* _tmp1_;
	ObjectsProject* _tmp2_;
	ObjectsProject* _tmp3_;
	ObjectsSource* _tmp4_;
	ObjectsSource* _tmp5_;
	ServicesCalDAVCalDAVClient* _tmp6_;
	ServicesCalDAVCalDAVClient* _tmp7_;
	ServicesCalDAVCalDAVClient* _tmp8_;
	HttpResponse* response;
	ServicesCalDAVCalDAVClient* _tmp9_;
	HttpResponse* _tmp10_;
	HttpResponse* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	HttpResponse* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	GError* _tmp17_;
	ServicesStore* _tmp18_;
	GError* e;
	ServicesEventBus* _tmp19_;
	ServicesEventBus* _tmp20_;
	GError* _tmp21_;
	const gchar* _tmp22_;
	GError* _inner_error0_;
};

struct _ObjectsItemDeleteSubitemsCaldavData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ObjectsItem* self;
	ObjectsItem* item;
	ServicesCalDAVCalDAVClient* caldav_client;
	GeeArrayList* _subitem_list;
	ServicesStore* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _subitem_size;
	GeeArrayList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _subitem_index;
	gint _tmp5_;
	gint _tmp6_;
	ObjectsItem* subitem;
	GeeArrayList* _tmp7_;
	gpointer _tmp8_;
	ObjectsItem* _tmp9_;
	HttpResponse* response;
	ObjectsItem* _tmp10_;
	HttpResponse* _tmp11_;
	HttpResponse* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	HttpResponse* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	GError* _tmp18_;
	ServicesStore* _tmp19_;
	ObjectsItem* _tmp20_;
	GError* _inner_error0_;
};

struct _ObjectsItemUpdateNextRecurrencyData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ObjectsItem* self;
	GDateTime* result;
	GDateTime* next_recurrency;
	ObjectsDueDate* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	ObjectsDueDate* _tmp3_;
	GDateTime* _tmp4_;
	ObjectsDueDate* _tmp5_;
	GDateTime* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ObjectsDueDate* _tmp9_;
	RecurrencyEndType _tmp10_;
	RecurrencyEndType _tmp11_;
	ObjectsDueDate* _tmp12_;
	ObjectsDueDate* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	GeeArrayList* _subitem_list;
	ServicesStore* _tmp16_;
	GeeArrayList* _tmp17_;
	gint _subitem_size;
	GeeArrayList* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	gint _subitem_index;
	gint _tmp21_;
	gint _tmp22_;
	ObjectsItem* subitem;
	GeeArrayList* _tmp23_;
	gpointer _tmp24_;
	ObjectsItem* _tmp25_;
	gboolean _tmp26_;
	gboolean old_checked;
	ObjectsItem* _tmp27_;
	gboolean _tmp28_;
	ObjectsItem* _tmp29_;
	ObjectsItem* _tmp30_;
	ObjectsItem* _tmp31_;
	ServicesEventBus* _tmp32_;
	ServicesEventBus* _tmp33_;
	ObjectsItem* _tmp34_;
	ObjectsProject* _tmp35_;
	ObjectsProject* _tmp36_;
	SourceType _tmp37_;
	SourceType _tmp38_;
	ServicesStore* _tmp39_;
	ObjectsProject* _tmp40_;
	ObjectsProject* _tmp41_;
	SourceType _tmp42_;
	SourceType _tmp43_;
	HttpResponse* response;
	ServicesTodoist* _tmp44_;
	ServicesTodoist* _tmp45_;
	HttpResponse* _tmp46_;
	HttpResponse* _tmp47_;
	HttpResponse* _tmp48_;
	gboolean _tmp49_;
	gboolean _tmp50_;
	ServicesStore* _tmp51_;
	ObjectsProject* _tmp52_;
	ObjectsProject* _tmp53_;
	SourceType _tmp54_;
	SourceType _tmp55_;
	ServicesCalDAVCalDAVClient* caldav_client;
	ServicesCalDAVCore* _tmp56_;
	ServicesCalDAVCore* _tmp57_;
	ObjectsProject* _tmp58_;
	ObjectsProject* _tmp59_;
	ObjectsSource* _tmp60_;
	ObjectsSource* _tmp61_;
	ServicesCalDAVCalDAVClient* _tmp62_;
	ServicesCalDAVCalDAVClient* _tmp63_;
	HttpResponse* _vala1_response;
	ServicesCalDAVCalDAVClient* _tmp64_;
	HttpResponse* _tmp65_;
	HttpResponse* _tmp66_;
	gboolean _tmp67_;
	gboolean _tmp68_;
	ServicesStore* _tmp69_;
	ObjectsDueDate* _tmp70_;
	GDateTime* _tmp71_;
	GDateTime* _tmp72_;
	GDateTime* _tmp73_;
};

struct _Block54Data {
	int _ref_count_;
	ObjectsItem* self;
	ObjectsProject* project;
	gchar* _section_id;
	gboolean notify;
};

struct _ObjectsItemMoveCaldavRecursiveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ObjectsItem* self;
	ObjectsProject* project;
	gchar* _section_id;
	gboolean notify;
	ServicesCalDAVCalDAVClient* caldav_client;
	ServicesCalDAVCore* _tmp0_;
	ServicesCalDAVCore* _tmp1_;
	ObjectsSource* _tmp2_;
	ObjectsSource* _tmp3_;
	ServicesCalDAVCalDAVClient* _tmp4_;
	ServicesCalDAVCalDAVClient* _tmp5_;
	HttpResponse* response;
	ServicesCalDAVCalDAVClient* _tmp6_;
	HttpResponse* _tmp7_;
	HttpResponse* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	HttpResponse* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GError* _tmp14_;
	gchar* old_parent_id;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	const gchar* _tmp18_;
	ServicesCalDAVCalDAVClient* _tmp19_;
	HttpResponse* _tmp20_;
	HttpResponse* _tmp21_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	HttpResponse* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	GError* _tmp27_;
	ServicesEventBus* _tmp28_;
	ServicesEventBus* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	ServicesCalDAVCalDAVClient* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	GError* e;
	ServicesEventBus* _tmp38_;
	ServicesEventBus* _tmp39_;
	GError* _tmp40_;
	const gchar* _tmp41_;
	GError* _inner_error0_;
};

struct _ObjectsItemMoveAllSubitemsCaldavData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ObjectsItem* self;
	ObjectsItem* item;
	ObjectsProject* project;
	ServicesCalDAVCalDAVClient* caldav_client;
	GeeArrayList* _subitem_list;
	ServicesStore* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _subitem_size;
	GeeArrayList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _subitem_index;
	gint _tmp5_;
	gint _tmp6_;
	ObjectsItem* subitem;
	GeeArrayList* _tmp7_;
	gpointer _tmp8_;
	HttpResponse* response;
	ObjectsItem* _tmp9_;
	HttpResponse* _tmp10_;
	HttpResponse* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	HttpResponse* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	GError* _tmp17_;
	ObjectsItem* _tmp18_;
	GError* _inner_error0_;
};

struct _Block55Data {
	int _ref_count_;
	ObjectsItem* self;
	ObjectsReminder* reminder;
};

struct _ObjectsItemCompleteItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ObjectsItem* self;
	gboolean old_checked;
	HttpResponse* result;
	HttpResponse* response;
	HttpResponse* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	SourceType _tmp3_;
	SourceType _tmp4_;
	ServicesStore* _tmp5_;
	HttpResponse* _tmp6_;
	ObjectsProject* _tmp7_;
	ObjectsProject* _tmp8_;
	SourceType _tmp9_;
	SourceType _tmp10_;
	ServicesTodoist* _tmp11_;
	ServicesTodoist* _tmp12_;
	HttpResponse* _tmp13_;
	ServicesCalDAVCalDAVClient* caldav_client;
	ServicesCalDAVCore* _tmp14_;
	ServicesCalDAVCore* _tmp15_;
	ObjectsProject* _tmp16_;
	ObjectsProject* _tmp17_;
	ObjectsSource* _tmp18_;
	ObjectsSource* _tmp19_;
	ServicesCalDAVCalDAVClient* _tmp20_;
	ServicesCalDAVCalDAVClient* _tmp21_;
	ServicesCalDAVCalDAVClient* _tmp22_;
	HttpResponse* _tmp23_;
	HttpResponse* _tmp24_;
	gboolean _tmp25_;
	gboolean _tmp26_;
	gboolean complete_subitems;
	ObjectsProject* _tmp27_;
	ObjectsProject* _tmp28_;
	SourceType _tmp29_;
	SourceType _tmp30_;
	ServicesStore* _tmp31_;
	ObjectsProject* _tmp32_;
	ObjectsProject* _tmp33_;
	SourceType _tmp34_;
	SourceType _tmp35_;
	GeeArrayList* _subitem_list;
	ServicesStore* _tmp36_;
	GeeArrayList* _tmp37_;
	gint _subitem_size;
	GeeArrayList* _tmp38_;
	gint _tmp39_;
	gint _tmp40_;
	gint _subitem_index;
	gint _tmp41_;
	gint _tmp42_;
	ObjectsItem* subitem;
	GeeArrayList* _tmp43_;
	gpointer _tmp44_;
	ObjectsItem* _tmp45_;
	gboolean _tmp46_;
	ObjectsItem* _tmp47_;
	const gchar* _tmp48_;
	ObjectsItem* _tmp49_;
	HttpResponse* _tmp50_;
	gint _tmp51_;
	gint _tmp52_;
	ServicesEventBus* _tmp53_;
	ServicesEventBus* _tmp54_;
	ObjectsProject* _tmp55_;
	ObjectsProject* _tmp56_;
	ObjectsSource* _tmp57_;
	ObjectsSource* _tmp58_;
};

static gint ObjectsItem_private_offset;
static gpointer objects_item_parent_class = NULL;

static void objects_item_patch_from_vtodo (ObjectsItem* self,
                                    const gchar* data,
                                    const gchar* _ical_url,
                                    gboolean is_update);
static ICalProperty* objects_item_find_x_property (ICalComponent* component,
                                            const gchar* x_name);
static void _g_free0_ (gpointer var);
static inline void _g_slist_free__g_free0_ (GSList* self);
static GeeArrayList* objects_item_get_caldav_categories (ObjectsItem* self,
                                                  GSList* categories_list);
static ObjectsLabel* objects_item_get_label_by_name (ObjectsItem* self,
                                              const gchar* name,
                                              GeeArrayList* labels_list);
static gchar* objects_item_real_get_add_json (ObjectsBaseObject* base,
                                       const gchar* temp_id,
                                       const gchar* uuid);
static void _vala_JsonNode_free (JsonNode* self);
static Block46Data* block46_data_ref (Block46Data* _data46_);
static void block46_data_unref (void * _userdata_);
static gboolean __lambda82_ (Block46Data* _data46_);
static void ____lambda83_ (Block46Data* _data46_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda83__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static Block47Data* block47_data_ref (Block47Data* _data47_);
static void block47_data_unref (void * _userdata_);
static void _____lambda84_ (Block47Data* _data47_,
                     GObject* obj,
                     GAsyncResult* res);
static void ______lambda84__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static gboolean ___lambda82__gsource_func (gpointer self);
static Block48Data* block48_data_ref (Block48Data* _data48_);
static void block48_data_unref (void * _userdata_);
static gboolean __lambda85_ (Block48Data* _data48_);
static void ____lambda86_ (Block48Data* _data48_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda86__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static Block49Data* block49_data_ref (Block49Data* _data49_);
static void block49_data_unref (void * _userdata_);
static void _____lambda87_ (Block49Data* _data49_,
                     GObject* obj,
                     GAsyncResult* res);
static void ______lambda87__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static gboolean ___lambda85__gsource_func (gpointer self);
static Block50Data* block50_data_ref (Block50Data* _data50_);
static void block50_data_unref (void * _userdata_);
static void ____lambda88_ (Block50Data* _data50_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda88__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static Block51Data* block51_data_ref (Block51Data* _data51_);
static void block51_data_unref (void * _userdata_);
static void _____lambda89_ (Block51Data* _data51_,
                     GObject* obj,
                     GAsyncResult* res);
static void ______lambda89__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static void _objects_item_update_pin (ObjectsItem* self);
static Block52Data* block52_data_ref (Block52Data* _data52_);
static void block52_data_unref (void * _userdata_);
static void ___lambda90_ (Block52Data* _data52_,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda90__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static ObjectsReminder* objects_item_get_reminder (ObjectsItem* self,
                                            ObjectsReminder* reminder);
static void _objects_item_add_reminder (ObjectsItem* self,
                                 ObjectsReminder* reminder);
static ObjectsAttachment* objects_item_get_attachment (ObjectsItem* self,
                                                ObjectsAttachment* attachment);
static void objects_item_add_attachment (ObjectsItem* self,
                                  ObjectsAttachment* attachment);
static gchar* objects_item_real_get_update_json (ObjectsBaseObject* base,
                                          const gchar* uuid,
                                          const gchar* temp_id);
static gchar* objects_item_real_to_json (ObjectsBaseObject* base);
static Block53Data* block53_data_ref (Block53Data* _data53_);
static void block53_data_unref (void * _userdata_);
static void __lambda91_ (Block53Data* _data53_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda91__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void ____lambda79_ (ObjectsItem* self,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda79__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void objects_item_delete_caldav (ObjectsItem* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
static void objects_item_delete_caldav_finish (ObjectsItem* self,
                                        GAsyncResult* _res_);
static void objects_item_delete_caldav_data_free (gpointer _data);
static gboolean objects_item_delete_caldav_co (ObjectsItemDeleteCaldavData* _data_);
static void objects_item_delete_subitems_caldav (ObjectsItem* self,
                                          ObjectsItem* item,
                                          ServicesCalDAVCalDAVClient* caldav_client,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void objects_item_delete_subitems_caldav_finish (ObjectsItem* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void objects_item_delete_caldav_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_);
static void objects_item_delete_subitems_caldav_data_free (gpointer _data);
static gboolean objects_item_delete_subitems_caldav_co (ObjectsItemDeleteSubitemsCaldavData* _data_);
static void objects_item_delete_subitems_caldav_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void objects_item_update_next_recurrency_data_free (gpointer _data);
static gboolean objects_item_update_next_recurrency_co (ObjectsItemUpdateNextRecurrencyData* _data_);
static void objects_item_update_next_recurrency_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static Block54Data* block54_data_ref (Block54Data* _data54_);
static void block54_data_unref (void * _userdata_);
static void _objects_item_move (ObjectsItem* self,
                         const gchar* _project_id,
                         const gchar* _section_id,
                         gboolean notify);
static void ____lambda92_ (Block54Data* _data54_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda92__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void objects_item_move_caldav_recursive (ObjectsItem* self,
                                         ObjectsProject* project,
                                         const gchar* _section_id,
                                         gboolean notify,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void objects_item_move_caldav_recursive_finish (ObjectsItem* self,
                                                GAsyncResult* _res_);
static void objects_item_move_caldav_recursive_data_free (gpointer _data);
static gboolean objects_item_move_caldav_recursive_co (ObjectsItemMoveCaldavRecursiveData* _data_);
static void objects_item_move_caldav_recursive_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void objects_item_move_all_subitems_caldav (ObjectsItem* self,
                                            ObjectsItem* item,
                                            ObjectsProject* project,
                                            ServicesCalDAVCalDAVClient* caldav_client,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void objects_item_move_all_subitems_caldav_finish (ObjectsItem* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static void objects_item_move_all_subitems_caldav_data_free (gpointer _data);
static gboolean objects_item_move_all_subitems_caldav_co (ObjectsItemMoveAllSubitemsCaldavData* _data_);
static void objects_item_move_all_subitems_caldav_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static gboolean objects_item_was_archived_internal (ObjectsItem* self,
                                             GeeSet* visited);
static void objects_item_remove_all_relative_reminders (ObjectsItem* self);
static Block55Data* block55_data_ref (Block55Data* _data55_);
static void block55_data_unref (void * _userdata_);
static void ___lambda93_ (Block55Data* _data55_,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda93__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void objects_item_complete_item_data_free (gpointer _data);
static gboolean objects_item_complete_item_co (ObjectsItemCompleteItemData* _data_);
static void objects_item_complete_item_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_);
static gint _objects_item_items___lambda9_ (ObjectsItem* self,
                                     ObjectsItem* a,
                                     ObjectsItem* b);
static gint __objects_item_items___lambda9__gcompare_data_func (gconstpointer a,
                                                         gconstpointer b,
                                                         gpointer self);
static void objects_item_finalize (GObject * obj);
static GType objects_item_get_type_once (void);
static void _vala_objects_item_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_objects_item_set_property (GObject * object,
                                      guint property_id,
                                      const 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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
objects_item_get_instance_private (ObjectsItem* self)
{
	return G_STRUCT_MEMBER_P (self, ObjectsItem_private_offset);
}

static gchar*
g_date_time_to_string (GDateTime* self)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_date_time_format (self, "%FT%H:%M:%S%z");
	result = _tmp0_;
	return result;
}

GeeArrayList*
objects_item_get_labels_list (ObjectsItem* self)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* result;
	g_return_val_if_fail (self != 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* _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_;
			GeeArrayList* _tmp9_;
			ObjectsLabel* _tmp10_;
			_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_ = return_value;
			_tmp10_ = label;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp10_);
			_g_object_unref0 (label);
		}
	}
	result = return_value;
	return result;
}

ObjectsItem*
objects_item_construct_from_json (GType object_type,
                                  JsonNode* node)
{
	ObjectsItem * self = NULL;
	JsonObject* _tmp0_;
	const gchar* _tmp1_;
	JsonObject* _tmp2_;
	const gchar* _tmp3_;
	JsonObject* _tmp4_;
	const gchar* _tmp5_;
	JsonObject* _tmp6_;
	const gchar* _tmp7_;
	JsonObject* _tmp8_;
	JsonObject* _tmp9_;
	JsonObject* _tmp10_;
	JsonObject* _tmp11_;
	const gchar* _tmp12_;
	GeeArrayList* _tmp13_;
	GeeArrayList* _tmp14_;
	JsonObject* _tmp15_;
	JsonObject* _tmp16_;
	JsonObject* _tmp19_;
	JsonObject* _tmp22_;
	JsonObject* _tmp25_;
	JsonObject* _tmp30_;
	g_return_val_if_fail (node != NULL, NULL);
	self = (ObjectsItem*) objects_base_object_construct (object_type);
	_tmp0_ = json_node_get_object (node);
	_tmp1_ = json_object_get_string_member (_tmp0_, "id");
	objects_base_object_set_id ((ObjectsBaseObject*) self, _tmp1_);
	_tmp2_ = json_node_get_object (node);
	_tmp3_ = json_object_get_string_member (_tmp2_, "project_id");
	objects_item_set_project_id (self, _tmp3_);
	_tmp4_ = json_node_get_object (node);
	_tmp5_ = json_object_get_string_member (_tmp4_, "content");
	objects_item_set_content (self, _tmp5_);
	_tmp6_ = json_node_get_object (node);
	_tmp7_ = json_object_get_string_member (_tmp6_, "description");
	objects_item_set_description (self, _tmp7_);
	_tmp8_ = json_node_get_object (node);
	objects_item_set_checked (self, json_object_get_boolean_member (_tmp8_, "checked"));
	_tmp9_ = json_node_get_object (node);
	objects_item_set_priority (self, (gint) ((gint32) json_object_get_int_member (_tmp9_, "priority")));
	_tmp10_ = json_node_get_object (node);
	objects_item_set_is_deleted (self, json_object_get_boolean_member (_tmp10_, "is_deleted"));
	_tmp11_ = json_node_get_object (node);
	_tmp12_ = json_object_get_string_member (_tmp11_, "added_at");
	objects_item_set_added_at (self, _tmp12_);
	_tmp13_ = objects_item_get_labels_from_json (self, node);
	_tmp14_ = _tmp13_;
	objects_item_set_labels (self, _tmp14_);
	_g_object_unref0 (_tmp14_);
	_tmp15_ = json_node_get_object (node);
	objects_item_set_child_order (self, (gint) ((gint32) json_object_get_int_member (_tmp15_, "child_order")));
	_tmp16_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp16_, "section_id")) {
		JsonObject* _tmp17_;
		const gchar* _tmp18_;
		_tmp17_ = json_node_get_object (node);
		_tmp18_ = json_object_get_string_member (_tmp17_, "section_id");
		objects_item_set_section_id (self, _tmp18_);
	} else {
		objects_item_set_section_id (self, "");
	}
	_tmp19_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp19_, "parent_id")) {
		JsonObject* _tmp20_;
		const gchar* _tmp21_;
		_tmp20_ = json_node_get_object (node);
		_tmp21_ = json_object_get_string_member (_tmp20_, "parent_id");
		objects_item_set_parent_id (self, _tmp21_);
	} else {
		objects_item_set_parent_id (self, "");
	}
	_tmp22_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp22_, "completed_at")) {
		JsonObject* _tmp23_;
		const gchar* _tmp24_;
		_tmp23_ = json_node_get_object (node);
		_tmp24_ = json_object_get_string_member (_tmp23_, "completed_at");
		objects_item_set_completed_at (self, _tmp24_);
	} else {
		objects_item_set_completed_at (self, "");
	}
	_tmp25_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp25_, "due")) {
		ObjectsDueDate* _tmp26_;
		JsonObject* _tmp27_;
		JsonObject* _tmp28_;
		_tmp26_ = self->priv->_due;
		_tmp27_ = json_node_get_object (node);
		_tmp28_ = json_object_get_object_member (_tmp27_, "due");
		objects_due_date_update_from_todoist_json (_tmp26_, _tmp28_);
	} else {
		ObjectsDueDate* _tmp29_;
		_tmp29_ = self->priv->_due;
		objects_due_date_reset (_tmp29_);
	}
	_tmp30_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp30_, "responsible_uid")) {
		JsonObject* _tmp31_;
		const gchar* _tmp32_;
		_tmp31_ = json_node_get_object (node);
		_tmp32_ = json_object_get_string_member (_tmp31_, "responsible_uid");
		objects_item_set_responsible_uid (self, _tmp32_);
	} else {
		objects_item_set_responsible_uid (self, "");
	}
	return self;
}

ObjectsItem*
objects_item_new_from_json (JsonNode* node)
{
	return objects_item_construct_from_json (OBJECTS_TYPE_ITEM, node);
}

void
objects_item_update_from_json (ObjectsItem* self,
                               JsonNode* node)
{
	JsonObject* _tmp0_;
	const gchar* _tmp1_;
	JsonObject* _tmp2_;
	const gchar* _tmp3_;
	JsonObject* _tmp4_;
	const gchar* _tmp5_;
	JsonObject* _tmp6_;
	JsonObject* _tmp7_;
	JsonObject* _tmp8_;
	JsonObject* _tmp9_;
	const gchar* _tmp10_;
	GeeHashMap* _tmp11_;
	GeeHashMap* _tmp12_;
	JsonObject* _tmp13_;
	JsonObject* _tmp14_;
	JsonObject* _tmp17_;
	JsonObject* _tmp20_;
	JsonObject* _tmp23_;
	JsonObject* _tmp28_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = json_node_get_object (node);
	_tmp1_ = json_object_get_string_member (_tmp0_, "project_id");
	objects_item_set_project_id (self, _tmp1_);
	_tmp2_ = json_node_get_object (node);
	_tmp3_ = json_object_get_string_member (_tmp2_, "content");
	objects_item_set_content (self, _tmp3_);
	_tmp4_ = json_node_get_object (node);
	_tmp5_ = json_object_get_string_member (_tmp4_, "description");
	objects_item_set_description (self, _tmp5_);
	_tmp6_ = json_node_get_object (node);
	objects_item_set_checked (self, json_object_get_boolean_member (_tmp6_, "checked"));
	_tmp7_ = json_node_get_object (node);
	objects_item_set_priority (self, (gint) ((gint32) json_object_get_int_member (_tmp7_, "priority")));
	_tmp8_ = json_node_get_object (node);
	objects_item_set_is_deleted (self, json_object_get_boolean_member (_tmp8_, "is_deleted"));
	_tmp9_ = json_node_get_object (node);
	_tmp10_ = json_object_get_string_member (_tmp9_, "added_at");
	objects_item_set_added_at (self, _tmp10_);
	_tmp11_ = objects_item_get_labels_maps_from_json (self, node);
	_tmp12_ = _tmp11_;
	objects_item_check_labels (self, _tmp12_);
	_g_object_unref0 (_tmp12_);
	_tmp13_ = json_node_get_object (node);
	objects_item_set_child_order (self, (gint) ((gint32) json_object_get_int_member (_tmp13_, "child_order")));
	_tmp14_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp14_, "section_id")) {
		JsonObject* _tmp15_;
		const gchar* _tmp16_;
		_tmp15_ = json_node_get_object (node);
		_tmp16_ = json_object_get_string_member (_tmp15_, "section_id");
		objects_item_set_section_id (self, _tmp16_);
	} else {
		objects_item_set_section_id (self, "");
	}
	_tmp17_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp17_, "parent_id")) {
		JsonObject* _tmp18_;
		const gchar* _tmp19_;
		_tmp18_ = json_node_get_object (node);
		_tmp19_ = json_object_get_string_member (_tmp18_, "parent_id");
		objects_item_set_parent_id (self, _tmp19_);
	} else {
		objects_item_set_parent_id (self, "");
	}
	_tmp20_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp20_, "completed_at")) {
		JsonObject* _tmp21_;
		const gchar* _tmp22_;
		_tmp21_ = json_node_get_object (node);
		_tmp22_ = json_object_get_string_member (_tmp21_, "completed_at");
		objects_item_set_completed_at (self, _tmp22_);
	} else {
		objects_item_set_completed_at (self, "");
	}
	_tmp23_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp23_, "due")) {
		ObjectsDueDate* _tmp24_;
		JsonObject* _tmp25_;
		JsonObject* _tmp26_;
		_tmp24_ = self->priv->_due;
		_tmp25_ = json_node_get_object (node);
		_tmp26_ = json_object_get_object_member (_tmp25_, "due");
		objects_due_date_update_from_todoist_json (_tmp24_, _tmp26_);
	} else {
		ObjectsDueDate* _tmp27_;
		_tmp27_ = self->priv->_due;
		objects_due_date_reset (_tmp27_);
	}
	_tmp28_ = json_node_get_object (node);
	if (!json_object_get_null_member (_tmp28_, "responsible_uid")) {
		JsonObject* _tmp29_;
		const gchar* _tmp30_;
		_tmp29_ = json_node_get_object (node);
		_tmp30_ = json_object_get_string_member (_tmp29_, "responsible_uid");
		objects_item_set_responsible_uid (self, _tmp30_);
	} else {
		objects_item_set_responsible_uid (self, "");
	}
}

ObjectsItem*
objects_item_construct_from_import_json (GType object_type,
                                         JsonNode* node,
                                         GeeArrayList* _labels)
{
	ObjectsItem * self = NULL;
	JsonObject* _tmp0_;
	const gchar* _tmp1_;
	JsonObject* _tmp2_;
	const gchar* _tmp3_;
	JsonObject* _tmp4_;
	const gchar* _tmp5_;
	JsonObject* _tmp6_;
	const gchar* _tmp7_;
	JsonObject* _tmp8_;
	const gchar* _tmp9_;
	JsonObject* _tmp10_;
	const gchar* _tmp11_;
	JsonObject* _tmp12_;
	const gchar* _tmp13_;
	JsonObject* _tmp14_;
	const gchar* _tmp15_;
	JsonObject* _tmp16_;
	const gchar* _tmp17_;
	JsonObject* _tmp18_;
	JsonObject* _tmp19_;
	JsonObject* _tmp20_;
	JsonObject* _tmp21_;
	JsonObject* _tmp22_;
	ObjectsDueDate* _tmp23_;
	ServicesDatabase* _tmp24_;
	ServicesDatabase* _tmp25_;
	JsonObject* _tmp26_;
	const gchar* _tmp27_;
	JsonObject* _tmp28_;
	JsonObject* _tmp29_;
	JsonObject* _tmp30_;
	JsonObject* _tmp31_;
	gint _tmp32_;
	gint _tmp33_;
	JsonObject* _tmp38_;
	JsonObject* _tmp41_;
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (_labels != NULL, NULL);
	self = (ObjectsItem*) objects_base_object_construct (object_type);
	_tmp0_ = json_node_get_object (node);
	_tmp1_ = json_object_get_string_member (_tmp0_, "id");
	objects_base_object_set_id ((ObjectsBaseObject*) self, _tmp1_);
	_tmp2_ = json_node_get_object (node);
	_tmp3_ = json_object_get_string_member (_tmp2_, "content");
	objects_item_set_content (self, _tmp3_);
	_tmp4_ = json_node_get_object (node);
	_tmp5_ = json_object_get_string_member (_tmp4_, "description");
	objects_item_set_description (self, _tmp5_);
	_tmp6_ = json_node_get_object (node);
	_tmp7_ = json_object_get_string_member (_tmp6_, "added_at");
	objects_item_set_added_at (self, _tmp7_);
	_tmp8_ = json_node_get_object (node);
	_tmp9_ = json_object_get_string_member (_tmp8_, "completed_at");
	objects_item_set_completed_at (self, _tmp9_);
	_tmp10_ = json_node_get_object (node);
	_tmp11_ = json_object_get_string_member (_tmp10_, "updated_at");
	objects_item_set_updated_at (self, _tmp11_);
	_tmp12_ = json_node_get_object (node);
	_tmp13_ = json_object_get_string_member (_tmp12_, "section_id");
	objects_item_set_section_id (self, _tmp13_);
	_tmp14_ = json_node_get_object (node);
	_tmp15_ = json_object_get_string_member (_tmp14_, "project_id");
	objects_item_set_project_id (self, _tmp15_);
	_tmp16_ = json_node_get_object (node);
	_tmp17_ = json_object_get_string_member (_tmp16_, "parent_id");
	objects_item_set_parent_id (self, _tmp17_);
	_tmp18_ = json_node_get_object (node);
	objects_item_set_priority (self, (gint) ((gint32) json_object_get_int_member (_tmp18_, "priority")));
	_tmp19_ = json_node_get_object (node);
	objects_item_set_child_order (self, (gint) ((gint32) json_object_get_int_member (_tmp19_, "child_order")));
	_tmp20_ = json_node_get_object (node);
	objects_item_set_checked (self, json_object_get_boolean_member (_tmp20_, "checked"));
	_tmp21_ = json_node_get_object (node);
	objects_item_set_is_deleted (self, json_object_get_boolean_member (_tmp21_, "is_deleted"));
	_tmp22_ = json_node_get_object (node);
	objects_item_set_day_order (self, (gint) ((gint32) json_object_get_int_member (_tmp22_, "day_order")));
	_tmp23_ = self->priv->_due;
	_tmp24_ = services_database_get_default ();
	_tmp25_ = _tmp24_;
	_tmp26_ = json_node_get_object (node);
	_tmp27_ = json_object_get_string_member (_tmp26_, "due");
	_tmp28_ = services_database_get_due_parameter (_tmp25_, _tmp27_);
	_tmp29_ = _tmp28_;
	objects_due_date_update_from_json (_tmp23_, _tmp29_);
	_json_object_unref0 (_tmp29_);
	_g_object_unref0 (_tmp25_);
	_tmp30_ = json_node_get_object (node);
	objects_item_set_collapsed (self, json_object_get_boolean_member (_tmp30_, "collapsed"));
	_tmp31_ = json_node_get_object (node);
	objects_item_set_pinned (self, json_object_get_boolean_member (_tmp31_, "pinned"));
	_tmp32_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _labels);
	_tmp33_ = _tmp32_;
	if (_tmp33_ <= 0) {
		GeeArrayList* _tmp34_;
		GeeArrayList* _tmp35_;
		_tmp34_ = objects_item_get_labels_from_json (self, node);
		_tmp35_ = _tmp34_;
		objects_item_set_labels (self, _tmp35_);
		_g_object_unref0 (_tmp35_);
	} else {
		GeeArrayList* _tmp36_;
		GeeArrayList* _tmp37_;
		_tmp36_ = objects_item_get_labels_from_labels_json (self, node, _labels);
		_tmp37_ = _tmp36_;
		objects_item_set_labels (self, _tmp37_);
		_g_object_unref0 (_tmp37_);
	}
	_tmp38_ = json_node_get_object (node);
	if (json_object_has_member (_tmp38_, "deadline_date")) {
		JsonObject* _tmp39_;
		const gchar* _tmp40_;
		_tmp39_ = json_node_get_object (node);
		_tmp40_ = json_object_get_string_member (_tmp39_, "deadline_date");
		objects_item_set_deadline_date (self, _tmp40_);
	}
	_tmp41_ = json_node_get_object (node);
	if (json_object_has_member (_tmp41_, "item_type")) {
		JsonObject* _tmp42_;
		const gchar* _tmp43_;
		_tmp42_ = json_node_get_object (node);
		_tmp43_ = json_object_get_string_member (_tmp42_, "item_type");
		objects_item_set_item_type (self, item_type_parse (_tmp43_));
	}
	return self;
}

ObjectsItem*
objects_item_new_from_import_json (JsonNode* node,
                                   GeeArrayList* _labels)
{
	return objects_item_construct_from_import_json (OBJECTS_TYPE_ITEM, node, _labels);
}

ObjectsItem*
objects_item_construct_from_vtodo (GType object_type,
                                   const gchar* data,
                                   const gchar* _ical_url,
                                   const gchar* _project_id)
{
	ObjectsItem * self = NULL;
	g_return_val_if_fail (data != NULL, NULL);
	g_return_val_if_fail (_ical_url != NULL, NULL);
	g_return_val_if_fail (_project_id != NULL, NULL);
	self = (ObjectsItem*) objects_base_object_construct (object_type);
	objects_item_set_project_id (self, _project_id);
	objects_item_patch_from_vtodo (self, data, _ical_url, FALSE);
	return self;
}

ObjectsItem*
objects_item_new_from_vtodo (const gchar* data,
                             const gchar* _ical_url,
                             const gchar* _project_id)
{
	return objects_item_construct_from_vtodo (OBJECTS_TYPE_ITEM, data, _ical_url, _project_id);
}

void
objects_item_update_from_vtodo (ObjectsItem* self,
                                const gchar* data,
                                const gchar* _ical_url)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (data != NULL);
	g_return_if_fail (_ical_url != NULL);
	objects_item_patch_from_vtodo (self, data, _ical_url, TRUE);
}

static gboolean
bool_parse (const gchar* str)
{
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	if (g_strcmp0 (str, "true") == 0) {
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

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

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_slist_free__g_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) _g_free0_);
}

static void
objects_item_patch_from_vtodo (ObjectsItem* self,
                               const gchar* data,
                               const gchar* _ical_url,
                               gboolean is_update)
{
	ICalComponent* ical = NULL;
	ICalComponent* _tmp0_;
	ICalComponent* ical_vtodo = NULL;
	ICalComponent* _tmp1_;
	ICalComponent* _tmp2_;
	ICalComponent* _tmp3_;
	const gchar* _tmp4_;
	ICalComponent* _tmp5_;
	const gchar* _tmp6_;
	ICalComponent* _tmp7_;
	const gchar* _tmp8_;
	ICalProperty* priority_property = NULL;
	ICalComponent* _tmp11_;
	ICalProperty* _tmp12_;
	ICalProperty* _tmp13_;
	ICalComponent* _tmp17_;
	ICalTime* _tmp18_;
	ICalTime* _tmp19_;
	gboolean _tmp20_;
	ICalProperty* rrule_property = NULL;
	ICalComponent* _tmp30_;
	ICalProperty* _tmp31_;
	ICalProperty* _tmp32_;
	ICalProperty* related_to_property = NULL;
	ICalComponent* _tmp37_;
	ICalProperty* _tmp38_;
	ICalProperty* _tmp39_;
	ICalProperty* percent_property = NULL;
	ICalComponent* _tmp58_;
	ICalProperty* _tmp59_;
	gboolean _tmp60_ = FALSE;
	ICalProperty* _tmp61_;
	gboolean is_percent_complete = FALSE;
	gboolean _tmp63_ = FALSE;
	ICalComponent* _tmp64_;
	ICalProperty* sort_order_property = NULL;
	ICalComponent* _tmp83_;
	ICalProperty* _tmp84_;
	ICalProperty* _tmp85_;
	ICalProperty* pinned_property = NULL;
	ICalComponent* _tmp97_;
	ICalProperty* _tmp98_;
	ICalProperty* _tmp99_;
	ICalComponent* _tmp104_;
	gchar* _tmp105_;
	gchar* _tmp106_;
	gchar* _tmp107_;
	gchar* _tmp108_;
	ECalComponent* ecal = NULL;
	ICalComponent* _tmp109_;
	ICalComponent* _tmp110_;
	ECalComponent* _tmp111_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (data != NULL);
	g_return_if_fail (_ical_url != NULL);
	_tmp0_ = i_cal_parser_parse_string (data);
	ical = _tmp0_;
	_tmp1_ = ical;
	_tmp2_ = i_cal_component_get_first_component (_tmp1_, I_CAL_VTODO_COMPONENT);
	ical_vtodo = _tmp2_;
	_tmp3_ = ical;
	_tmp4_ = i_cal_component_get_uid (_tmp3_);
	objects_base_object_set_id ((ObjectsBaseObject*) self, _tmp4_);
	_tmp5_ = ical;
	_tmp6_ = i_cal_component_get_summary (_tmp5_);
	objects_item_set_content (self, _tmp6_);
	_tmp7_ = ical;
	_tmp8_ = i_cal_component_get_description (_tmp7_);
	if (_tmp8_ != NULL) {
		ICalComponent* _tmp9_;
		const gchar* _tmp10_;
		_tmp9_ = ical;
		_tmp10_ = i_cal_component_get_description (_tmp9_);
		objects_item_set_description (self, _tmp10_);
	}
	_tmp11_ = ical_vtodo;
	_tmp12_ = i_cal_component_get_first_property (_tmp11_, I_CAL_PRIORITY_PROPERTY);
	priority_property = _tmp12_;
	_tmp13_ = priority_property;
	if (_tmp13_ != NULL) {
		gint _priority = 0;
		ICalProperty* _tmp14_;
		_tmp14_ = priority_property;
		_priority = i_cal_property_get_priority (_tmp14_);
		if (_priority <= 0) {
			objects_item_set_priority (self, CONSTANTS_PRIORITY_4);
		} else {
			gboolean _tmp15_ = FALSE;
			if (_priority >= 1) {
				_tmp15_ = _priority <= 4;
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				objects_item_set_priority (self, CONSTANTS_PRIORITY_1);
			} else {
				if (_priority == 5) {
					objects_item_set_priority (self, CONSTANTS_PRIORITY_2);
				} else {
					gboolean _tmp16_ = FALSE;
					if (_priority > 5) {
						_tmp16_ = _priority <= 9;
					} else {
						_tmp16_ = FALSE;
					}
					if (_tmp16_) {
						objects_item_set_priority (self, CONSTANTS_PRIORITY_3);
					} else {
						objects_item_set_priority (self, CONSTANTS_PRIORITY_4);
					}
				}
			}
		}
	} else {
		objects_item_set_priority (self, CONSTANTS_PRIORITY_4);
	}
	_tmp17_ = ical;
	_tmp18_ = i_cal_component_get_due (_tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = !i_cal_time_is_null_time (_tmp19_);
	_g_object_unref0 (_tmp19_);
	if (_tmp20_) {
		ObjectsDueDate* _tmp21_;
		ICalComponent* _tmp22_;
		ICalTime* _tmp23_;
		ICalTime* _tmp24_;
		GDateTime* _tmp25_;
		GDateTime* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		_tmp21_ = self->priv->_due;
		_tmp22_ = ical;
		_tmp23_ = i_cal_component_get_due (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = utils_datetime_ical_to_date_time_local (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = g_date_time_to_string (_tmp26_);
		_tmp28_ = _tmp27_;
		objects_due_date_set_date (_tmp21_, _tmp28_);
		_g_free0 (_tmp28_);
		_g_date_time_unref0 (_tmp26_);
		_g_object_unref0 (_tmp24_);
	} else {
		if (is_update) {
			ObjectsDueDate* _tmp29_;
			_tmp29_ = self->priv->_due;
			objects_due_date_reset (_tmp29_);
		}
	}
	_tmp30_ = ical_vtodo;
	_tmp31_ = i_cal_component_get_first_property (_tmp30_, I_CAL_RRULE_PROPERTY);
	rrule_property = _tmp31_;
	_tmp32_ = rrule_property;
	if (_tmp32_ != NULL) {
		ICalProperty* _tmp33_;
		ICalRecurrence* _tmp34_;
		ICalRecurrence* _tmp35_;
		ObjectsDueDate* _tmp36_;
		_tmp33_ = rrule_property;
		_tmp34_ = i_cal_property_get_rrule (_tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = self->priv->_due;
		utils_datetime_recurrence_to_due (_tmp35_, _tmp36_);
		_g_object_unref0 (_tmp35_);
	}
	_tmp37_ = ical_vtodo;
	_tmp38_ = i_cal_component_get_first_property (_tmp37_, I_CAL_RELATEDTO_PROPERTY);
	related_to_property = _tmp38_;
	_tmp39_ = related_to_property;
	if (_tmp39_ != NULL) {
		gchar* related_id = NULL;
		ICalProperty* _tmp40_;
		const gchar* _tmp41_;
		gchar* _tmp42_;
		ICalParameterReltype reltype = 0;
		ICalParameter* reltype_parameter = NULL;
		ICalProperty* _tmp43_;
		ICalParameter* _tmp44_;
		ICalParameter* _tmp45_;
		const gchar* _tmp47_;
		const gchar* _tmp48_;
		const gchar* _tmp49_;
		_tmp40_ = related_to_property;
		_tmp41_ = i_cal_property_get_relatedto (_tmp40_);
		_tmp42_ = g_strdup (_tmp41_);
		related_id = _tmp42_;
		reltype = I_CAL_RELTYPE_PARENT;
		_tmp43_ = related_to_property;
		_tmp44_ = i_cal_property_get_first_parameter (_tmp43_, I_CAL_RELTYPE_PARAMETER);
		reltype_parameter = _tmp44_;
		_tmp45_ = reltype_parameter;
		if (_tmp45_ != NULL) {
			ICalParameter* _tmp46_;
			_tmp46_ = reltype_parameter;
			reltype = i_cal_parameter_get_reltype (_tmp46_);
		}
		_tmp47_ = related_id;
		_tmp48_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
		_tmp49_ = _tmp48_;
		if (g_strcmp0 (_tmp47_, _tmp49_) == 0) {
			const gchar* _tmp50_;
			const gchar* _tmp51_;
			_tmp50_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
			_tmp51_ = _tmp50_;
			g_warning ("Item.vala:544: Item/Task %s has a direct self-reference", _tmp51_);
			objects_item_set_parent_id (self, "");
			objects_item_set_section_id (self, "");
		} else {
			ObjectsSection* related_section = NULL;
			ServicesStore* _tmp52_;
			const gchar* _tmp53_;
			ObjectsSection* _tmp54_;
			ObjectsSection* _tmp55_;
			_tmp52_ = services_store_instance ();
			_tmp53_ = related_id;
			_tmp54_ = services_store_get_section (_tmp52_, _tmp53_);
			related_section = _tmp54_;
			_tmp55_ = related_section;
			if (_tmp55_ != NULL) {
				const gchar* _tmp56_;
				_tmp56_ = related_id;
				objects_item_set_section_id (self, _tmp56_);
				objects_item_set_parent_id (self, "");
			} else {
				if (reltype == I_CAL_RELTYPE_PARENT) {
					const gchar* _tmp57_;
					_tmp57_ = related_id;
					objects_item_set_parent_id (self, _tmp57_);
					objects_item_set_section_id (self, "");
				}
			}
			_g_object_unref0 (related_section);
		}
		_g_object_unref0 (reltype_parameter);
		_g_free0 (related_id);
	} else {
		objects_item_set_parent_id (self, "");
	}
	_tmp58_ = ical_vtodo;
	_tmp59_ = i_cal_component_get_first_property (_tmp58_, I_CAL_PERCENTCOMPLETE_PROPERTY);
	percent_property = _tmp59_;
	_tmp61_ = percent_property;
	if (_tmp61_ != NULL) {
		ICalProperty* _tmp62_;
		_tmp62_ = percent_property;
		_tmp60_ = i_cal_property_get_percentcomplete (_tmp62_) == 100;
	} else {
		_tmp60_ = FALSE;
	}
	is_percent_complete = _tmp60_;
	_tmp64_ = ical;
	if (i_cal_component_get_status (_tmp64_) == I_CAL_STATUS_COMPLETED) {
		_tmp63_ = TRUE;
	} else {
		_tmp63_ = is_percent_complete;
	}
	if (_tmp63_) {
		ICalProperty* completed_property = NULL;
		ICalComponent* _tmp65_;
		ICalProperty* _tmp66_;
		ICalProperty* _tmp67_;
		objects_item_set_checked (self, TRUE);
		_tmp65_ = ical_vtodo;
		_tmp66_ = i_cal_component_get_first_property (_tmp65_, I_CAL_COMPLETED_PROPERTY);
		completed_property = _tmp66_;
		_tmp67_ = completed_property;
		if (_tmp67_ != NULL) {
			ICalProperty* _tmp68_;
			ICalTime* _tmp69_;
			ICalTime* _tmp70_;
			GDateTime* _tmp71_;
			GDateTime* _tmp72_;
			GDateTime* _tmp73_;
			GDateTime* _tmp74_;
			gchar* _tmp75_;
			gchar* _tmp76_;
			_tmp68_ = completed_property;
			_tmp69_ = i_cal_property_get_completed (_tmp68_);
			_tmp70_ = _tmp69_;
			_tmp71_ = utils_datetime_ical_to_date_time_local (_tmp70_);
			_tmp72_ = _tmp71_;
			_tmp73_ = utils_datetime_get_date_only (_tmp72_);
			_tmp74_ = _tmp73_;
			_tmp75_ = g_date_time_to_string (_tmp74_);
			_tmp76_ = _tmp75_;
			objects_item_set_completed_at (self, _tmp76_);
			_g_free0 (_tmp76_);
			_g_date_time_unref0 (_tmp74_);
			_g_date_time_unref0 (_tmp72_);
			_g_object_unref0 (_tmp70_);
		} else {
			GDateTime* _tmp77_;
			GDateTime* _tmp78_;
			GDateTime* _tmp79_;
			GDateTime* _tmp80_;
			gchar* _tmp81_;
			gchar* _tmp82_;
			_tmp77_ = g_date_time_new_now_local ();
			_tmp78_ = _tmp77_;
			_tmp79_ = utils_datetime_get_date_only (_tmp78_);
			_tmp80_ = _tmp79_;
			_tmp81_ = g_date_time_to_string (_tmp80_);
			_tmp82_ = _tmp81_;
			objects_item_set_completed_at (self, _tmp82_);
			_g_free0 (_tmp82_);
			_g_date_time_unref0 (_tmp80_);
			_g_date_time_unref0 (_tmp78_);
		}
		_g_object_unref0 (completed_property);
	} else {
		objects_item_set_checked (self, FALSE);
		objects_item_set_completed_at (self, "");
	}
	_tmp83_ = ical_vtodo;
	_tmp84_ = objects_item_find_x_property (_tmp83_, "X-APPLE-SORT-ORDER");
	sort_order_property = _tmp84_;
	_tmp85_ = sort_order_property;
	if (_tmp85_ != NULL) {
		gchar* sort_order_str = NULL;
		ICalProperty* _tmp86_;
		gchar* _tmp87_;
		const gchar* _tmp88_;
		_tmp86_ = sort_order_property;
		_tmp87_ = i_cal_property_get_value_as_string (_tmp86_);
		sort_order_str = _tmp87_;
		_tmp88_ = sort_order_str;
		if (_tmp88_ != NULL) {
			const gchar* _tmp89_;
			_tmp89_ = sort_order_str;
			objects_item_set_child_order (self, atoi (_tmp89_));
		}
		_g_free0 (sort_order_str);
	} else {
		ICalProperty* created_property = NULL;
		ICalComponent* _tmp90_;
		ICalProperty* _tmp91_;
		ICalProperty* _tmp92_;
		_tmp90_ = ical_vtodo;
		_tmp91_ = i_cal_component_get_first_property (_tmp90_, I_CAL_CREATED_PROPERTY);
		created_property = _tmp91_;
		_tmp92_ = created_property;
		if (_tmp92_ != NULL) {
			glong create_time = 0L;
			ICalProperty* _tmp93_;
			ICalTime* _tmp94_;
			ICalTime* _tmp95_;
			glong _tmp96_;
			_tmp93_ = created_property;
			_tmp94_ = i_cal_property_get_created (_tmp93_);
			_tmp95_ = _tmp94_;
			_tmp96_ = (glong) i_cal_time_as_timet (_tmp95_);
			_g_object_unref0 (_tmp95_);
			create_time = _tmp96_;
			objects_item_set_child_order (self, (gint) (create_time - 978307200L));
		} else {
		}
		_g_object_unref0 (created_property);
	}
	_tmp97_ = ical_vtodo;
	_tmp98_ = objects_item_find_x_property (_tmp97_, "X-PINNED");
	pinned_property = _tmp98_;
	_tmp99_ = pinned_property;
	if (_tmp99_ != NULL) {
		gchar* pinned_str = NULL;
		ICalProperty* _tmp100_;
		gchar* _tmp101_;
		const gchar* _tmp102_;
		_tmp100_ = pinned_property;
		_tmp101_ = i_cal_property_get_value_as_string (_tmp100_);
		pinned_str = _tmp101_;
		_tmp102_ = pinned_str;
		if (_tmp102_ != NULL) {
			const gchar* _tmp103_;
			_tmp103_ = pinned_str;
			objects_item_set_pinned (self, bool_parse (_tmp103_));
		}
		_g_free0 (pinned_str);
	} else {
		objects_item_set_pinned (self, FALSE);
	}
	_tmp104_ = ical;
	_tmp105_ = i_cal_component_as_ical_string (_tmp104_);
	_tmp106_ = _tmp105_;
	_tmp107_ = util_generate_extra_data (_ical_url, "", _tmp106_);
	_tmp108_ = _tmp107_;
	objects_item_set_extra_data (self, _tmp108_);
	_g_free0 (_tmp108_);
	_g_free0 (_tmp106_);
	_tmp109_ = ical_vtodo;
	_tmp110_ = _g_object_ref0 (_tmp109_);
	_tmp111_ = e_cal_component_new_from_icalcomponent (_tmp110_);
	ecal = _tmp111_;
	if (is_update) {
		ECalComponent* _tmp112_;
		GSList* _tmp113_;
		GSList* _tmp114_;
		GeeHashMap* _tmp115_;
		GeeHashMap* _tmp116_;
		_tmp112_ = ecal;
		_tmp113_ = e_cal_component_get_categories_list (_tmp112_);
		_tmp114_ = _tmp113_;
		_tmp115_ = objects_item_get_labels_maps_from_caldav (self, _tmp114_);
		_tmp116_ = _tmp115_;
		objects_item_check_labels (self, _tmp116_);
		_g_object_unref0 (_tmp116_);
		(_tmp114_ == NULL) ? NULL : (_tmp114_ = (_g_slist_free__g_free0_ (_tmp114_), NULL));
	} else {
		ECalComponent* _tmp117_;
		GSList* _tmp118_;
		GSList* _tmp119_;
		GeeArrayList* _tmp120_;
		GeeArrayList* _tmp121_;
		_tmp117_ = ecal;
		_tmp118_ = e_cal_component_get_categories_list (_tmp117_);
		_tmp119_ = _tmp118_;
		_tmp120_ = objects_item_get_caldav_categories (self, _tmp119_);
		_tmp121_ = _tmp120_;
		objects_item_set_labels (self, _tmp121_);
		_g_object_unref0 (_tmp121_);
		(_tmp119_ == NULL) ? NULL : (_tmp119_ = (_g_slist_free__g_free0_ (_tmp119_), NULL));
	}
	_g_object_unref0 (ecal);
	_g_object_unref0 (pinned_property);
	_g_object_unref0 (sort_order_property);
	_g_object_unref0 (percent_property);
	_g_object_unref0 (related_to_property);
	_g_object_unref0 (rrule_property);
	_g_object_unref0 (priority_property);
	_g_object_unref0 (ical_vtodo);
	_g_object_unref0 (ical);
}

static ICalProperty*
objects_item_find_x_property (ICalComponent* component,
                              const gchar* x_name)
{
	ICalProperty* prop = NULL;
	ICalProperty* _tmp0_;
	ICalProperty* result;
	g_return_val_if_fail (component != NULL, NULL);
	g_return_val_if_fail (x_name != NULL, NULL);
	_tmp0_ = i_cal_component_get_first_property (component, I_CAL_X_PROPERTY);
	prop = _tmp0_;
	while (TRUE) {
		ICalProperty* _tmp1_;
		ICalProperty* _tmp2_;
		const gchar* _tmp3_;
		ICalProperty* _tmp4_;
		_tmp1_ = prop;
		if (!(_tmp1_ != NULL)) {
			break;
		}
		_tmp2_ = prop;
		_tmp3_ = i_cal_property_get_x_name (_tmp2_);
		if (g_strcmp0 (_tmp3_, x_name) == 0) {
			result = prop;
			return result;
		}
		_tmp4_ = i_cal_component_get_next_property (component, I_CAL_X_PROPERTY);
		_g_object_unref0 (prop);
		prop = _tmp4_;
	}
	result = NULL;
	_g_object_unref0 (prop);
	return result;
}

static GeeArrayList*
objects_item_get_caldav_categories (ObjectsItem* self,
                                    GSList* categories_list)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GSList* category_collection = NULL;
		GSList* category_it = NULL;
		category_collection = categories_list;
		for (category_it = category_collection; category_it != NULL; category_it = category_it->next) {
			gchar* _tmp1_;
			gchar* category = NULL;
			_tmp1_ = g_strdup ((const gchar*) category_it->data);
			category = _tmp1_;
			{
				ObjectsLabel* label = NULL;
				ServicesStore* _tmp2_;
				const gchar* _tmp3_;
				ObjectsProject* _tmp4_;
				ObjectsProject* _tmp5_;
				const gchar* _tmp6_;
				const gchar* _tmp7_;
				ObjectsLabel* _tmp8_;
				ObjectsLabel* _tmp9_;
				GeeArrayList* _tmp31_;
				ObjectsLabel* _tmp32_;
				_tmp2_ = services_store_instance ();
				_tmp3_ = category;
				_tmp4_ = objects_item_get_project (self);
				_tmp5_ = _tmp4_;
				_tmp6_ = objects_project_get_source_id (_tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = services_store_get_label_by_name (_tmp2_, _tmp3_, TRUE, _tmp7_);
				label = _tmp8_;
				_tmp9_ = label;
				if (_tmp9_ == NULL) {
					ObjectsLabel* _tmp10_;
					ObjectsLabel* _tmp11_;
					Util* _tmp12_;
					Util* _tmp13_;
					ObjectsLabel* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_;
					ObjectsLabel* _tmp17_;
					const gchar* _tmp18_;
					ObjectsLabel* _tmp19_;
					Util* _tmp20_;
					Util* _tmp21_;
					gchar* _tmp22_;
					gchar* _tmp23_;
					ObjectsLabel* _tmp24_;
					ObjectsProject* _tmp25_;
					ObjectsProject* _tmp26_;
					const gchar* _tmp27_;
					const gchar* _tmp28_;
					ServicesStore* _tmp29_;
					ObjectsLabel* _tmp30_;
					_tmp10_ = objects_label_new ();
					_g_object_unref0 (label);
					label = _tmp10_;
					_tmp11_ = label;
					_tmp12_ = util_get_default ();
					_tmp13_ = _tmp12_;
					_tmp14_ = label;
					_tmp15_ = util_generate_id (_tmp13_, (ObjectsBaseObject*) _tmp14_);
					_tmp16_ = _tmp15_;
					objects_base_object_set_id ((ObjectsBaseObject*) _tmp11_, _tmp16_);
					_g_free0 (_tmp16_);
					_g_object_unref0 (_tmp13_);
					_tmp17_ = label;
					_tmp18_ = category;
					objects_base_object_set_name ((ObjectsBaseObject*) _tmp17_, _tmp18_);
					_tmp19_ = label;
					_tmp20_ = util_get_default ();
					_tmp21_ = _tmp20_;
					_tmp22_ = util_get_random_color (_tmp21_);
					_tmp23_ = _tmp22_;
					objects_base_object_set_color ((ObjectsBaseObject*) _tmp19_, _tmp23_);
					_g_free0 (_tmp23_);
					_g_object_unref0 (_tmp21_);
					_tmp24_ = label;
					_tmp25_ = objects_item_get_project (self);
					_tmp26_ = _tmp25_;
					_tmp27_ = objects_project_get_source_id (_tmp26_);
					_tmp28_ = _tmp27_;
					objects_label_set_source_id (_tmp24_, _tmp28_);
					_tmp29_ = services_store_instance ();
					_tmp30_ = label;
					services_store_insert_label (_tmp29_, _tmp30_);
				}
				_tmp31_ = return_value;
				_tmp32_ = label;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp31_, _tmp32_);
				_g_object_unref0 (label);
				_g_free0 (category);
			}
		}
	}
	result = return_value;
	return result;
}

void
objects_item_check_labels (ObjectsItem* self,
                           GeeHashMap* new_labels)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_labels != NULL);
	{
		GeeIterator* _entry_it = NULL;
		GeeSet* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_;
		GeeIterator* _tmp4_;
		_tmp0_ = gee_abstract_map_get_entries ((GeeAbstractMap*) new_labels);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_entry_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp6_;
			gpointer _tmp7_;
			GeeMapEntry* _tmp8_;
			gconstpointer _tmp9_;
			gconstpointer _tmp10_;
			ObjectsLabel* _tmp11_;
			ObjectsLabel* _tmp12_;
			gboolean _tmp13_;
			_tmp5_ = _entry_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _entry_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			entry = (GeeMapEntry*) _tmp7_;
			_tmp8_ = entry;
			_tmp9_ = gee_map_entry_get_key (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp11_ = objects_item_get_label (self, (const gchar*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = _tmp12_ == NULL;
			_g_object_unref0 (_tmp12_);
			if (_tmp13_) {
				GeeMapEntry* _tmp14_;
				gconstpointer _tmp15_;
				gconstpointer _tmp16_;
				ObjectsLabel* _tmp17_;
				ObjectsLabel* _tmp18_;
				_tmp14_ = entry;
				_tmp15_ = gee_map_entry_get_value (_tmp14_);
				_tmp16_ = _tmp15_;
				_tmp17_ = objects_item_add_label_if_not_exists (self, (ObjectsLabel*) _tmp16_);
				_tmp18_ = _tmp17_;
				_g_object_unref0 (_tmp18_);
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	{
		GeeArrayList* _label_list = NULL;
		GeeArrayList* _tmp19_;
		gint _label_size = 0;
		GeeArrayList* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		gint _label_index = 0;
		_tmp19_ = objects_item_get_labels_list (self);
		_label_list = _tmp19_;
		_tmp20_ = _label_list;
		_tmp21_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp20_);
		_tmp22_ = _tmp21_;
		_label_size = _tmp22_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp23_;
			gint _tmp24_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp25_;
			gpointer _tmp26_;
			ObjectsLabel* _tmp27_;
			const gchar* _tmp28_;
			const gchar* _tmp29_;
			_label_index = _label_index + 1;
			_tmp23_ = _label_index;
			_tmp24_ = _label_size;
			if (!(_tmp23_ < _tmp24_)) {
				break;
			}
			_tmp25_ = _label_list;
			_tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _tmp25_, _label_index);
			label = (ObjectsLabel*) _tmp26_;
			_tmp27_ = label;
			_tmp28_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp27_);
			_tmp29_ = _tmp28_;
			if (!gee_abstract_map_has_key ((GeeAbstractMap*) new_labels, _tmp29_)) {
				ObjectsLabel* _tmp30_;
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				ObjectsLabel* _tmp33_;
				ObjectsLabel* _tmp34_;
				_tmp30_ = label;
				_tmp31_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = objects_item_delete_item_label (self, _tmp32_);
				_tmp34_ = _tmp33_;
				_g_object_unref0 (_tmp34_);
			}
			_g_object_unref0 (label);
		}
		_g_object_unref0 (_label_list);
	}
}

GeeArrayList*
objects_item_get_labels_from_json (ObjectsItem* self,
                                   JsonNode* node)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	JsonObject* _tmp1_;
	JsonArray* _tmp2_;
	GList* _tmp3_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	_tmp1_ = json_node_get_object (node);
	_tmp2_ = json_object_get_array_member (_tmp1_, "labels");
	_tmp3_ = json_array_get_elements (_tmp2_);
	{
		GList* element_collection = NULL;
		GList* element_it = NULL;
		element_collection = _tmp3_;
		for (element_it = element_collection; element_it != NULL; element_it = element_it->next) {
			JsonNode* element = NULL;
			element = (JsonNode*) element_it->data;
			{
				ObjectsLabel* label = NULL;
				ServicesStore* _tmp4_;
				JsonNode* _tmp5_;
				const gchar* _tmp6_;
				ObjectsProject* _tmp7_;
				ObjectsProject* _tmp8_;
				const gchar* _tmp9_;
				const gchar* _tmp10_;
				ObjectsLabel* _tmp11_;
				GeeArrayList* _tmp12_;
				ObjectsLabel* _tmp13_;
				_tmp4_ = services_store_instance ();
				_tmp5_ = element;
				_tmp6_ = json_node_get_string (_tmp5_);
				_tmp7_ = objects_item_get_project (self);
				_tmp8_ = _tmp7_;
				_tmp9_ = objects_project_get_source_id (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = services_store_get_label_by_name (_tmp4_, _tmp6_, TRUE, _tmp10_);
				label = _tmp11_;
				_tmp12_ = return_value;
				_tmp13_ = label;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp13_);
				_g_object_unref0 (label);
			}
		}
		(element_collection == NULL) ? NULL : (element_collection = (g_list_free (element_collection), NULL));
	}
	result = return_value;
	return result;
}

GeeArrayList*
objects_item_get_labels_from_labels_json (ObjectsItem* self,
                                          JsonNode* node,
                                          GeeArrayList* labels_list)
{
	GeeArrayList* return_value = NULL;
	GeeArrayList* _tmp0_;
	JsonObject* _tmp1_;
	JsonArray* _tmp2_;
	GList* _tmp3_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (labels_list != NULL, NULL);
	_tmp0_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return_value = _tmp0_;
	_tmp1_ = json_node_get_object (node);
	_tmp2_ = json_object_get_array_member (_tmp1_, "labels");
	_tmp3_ = json_array_get_elements (_tmp2_);
	{
		GList* element_collection = NULL;
		GList* element_it = NULL;
		element_collection = _tmp3_;
		for (element_it = element_collection; element_it != NULL; element_it = element_it->next) {
			JsonNode* element = NULL;
			element = (JsonNode*) element_it->data;
			{
				ObjectsLabel* label = NULL;
				JsonNode* _tmp4_;
				const gchar* _tmp5_;
				ObjectsLabel* _tmp6_;
				GeeArrayList* _tmp7_;
				ObjectsLabel* _tmp8_;
				_tmp4_ = element;
				_tmp5_ = json_node_get_string (_tmp4_);
				_tmp6_ = objects_item_get_label_by_name (self, _tmp5_, labels_list);
				label = _tmp6_;
				_tmp7_ = return_value;
				_tmp8_ = label;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, _tmp8_);
				_g_object_unref0 (label);
			}
		}
		(element_collection == NULL) ? NULL : (element_collection = (g_list_free (element_collection), NULL));
	}
	result = return_value;
	return result;
}

static ObjectsLabel*
objects_item_get_label_by_name (ObjectsItem* self,
                                const gchar* name,
                                GeeArrayList* labels_list)
{
	ObjectsLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (labels_list != NULL, NULL);
	{
		GeeArrayList* _label_list = NULL;
		gint _label_size = 0;
		GeeArrayList* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gint _label_index = 0;
		_label_list = labels_list;
		_tmp0_ = _label_list;
		_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
		_tmp2_ = _tmp1_;
		_label_size = _tmp2_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp3_;
			gint _tmp4_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp5_;
			gpointer _tmp6_;
			ObjectsLabel* _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gboolean _tmp14_;
			_label_index = _label_index + 1;
			_tmp3_ = _label_index;
			_tmp4_ = _label_size;
			if (!(_tmp3_ < _tmp4_)) {
				break;
			}
			_tmp5_ = _label_list;
			_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, _label_index);
			label = (ObjectsLabel*) _tmp6_;
			_tmp7_ = label;
			_tmp8_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = g_utf8_strdown (_tmp9_, (gssize) -1);
			_tmp11_ = _tmp10_;
			_tmp12_ = g_utf8_strdown (name, (gssize) -1);
			_tmp13_ = _tmp12_;
			_tmp14_ = g_strcmp0 (_tmp11_, _tmp13_) == 0;
			_g_free0 (_tmp13_);
			_g_free0 (_tmp11_);
			if (_tmp14_) {
				result = label;
				return result;
			}
			_g_object_unref0 (label);
		}
	}
	result = NULL;
	return result;
}

GeeHashMap*
objects_item_get_labels_maps_from_json (ObjectsItem* self,
                                        JsonNode* node)
{
	GeeHashMap* return_value = NULL;
	GeeHashMap* _tmp0_;
	JsonObject* _tmp1_;
	JsonArray* _tmp2_;
	GList* _tmp3_;
	GeeHashMap* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	return_value = _tmp0_;
	_tmp1_ = json_node_get_object (node);
	_tmp2_ = json_object_get_array_member (_tmp1_, "labels");
	_tmp3_ = json_array_get_elements (_tmp2_);
	{
		GList* element_collection = NULL;
		GList* element_it = NULL;
		element_collection = _tmp3_;
		for (element_it = element_collection; element_it != NULL; element_it = element_it->next) {
			JsonNode* element = NULL;
			element = (JsonNode*) element_it->data;
			{
				ObjectsLabel* label = NULL;
				ServicesStore* _tmp4_;
				JsonNode* _tmp5_;
				const gchar* _tmp6_;
				ObjectsProject* _tmp7_;
				ObjectsProject* _tmp8_;
				const gchar* _tmp9_;
				const gchar* _tmp10_;
				ObjectsLabel* _tmp11_;
				GeeHashMap* _tmp12_;
				ObjectsLabel* _tmp13_;
				const gchar* _tmp14_;
				const gchar* _tmp15_;
				ObjectsLabel* _tmp16_;
				_tmp4_ = services_store_instance ();
				_tmp5_ = element;
				_tmp6_ = json_node_get_string (_tmp5_);
				_tmp7_ = objects_item_get_project (self);
				_tmp8_ = _tmp7_;
				_tmp9_ = objects_project_get_source_id (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = services_store_get_label_by_name (_tmp4_, _tmp6_, TRUE, _tmp10_);
				label = _tmp11_;
				_tmp12_ = return_value;
				_tmp13_ = label;
				_tmp14_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = label;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, _tmp15_, _tmp16_);
				_g_object_unref0 (label);
			}
		}
		(element_collection == NULL) ? NULL : (element_collection = (g_list_free (element_collection), NULL));
	}
	result = return_value;
	return result;
}

GeeHashMap*
objects_item_get_labels_maps_from_caldav (ObjectsItem* self,
                                          GSList* categories_list)
{
	GeeHashMap* return_value = NULL;
	GeeHashMap* _tmp0_;
	GeeHashMap* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	return_value = _tmp0_;
	{
		GSList* category_collection = NULL;
		GSList* category_it = NULL;
		category_collection = categories_list;
		for (category_it = category_collection; category_it != NULL; category_it = category_it->next) {
			gchar* _tmp1_;
			gchar* category = NULL;
			_tmp1_ = g_strdup ((const gchar*) category_it->data);
			category = _tmp1_;
			{
				ObjectsLabel* label = NULL;
				ServicesStore* _tmp2_;
				const gchar* _tmp3_;
				ObjectsProject* _tmp4_;
				ObjectsProject* _tmp5_;
				const gchar* _tmp6_;
				const gchar* _tmp7_;
				ObjectsLabel* _tmp8_;
				ObjectsLabel* _tmp9_;
				GeeHashMap* _tmp31_;
				ObjectsLabel* _tmp32_;
				const gchar* _tmp33_;
				const gchar* _tmp34_;
				ObjectsLabel* _tmp35_;
				_tmp2_ = services_store_instance ();
				_tmp3_ = category;
				_tmp4_ = objects_item_get_project (self);
				_tmp5_ = _tmp4_;
				_tmp6_ = objects_project_get_source_id (_tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = services_store_get_label_by_name (_tmp2_, _tmp3_, TRUE, _tmp7_);
				label = _tmp8_;
				_tmp9_ = label;
				if (_tmp9_ == NULL) {
					ObjectsLabel* _tmp10_;
					ObjectsLabel* _tmp11_;
					Util* _tmp12_;
					Util* _tmp13_;
					ObjectsLabel* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_;
					ObjectsLabel* _tmp17_;
					const gchar* _tmp18_;
					ObjectsLabel* _tmp19_;
					Util* _tmp20_;
					Util* _tmp21_;
					gchar* _tmp22_;
					gchar* _tmp23_;
					ObjectsLabel* _tmp24_;
					ObjectsProject* _tmp25_;
					ObjectsProject* _tmp26_;
					const gchar* _tmp27_;
					const gchar* _tmp28_;
					ServicesStore* _tmp29_;
					ObjectsLabel* _tmp30_;
					_tmp10_ = objects_label_new ();
					_g_object_unref0 (label);
					label = _tmp10_;
					_tmp11_ = label;
					_tmp12_ = util_get_default ();
					_tmp13_ = _tmp12_;
					_tmp14_ = label;
					_tmp15_ = util_generate_id (_tmp13_, (ObjectsBaseObject*) _tmp14_);
					_tmp16_ = _tmp15_;
					objects_base_object_set_id ((ObjectsBaseObject*) _tmp11_, _tmp16_);
					_g_free0 (_tmp16_);
					_g_object_unref0 (_tmp13_);
					_tmp17_ = label;
					_tmp18_ = category;
					objects_base_object_set_name ((ObjectsBaseObject*) _tmp17_, _tmp18_);
					_tmp19_ = label;
					_tmp20_ = util_get_default ();
					_tmp21_ = _tmp20_;
					_tmp22_ = util_get_random_color (_tmp21_);
					_tmp23_ = _tmp22_;
					objects_base_object_set_color ((ObjectsBaseObject*) _tmp19_, _tmp23_);
					_g_free0 (_tmp23_);
					_g_object_unref0 (_tmp21_);
					_tmp24_ = label;
					_tmp25_ = objects_item_get_project (self);
					_tmp26_ = _tmp25_;
					_tmp27_ = objects_project_get_source_id (_tmp26_);
					_tmp28_ = _tmp27_;
					objects_label_set_source_id (_tmp24_, _tmp28_);
					_tmp29_ = services_store_instance ();
					_tmp30_ = label;
					services_store_insert_label (_tmp29_, _tmp30_);
				}
				_tmp31_ = return_value;
				_tmp32_ = label;
				_tmp33_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp32_);
				_tmp34_ = _tmp33_;
				_tmp35_ = label;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp31_, _tmp34_, _tmp35_);
				_g_object_unref0 (label);
				_g_free0 (category);
			}
		}
	}
	result = return_value;
	return result;
}

void
objects_item_set_section (ObjectsItem* self,
                          ObjectsSection* section)
{
	ObjectsSection* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	_tmp0_ = _g_object_ref0 (section);
	_g_object_unref0 (self->priv->_section);
	self->priv->_section = _tmp0_;
}

void
objects_item_set_parent (ObjectsItem* self,
                         ObjectsItem* item)
{
	ObjectsItem* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (self->priv->_parent);
	self->priv->_parent = _tmp0_;
}

void
objects_item_set_project (ObjectsItem* self,
                          ObjectsProject* project)
{
	ObjectsProject* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_tmp0_ = _g_object_ref0 (project);
	_g_object_unref0 (self->priv->_project);
	self->priv->_project = _tmp0_;
}

static gchar*
objects_item_real_get_add_json (ObjectsBaseObject* base,
                                const gchar* temp_id,
                                const gchar* uuid)
{
	ObjectsItem * self;
	gchar* _tmp0_;
	gchar* result;
	self = (ObjectsItem*) base;
	g_return_val_if_fail (temp_id != NULL, NULL);
	g_return_val_if_fail (uuid != NULL, NULL);
	_tmp0_ = objects_base_object_get_update_json ((ObjectsBaseObject*) self, uuid, temp_id);
	result = _tmp0_;
	return result;
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

gchar*
objects_item_get_check_json (ObjectsItem* self,
                             const gchar* uuid,
                             const gchar* type,
                             const gchar* sync_token)
{
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp16_;
	JsonBuilder* _tmp17_;
	JsonBuilder* _tmp18_;
	JsonBuilder* _tmp19_;
	JsonBuilder* _tmp20_;
	JsonBuilder* _tmp21_;
	JsonBuilder* _tmp22_;
	JsonBuilder* _tmp23_;
	JsonBuilder* _tmp24_;
	JsonBuilder* _tmp25_;
	JsonBuilder* _tmp26_;
	JsonBuilder* _tmp27_;
	JsonBuilder* _tmp28_;
	JsonBuilder* _tmp29_;
	JsonBuilder* _tmp30_;
	JsonBuilder* _tmp31_;
	JsonBuilder* _tmp32_;
	JsonBuilder* _tmp33_;
	JsonBuilder* _tmp34_;
	JsonBuilder* _tmp35_;
	JsonBuilder* _tmp36_;
	JsonBuilder* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	JsonBuilder* _tmp40_;
	JsonBuilder* _tmp41_;
	JsonBuilder* _tmp42_;
	JsonBuilder* _tmp43_;
	JsonBuilder* _tmp44_;
	JsonBuilder* _tmp45_;
	JsonBuilder* _tmp46_;
	JsonBuilder* _tmp47_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp48_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp49_;
	JsonBuilder* _tmp50_;
	JsonNode* _tmp51_;
	gchar* _tmp52_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (uuid != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	_tmp0_ = objects_item_get_builder (self);
	_tmp1_ = _tmp0_;
	json_builder_reset (_tmp1_);
	_tmp2_ = objects_item_get_builder (self);
	_tmp3_ = _tmp2_;
	json_builder_begin_object (_tmp3_);
	if (sync_token != NULL) {
		JsonBuilder* _tmp4_;
		JsonBuilder* _tmp5_;
		JsonBuilder* _tmp6_;
		JsonBuilder* _tmp7_;
		JsonBuilder* _tmp8_;
		JsonBuilder* _tmp9_;
		JsonBuilder* _tmp10_;
		JsonBuilder* _tmp11_;
		JsonBuilder* _tmp12_;
		JsonBuilder* _tmp13_;
		JsonBuilder* _tmp14_;
		JsonBuilder* _tmp15_;
		_tmp4_ = objects_item_get_builder (self);
		_tmp5_ = _tmp4_;
		json_builder_set_member_name (_tmp5_, "sync_token");
		_tmp6_ = objects_item_get_builder (self);
		_tmp7_ = _tmp6_;
		json_builder_add_string_value (_tmp7_, sync_token);
		_tmp8_ = objects_item_get_builder (self);
		_tmp9_ = _tmp8_;
		json_builder_set_member_name (_tmp9_, "resource_types");
		_tmp10_ = objects_item_get_builder (self);
		_tmp11_ = _tmp10_;
		json_builder_begin_array (_tmp11_);
		_tmp12_ = objects_item_get_builder (self);
		_tmp13_ = _tmp12_;
		json_builder_add_string_value (_tmp13_, "items");
		_tmp14_ = objects_item_get_builder (self);
		_tmp15_ = _tmp14_;
		json_builder_end_array (_tmp15_);
	}
	_tmp16_ = objects_item_get_builder (self);
	_tmp17_ = _tmp16_;
	json_builder_set_member_name (_tmp17_, "commands");
	_tmp18_ = objects_item_get_builder (self);
	_tmp19_ = _tmp18_;
	json_builder_begin_array (_tmp19_);
	_tmp20_ = objects_item_get_builder (self);
	_tmp21_ = _tmp20_;
	json_builder_begin_object (_tmp21_);
	_tmp22_ = objects_item_get_builder (self);
	_tmp23_ = _tmp22_;
	json_builder_set_member_name (_tmp23_, "type");
	_tmp24_ = objects_item_get_builder (self);
	_tmp25_ = _tmp24_;
	json_builder_add_string_value (_tmp25_, type);
	_tmp26_ = objects_item_get_builder (self);
	_tmp27_ = _tmp26_;
	json_builder_set_member_name (_tmp27_, "uuid");
	_tmp28_ = objects_item_get_builder (self);
	_tmp29_ = _tmp28_;
	json_builder_add_string_value (_tmp29_, uuid);
	_tmp30_ = objects_item_get_builder (self);
	_tmp31_ = _tmp30_;
	json_builder_set_member_name (_tmp31_, "args");
	_tmp32_ = objects_item_get_builder (self);
	_tmp33_ = _tmp32_;
	json_builder_begin_object (_tmp33_);
	_tmp34_ = objects_item_get_builder (self);
	_tmp35_ = _tmp34_;
	json_builder_set_member_name (_tmp35_, "id");
	_tmp36_ = objects_item_get_builder (self);
	_tmp37_ = _tmp36_;
	_tmp38_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp39_ = _tmp38_;
	json_builder_add_string_value (_tmp37_, _tmp39_);
	_tmp40_ = objects_item_get_builder (self);
	_tmp41_ = _tmp40_;
	json_builder_end_object (_tmp41_);
	_tmp42_ = objects_item_get_builder (self);
	_tmp43_ = _tmp42_;
	json_builder_end_object (_tmp43_);
	_tmp44_ = objects_item_get_builder (self);
	_tmp45_ = _tmp44_;
	json_builder_end_array (_tmp45_);
	_tmp46_ = objects_item_get_builder (self);
	_tmp47_ = _tmp46_;
	json_builder_end_object (_tmp47_);
	_tmp48_ = json_generator_new ();
	generator = _tmp48_;
	_tmp49_ = objects_item_get_builder (self);
	_tmp50_ = _tmp49_;
	_tmp51_ = json_builder_get_root (_tmp50_);
	root = _tmp51_;
	json_generator_set_root (generator, root);
	_tmp52_ = json_generator_to_data (generator, NULL);
	result = _tmp52_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	return result;
}

void
objects_item_update_local (ObjectsItem* self)
{
	ServicesStore* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_store_instance ();
	services_store_update_item (_tmp0_, self, "");
}

static Block46Data*
block46_data_ref (Block46Data* _data46_)
{
	g_atomic_int_inc (&_data46_->_ref_count_);
	return _data46_;
}

static void
block46_data_unref (void * _userdata_)
{
	Block46Data* _data46_;
	_data46_ = (Block46Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data46_->_ref_count_)) {
		ObjectsItem* self;
		self = _data46_->self;
		_g_free0 (_data46_->update_id);
		_g_object_unref0 (self);
		g_slice_free (Block46Data, _data46_);
	}
}

static void
____lambda83_ (Block46Data* _data46_,
               GObject* obj,
               GAsyncResult* res)
{
	ObjectsItem* self;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	ServicesStore* _tmp4_;
	self = _data46_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_update_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_http_response_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	_tmp4_ = services_store_instance ();
	services_store_update_item (_tmp4_, self, _data46_->update_id);
}

static void
_____lambda83__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda83_ (self, source_object, res);
	block46_data_unref (self);
}

static Block47Data*
block47_data_ref (Block47Data* _data47_)
{
	g_atomic_int_inc (&_data47_->_ref_count_);
	return _data47_;
}

static void
block47_data_unref (void * _userdata_)
{
	Block47Data* _data47_;
	_data47_ = (Block47Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data47_->_ref_count_)) {
		ObjectsItem* self;
		self = _data47_->_data46_->self;
		_g_object_unref0 (_data47_->caldav_client);
		block46_data_unref (_data47_->_data46_);
		_data47_->_data46_ = NULL;
		g_slice_free (Block47Data, _data47_);
	}
}

static void
_____lambda84_ (Block47Data* _data47_,
                GObject* obj,
                GAsyncResult* res)
{
	Block46Data* _data46_;
	ObjectsItem* self;
	HttpResponse* response = NULL;
	ServicesCalDAVCalDAVClient* _tmp0_;
	HttpResponse* _tmp1_;
	HttpResponse* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	_data46_ = _data47_->_data46_;
	self = _data46_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data47_->caldav_client;
	_tmp1_ = services_cal_dav_cal_dav_client_add_item_finish (_tmp0_, res);
	response = _tmp1_;
	_tmp2_ = response;
	_tmp3_ = http_response_get_status (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		ServicesStore* _tmp5_;
		_tmp5_ = services_store_instance ();
		services_store_update_item (_tmp5_, self, _data46_->update_id);
	} else {
		HttpResponse* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp6_ = response;
		_tmp7_ = http_response_get_error_code (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ == 412) {
			ServicesEventBus* _tmp9_;
			ServicesEventBus* _tmp10_;
			ObjectsProject* _tmp11_;
			ObjectsProject* _tmp12_;
			ObjectsSource* _tmp13_;
			ObjectsSource* _tmp14_;
			_tmp9_ = services_event_bus_get_default ();
			_tmp10_ = _tmp9_;
			_tmp11_ = objects_item_get_project (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = objects_project_get_source (_tmp12_);
			_tmp14_ = _tmp13_;
			g_signal_emit_by_name (_tmp10_, "send-conflict-toast", _tmp14_);
			_g_object_unref0 (_tmp10_);
		}
	}
	_http_response_unref0 (response);
}

static void
______lambda84__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda84_ (self, source_object, res);
	block47_data_unref (self);
}

static gboolean
__lambda82_ (Block46Data* _data46_)
{
	ObjectsItem* self;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	gboolean result;
	self = _data46_->self;
	objects_base_object_set_update_timeout_id ((ObjectsBaseObject*) self, (guint) 0);
	_tmp0_ = objects_item_get_project (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_source_type (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == SOURCE_TYPE_LOCAL) {
		ServicesStore* _tmp4_;
		_tmp4_ = services_store_instance ();
		services_store_update_item (_tmp4_, self, _data46_->update_id);
	} else {
		ObjectsProject* _tmp5_;
		ObjectsProject* _tmp6_;
		SourceType _tmp7_;
		SourceType _tmp8_;
		_tmp5_ = objects_item_get_project (self);
		_tmp6_ = _tmp5_;
		_tmp7_ = objects_project_get_source_type (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ == SOURCE_TYPE_TODOIST) {
			ServicesTodoist* _tmp9_;
			ServicesTodoist* _tmp10_;
			_tmp9_ = services_todoist_get_default ();
			_tmp10_ = _tmp9_;
			services_todoist_update (_tmp10_, (ObjectsBaseObject*) self, _____lambda83__gasync_ready_callback, block46_data_ref (_data46_));
			_g_object_unref0 (_tmp10_);
		} else {
			ObjectsProject* _tmp11_;
			ObjectsProject* _tmp12_;
			SourceType _tmp13_;
			SourceType _tmp14_;
			_tmp11_ = objects_item_get_project (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = objects_project_get_source_type (_tmp12_);
			_tmp14_ = _tmp13_;
			if (_tmp14_ == SOURCE_TYPE_CALDAV) {
				Block47Data* _data47_;
				ServicesCalDAVCore* _tmp15_;
				ServicesCalDAVCore* _tmp16_;
				ObjectsProject* _tmp17_;
				ObjectsProject* _tmp18_;
				ObjectsSource* _tmp19_;
				ObjectsSource* _tmp20_;
				ServicesCalDAVCalDAVClient* _tmp21_;
				ServicesCalDAVCalDAVClient* _tmp22_;
				ServicesCalDAVCalDAVClient* _tmp23_;
				_data47_ = g_slice_new0 (Block47Data);
				_data47_->_ref_count_ = 1;
				_data47_->_data46_ = block46_data_ref (_data46_);
				_tmp15_ = services_cal_dav_core_get_default ();
				_tmp16_ = _tmp15_;
				_tmp17_ = objects_item_get_project (self);
				_tmp18_ = _tmp17_;
				_tmp19_ = objects_project_get_source (_tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = services_cal_dav_core_get_client (_tmp16_, _tmp20_);
				_tmp22_ = _tmp21_;
				_g_object_unref0 (_tmp16_);
				_data47_->caldav_client = _tmp22_;
				_tmp23_ = _data47_->caldav_client;
				services_cal_dav_cal_dav_client_add_item (_tmp23_, self, TRUE, ______lambda84__gasync_ready_callback, block47_data_ref (_data47_));
				block47_data_unref (_data47_);
				_data47_ = NULL;
			}
		}
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda82__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda82_ (self);
	return result;
}

void
objects_item_update (ObjectsItem* self,
                     const gchar* update_id)
{
	Block46Data* _data46_;
	gchar* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (update_id != NULL);
	_data46_ = g_slice_new0 (Block46Data);
	_data46_->_ref_count_ = 1;
	_data46_->self = g_object_ref (self);
	_tmp0_ = g_strdup (update_id);
	_g_free0 (_data46_->update_id);
	_data46_->update_id = _tmp0_;
	_tmp1_ = objects_base_object_get_update_timeout_id ((ObjectsBaseObject*) self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != ((guint) 0)) {
		guint _tmp3_;
		guint _tmp4_;
		_tmp3_ = objects_base_object_get_update_timeout_id ((ObjectsBaseObject*) self);
		_tmp4_ = _tmp3_;
		g_source_remove (_tmp4_);
	}
	objects_base_object_set_update_timeout_id ((ObjectsBaseObject*) self, g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) CONSTANTS_UPDATE_TIMEOUT, ___lambda82__gsource_func, block46_data_ref (_data46_), block46_data_unref));
	block46_data_unref (_data46_);
	_data46_ = NULL;
}

static Block48Data*
block48_data_ref (Block48Data* _data48_)
{
	g_atomic_int_inc (&_data48_->_ref_count_);
	return _data48_;
}

static void
block48_data_unref (void * _userdata_)
{
	Block48Data* _data48_;
	_data48_ = (Block48Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data48_->_ref_count_)) {
		ObjectsItem* self;
		self = _data48_->self;
		_g_free0 (_data48_->update_id);
		_g_object_unref0 (self);
		g_slice_free (Block48Data, _data48_);
	}
}

static void
____lambda86_ (Block48Data* _data48_,
               GObject* obj,
               GAsyncResult* res)
{
	ObjectsItem* self;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	ServicesStore* _tmp4_;
	self = _data48_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_update_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_http_response_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	_tmp4_ = services_store_instance ();
	services_store_update_item (_tmp4_, self, _data48_->update_id);
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
}

static void
_____lambda86__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda86_ (self, source_object, res);
	block48_data_unref (self);
}

static Block49Data*
block49_data_ref (Block49Data* _data49_)
{
	g_atomic_int_inc (&_data49_->_ref_count_);
	return _data49_;
}

static void
block49_data_unref (void * _userdata_)
{
	Block49Data* _data49_;
	_data49_ = (Block49Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data49_->_ref_count_)) {
		ObjectsItem* self;
		self = _data49_->_data48_->self;
		_g_object_unref0 (_data49_->caldav_client);
		block48_data_unref (_data49_->_data48_);
		_data49_->_data48_ = NULL;
		g_slice_free (Block49Data, _data49_);
	}
}

static void
_____lambda87_ (Block49Data* _data49_,
                GObject* obj,
                GAsyncResult* res)
{
	Block48Data* _data48_;
	ObjectsItem* self;
	HttpResponse* response = NULL;
	ServicesCalDAVCalDAVClient* _tmp0_;
	HttpResponse* _tmp1_;
	HttpResponse* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	_data48_ = _data49_->_data48_;
	self = _data48_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data49_->caldav_client;
	_tmp1_ = services_cal_dav_cal_dav_client_add_item_finish (_tmp0_, res);
	response = _tmp1_;
	_tmp2_ = response;
	_tmp3_ = http_response_get_status (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		ServicesStore* _tmp5_;
		_tmp5_ = services_store_instance ();
		services_store_update_item (_tmp5_, self, _data48_->update_id);
	} else {
		HttpResponse* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp6_ = response;
		_tmp7_ = http_response_get_error_code (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ == 412) {
			ServicesEventBus* _tmp9_;
			ServicesEventBus* _tmp10_;
			ObjectsProject* _tmp11_;
			ObjectsProject* _tmp12_;
			ObjectsSource* _tmp13_;
			ObjectsSource* _tmp14_;
			_tmp9_ = services_event_bus_get_default ();
			_tmp10_ = _tmp9_;
			_tmp11_ = objects_item_get_project (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = objects_project_get_source (_tmp12_);
			_tmp14_ = _tmp13_;
			g_signal_emit_by_name (_tmp10_, "send-conflict-toast", _tmp14_);
			_g_object_unref0 (_tmp10_);
		}
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	_http_response_unref0 (response);
}

static void
______lambda87__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda87_ (self, source_object, res);
	block49_data_unref (self);
}

static gboolean
__lambda85_ (Block48Data* _data48_)
{
	ObjectsItem* self;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	gboolean result;
	self = _data48_->self;
	objects_base_object_set_update_timeout_id ((ObjectsBaseObject*) self, (guint) 0);
	objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
	_tmp0_ = objects_item_get_project (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_source_type (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == SOURCE_TYPE_LOCAL) {
		ServicesStore* _tmp4_;
		_tmp4_ = services_store_instance ();
		services_store_update_item (_tmp4_, self, _data48_->update_id);
		objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	} else {
		ObjectsProject* _tmp5_;
		ObjectsProject* _tmp6_;
		SourceType _tmp7_;
		SourceType _tmp8_;
		_tmp5_ = objects_item_get_project (self);
		_tmp6_ = _tmp5_;
		_tmp7_ = objects_project_get_source_type (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ == SOURCE_TYPE_TODOIST) {
			ServicesTodoist* _tmp9_;
			ServicesTodoist* _tmp10_;
			_tmp9_ = services_todoist_get_default ();
			_tmp10_ = _tmp9_;
			services_todoist_update (_tmp10_, (ObjectsBaseObject*) self, _____lambda86__gasync_ready_callback, block48_data_ref (_data48_));
			_g_object_unref0 (_tmp10_);
		} else {
			ObjectsProject* _tmp11_;
			ObjectsProject* _tmp12_;
			SourceType _tmp13_;
			SourceType _tmp14_;
			_tmp11_ = objects_item_get_project (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = objects_project_get_source_type (_tmp12_);
			_tmp14_ = _tmp13_;
			if (_tmp14_ == SOURCE_TYPE_CALDAV) {
				Block49Data* _data49_;
				ServicesCalDAVCore* _tmp15_;
				ServicesCalDAVCore* _tmp16_;
				ObjectsProject* _tmp17_;
				ObjectsProject* _tmp18_;
				ObjectsSource* _tmp19_;
				ObjectsSource* _tmp20_;
				ServicesCalDAVCalDAVClient* _tmp21_;
				ServicesCalDAVCalDAVClient* _tmp22_;
				ServicesCalDAVCalDAVClient* _tmp23_;
				_data49_ = g_slice_new0 (Block49Data);
				_data49_->_ref_count_ = 1;
				_data49_->_data48_ = block48_data_ref (_data48_);
				_tmp15_ = services_cal_dav_core_get_default ();
				_tmp16_ = _tmp15_;
				_tmp17_ = objects_item_get_project (self);
				_tmp18_ = _tmp17_;
				_tmp19_ = objects_project_get_source (_tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = services_cal_dav_core_get_client (_tmp16_, _tmp20_);
				_tmp22_ = _tmp21_;
				_g_object_unref0 (_tmp16_);
				_data49_->caldav_client = _tmp22_;
				_tmp23_ = _data49_->caldav_client;
				services_cal_dav_cal_dav_client_add_item (_tmp23_, self, TRUE, ______lambda87__gasync_ready_callback, block49_data_ref (_data49_));
				block49_data_unref (_data49_);
				_data49_ = NULL;
			}
		}
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda85__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda85_ (self);
	return result;
}

void
objects_item_update_async_timeout (ObjectsItem* self,
                                   const gchar* update_id)
{
	Block48Data* _data48_;
	gchar* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (update_id != NULL);
	_data48_ = g_slice_new0 (Block48Data);
	_data48_->_ref_count_ = 1;
	_data48_->self = g_object_ref (self);
	_tmp0_ = g_strdup (update_id);
	_g_free0 (_data48_->update_id);
	_data48_->update_id = _tmp0_;
	_tmp1_ = objects_base_object_get_update_timeout_id ((ObjectsBaseObject*) self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != ((guint) 0)) {
		guint _tmp3_;
		guint _tmp4_;
		_tmp3_ = objects_base_object_get_update_timeout_id ((ObjectsBaseObject*) self);
		_tmp4_ = _tmp3_;
		g_source_remove (_tmp4_);
	}
	objects_base_object_set_update_timeout_id ((ObjectsBaseObject*) self, g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) CONSTANTS_UPDATE_TIMEOUT, ___lambda85__gsource_func, block48_data_ref (_data48_), block48_data_unref));
	block48_data_unref (_data48_);
	_data48_ = NULL;
}

static Block50Data*
block50_data_ref (Block50Data* _data50_)
{
	g_atomic_int_inc (&_data50_->_ref_count_);
	return _data50_;
}

static void
block50_data_unref (void * _userdata_)
{
	Block50Data* _data50_;
	_data50_ = (Block50Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data50_->_ref_count_)) {
		ObjectsItem* self;
		self = _data50_->self;
		_g_free0 (_data50_->update_id);
		_g_object_unref0 (self);
		g_slice_free (Block50Data, _data50_);
	}
}

static void
____lambda88_ (Block50Data* _data50_,
               GObject* obj,
               GAsyncResult* res)
{
	ObjectsItem* self;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	ServicesStore* _tmp4_;
	self = _data50_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_update_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_http_response_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	_tmp4_ = services_store_instance ();
	services_store_update_item (_tmp4_, self, _data50_->update_id);
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
}

static void
_____lambda88__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda88_ (self, source_object, res);
	block50_data_unref (self);
}

static Block51Data*
block51_data_ref (Block51Data* _data51_)
{
	g_atomic_int_inc (&_data51_->_ref_count_);
	return _data51_;
}

static void
block51_data_unref (void * _userdata_)
{
	Block51Data* _data51_;
	_data51_ = (Block51Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data51_->_ref_count_)) {
		ObjectsItem* self;
		self = _data51_->_data50_->self;
		_g_object_unref0 (_data51_->caldav_client);
		block50_data_unref (_data51_->_data50_);
		_data51_->_data50_ = NULL;
		g_slice_free (Block51Data, _data51_);
	}
}

static void
_____lambda89_ (Block51Data* _data51_,
                GObject* obj,
                GAsyncResult* res)
{
	Block50Data* _data50_;
	ObjectsItem* self;
	HttpResponse* response = NULL;
	ServicesCalDAVCalDAVClient* _tmp0_;
	HttpResponse* _tmp1_;
	HttpResponse* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	_data50_ = _data51_->_data50_;
	self = _data50_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data51_->caldav_client;
	_tmp1_ = services_cal_dav_cal_dav_client_add_item_finish (_tmp0_, res);
	response = _tmp1_;
	_tmp2_ = response;
	_tmp3_ = http_response_get_status (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		ServicesStore* _tmp5_;
		_tmp5_ = services_store_instance ();
		services_store_update_item (_tmp5_, self, _data50_->update_id);
	} else {
		HttpResponse* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp6_ = response;
		_tmp7_ = http_response_get_error_code (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ == 412) {
			ServicesEventBus* _tmp9_;
			ServicesEventBus* _tmp10_;
			ObjectsProject* _tmp11_;
			ObjectsProject* _tmp12_;
			ObjectsSource* _tmp13_;
			ObjectsSource* _tmp14_;
			_tmp9_ = services_event_bus_get_default ();
			_tmp10_ = _tmp9_;
			_tmp11_ = objects_item_get_project (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = objects_project_get_source (_tmp12_);
			_tmp14_ = _tmp13_;
			g_signal_emit_by_name (_tmp10_, "send-conflict-toast", _tmp14_);
			_g_object_unref0 (_tmp10_);
		}
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	_http_response_unref0 (response);
}

static void
______lambda89__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda89_ (self, source_object, res);
	block51_data_unref (self);
}

void
objects_item_update_async (ObjectsItem* self,
                           const gchar* update_id)
{
	Block50Data* _data50_;
	gchar* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	SourceType _tmp3_;
	SourceType _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (update_id != NULL);
	_data50_ = g_slice_new0 (Block50Data);
	_data50_->_ref_count_ = 1;
	_data50_->self = g_object_ref (self);
	_tmp0_ = g_strdup (update_id);
	_g_free0 (_data50_->update_id);
	_data50_->update_id = _tmp0_;
	objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
	_tmp1_ = objects_item_get_project (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = objects_project_get_source_type (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == SOURCE_TYPE_LOCAL) {
		ServicesStore* _tmp5_;
		_tmp5_ = services_store_instance ();
		services_store_update_item (_tmp5_, self, _data50_->update_id);
		objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	} else {
		ObjectsProject* _tmp6_;
		ObjectsProject* _tmp7_;
		SourceType _tmp8_;
		SourceType _tmp9_;
		_tmp6_ = objects_item_get_project (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = objects_project_get_source_type (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_ == SOURCE_TYPE_TODOIST) {
			ServicesTodoist* _tmp10_;
			ServicesTodoist* _tmp11_;
			_tmp10_ = services_todoist_get_default ();
			_tmp11_ = _tmp10_;
			services_todoist_update (_tmp11_, (ObjectsBaseObject*) self, _____lambda88__gasync_ready_callback, block50_data_ref (_data50_));
			_g_object_unref0 (_tmp11_);
		} else {
			ObjectsProject* _tmp12_;
			ObjectsProject* _tmp13_;
			SourceType _tmp14_;
			SourceType _tmp15_;
			_tmp12_ = objects_item_get_project (self);
			_tmp13_ = _tmp12_;
			_tmp14_ = objects_project_get_source_type (_tmp13_);
			_tmp15_ = _tmp14_;
			if (_tmp15_ == SOURCE_TYPE_CALDAV) {
				Block51Data* _data51_;
				ServicesCalDAVCore* _tmp16_;
				ServicesCalDAVCore* _tmp17_;
				ObjectsProject* _tmp18_;
				ObjectsProject* _tmp19_;
				ObjectsSource* _tmp20_;
				ObjectsSource* _tmp21_;
				ServicesCalDAVCalDAVClient* _tmp22_;
				ServicesCalDAVCalDAVClient* _tmp23_;
				ServicesCalDAVCalDAVClient* _tmp24_;
				_data51_ = g_slice_new0 (Block51Data);
				_data51_->_ref_count_ = 1;
				_data51_->_data50_ = block50_data_ref (_data50_);
				_tmp16_ = services_cal_dav_core_get_default ();
				_tmp17_ = _tmp16_;
				_tmp18_ = objects_item_get_project (self);
				_tmp19_ = _tmp18_;
				_tmp20_ = objects_project_get_source (_tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = services_cal_dav_core_get_client (_tmp17_, _tmp21_);
				_tmp23_ = _tmp22_;
				_g_object_unref0 (_tmp17_);
				_data51_->caldav_client = _tmp23_;
				_tmp24_ = _data51_->caldav_client;
				services_cal_dav_cal_dav_client_add_item (_tmp24_, self, TRUE, ______lambda89__gasync_ready_callback, block51_data_ref (_data51_));
				block51_data_unref (_data51_);
				_data51_ = NULL;
			}
		}
	}
	block50_data_unref (_data50_);
	_data50_ = NULL;
}

void
objects_item_update_pin (ObjectsItem* self,
                         gboolean _pinned)
{
	g_return_if_fail (self != NULL);
	objects_item_set_pinned (self, _pinned);
	_objects_item_update_pin (self);
}

static Block52Data*
block52_data_ref (Block52Data* _data52_)
{
	g_atomic_int_inc (&_data52_->_ref_count_);
	return _data52_;
}

static void
block52_data_unref (void * _userdata_)
{
	Block52Data* _data52_;
	_data52_ = (Block52Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data52_->_ref_count_)) {
		ObjectsItem* self;
		self = _data52_->self;
		_g_object_unref0 (_data52_->caldav_client);
		_g_object_unref0 (self);
		g_slice_free (Block52Data, _data52_);
	}
}

static void
___lambda90_ (Block52Data* _data52_,
              GObject* obj,
              GAsyncResult* res)
{
	ObjectsItem* self;
	HttpResponse* response = NULL;
	ServicesCalDAVCalDAVClient* _tmp0_;
	HttpResponse* _tmp1_;
	HttpResponse* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	self = _data52_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data52_->caldav_client;
	_tmp1_ = services_cal_dav_cal_dav_client_add_item_finish (_tmp0_, res);
	response = _tmp1_;
	_tmp2_ = response;
	_tmp3_ = http_response_get_status (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		ServicesStore* _tmp5_;
		_tmp5_ = services_store_instance ();
		services_store_update_item_pin (_tmp5_, self);
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	_http_response_unref0 (response);
}

static void
____lambda90__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda90_ (self, source_object, res);
	block52_data_unref (self);
}

static void
_objects_item_update_pin (ObjectsItem* self)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = objects_item_get_project (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_source_type (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == SOURCE_TYPE_CALDAV) {
		Block52Data* _data52_;
		ServicesCalDAVCore* _tmp4_;
		ServicesCalDAVCore* _tmp5_;
		ObjectsProject* _tmp6_;
		ObjectsProject* _tmp7_;
		ObjectsSource* _tmp8_;
		ObjectsSource* _tmp9_;
		ServicesCalDAVCalDAVClient* _tmp10_;
		ServicesCalDAVCalDAVClient* _tmp11_;
		ServicesCalDAVCalDAVClient* _tmp12_;
		_data52_ = g_slice_new0 (Block52Data);
		_data52_->_ref_count_ = 1;
		_data52_->self = g_object_ref (self);
		objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
		_tmp4_ = services_cal_dav_core_get_default ();
		_tmp5_ = _tmp4_;
		_tmp6_ = objects_item_get_project (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = objects_project_get_source (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = services_cal_dav_core_get_client (_tmp5_, _tmp9_);
		_tmp11_ = _tmp10_;
		_g_object_unref0 (_tmp5_);
		_data52_->caldav_client = _tmp11_;
		_tmp12_ = _data52_->caldav_client;
		services_cal_dav_cal_dav_client_add_item (_tmp12_, self, TRUE, ____lambda90__gasync_ready_callback, block52_data_ref (_data52_));
		block52_data_unref (_data52_);
		_data52_ = NULL;
	} else {
		ServicesStore* _tmp13_;
		_tmp13_ = services_store_instance ();
		services_store_update_item_pin (_tmp13_, self);
	}
}

ObjectsReminder*
objects_item_add_reminder_if_not_exists (ObjectsItem* self,
                                         ObjectsReminder* reminder,
                                         gboolean insert_db)
{
	ObjectsReminder* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsReminder* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (reminder != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_reminders;
		g_rec_mutex_lock (&self->priv->__lock__reminders);
		{
			ObjectsReminder* _tmp1_;
			ObjectsReminder* _tmp2_;
			ObjectsReminder* _tmp4_;
			ObjectsReminder* _tmp5_;
			_tmp1_ = objects_item_get_reminder (self, reminder);
			_g_object_unref0 (return_value);
			return_value = _tmp1_;
			_tmp2_ = return_value;
			if (_tmp2_ == NULL) {
				if (insert_db) {
					ServicesStore* _tmp3_;
					_tmp3_ = services_store_instance ();
					services_store_insert_reminder (_tmp3_, reminder);
				} else {
					g_signal_emit (self, objects_item_signals[OBJECTS_ITEM_REMINDER_ADDED_SIGNAL], 0, reminder);
				}
				_objects_item_add_reminder (self, reminder);
			}
			_tmp4_ = return_value;
			_tmp5_ = _g_object_ref0 (_tmp4_);
			result = _tmp5_;
			{
				GeeArrayList* _tmp6_;
				_tmp6_ = self->priv->_reminders;
				g_rec_mutex_unlock (&self->priv->__lock__reminders);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp7_;
			_tmp7_ = 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;
	}
}

static ObjectsReminder*
objects_item_get_reminder (ObjectsItem* self,
                           ObjectsReminder* reminder)
{
	ObjectsReminder* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsReminder* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (reminder != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_reminders;
		g_rec_mutex_lock (&self->priv->__lock__reminders);
		{
			{
				GeeArrayList* __reminder_list = NULL;
				GeeArrayList* _tmp1_;
				gint __reminder_size = 0;
				GeeArrayList* _tmp2_;
				gint _tmp3_;
				gint _tmp4_;
				gint __reminder_index = 0;
				_tmp1_ = self->priv->_reminders;
				__reminder_list = _tmp1_;
				_tmp2_ = __reminder_list;
				_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
				_tmp4_ = _tmp3_;
				__reminder_size = _tmp4_;
				__reminder_index = -1;
				while (TRUE) {
					gint _tmp5_;
					gint _tmp6_;
					ObjectsReminder* _reminder = NULL;
					GeeArrayList* _tmp7_;
					gpointer _tmp8_;
					GDateTime* _tmp9_;
					GDateTime* _tmp10_;
					ObjectsReminder* _tmp11_;
					GDateTime* _tmp12_;
					GDateTime* _tmp13_;
					__reminder_index = __reminder_index + 1;
					_tmp5_ = __reminder_index;
					_tmp6_ = __reminder_size;
					if (!(_tmp5_ < _tmp6_)) {
						break;
					}
					_tmp7_ = __reminder_list;
					_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, __reminder_index);
					_reminder = (ObjectsReminder*) _tmp8_;
					_tmp9_ = objects_reminder_get_datetime (reminder);
					_tmp10_ = _tmp9_;
					_tmp11_ = _reminder;
					_tmp12_ = objects_reminder_get_datetime (_tmp11_);
					_tmp13_ = _tmp12_;
					if (g_date_time_compare (_tmp10_, _tmp13_) == 0) {
						ObjectsReminder* _tmp14_;
						ObjectsReminder* _tmp15_;
						_tmp14_ = _reminder;
						_tmp15_ = _g_object_ref0 (_tmp14_);
						_g_object_unref0 (return_value);
						return_value = _tmp15_;
						_g_object_unref0 (_reminder);
						break;
					}
					_g_object_unref0 (_reminder);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp16_;
			_tmp16_ = self->priv->_reminders;
			g_rec_mutex_unlock (&self->priv->__lock__reminders);
		}
		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;
}

static void
_objects_item_add_reminder (ObjectsItem* self,
                            ObjectsReminder* reminder)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reminder != NULL);
	_tmp0_ = self->priv->_reminders;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, reminder);
}

ObjectsAttachment*
objects_item_add_attachment_if_not_exists (ObjectsItem* self,
                                           ObjectsAttachment* attachment)
{
	ObjectsAttachment* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsAttachment* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (attachment != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_attachments;
		g_rec_mutex_lock (&self->priv->__lock__attachments);
		{
			ObjectsAttachment* _tmp1_;
			ObjectsAttachment* _tmp2_;
			ObjectsAttachment* _tmp4_;
			ObjectsAttachment* _tmp5_;
			_tmp1_ = objects_item_get_attachment (self, attachment);
			_g_object_unref0 (return_value);
			return_value = _tmp1_;
			_tmp2_ = return_value;
			if (_tmp2_ == NULL) {
				ServicesStore* _tmp3_;
				_tmp3_ = services_store_instance ();
				services_store_insert_attachment (_tmp3_, attachment);
				objects_item_add_attachment (self, attachment);
			}
			_tmp4_ = return_value;
			_tmp5_ = _g_object_ref0 (_tmp4_);
			result = _tmp5_;
			{
				GeeArrayList* _tmp6_;
				_tmp6_ = self->priv->_attachments;
				g_rec_mutex_unlock (&self->priv->__lock__attachments);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp7_;
			_tmp7_ = 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;
	}
}

static ObjectsAttachment*
objects_item_get_attachment (ObjectsItem* self,
                             ObjectsAttachment* attachment)
{
	ObjectsAttachment* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsAttachment* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (attachment != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_attachments;
		g_rec_mutex_lock (&self->priv->__lock__attachments);
		{
			{
				GeeArrayList* __attachment_list = NULL;
				GeeArrayList* _tmp1_;
				gint __attachment_size = 0;
				GeeArrayList* _tmp2_;
				gint _tmp3_;
				gint _tmp4_;
				gint __attachment_index = 0;
				_tmp1_ = self->priv->_attachments;
				__attachment_list = _tmp1_;
				_tmp2_ = __attachment_list;
				_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
				_tmp4_ = _tmp3_;
				__attachment_size = _tmp4_;
				__attachment_index = -1;
				while (TRUE) {
					gint _tmp5_;
					gint _tmp6_;
					ObjectsAttachment* _attachment = NULL;
					GeeArrayList* _tmp7_;
					gpointer _tmp8_;
					ObjectsAttachment* _tmp9_;
					const gchar* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					__attachment_index = __attachment_index + 1;
					_tmp5_ = __attachment_index;
					_tmp6_ = __attachment_size;
					if (!(_tmp5_ < _tmp6_)) {
						break;
					}
					_tmp7_ = __attachment_list;
					_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, __attachment_index);
					_attachment = (ObjectsAttachment*) _tmp8_;
					_tmp9_ = _attachment;
					_tmp10_ = objects_attachment_get_file_path (_tmp9_);
					_tmp11_ = _tmp10_;
					_tmp12_ = objects_attachment_get_file_path (attachment);
					_tmp13_ = _tmp12_;
					if (g_strcmp0 (_tmp11_, _tmp13_) == 0) {
						ObjectsAttachment* _tmp14_;
						ObjectsAttachment* _tmp15_;
						_tmp14_ = _attachment;
						_tmp15_ = _g_object_ref0 (_tmp14_);
						_g_object_unref0 (return_value);
						return_value = _tmp15_;
						_g_object_unref0 (_attachment);
						break;
					}
					_g_object_unref0 (_attachment);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp16_;
			_tmp16_ = self->priv->_attachments;
			g_rec_mutex_unlock (&self->priv->__lock__attachments);
		}
		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;
}

static void
objects_item_add_attachment (ObjectsItem* self,
                             ObjectsAttachment* attachment)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (attachment != NULL);
	_tmp0_ = self->priv->_attachments;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, attachment);
}

ObjectsLabel*
objects_item_add_label_if_not_exists (ObjectsItem* self,
                                      ObjectsLabel* label)
{
	ObjectsLabel* return_value = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ObjectsLabel* _tmp2_;
	ObjectsLabel* _tmp3_;
	ObjectsLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	return_value = NULL;
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) label);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_item_get_label (self, _tmp1_);
	_g_object_unref0 (return_value);
	return_value = _tmp2_;
	_tmp3_ = return_value;
	if (_tmp3_ == NULL) {
		ObjectsLabel* _tmp4_;
		ServicesStore* _tmp5_;
		ObjectsLabel* _tmp6_;
		ObjectsLabel* _tmp7_;
		_tmp4_ = _g_object_ref0 (label);
		_g_object_unref0 (return_value);
		return_value = _tmp4_;
		_tmp5_ = services_store_instance ();
		_tmp6_ = return_value;
		g_signal_emit_by_name (_tmp5_, "item-label-added", _tmp6_);
		_tmp7_ = return_value;
		objects_item_add_item_label (self, _tmp7_);
	}
	result = return_value;
	return result;
}

ObjectsLabel*
objects_item_get_label (ObjectsItem* self,
                        const gchar* id)
{
	ObjectsLabel* return_value = NULL;
	ObjectsLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _label_list = NULL;
		GeeArrayList* _tmp0_;
		gint _label_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _label_index = 0;
		_tmp0_ = self->priv->_labels;
		_label_list = _tmp0_;
		_tmp1_ = _label_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_label_size = _tmp3_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			ObjectsLabel* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_label_index = _label_index + 1;
			_tmp4_ = _label_index;
			_tmp5_ = _label_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _label_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _label_index);
			label = (ObjectsLabel*) _tmp7_;
			_tmp8_ = label;
			_tmp9_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp8_);
			_tmp10_ = _tmp9_;
			if (g_strcmp0 (_tmp10_, id) == 0) {
				ObjectsLabel* _tmp11_;
				ObjectsLabel* _tmp12_;
				_tmp11_ = label;
				_tmp12_ = _g_object_ref0 (_tmp11_);
				_g_object_unref0 (return_value);
				return_value = _tmp12_;
				_g_object_unref0 (label);
				break;
			}
			_g_object_unref0 (label);
		}
	}
	result = return_value;
	return result;
}

gboolean
objects_item_has_label (ObjectsItem* self,
                        const gchar* id)
{
	ObjectsLabel* _tmp0_;
	ObjectsLabel* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (id != NULL, FALSE);
	_tmp0_ = objects_item_get_label (self, id);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_ == NULL;
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}

gboolean
objects_item_has_labels (ObjectsItem* self)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_labels;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ > 0;
	return result;
}

void
objects_item_add_item_label (ObjectsItem* self,
                             ObjectsLabel* label)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = self->priv->_labels;
	if (_tmp0_ == NULL) {
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		_tmp1_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_tmp2_ = _tmp1_;
		objects_item_set_labels (self, _tmp2_);
		_g_object_unref0 (_tmp2_);
	}
	_tmp3_ = self->priv->_labels;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, label);
	g_signal_emit (self, objects_item_signals[OBJECTS_ITEM_ITEM_LABEL_ADDED_SIGNAL], 0, label);
}

void
objects_item_clean_labels (ObjectsItem* self)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_labels;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp0_);
}

ObjectsLabel*
objects_item_delete_item_label (ObjectsItem* self,
                                const gchar* id)
{
	ObjectsLabel* return_value = NULL;
	ObjectsLabel* _tmp0_;
	ObjectsLabel* _tmp1_;
	ObjectsLabel* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	return_value = NULL;
	_tmp0_ = objects_item_get_label (self, id);
	_g_object_unref0 (return_value);
	return_value = _tmp0_;
	_tmp1_ = return_value;
	if (_tmp1_ != NULL) {
		GeeArrayList* _tmp2_;
		ObjectsLabel* _tmp3_;
		ServicesStore* _tmp4_;
		ObjectsLabel* _tmp5_;
		ObjectsLabel* _tmp6_;
		_tmp2_ = self->priv->_labels;
		_tmp3_ = return_value;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp2_, _tmp3_);
		_tmp4_ = services_store_instance ();
		_tmp5_ = return_value;
		g_signal_emit_by_name (_tmp4_, "item-label-deleted", _tmp5_);
		_tmp6_ = return_value;
		g_signal_emit (self, objects_item_signals[OBJECTS_ITEM_ITEM_LABEL_DELETED_SIGNAL], 0, _tmp6_);
	}
	result = return_value;
	return result;
}

gchar*
objects_item_to_move_json (ObjectsItem* self,
                           const gchar* type,
                           const gchar* move_id)
{
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp4_;
	JsonBuilder* _tmp5_;
	JsonBuilder* _tmp6_;
	JsonBuilder* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	JsonBuilder* _tmp10_;
	JsonBuilder* _tmp11_;
	JsonBuilder* _tmp12_;
	JsonBuilder* _tmp13_;
	JsonBuilder* _tmp14_;
	JsonBuilder* _tmp15_;
	ServicesDatabase* _tmp16_;
	ServicesDatabase* _tmp17_;
	gboolean _tmp18_;
	JsonBuilder* _tmp27_;
	JsonBuilder* _tmp28_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp29_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp30_;
	JsonBuilder* _tmp31_;
	JsonNode* _tmp32_;
	gchar* _tmp33_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	g_return_val_if_fail (move_id != NULL, NULL);
	_tmp0_ = objects_item_get_builder (self);
	_tmp1_ = _tmp0_;
	json_builder_reset (_tmp1_);
	_tmp2_ = objects_item_get_builder (self);
	_tmp3_ = _tmp2_;
	json_builder_begin_object (_tmp3_);
	_tmp4_ = objects_item_get_builder (self);
	_tmp5_ = _tmp4_;
	json_builder_set_member_name (_tmp5_, "id");
	_tmp6_ = objects_item_get_builder (self);
	_tmp7_ = _tmp6_;
	_tmp8_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp9_ = _tmp8_;
	json_builder_add_string_value (_tmp7_, _tmp9_);
	_tmp10_ = objects_item_get_builder (self);
	_tmp11_ = _tmp10_;
	json_builder_set_member_name (_tmp11_, "type");
	_tmp12_ = objects_item_get_builder (self);
	_tmp13_ = _tmp12_;
	json_builder_add_string_value (_tmp13_, type);
	_tmp14_ = objects_item_get_builder (self);
	_tmp15_ = _tmp14_;
	json_builder_set_member_name (_tmp15_, type);
	_tmp16_ = services_database_get_default ();
	_tmp17_ = _tmp16_;
	_tmp18_ = services_database_curTempIds_exists (_tmp17_, move_id);
	_g_object_unref0 (_tmp17_);
	if (_tmp18_) {
		JsonBuilder* _tmp19_;
		JsonBuilder* _tmp20_;
		ServicesDatabase* _tmp21_;
		ServicesDatabase* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		_tmp19_ = objects_item_get_builder (self);
		_tmp20_ = _tmp19_;
		_tmp21_ = services_database_get_default ();
		_tmp22_ = _tmp21_;
		_tmp23_ = services_database_get_temp_id (_tmp22_, move_id);
		_tmp24_ = _tmp23_;
		json_builder_add_string_value (_tmp20_, _tmp24_);
		_g_free0 (_tmp24_);
		_g_object_unref0 (_tmp22_);
	} else {
		JsonBuilder* _tmp25_;
		JsonBuilder* _tmp26_;
		_tmp25_ = objects_item_get_builder (self);
		_tmp26_ = _tmp25_;
		json_builder_add_string_value (_tmp26_, move_id);
	}
	_tmp27_ = objects_item_get_builder (self);
	_tmp28_ = _tmp27_;
	json_builder_end_object (_tmp28_);
	_tmp29_ = json_generator_new ();
	generator = _tmp29_;
	_tmp30_ = objects_item_get_builder (self);
	_tmp31_ = _tmp30_;
	_tmp32_ = json_builder_get_root (_tmp31_);
	root = _tmp32_;
	json_generator_set_root (generator, root);
	_tmp33_ = json_generator_to_data (generator, NULL);
	result = _tmp33_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	return result;
}

gchar*
objects_item_get_move_item (ObjectsItem* self,
                            const gchar* uuid,
                            const gchar* type,
                            const gchar* move_id)
{
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp4_;
	JsonBuilder* _tmp5_;
	JsonBuilder* _tmp6_;
	JsonBuilder* _tmp7_;
	JsonBuilder* _tmp8_;
	JsonBuilder* _tmp9_;
	JsonBuilder* _tmp10_;
	JsonBuilder* _tmp11_;
	JsonBuilder* _tmp12_;
	JsonBuilder* _tmp13_;
	JsonBuilder* _tmp14_;
	JsonBuilder* _tmp15_;
	JsonBuilder* _tmp16_;
	JsonBuilder* _tmp17_;
	JsonBuilder* _tmp18_;
	JsonBuilder* _tmp19_;
	JsonBuilder* _tmp20_;
	JsonBuilder* _tmp21_;
	JsonBuilder* _tmp22_;
	JsonBuilder* _tmp23_;
	JsonBuilder* _tmp24_;
	JsonBuilder* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	JsonBuilder* _tmp28_;
	JsonBuilder* _tmp29_;
	JsonBuilder* _tmp30_;
	JsonBuilder* _tmp31_;
	JsonBuilder* _tmp32_;
	JsonBuilder* _tmp33_;
	JsonBuilder* _tmp34_;
	JsonBuilder* _tmp35_;
	JsonBuilder* _tmp36_;
	JsonBuilder* _tmp37_;
	JsonBuilder* _tmp38_;
	JsonBuilder* _tmp39_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp40_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp41_;
	JsonBuilder* _tmp42_;
	JsonNode* _tmp43_;
	gchar* _tmp44_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (uuid != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	g_return_val_if_fail (move_id != NULL, NULL);
	_tmp0_ = objects_item_get_builder (self);
	_tmp1_ = _tmp0_;
	json_builder_reset (_tmp1_);
	_tmp2_ = objects_item_get_builder (self);
	_tmp3_ = _tmp2_;
	json_builder_begin_object (_tmp3_);
	_tmp4_ = objects_item_get_builder (self);
	_tmp5_ = _tmp4_;
	json_builder_set_member_name (_tmp5_, "commands");
	_tmp6_ = objects_item_get_builder (self);
	_tmp7_ = _tmp6_;
	json_builder_begin_array (_tmp7_);
	_tmp8_ = objects_item_get_builder (self);
	_tmp9_ = _tmp8_;
	json_builder_begin_object (_tmp9_);
	_tmp10_ = objects_item_get_builder (self);
	_tmp11_ = _tmp10_;
	json_builder_set_member_name (_tmp11_, "type");
	_tmp12_ = objects_item_get_builder (self);
	_tmp13_ = _tmp12_;
	json_builder_add_string_value (_tmp13_, "item_move");
	_tmp14_ = objects_item_get_builder (self);
	_tmp15_ = _tmp14_;
	json_builder_set_member_name (_tmp15_, "uuid");
	_tmp16_ = objects_item_get_builder (self);
	_tmp17_ = _tmp16_;
	json_builder_add_string_value (_tmp17_, uuid);
	_tmp18_ = objects_item_get_builder (self);
	_tmp19_ = _tmp18_;
	json_builder_set_member_name (_tmp19_, "args");
	_tmp20_ = objects_item_get_builder (self);
	_tmp21_ = _tmp20_;
	json_builder_begin_object (_tmp21_);
	_tmp22_ = objects_item_get_builder (self);
	_tmp23_ = _tmp22_;
	json_builder_set_member_name (_tmp23_, "id");
	_tmp24_ = objects_item_get_builder (self);
	_tmp25_ = _tmp24_;
	_tmp26_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp27_ = _tmp26_;
	json_builder_add_string_value (_tmp25_, _tmp27_);
	_tmp28_ = objects_item_get_builder (self);
	_tmp29_ = _tmp28_;
	json_builder_set_member_name (_tmp29_, type);
	_tmp30_ = objects_item_get_builder (self);
	_tmp31_ = _tmp30_;
	json_builder_add_string_value (_tmp31_, move_id);
	_tmp32_ = objects_item_get_builder (self);
	_tmp33_ = _tmp32_;
	json_builder_end_object (_tmp33_);
	_tmp34_ = objects_item_get_builder (self);
	_tmp35_ = _tmp34_;
	json_builder_end_object (_tmp35_);
	_tmp36_ = objects_item_get_builder (self);
	_tmp37_ = _tmp36_;
	json_builder_end_array (_tmp37_);
	_tmp38_ = objects_item_get_builder (self);
	_tmp39_ = _tmp38_;
	json_builder_end_object (_tmp39_);
	_tmp40_ = json_generator_new ();
	generator = _tmp40_;
	_tmp41_ = objects_item_get_builder (self);
	_tmp42_ = _tmp41_;
	_tmp43_ = json_builder_get_root (_tmp42_);
	root = _tmp43_;
	json_generator_set_root (generator, root);
	_tmp44_ = json_generator_to_data (generator, NULL);
	result = _tmp44_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	return result;
}

static gchar*
objects_item_real_get_update_json (ObjectsBaseObject* base,
                                   const gchar* uuid,
                                   const gchar* temp_id)
{
	ObjectsItem * self;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp4_;
	JsonBuilder* _tmp5_;
	JsonBuilder* _tmp6_;
	JsonBuilder* _tmp7_;
	const gchar* _tmp8_ = NULL;
	JsonBuilder* _tmp9_;
	JsonBuilder* _tmp10_;
	JsonBuilder* _tmp11_;
	JsonBuilder* _tmp14_;
	JsonBuilder* _tmp15_;
	JsonBuilder* _tmp36_;
	JsonBuilder* _tmp37_;
	const gchar* _tmp38_;
	JsonBuilder* _tmp39_;
	JsonBuilder* _tmp40_;
	const gchar* _tmp41_;
	JsonBuilder* _tmp42_;
	JsonBuilder* _tmp43_;
	gint _tmp44_;
	JsonBuilder* _tmp45_;
	gint _tmp46_;
	gboolean _tmp50_;
	gboolean _tmp51_;
	gboolean _tmp67_;
	gboolean _tmp68_;
	JsonBuilder* _tmp80_;
	JsonBuilder* _tmp81_;
	JsonBuilder* _tmp94_;
	JsonBuilder* _tmp95_;
	JsonBuilder* _tmp96_;
	JsonBuilder* _tmp97_;
	JsonBuilder* _tmp98_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp99_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp100_;
	JsonNode* _tmp101_;
	gchar* _tmp102_;
	gchar* result;
	self = (ObjectsItem*) base;
	g_return_val_if_fail (uuid != NULL, NULL);
	_tmp0_ = objects_item_get_builder (self);
	_tmp1_ = _tmp0_;
	json_builder_reset (_tmp1_);
	_tmp2_ = json_builder_new ();
	builder = _tmp2_;
	_tmp3_ = builder;
	json_builder_begin_object (_tmp3_);
	_tmp4_ = builder;
	json_builder_set_member_name (_tmp4_, "commands");
	_tmp5_ = builder;
	json_builder_begin_array (_tmp5_);
	_tmp6_ = builder;
	json_builder_begin_object (_tmp6_);
	_tmp7_ = builder;
	json_builder_set_member_name (_tmp7_, "type");
	if (temp_id == NULL) {
		_tmp8_ = "item_update";
	} else {
		_tmp8_ = "item_add";
	}
	_tmp9_ = builder;
	json_builder_add_string_value (_tmp9_, _tmp8_);
	_tmp10_ = builder;
	json_builder_set_member_name (_tmp10_, "uuid");
	_tmp11_ = builder;
	json_builder_add_string_value (_tmp11_, uuid);
	if (temp_id != NULL) {
		JsonBuilder* _tmp12_;
		JsonBuilder* _tmp13_;
		_tmp12_ = builder;
		json_builder_set_member_name (_tmp12_, "temp_id");
		_tmp13_ = builder;
		json_builder_add_string_value (_tmp13_, temp_id);
	}
	_tmp14_ = builder;
	json_builder_set_member_name (_tmp14_, "args");
	_tmp15_ = builder;
	json_builder_begin_object (_tmp15_);
	if (temp_id == NULL) {
		JsonBuilder* _tmp16_;
		JsonBuilder* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		_tmp16_ = builder;
		json_builder_set_member_name (_tmp16_, "id");
		_tmp17_ = builder;
		_tmp18_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
		_tmp19_ = _tmp18_;
		json_builder_add_string_value (_tmp17_, _tmp19_);
	}
	if (temp_id != NULL) {
		JsonBuilder* _tmp20_;
		JsonBuilder* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		_tmp20_ = builder;
		json_builder_set_member_name (_tmp20_, "project_id");
		_tmp21_ = builder;
		_tmp22_ = objects_item_get_project_id (self);
		_tmp23_ = _tmp22_;
		json_builder_add_string_value (_tmp21_, _tmp23_);
		_tmp24_ = objects_item_get_parent_id (self);
		_tmp25_ = _tmp24_;
		if (g_strcmp0 (_tmp25_, "") != 0) {
			JsonBuilder* _tmp26_;
			JsonBuilder* _tmp27_;
			const gchar* _tmp28_;
			const gchar* _tmp29_;
			_tmp26_ = builder;
			json_builder_set_member_name (_tmp26_, "parent_id");
			_tmp27_ = builder;
			_tmp28_ = objects_item_get_parent_id (self);
			_tmp29_ = _tmp28_;
			json_builder_add_string_value (_tmp27_, _tmp29_);
		}
		_tmp30_ = objects_item_get_section_id (self);
		_tmp31_ = _tmp30_;
		if (g_strcmp0 (_tmp31_, "") != 0) {
			JsonBuilder* _tmp32_;
			JsonBuilder* _tmp33_;
			const gchar* _tmp34_;
			const gchar* _tmp35_;
			_tmp32_ = builder;
			json_builder_set_member_name (_tmp32_, "section_id");
			_tmp33_ = builder;
			_tmp34_ = objects_item_get_section_id (self);
			_tmp35_ = _tmp34_;
			json_builder_add_string_value (_tmp33_, _tmp35_);
		}
	}
	_tmp36_ = builder;
	json_builder_set_member_name (_tmp36_, "content");
	_tmp37_ = builder;
	_tmp38_ = self->priv->_content;
	json_builder_add_string_value (_tmp37_, _tmp38_);
	_tmp39_ = builder;
	json_builder_set_member_name (_tmp39_, "description");
	_tmp40_ = builder;
	_tmp41_ = self->priv->_description;
	json_builder_add_string_value (_tmp40_, _tmp41_);
	_tmp42_ = builder;
	json_builder_set_member_name (_tmp42_, "child_order");
	_tmp43_ = builder;
	_tmp44_ = self->priv->_child_order;
	json_builder_add_int_value (_tmp43_, (gint64) _tmp44_);
	_tmp45_ = builder;
	json_builder_set_member_name (_tmp45_, "priority");
	_tmp46_ = self->priv->_priority;
	if (_tmp46_ == 0) {
		JsonBuilder* _tmp47_;
		_tmp47_ = builder;
		json_builder_add_int_value (_tmp47_, (gint64) CONSTANTS_PRIORITY_4);
	} else {
		JsonBuilder* _tmp48_;
		gint _tmp49_;
		_tmp48_ = builder;
		_tmp49_ = self->priv->_priority;
		json_builder_add_int_value (_tmp48_, (gint64) _tmp49_);
	}
	_tmp50_ = objects_item_get_has_due (self);
	_tmp51_ = _tmp50_;
	if (_tmp51_) {
		JsonBuilder* _tmp52_;
		JsonBuilder* _tmp53_;
		JsonBuilder* _tmp54_;
		JsonBuilder* _tmp55_;
		ObjectsDueDate* _tmp56_;
		gchar* _tmp57_;
		gchar* _tmp58_;
		JsonBuilder* _tmp59_;
		JsonBuilder* _tmp60_;
		ObjectsDueDate* _tmp61_;
		const gchar* _tmp62_;
		const gchar* _tmp63_;
		JsonBuilder* _tmp64_;
		_tmp52_ = builder;
		json_builder_set_member_name (_tmp52_, "due");
		_tmp53_ = builder;
		json_builder_begin_object (_tmp53_);
		_tmp54_ = builder;
		json_builder_set_member_name (_tmp54_, "string");
		_tmp55_ = builder;
		_tmp56_ = self->priv->_due;
		_tmp57_ = utils_datetime_due_to_todoist_natural_language (_tmp56_);
		_tmp58_ = _tmp57_;
		json_builder_add_string_value (_tmp55_, _tmp58_);
		_g_free0 (_tmp58_);
		_tmp59_ = builder;
		json_builder_set_member_name (_tmp59_, "date");
		_tmp60_ = builder;
		_tmp61_ = self->priv->_due;
		_tmp62_ = objects_due_date_get_date (_tmp61_);
		_tmp63_ = _tmp62_;
		json_builder_add_string_value (_tmp60_, _tmp63_);
		_tmp64_ = builder;
		json_builder_end_object (_tmp64_);
	} else {
		JsonBuilder* _tmp65_;
		JsonBuilder* _tmp66_;
		_tmp65_ = builder;
		json_builder_set_member_name (_tmp65_, "due");
		_tmp66_ = builder;
		json_builder_add_null_value (_tmp66_);
	}
	_tmp67_ = objects_item_get_has_deadline (self);
	_tmp68_ = _tmp67_;
	if (_tmp68_) {
		JsonBuilder* _tmp69_;
		JsonBuilder* _tmp70_;
		JsonBuilder* _tmp71_;
		JsonBuilder* _tmp72_;
		GDateTime* _tmp73_;
		GDateTime* _tmp74_;
		gchar* _tmp75_;
		gchar* _tmp76_;
		JsonBuilder* _tmp77_;
		_tmp69_ = builder;
		json_builder_set_member_name (_tmp69_, "deadline");
		_tmp70_ = builder;
		json_builder_begin_object (_tmp70_);
		_tmp71_ = builder;
		json_builder_set_member_name (_tmp71_, "date");
		_tmp72_ = builder;
		_tmp73_ = objects_item_get_deadline_datetime (self);
		_tmp74_ = _tmp73_;
		_tmp75_ = utils_datetime_get_todoist_datetime_format (_tmp74_);
		_tmp76_ = _tmp75_;
		json_builder_add_string_value (_tmp72_, _tmp76_);
		_g_free0 (_tmp76_);
		_tmp77_ = builder;
		json_builder_end_object (_tmp77_);
	} else {
		JsonBuilder* _tmp78_;
		JsonBuilder* _tmp79_;
		_tmp78_ = builder;
		json_builder_set_member_name (_tmp78_, "deadline");
		_tmp79_ = builder;
		json_builder_add_null_value (_tmp79_);
	}
	_tmp80_ = builder;
	json_builder_set_member_name (_tmp80_, "labels");
	_tmp81_ = builder;
	json_builder_begin_array (_tmp81_);
	{
		GeeArrayList* _label_list = NULL;
		GeeArrayList* _tmp82_;
		gint _label_size = 0;
		GeeArrayList* _tmp83_;
		gint _tmp84_;
		gint _tmp85_;
		gint _label_index = 0;
		_tmp82_ = self->priv->_labels;
		_label_list = _tmp82_;
		_tmp83_ = _label_list;
		_tmp84_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp83_);
		_tmp85_ = _tmp84_;
		_label_size = _tmp85_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp86_;
			gint _tmp87_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp88_;
			gpointer _tmp89_;
			JsonBuilder* _tmp90_;
			ObjectsLabel* _tmp91_;
			const gchar* _tmp92_;
			const gchar* _tmp93_;
			_label_index = _label_index + 1;
			_tmp86_ = _label_index;
			_tmp87_ = _label_size;
			if (!(_tmp86_ < _tmp87_)) {
				break;
			}
			_tmp88_ = _label_list;
			_tmp89_ = gee_abstract_list_get ((GeeAbstractList*) _tmp88_, _label_index);
			label = (ObjectsLabel*) _tmp89_;
			_tmp90_ = builder;
			_tmp91_ = label;
			_tmp92_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp91_);
			_tmp93_ = _tmp92_;
			json_builder_add_string_value (_tmp90_, _tmp93_);
			_g_object_unref0 (label);
		}
	}
	_tmp94_ = builder;
	json_builder_end_array (_tmp94_);
	_tmp95_ = builder;
	json_builder_end_object (_tmp95_);
	_tmp96_ = builder;
	json_builder_end_object (_tmp96_);
	_tmp97_ = builder;
	json_builder_end_array (_tmp97_);
	_tmp98_ = builder;
	json_builder_end_object (_tmp98_);
	_tmp99_ = json_generator_new ();
	generator = _tmp99_;
	_tmp100_ = builder;
	_tmp101_ = json_builder_get_root (_tmp100_);
	root = _tmp101_;
	json_generator_set_root (generator, root);
	_tmp102_ = json_generator_to_data (generator, NULL);
	result = _tmp102_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
	return result;
}

static gchar*
objects_item_real_to_json (ObjectsBaseObject* base)
{
	ObjectsItem * self;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp4_;
	JsonBuilder* _tmp5_;
	JsonBuilder* _tmp6_;
	JsonBuilder* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	JsonBuilder* _tmp10_;
	JsonBuilder* _tmp11_;
	ServicesDatabase* _tmp12_;
	ServicesDatabase* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gboolean _tmp16_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	JsonBuilder* _tmp71_;
	JsonBuilder* _tmp72_;
	JsonBuilder* _tmp73_;
	JsonBuilder* _tmp74_;
	Util* _tmp75_;
	Util* _tmp76_;
	const gchar* _tmp77_;
	gchar* _tmp78_;
	gchar* _tmp79_;
	JsonBuilder* _tmp80_;
	JsonBuilder* _tmp81_;
	JsonBuilder* _tmp82_;
	JsonBuilder* _tmp83_;
	Util* _tmp84_;
	Util* _tmp85_;
	const gchar* _tmp86_;
	gchar* _tmp87_;
	gchar* _tmp88_;
	JsonBuilder* _tmp89_;
	JsonBuilder* _tmp90_;
	gint _tmp91_;
	gboolean _tmp97_;
	gboolean _tmp98_;
	JsonBuilder* _tmp123_;
	JsonBuilder* _tmp124_;
	JsonBuilder* _tmp125_;
	JsonBuilder* _tmp126_;
	JsonBuilder* _tmp140_;
	JsonBuilder* _tmp141_;
	JsonBuilder* _tmp142_;
	JsonBuilder* _tmp143_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp144_;
	JsonNode* root = NULL;
	JsonBuilder* _tmp145_;
	JsonBuilder* _tmp146_;
	JsonNode* _tmp147_;
	gchar* _tmp148_;
	gchar* result;
	self = (ObjectsItem*) base;
	_tmp0_ = objects_item_get_builder (self);
	_tmp1_ = _tmp0_;
	json_builder_reset (_tmp1_);
	_tmp2_ = objects_item_get_builder (self);
	_tmp3_ = _tmp2_;
	json_builder_begin_object (_tmp3_);
	_tmp4_ = objects_item_get_builder (self);
	_tmp5_ = _tmp4_;
	json_builder_set_member_name (_tmp5_, "id");
	_tmp6_ = objects_item_get_builder (self);
	_tmp7_ = _tmp6_;
	_tmp8_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp9_ = _tmp8_;
	json_builder_add_string_value (_tmp7_, _tmp9_);
	_tmp10_ = objects_item_get_builder (self);
	_tmp11_ = _tmp10_;
	json_builder_set_member_name (_tmp11_, "project_id");
	_tmp12_ = services_database_get_default ();
	_tmp13_ = _tmp12_;
	_tmp14_ = objects_item_get_project_id (self);
	_tmp15_ = _tmp14_;
	_tmp16_ = services_database_curTempIds_exists (_tmp13_, _tmp15_);
	_g_object_unref0 (_tmp13_);
	if (_tmp16_) {
		JsonBuilder* _tmp17_;
		JsonBuilder* _tmp18_;
		ServicesDatabase* _tmp19_;
		ServicesDatabase* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		_tmp17_ = objects_item_get_builder (self);
		_tmp18_ = _tmp17_;
		_tmp19_ = services_database_get_default ();
		_tmp20_ = _tmp19_;
		_tmp21_ = objects_item_get_project_id (self);
		_tmp22_ = _tmp21_;
		_tmp23_ = services_database_get_temp_id (_tmp20_, _tmp22_);
		_tmp24_ = _tmp23_;
		json_builder_add_string_value (_tmp18_, _tmp24_);
		_g_free0 (_tmp24_);
		_g_object_unref0 (_tmp20_);
	} else {
		JsonBuilder* _tmp25_;
		JsonBuilder* _tmp26_;
		const gchar* _tmp27_;
		const gchar* _tmp28_;
		_tmp25_ = objects_item_get_builder (self);
		_tmp26_ = _tmp25_;
		_tmp27_ = objects_item_get_project_id (self);
		_tmp28_ = _tmp27_;
		json_builder_add_string_value (_tmp26_, _tmp28_);
	}
	_tmp29_ = objects_item_get_section_id (self);
	_tmp30_ = _tmp29_;
	if (g_strcmp0 (_tmp30_, "") != 0) {
		JsonBuilder* _tmp31_;
		JsonBuilder* _tmp32_;
		ServicesDatabase* _tmp33_;
		ServicesDatabase* _tmp34_;
		const gchar* _tmp35_;
		const gchar* _tmp36_;
		gboolean _tmp37_;
		_tmp31_ = objects_item_get_builder (self);
		_tmp32_ = _tmp31_;
		json_builder_set_member_name (_tmp32_, "section_id");
		_tmp33_ = services_database_get_default ();
		_tmp34_ = _tmp33_;
		_tmp35_ = objects_item_get_section_id (self);
		_tmp36_ = _tmp35_;
		_tmp37_ = services_database_curTempIds_exists (_tmp34_, _tmp36_);
		_g_object_unref0 (_tmp34_);
		if (_tmp37_) {
			JsonBuilder* _tmp38_;
			JsonBuilder* _tmp39_;
			ServicesDatabase* _tmp40_;
			ServicesDatabase* _tmp41_;
			const gchar* _tmp42_;
			const gchar* _tmp43_;
			gchar* _tmp44_;
			gchar* _tmp45_;
			_tmp38_ = objects_item_get_builder (self);
			_tmp39_ = _tmp38_;
			_tmp40_ = services_database_get_default ();
			_tmp41_ = _tmp40_;
			_tmp42_ = objects_item_get_section_id (self);
			_tmp43_ = _tmp42_;
			_tmp44_ = services_database_get_temp_id (_tmp41_, _tmp43_);
			_tmp45_ = _tmp44_;
			json_builder_add_string_value (_tmp39_, _tmp45_);
			_g_free0 (_tmp45_);
			_g_object_unref0 (_tmp41_);
		} else {
			JsonBuilder* _tmp46_;
			JsonBuilder* _tmp47_;
			const gchar* _tmp48_;
			const gchar* _tmp49_;
			_tmp46_ = objects_item_get_builder (self);
			_tmp47_ = _tmp46_;
			_tmp48_ = objects_item_get_section_id (self);
			_tmp49_ = _tmp48_;
			json_builder_add_string_value (_tmp47_, _tmp49_);
		}
	}
	_tmp50_ = objects_item_get_parent_id (self);
	_tmp51_ = _tmp50_;
	if (g_strcmp0 (_tmp51_, "") != 0) {
		JsonBuilder* _tmp52_;
		JsonBuilder* _tmp53_;
		ServicesDatabase* _tmp54_;
		ServicesDatabase* _tmp55_;
		const gchar* _tmp56_;
		const gchar* _tmp57_;
		gboolean _tmp58_;
		_tmp52_ = objects_item_get_builder (self);
		_tmp53_ = _tmp52_;
		json_builder_set_member_name (_tmp53_, "parent_id");
		_tmp54_ = services_database_get_default ();
		_tmp55_ = _tmp54_;
		_tmp56_ = objects_item_get_parent_id (self);
		_tmp57_ = _tmp56_;
		_tmp58_ = services_database_curTempIds_exists (_tmp55_, _tmp57_);
		_g_object_unref0 (_tmp55_);
		if (_tmp58_) {
			JsonBuilder* _tmp59_;
			JsonBuilder* _tmp60_;
			ServicesDatabase* _tmp61_;
			ServicesDatabase* _tmp62_;
			const gchar* _tmp63_;
			const gchar* _tmp64_;
			gchar* _tmp65_;
			gchar* _tmp66_;
			_tmp59_ = objects_item_get_builder (self);
			_tmp60_ = _tmp59_;
			_tmp61_ = services_database_get_default ();
			_tmp62_ = _tmp61_;
			_tmp63_ = objects_item_get_parent_id (self);
			_tmp64_ = _tmp63_;
			_tmp65_ = services_database_get_temp_id (_tmp62_, _tmp64_);
			_tmp66_ = _tmp65_;
			json_builder_add_string_value (_tmp60_, _tmp66_);
			_g_free0 (_tmp66_);
			_g_object_unref0 (_tmp62_);
		} else {
			JsonBuilder* _tmp67_;
			JsonBuilder* _tmp68_;
			const gchar* _tmp69_;
			const gchar* _tmp70_;
			_tmp67_ = objects_item_get_builder (self);
			_tmp68_ = _tmp67_;
			_tmp69_ = objects_item_get_parent_id (self);
			_tmp70_ = _tmp69_;
			json_builder_add_string_value (_tmp68_, _tmp70_);
		}
	}
	_tmp71_ = objects_item_get_builder (self);
	_tmp72_ = _tmp71_;
	json_builder_set_member_name (_tmp72_, "content");
	_tmp73_ = objects_item_get_builder (self);
	_tmp74_ = _tmp73_;
	_tmp75_ = util_get_default ();
	_tmp76_ = _tmp75_;
	_tmp77_ = self->priv->_content;
	_tmp78_ = util_get_encode_text (_tmp76_, _tmp77_);
	_tmp79_ = _tmp78_;
	json_builder_add_string_value (_tmp74_, _tmp79_);
	_g_free0 (_tmp79_);
	_g_object_unref0 (_tmp76_);
	_tmp80_ = objects_item_get_builder (self);
	_tmp81_ = _tmp80_;
	json_builder_set_member_name (_tmp81_, "description");
	_tmp82_ = objects_item_get_builder (self);
	_tmp83_ = _tmp82_;
	_tmp84_ = util_get_default ();
	_tmp85_ = _tmp84_;
	_tmp86_ = self->priv->_description;
	_tmp87_ = util_get_encode_text (_tmp85_, _tmp86_);
	_tmp88_ = _tmp87_;
	json_builder_add_string_value (_tmp83_, _tmp88_);
	_g_free0 (_tmp88_);
	_g_object_unref0 (_tmp85_);
	_tmp89_ = objects_item_get_builder (self);
	_tmp90_ = _tmp89_;
	json_builder_set_member_name (_tmp90_, "priority");
	_tmp91_ = self->priv->_priority;
	if (_tmp91_ == 0) {
		JsonBuilder* _tmp92_;
		JsonBuilder* _tmp93_;
		_tmp92_ = objects_item_get_builder (self);
		_tmp93_ = _tmp92_;
		json_builder_add_int_value (_tmp93_, (gint64) CONSTANTS_PRIORITY_4);
	} else {
		JsonBuilder* _tmp94_;
		JsonBuilder* _tmp95_;
		gint _tmp96_;
		_tmp94_ = objects_item_get_builder (self);
		_tmp95_ = _tmp94_;
		_tmp96_ = self->priv->_priority;
		json_builder_add_int_value (_tmp95_, (gint64) _tmp96_);
	}
	_tmp97_ = objects_item_get_has_due (self);
	_tmp98_ = _tmp97_;
	if (_tmp98_) {
		JsonBuilder* _tmp99_;
		JsonBuilder* _tmp100_;
		JsonBuilder* _tmp101_;
		JsonBuilder* _tmp102_;
		JsonBuilder* _tmp103_;
		JsonBuilder* _tmp104_;
		JsonBuilder* _tmp105_;
		JsonBuilder* _tmp106_;
		ObjectsDueDate* _tmp107_;
		const gchar* _tmp108_;
		const gchar* _tmp109_;
		JsonBuilder* _tmp110_;
		JsonBuilder* _tmp111_;
		JsonBuilder* _tmp112_;
		JsonBuilder* _tmp113_;
		ObjectsDueDate* _tmp114_;
		gchar* _tmp115_;
		gchar* _tmp116_;
		JsonBuilder* _tmp117_;
		JsonBuilder* _tmp118_;
		_tmp99_ = objects_item_get_builder (self);
		_tmp100_ = _tmp99_;
		json_builder_set_member_name (_tmp100_, "due");
		_tmp101_ = objects_item_get_builder (self);
		_tmp102_ = _tmp101_;
		json_builder_begin_object (_tmp102_);
		_tmp103_ = objects_item_get_builder (self);
		_tmp104_ = _tmp103_;
		json_builder_set_member_name (_tmp104_, "date");
		_tmp105_ = objects_item_get_builder (self);
		_tmp106_ = _tmp105_;
		_tmp107_ = self->priv->_due;
		_tmp108_ = objects_due_date_get_date (_tmp107_);
		_tmp109_ = _tmp108_;
		json_builder_add_string_value (_tmp106_, _tmp109_);
		_tmp110_ = objects_item_get_builder (self);
		_tmp111_ = _tmp110_;
		json_builder_set_member_name (_tmp111_, "string");
		_tmp112_ = objects_item_get_builder (self);
		_tmp113_ = _tmp112_;
		_tmp114_ = self->priv->_due;
		_tmp115_ = utils_datetime_due_to_todoist_natural_language (_tmp114_);
		_tmp116_ = _tmp115_;
		json_builder_add_string_value (_tmp113_, _tmp116_);
		_g_free0 (_tmp116_);
		_tmp117_ = objects_item_get_builder (self);
		_tmp118_ = _tmp117_;
		json_builder_end_object (_tmp118_);
	} else {
		JsonBuilder* _tmp119_;
		JsonBuilder* _tmp120_;
		JsonBuilder* _tmp121_;
		JsonBuilder* _tmp122_;
		_tmp119_ = objects_item_get_builder (self);
		_tmp120_ = _tmp119_;
		json_builder_set_member_name (_tmp120_, "due");
		_tmp121_ = objects_item_get_builder (self);
		_tmp122_ = _tmp121_;
		json_builder_add_null_value (_tmp122_);
	}
	_tmp123_ = objects_item_get_builder (self);
	_tmp124_ = _tmp123_;
	json_builder_set_member_name (_tmp124_, "labels");
	_tmp125_ = objects_item_get_builder (self);
	_tmp126_ = _tmp125_;
	json_builder_begin_array (_tmp126_);
	{
		GeeArrayList* _label_list = NULL;
		GeeArrayList* _tmp127_;
		gint _label_size = 0;
		GeeArrayList* _tmp128_;
		gint _tmp129_;
		gint _tmp130_;
		gint _label_index = 0;
		_tmp127_ = self->priv->_labels;
		_label_list = _tmp127_;
		_tmp128_ = _label_list;
		_tmp129_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp128_);
		_tmp130_ = _tmp129_;
		_label_size = _tmp130_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp131_;
			gint _tmp132_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp133_;
			gpointer _tmp134_;
			JsonBuilder* _tmp135_;
			JsonBuilder* _tmp136_;
			ObjectsLabel* _tmp137_;
			const gchar* _tmp138_;
			const gchar* _tmp139_;
			_label_index = _label_index + 1;
			_tmp131_ = _label_index;
			_tmp132_ = _label_size;
			if (!(_tmp131_ < _tmp132_)) {
				break;
			}
			_tmp133_ = _label_list;
			_tmp134_ = gee_abstract_list_get ((GeeAbstractList*) _tmp133_, _label_index);
			label = (ObjectsLabel*) _tmp134_;
			_tmp135_ = objects_item_get_builder (self);
			_tmp136_ = _tmp135_;
			_tmp137_ = label;
			_tmp138_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp137_);
			_tmp139_ = _tmp138_;
			json_builder_add_string_value (_tmp136_, _tmp139_);
			_g_object_unref0 (label);
		}
	}
	_tmp140_ = objects_item_get_builder (self);
	_tmp141_ = _tmp140_;
	json_builder_end_array (_tmp141_);
	_tmp142_ = objects_item_get_builder (self);
	_tmp143_ = _tmp142_;
	json_builder_end_object (_tmp143_);
	_tmp144_ = json_generator_new ();
	generator = _tmp144_;
	_tmp145_ = objects_item_get_builder (self);
	_tmp146_ = _tmp145_;
	_tmp147_ = json_builder_get_root (_tmp146_);
	root = _tmp147_;
	json_generator_set_root (generator, root);
	_tmp148_ = json_generator_to_data (generator, NULL);
	result = _tmp148_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	return result;
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

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

gchar*
objects_item_to_vtodo (ObjectsItem* self)
{
	ICalComponent* ical = NULL;
	ICalComponent* _tmp0_;
	ICalComponent* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ICalComponent* _tmp4_;
	ICalTimezone* _tmp5_;
	ICalTime* _tmp6_;
	ICalTime* _tmp7_;
	ICalComponent* _tmp8_;
	const gchar* _tmp9_;
	ICalComponent* _tmp10_;
	const gchar* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	const gchar* _tmp136_;
	const gchar* _tmp137_;
	gboolean _tmp155_;
	gint _priority = 0;
	gint _tmp169_;
	ICalComponent* _tmp173_;
	ICalProperty* _tmp174_;
	ICalProperty* _tmp175_;
	GeeArrayList* _tmp176_;
	gint _tmp177_;
	gint _tmp178_;
	ICalProperty* child_order_property = NULL;
	ICalProperty* _tmp185_;
	gint _tmp186_;
	gchar* _tmp187_;
	gchar* _tmp188_;
	ICalComponent* _tmp189_;
	ICalComponent* _tmp190_;
	gchar* _tmp191_;
	gchar* _tmp192_;
	gchar* _tmp193_;
	gchar* _tmp194_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = i_cal_component_new_vtodo ();
	ical = _tmp0_;
	_tmp1_ = ical;
	_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp3_ = _tmp2_;
	i_cal_component_set_uid (_tmp1_, _tmp3_);
	_tmp4_ = ical;
	_tmp5_ = i_cal_timezone_get_utc_timezone ();
	_tmp6_ = i_cal_time_new_current_with_zone (_tmp5_);
	_tmp7_ = _tmp6_;
	i_cal_component_set_dtstamp (_tmp4_, _tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = ical;
	_tmp9_ = self->priv->_content;
	i_cal_component_set_summary (_tmp8_, _tmp9_);
	_tmp10_ = ical;
	_tmp11_ = self->priv->_description;
	i_cal_component_set_description (_tmp10_, _tmp11_);
	_tmp12_ = self->priv->_pinned;
	if (_tmp12_) {
		ICalProperty* pinned_property = NULL;
		ICalProperty* _tmp13_;
		ICalProperty* _tmp14_;
		ICalProperty* _tmp15_;
		gboolean _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		ICalComponent* _tmp19_;
		ICalProperty* _tmp20_;
		_tmp13_ = i_cal_property_new (I_CAL_X_PROPERTY);
		pinned_property = _tmp13_;
		_tmp14_ = pinned_property;
		i_cal_property_set_x_name (_tmp14_, "X-PINNED");
		_tmp15_ = pinned_property;
		_tmp16_ = self->priv->_pinned;
		_tmp17_ = bool_to_string (_tmp16_);
		_tmp18_ = _tmp17_;
		i_cal_property_set_x (_tmp15_, _tmp18_);
		_g_free0 (_tmp18_);
		_tmp19_ = ical;
		_tmp20_ = pinned_property;
		i_cal_component_add_property (_tmp19_, _tmp20_);
		_g_object_unref0 (pinned_property);
	}
	_tmp21_ = objects_item_get_has_due (self);
	_tmp22_ = _tmp21_;
	if (_tmp22_) {
		GDateTime* _tmp23_ = NULL;
		ObjectsDueDate* _tmp24_;
		GDateTime* _tmp25_;
		GDateTime* _tmp26_;
		ICalTime* new_icaltime = NULL;
		ObjectsDueDate* _tmp30_;
		GDateTime* _tmp31_;
		GDateTime* _tmp32_;
		ICalTime* _tmp33_;
		ICalComponent* _tmp34_;
		ICalTime* _tmp35_;
		ObjectsDueDate* _tmp36_;
		gboolean _tmp37_;
		gboolean _tmp38_;
		_tmp24_ = self->priv->_due;
		_tmp25_ = objects_due_date_get_datetime (_tmp24_);
		_tmp26_ = _tmp25_;
		if (utils_datetime_has_time (_tmp26_)) {
			ObjectsDueDate* _tmp27_;
			GDateTime* _tmp28_;
			GDateTime* _tmp29_;
			_tmp27_ = self->priv->_due;
			_tmp28_ = objects_due_date_get_datetime (_tmp27_);
			_tmp29_ = _tmp28_;
			_tmp23_ = _tmp29_;
		} else {
			_tmp23_ = NULL;
		}
		_tmp30_ = self->priv->_due;
		_tmp31_ = objects_due_date_get_datetime (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = utils_datetime_datetimes_to_icaltime (_tmp32_, _tmp23_, NULL);
		new_icaltime = _tmp33_;
		_tmp34_ = ical;
		_tmp35_ = new_icaltime;
		i_cal_component_set_due (_tmp34_, _tmp35_);
		_tmp36_ = self->priv->_due;
		_tmp37_ = objects_due_date_get_is_recurring (_tmp36_);
		_tmp38_ = _tmp37_;
		if (_tmp38_) {
			ICalRecurrence* rrule = NULL;
			ICalRecurrence* _tmp39_;
			ObjectsDueDate* _tmp40_;
			RecurrencyType _tmp41_;
			RecurrencyType _tmp42_;
			ICalRecurrence* _tmp112_;
			ObjectsDueDate* _tmp113_;
			gint _tmp114_;
			gint _tmp115_;
			ObjectsDueDate* _tmp116_;
			gint _tmp117_;
			gint _tmp118_;
			ObjectsDueDate* _tmp123_;
			const gchar* _tmp124_;
			const gchar* _tmp125_;
			ICalProperty* rrule_property = NULL;
			ICalRecurrence* _tmp132_;
			ICalProperty* _tmp133_;
			ICalComponent* _tmp134_;
			ICalProperty* _tmp135_;
			_tmp39_ = i_cal_recurrence_new ();
			rrule = _tmp39_;
			_tmp40_ = self->priv->_due;
			_tmp41_ = objects_due_date_get_recurrency_type (_tmp40_);
			_tmp42_ = _tmp41_;
			if (_tmp42_ == RECURRENCY_TYPE_MINUTELY) {
				ICalRecurrence* _tmp43_;
				_tmp43_ = rrule;
				i_cal_recurrence_set_freq (_tmp43_, I_CAL_MINUTELY_RECURRENCE);
			} else {
				ObjectsDueDate* _tmp44_;
				RecurrencyType _tmp45_;
				RecurrencyType _tmp46_;
				_tmp44_ = self->priv->_due;
				_tmp45_ = objects_due_date_get_recurrency_type (_tmp44_);
				_tmp46_ = _tmp45_;
				if (_tmp46_ == RECURRENCY_TYPE_HOURLY) {
					ICalRecurrence* _tmp47_;
					_tmp47_ = rrule;
					i_cal_recurrence_set_freq (_tmp47_, I_CAL_HOURLY_RECURRENCE);
				} else {
					ObjectsDueDate* _tmp48_;
					RecurrencyType _tmp49_;
					RecurrencyType _tmp50_;
					_tmp48_ = self->priv->_due;
					_tmp49_ = objects_due_date_get_recurrency_type (_tmp48_);
					_tmp50_ = _tmp49_;
					if (_tmp50_ == RECURRENCY_TYPE_EVERY_DAY) {
						ICalRecurrence* _tmp51_;
						_tmp51_ = rrule;
						i_cal_recurrence_set_freq (_tmp51_, I_CAL_DAILY_RECURRENCE);
					} else {
						ObjectsDueDate* _tmp52_;
						RecurrencyType _tmp53_;
						RecurrencyType _tmp54_;
						_tmp52_ = self->priv->_due;
						_tmp53_ = objects_due_date_get_recurrency_type (_tmp52_);
						_tmp54_ = _tmp53_;
						if (_tmp54_ == RECURRENCY_TYPE_EVERY_WEEK) {
							ICalRecurrence* _tmp55_;
							GArray* values = NULL;
							GArray* _tmp56_;
							gshort val = 0;
							gboolean _tmp57_ = FALSE;
							ObjectsDueDate* _tmp58_;
							const gchar* _tmp59_;
							const gchar* _tmp60_;
							ICalRecurrence* _tmp95_;
							GArray* _tmp96_;
							_tmp55_ = rrule;
							i_cal_recurrence_set_freq (_tmp55_, I_CAL_WEEKLY_RECURRENCE);
							_tmp56_ = g_array_new (TRUE, TRUE, sizeof (gshort));
							values = _tmp56_;
							_tmp58_ = self->priv->_due;
							_tmp59_ = objects_due_date_get_recurrency_weeks (_tmp58_);
							_tmp60_ = _tmp59_;
							if (_tmp60_ != NULL) {
								ObjectsDueDate* _tmp61_;
								const gchar* _tmp62_;
								const gchar* _tmp63_;
								gchar** _tmp64_;
								gchar** _tmp65_;
								gchar** _tmp66_;
								gint _tmp66__length1;
								_tmp61_ = self->priv->_due;
								_tmp62_ = objects_due_date_get_recurrency_weeks (_tmp61_);
								_tmp63_ = _tmp62_;
								_tmp65_ = _tmp64_ = g_strsplit (_tmp63_, ",", 0);
								_tmp66_ = _tmp65_;
								_tmp66__length1 = _vala_array_length (_tmp64_);
								_tmp57_ = _vala_array_length (_tmp64_) > 0;
								_tmp66_ = (_vala_array_free (_tmp66_, _tmp66__length1, (GDestroyNotify) g_free), NULL);
							} else {
								_tmp57_ = FALSE;
							}
							if (_tmp57_) {
								ObjectsDueDate* _tmp67_;
								const gchar* _tmp68_;
								const gchar* _tmp69_;
								ObjectsDueDate* _tmp71_;
								const gchar* _tmp72_;
								const gchar* _tmp73_;
								ObjectsDueDate* _tmp75_;
								const gchar* _tmp76_;
								const gchar* _tmp77_;
								ObjectsDueDate* _tmp79_;
								const gchar* _tmp80_;
								const gchar* _tmp81_;
								ObjectsDueDate* _tmp83_;
								const gchar* _tmp84_;
								const gchar* _tmp85_;
								ObjectsDueDate* _tmp87_;
								const gchar* _tmp88_;
								const gchar* _tmp89_;
								ObjectsDueDate* _tmp91_;
								const gchar* _tmp92_;
								const gchar* _tmp93_;
								_tmp67_ = self->priv->_due;
								_tmp68_ = objects_due_date_get_recurrency_weeks (_tmp67_);
								_tmp69_ = _tmp68_;
								if (string_contains (_tmp69_, "1")) {
									GArray* _tmp70_;
									val = (gshort) 2;
									_tmp70_ = values;
									g_array_append_val (_tmp70_, val);
								}
								_tmp71_ = self->priv->_due;
								_tmp72_ = objects_due_date_get_recurrency_weeks (_tmp71_);
								_tmp73_ = _tmp72_;
								if (string_contains (_tmp73_, "2")) {
									GArray* _tmp74_;
									val = (gshort) 3;
									_tmp74_ = values;
									g_array_append_val (_tmp74_, val);
								}
								_tmp75_ = self->priv->_due;
								_tmp76_ = objects_due_date_get_recurrency_weeks (_tmp75_);
								_tmp77_ = _tmp76_;
								if (string_contains (_tmp77_, "3")) {
									GArray* _tmp78_;
									val = (gshort) 4;
									_tmp78_ = values;
									g_array_append_val (_tmp78_, val);
								}
								_tmp79_ = self->priv->_due;
								_tmp80_ = objects_due_date_get_recurrency_weeks (_tmp79_);
								_tmp81_ = _tmp80_;
								if (string_contains (_tmp81_, "4")) {
									GArray* _tmp82_;
									val = (gshort) 5;
									_tmp82_ = values;
									g_array_append_val (_tmp82_, val);
								}
								_tmp83_ = self->priv->_due;
								_tmp84_ = objects_due_date_get_recurrency_weeks (_tmp83_);
								_tmp85_ = _tmp84_;
								if (string_contains (_tmp85_, "5")) {
									GArray* _tmp86_;
									val = (gshort) 6;
									_tmp86_ = values;
									g_array_append_val (_tmp86_, val);
								}
								_tmp87_ = self->priv->_due;
								_tmp88_ = objects_due_date_get_recurrency_weeks (_tmp87_);
								_tmp89_ = _tmp88_;
								if (string_contains (_tmp89_, "6")) {
									GArray* _tmp90_;
									val = (gshort) 7;
									_tmp90_ = values;
									g_array_append_val (_tmp90_, val);
								}
								_tmp91_ = self->priv->_due;
								_tmp92_ = objects_due_date_get_recurrency_weeks (_tmp91_);
								_tmp93_ = _tmp92_;
								if (string_contains (_tmp93_, "7")) {
									GArray* _tmp94_;
									val = (gshort) 1;
									_tmp94_ = values;
									g_array_append_val (_tmp94_, val);
								}
							}
							_tmp95_ = rrule;
							_tmp96_ = values;
							i_cal_recurrence_set_by_array (_tmp95_, I_CAL_BY_DAY, _tmp96_);
							_g_array_unref0 (values);
						} else {
							ObjectsDueDate* _tmp97_;
							RecurrencyType _tmp98_;
							RecurrencyType _tmp99_;
							_tmp97_ = self->priv->_due;
							_tmp98_ = objects_due_date_get_recurrency_type (_tmp97_);
							_tmp99_ = _tmp98_;
							if (_tmp99_ == RECURRENCY_TYPE_EVERY_MONTH) {
								ICalRecurrence* _tmp100_;
								ObjectsDueDate* _tmp101_;
								gboolean _tmp102_;
								gboolean _tmp103_;
								_tmp100_ = rrule;
								i_cal_recurrence_set_freq (_tmp100_, I_CAL_MONTHLY_RECURRENCE);
								_tmp101_ = self->priv->_due;
								_tmp102_ = objects_due_date_get_recurrency_last_day_of_month (_tmp101_);
								_tmp103_ = _tmp102_;
								if (_tmp103_) {
									GArray* values = NULL;
									GArray* _tmp104_;
									gshort minus_one = 0;
									GArray* _tmp105_;
									ICalRecurrence* _tmp106_;
									GArray* _tmp107_;
									_tmp104_ = g_array_new (TRUE, TRUE, sizeof (gshort));
									values = _tmp104_;
									minus_one = (gshort) -1;
									_tmp105_ = values;
									g_array_append_val (_tmp105_, minus_one);
									_tmp106_ = rrule;
									_tmp107_ = values;
									i_cal_recurrence_set_by_array (_tmp106_, I_CAL_BY_MONTH_DAY, _tmp107_);
									_g_array_unref0 (values);
								}
							} else {
								ObjectsDueDate* _tmp108_;
								RecurrencyType _tmp109_;
								RecurrencyType _tmp110_;
								_tmp108_ = self->priv->_due;
								_tmp109_ = objects_due_date_get_recurrency_type (_tmp108_);
								_tmp110_ = _tmp109_;
								if (_tmp110_ == RECURRENCY_TYPE_EVERY_YEAR) {
									ICalRecurrence* _tmp111_;
									_tmp111_ = rrule;
									i_cal_recurrence_set_freq (_tmp111_, I_CAL_YEARLY_RECURRENCE);
								}
							}
						}
					}
				}
			}
			_tmp112_ = rrule;
			_tmp113_ = self->priv->_due;
			_tmp114_ = objects_due_date_get_recurrency_interval (_tmp113_);
			_tmp115_ = _tmp114_;
			i_cal_recurrence_set_interval (_tmp112_, (gshort) _tmp115_);
			_tmp116_ = self->priv->_due;
			_tmp117_ = objects_due_date_get_recurrency_count (_tmp116_);
			_tmp118_ = _tmp117_;
			if (_tmp118_ > 0) {
				ICalRecurrence* _tmp119_;
				ObjectsDueDate* _tmp120_;
				gint _tmp121_;
				gint _tmp122_;
				_tmp119_ = rrule;
				_tmp120_ = self->priv->_due;
				_tmp121_ = objects_due_date_get_recurrency_count (_tmp120_);
				_tmp122_ = _tmp121_;
				i_cal_recurrence_set_count (_tmp119_, _tmp122_);
			}
			_tmp123_ = self->priv->_due;
			_tmp124_ = objects_due_date_get_recurrency_end (_tmp123_);
			_tmp125_ = _tmp124_;
			if (g_strcmp0 (_tmp125_, "") != 0) {
				ICalTime* until_icaltime = NULL;
				ObjectsDueDate* _tmp126_;
				GDateTime* _tmp127_;
				GDateTime* _tmp128_;
				ICalTime* _tmp129_;
				ICalRecurrence* _tmp130_;
				ICalTime* _tmp131_;
				_tmp126_ = self->priv->_due;
				_tmp127_ = objects_due_date_get_end_datetime (_tmp126_);
				_tmp128_ = _tmp127_;
				_tmp129_ = utils_datetime_datetimes_to_icaltime (_tmp128_, NULL, NULL);
				until_icaltime = _tmp129_;
				_tmp130_ = rrule;
				_tmp131_ = until_icaltime;
				i_cal_recurrence_set_until (_tmp130_, _tmp131_);
				_g_object_unref0 (until_icaltime);
			}
			_tmp132_ = rrule;
			_tmp133_ = i_cal_property_new_rrule (_tmp132_);
			rrule_property = _tmp133_;
			_tmp134_ = ical;
			_tmp135_ = rrule_property;
			i_cal_component_add_property (_tmp134_, _tmp135_);
			_g_object_unref0 (rrule_property);
			_g_object_unref0 (rrule);
		}
		_g_object_unref0 (new_icaltime);
	}
	_tmp136_ = objects_item_get_parent_id (self);
	_tmp137_ = _tmp136_;
	if (g_strcmp0 (_tmp137_, "") != 0) {
		ICalComponent* _tmp138_;
		const gchar* _tmp139_;
		const gchar* _tmp140_;
		ICalProperty* _tmp141_;
		ICalProperty* _tmp142_;
		_tmp138_ = ical;
		_tmp139_ = objects_item_get_parent_id (self);
		_tmp140_ = _tmp139_;
		_tmp141_ = i_cal_property_new_relatedto (_tmp140_);
		_tmp142_ = _tmp141_;
		i_cal_component_add_property (_tmp138_, _tmp142_);
		_g_object_unref0 (_tmp142_);
	} else {
		gboolean _tmp143_ = FALSE;
		const gchar* _tmp144_;
		const gchar* _tmp145_;
		_tmp144_ = objects_item_get_section_id (self);
		_tmp145_ = _tmp144_;
		if (g_strcmp0 (_tmp145_, "") != 0) {
			ObjectsProject* _tmp146_;
			ObjectsProject* _tmp147_;
			SourceType _tmp148_;
			SourceType _tmp149_;
			_tmp146_ = objects_item_get_project (self);
			_tmp147_ = _tmp146_;
			_tmp148_ = objects_project_get_source_type (_tmp147_);
			_tmp149_ = _tmp148_;
			_tmp143_ = _tmp149_ == SOURCE_TYPE_CALDAV;
		} else {
			_tmp143_ = FALSE;
		}
		if (_tmp143_) {
			ICalComponent* _tmp150_;
			const gchar* _tmp151_;
			const gchar* _tmp152_;
			ICalProperty* _tmp153_;
			ICalProperty* _tmp154_;
			_tmp150_ = ical;
			_tmp151_ = objects_item_get_section_id (self);
			_tmp152_ = _tmp151_;
			_tmp153_ = i_cal_property_new_relatedto (_tmp152_);
			_tmp154_ = _tmp153_;
			i_cal_component_add_property (_tmp150_, _tmp154_);
			_g_object_unref0 (_tmp154_);
		}
	}
	_tmp155_ = self->priv->_checked;
	if (_tmp155_) {
		ICalComponent* _tmp156_;
		ICalComponent* _tmp157_;
		ICalProperty* _tmp158_;
		ICalProperty* _tmp159_;
		ICalComponent* _tmp160_;
		GDateTime* _tmp161_;
		GDateTime* _tmp162_;
		ICalTimezone* _tmp163_;
		ICalTime* _tmp164_;
		ICalTime* _tmp165_;
		ICalProperty* _tmp166_;
		ICalProperty* _tmp167_;
		_tmp156_ = ical;
		i_cal_component_set_status (_tmp156_, I_CAL_STATUS_COMPLETED);
		_tmp157_ = ical;
		_tmp158_ = i_cal_property_new_percentcomplete (100);
		_tmp159_ = _tmp158_;
		i_cal_component_add_property (_tmp157_, _tmp159_);
		_g_object_unref0 (_tmp159_);
		_tmp160_ = ical;
		_tmp161_ = g_date_time_new_now_utc ();
		_tmp162_ = _tmp161_;
		_tmp163_ = i_cal_timezone_get_utc_timezone ();
		_tmp164_ = i_cal_time_new_from_timet_with_zone ((time_t) g_date_time_to_unix (_tmp162_), FALSE, _tmp163_);
		_tmp165_ = _tmp164_;
		_tmp166_ = i_cal_property_new_completed (_tmp165_);
		_tmp167_ = _tmp166_;
		i_cal_component_add_property (_tmp160_, _tmp167_);
		_g_object_unref0 (_tmp167_);
		_g_object_unref0 (_tmp165_);
		_g_date_time_unref0 (_tmp162_);
	} else {
		ICalComponent* _tmp168_;
		_tmp168_ = ical;
		i_cal_component_set_status (_tmp168_, I_CAL_STATUS_NEEDSACTION);
	}
	_priority = 0;
	_tmp169_ = self->priv->_priority;
	if (_tmp169_ == CONSTANTS_PRIORITY_4) {
		_priority = 0;
	} else {
		gint _tmp170_;
		_tmp170_ = self->priv->_priority;
		if (_tmp170_ == CONSTANTS_PRIORITY_1) {
			_priority = 1;
		} else {
			gint _tmp171_;
			_tmp171_ = self->priv->_priority;
			if (_tmp171_ == CONSTANTS_PRIORITY_2) {
				_priority = 5;
			} else {
				gint _tmp172_;
				_tmp172_ = self->priv->_priority;
				if (_tmp172_ == CONSTANTS_PRIORITY_3) {
					_priority = 9;
				} else {
					_priority = 0;
				}
			}
		}
	}
	_tmp173_ = ical;
	_tmp174_ = i_cal_property_new_priority (_priority);
	_tmp175_ = _tmp174_;
	i_cal_component_add_property (_tmp173_, _tmp175_);
	_g_object_unref0 (_tmp175_);
	_tmp176_ = self->priv->_labels;
	_tmp177_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp176_);
	_tmp178_ = _tmp177_;
	if (_tmp178_ > 0) {
		ICalComponent* _tmp179_;
		GeeArrayList* _tmp180_;
		gchar* _tmp181_;
		gchar* _tmp182_;
		ICalProperty* _tmp183_;
		ICalProperty* _tmp184_;
		_tmp179_ = ical;
		_tmp180_ = self->priv->_labels;
		_tmp181_ = objects_item_get_labels_names (self, _tmp180_);
		_tmp182_ = _tmp181_;
		_tmp183_ = i_cal_property_new_categories (_tmp182_);
		_tmp184_ = _tmp183_;
		i_cal_component_add_property (_tmp179_, _tmp184_);
		_g_object_unref0 (_tmp184_);
		_g_free0 (_tmp182_);
	}
	_tmp185_ = i_cal_property_new (I_CAL_X_PROPERTY);
	child_order_property = _tmp185_;
	i_cal_property_set_x_name (child_order_property, "X-APPLE-SORT-ORDER");
	_tmp186_ = self->priv->_child_order;
	_tmp187_ = g_strdup_printf ("%i", _tmp186_);
	_tmp188_ = _tmp187_;
	i_cal_property_set_x (child_order_property, _tmp188_);
	_g_free0 (_tmp188_);
	_tmp189_ = ical;
	i_cal_component_add_property (_tmp189_, child_order_property);
	_tmp190_ = ical;
	_tmp191_ = i_cal_component_as_ical_string (_tmp190_);
	_tmp192_ = _tmp191_;
	_tmp193_ = g_strdup_printf ("%s%s%s", "BEGIN:VCALENDAR\n" \
"VERSION:2.0\n" \
"PRODID:-//Planify App (https://github.com/alainm23/planify)\n", _tmp192_, "END:VCALENDAR\n");
	_tmp194_ = _tmp193_;
	_g_free0 (_tmp192_);
	result = _tmp194_;
	_g_object_unref0 (child_order_property);
	_g_object_unref0 (ical);
	return result;
}

ObjectsItem*
objects_item_add_item_if_not_exists (ObjectsItem* self,
                                     ObjectsItem* new_item,
                                     gboolean insert)
{
	ObjectsItem* return_value = NULL;
	GError* _inner_error0_ = NULL;
	ObjectsItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (new_item != NULL, NULL);
	return_value = NULL;
	{
		GeeArrayList* _tmp0_;
		_tmp0_ = self->priv->_items;
		g_rec_mutex_lock (&self->priv->__lock__items);
		{
			const gchar* _tmp1_;
			const gchar* _tmp2_;
			ObjectsItem* _tmp3_;
			ObjectsItem* _tmp4_;
			ObjectsItem* _tmp7_;
			ObjectsItem* _tmp8_;
			_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) new_item);
			_tmp2_ = _tmp1_;
			_tmp3_ = objects_item_get_item (self, _tmp2_);
			_g_object_unref0 (return_value);
			return_value = _tmp3_;
			_tmp4_ = return_value;
			if (_tmp4_ == NULL) {
				ServicesStore* _tmp5_;
				ObjectsItem* _tmp6_;
				objects_item_set_parent (new_item, self);
				objects_item_add_item (self, new_item);
				_tmp5_ = services_store_instance ();
				services_store_insert_item (_tmp5_, new_item, insert, TRUE);
				_tmp6_ = _g_object_ref0 (new_item);
				_g_object_unref0 (return_value);
				return_value = _tmp6_;
			}
			_tmp7_ = return_value;
			_tmp8_ = _g_object_ref0 (_tmp7_);
			result = _tmp8_;
			{
				GeeArrayList* _tmp9_;
				_tmp9_ = self->priv->_items;
				g_rec_mutex_unlock (&self->priv->__lock__items);
			}
			_g_object_unref0 (return_value);
			return result;
		}
		__finally0:
		{
			GeeArrayList* _tmp10_;
			_tmp10_ = 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*
objects_item_get_item (ObjectsItem* 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);
		{
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp1_;
				GeeArrayList* _tmp2_;
				gint _item_size = 0;
				GeeArrayList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				gint _item_index = 0;
				_tmp1_ = objects_item_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);
				}
			}
		}
		__finally0:
		{
			GeeArrayList* _tmp15_;
			_tmp15_ = 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;
}

void
objects_item_add_item (ObjectsItem* self,
                       ObjectsItem* item)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->priv->_items;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, item);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

gchar*
objects_item_to_clipboard_text (ObjectsItem* self)
{
	GString* text = NULL;
	GString* _tmp0_;
	const gchar* _tmp1_ = NULL;
	gboolean _tmp2_;
	GString* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gint _tmp7_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	GeeArrayList* _tmp31_;
	gint _tmp32_;
	gint _tmp33_;
	gboolean _tmp54_ = FALSE;
	const gchar* _tmp55_;
	GString* _tmp65_;
	const gchar* _tmp66_;
	gchar* _tmp67_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_string_new ("");
	text = _tmp0_;
	_tmp2_ = self->priv->_checked;
	if (_tmp2_) {
		_tmp1_ = "x";
	} else {
		_tmp1_ = " ";
	}
	_tmp3_ = text;
	_tmp4_ = self->priv->_content;
	_tmp5_ = g_strdup_printf ("[%s] %s", _tmp1_, _tmp4_);
	_tmp6_ = _tmp5_;
	g_string_append (_tmp3_, _tmp6_);
	_g_free0 (_tmp6_);
	_tmp7_ = self->priv->_priority;
	if (_tmp7_ != CONSTANTS_PRIORITY_4) {
		GString* _tmp8_;
		gint _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp8_ = text;
		_tmp9_ = self->priv->_priority;
		_tmp10_ = g_strdup_printf (" (P%d)", 5 - _tmp9_);
		_tmp11_ = _tmp10_;
		g_string_append (_tmp8_, _tmp11_);
		_g_free0 (_tmp11_);
	}
	_tmp12_ = objects_item_get_has_due (self);
	_tmp13_ = _tmp12_;
	if (_tmp13_) {
		GString* _tmp14_;
		ObjectsDueDate* _tmp15_;
		GDateTime* _tmp16_;
		GDateTime* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		_tmp14_ = text;
		_tmp15_ = self->priv->_due;
		_tmp16_ = objects_due_date_get_datetime (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = utils_datetime_get_relative_date_from_date (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = g_strdup_printf (" · %s", _tmp19_);
		_tmp21_ = _tmp20_;
		g_string_append (_tmp14_, _tmp21_);
		_g_free0 (_tmp21_);
		_g_free0 (_tmp19_);
	}
	_tmp22_ = objects_item_get_has_deadline (self);
	_tmp23_ = _tmp22_;
	if (_tmp23_) {
		GString* _tmp24_;
		GDateTime* _tmp25_;
		GDateTime* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		_tmp24_ = text;
		_tmp25_ = objects_item_get_deadline_datetime (self);
		_tmp26_ = _tmp25_;
		_tmp27_ = utils_datetime_get_relative_time_from_date (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = g_strdup_printf (" · %s %s", _ ("Deadline:"), _tmp28_);
		_tmp30_ = _tmp29_;
		g_string_append (_tmp24_, _tmp30_);
		_g_free0 (_tmp30_);
		_g_free0 (_tmp28_);
	}
	_tmp31_ = self->priv->_labels;
	_tmp32_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp31_);
	_tmp33_ = _tmp32_;
	if (_tmp33_ > 0) {
		GString* label_names = NULL;
		GString* _tmp34_;
		GString* _tmp49_;
		GString* _tmp50_;
		const gchar* _tmp51_;
		gchar* _tmp52_;
		gchar* _tmp53_;
		_tmp34_ = g_string_new ("");
		label_names = _tmp34_;
		{
			GeeArrayList* _label_list = NULL;
			GeeArrayList* _tmp35_;
			gint _label_size = 0;
			GeeArrayList* _tmp36_;
			gint _tmp37_;
			gint _tmp38_;
			gint _label_index = 0;
			_tmp35_ = self->priv->_labels;
			_label_list = _tmp35_;
			_tmp36_ = _label_list;
			_tmp37_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp36_);
			_tmp38_ = _tmp37_;
			_label_size = _tmp38_;
			_label_index = -1;
			while (TRUE) {
				gint _tmp39_;
				gint _tmp40_;
				ObjectsLabel* label = NULL;
				GeeArrayList* _tmp41_;
				gpointer _tmp42_;
				GString* _tmp43_;
				GString* _tmp45_;
				ObjectsLabel* _tmp46_;
				const gchar* _tmp47_;
				const gchar* _tmp48_;
				_label_index = _label_index + 1;
				_tmp39_ = _label_index;
				_tmp40_ = _label_size;
				if (!(_tmp39_ < _tmp40_)) {
					break;
				}
				_tmp41_ = _label_list;
				_tmp42_ = gee_abstract_list_get ((GeeAbstractList*) _tmp41_, _label_index);
				label = (ObjectsLabel*) _tmp42_;
				_tmp43_ = label_names;
				if (_tmp43_->len > ((gssize) 0)) {
					GString* _tmp44_;
					_tmp44_ = label_names;
					g_string_append (_tmp44_, ", ");
				}
				_tmp45_ = label_names;
				_tmp46_ = label;
				_tmp47_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp46_);
				_tmp48_ = _tmp47_;
				g_string_append (_tmp45_, _tmp48_);
				_g_object_unref0 (label);
			}
		}
		_tmp49_ = text;
		_tmp50_ = label_names;
		_tmp51_ = _tmp50_->str;
		_tmp52_ = g_strdup_printf (" @%s", _tmp51_);
		_tmp53_ = _tmp52_;
		g_string_append (_tmp49_, _tmp53_);
		_g_free0 (_tmp53_);
		_g_string_free0 (label_names);
	}
	_tmp55_ = self->priv->_description;
	if (_tmp55_ != NULL) {
		const gchar* _tmp56_;
		gchar* _tmp57_;
		gchar* _tmp58_;
		_tmp56_ = self->priv->_description;
		_tmp57_ = string_strip (_tmp56_);
		_tmp58_ = _tmp57_;
		_tmp54_ = g_strcmp0 (_tmp58_, "") != 0;
		_g_free0 (_tmp58_);
	} else {
		_tmp54_ = FALSE;
	}
	if (_tmp54_) {
		GString* _tmp59_;
		const gchar* _tmp60_;
		gchar* _tmp61_;
		gchar* _tmp62_;
		gchar* _tmp63_;
		gchar* _tmp64_;
		_tmp59_ = text;
		_tmp60_ = self->priv->_description;
		_tmp61_ = string_strip (_tmp60_);
		_tmp62_ = _tmp61_;
		_tmp63_ = g_strdup_printf ("\n    %s", _tmp62_);
		_tmp64_ = _tmp63_;
		g_string_append (_tmp59_, _tmp64_);
		_g_free0 (_tmp64_);
		_g_free0 (_tmp62_);
	}
	_tmp65_ = text;
	_tmp66_ = _tmp65_->str;
	_tmp67_ = g_strdup (_tmp66_);
	result = _tmp67_;
	_g_string_free0 (text);
	return result;
}

void
objects_item_copy_clipboard (ObjectsItem* self)
{
	GdkClipboard* clipboard = NULL;
	GdkDisplay* _tmp0_;
	GdkClipboard* _tmp1_;
	GdkClipboard* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	ServicesEventBus* _tmp5_;
	ServicesEventBus* _tmp6_;
	Util* _tmp7_;
	Util* _tmp8_;
	AdwToast* _tmp9_;
	AdwToast* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gdk_display_get_clipboard (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	clipboard = _tmp2_;
	_tmp3_ = objects_item_to_clipboard_text (self);
	_tmp4_ = _tmp3_;
	gdk_clipboard_set_text (clipboard, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = services_event_bus_get_default ();
	_tmp6_ = _tmp5_;
	_tmp7_ = util_get_default ();
	_tmp8_ = _tmp7_;
	_tmp9_ = util_create_toast (_tmp8_, _ ("Task copied to clipboard"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
	_tmp10_ = _tmp9_;
	g_signal_emit_by_name (_tmp6_, "send-toast", _tmp10_);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (_tmp8_);
	_g_object_unref0 (_tmp6_);
	_g_object_unref0 (clipboard);
}

gchar*
objects_item_get_ics_content (ObjectsItem* self)
{
	gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp10_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp2_ = objects_item_get_calendar_data (self);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = objects_item_get_calendar_data (self);
		_tmp5_ = _tmp4_;
		_tmp1_ = g_strcmp0 (_tmp5_, "") != 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = objects_item_get_calendar_data (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp8_;
	} else {
		gchar* _tmp9_;
		_tmp9_ = objects_item_to_vtodo (self);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp9_;
	}
	_tmp10_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp10_;
	_g_free0 (_tmp0_);
	return result;
}

static Block53Data*
block53_data_ref (Block53Data* _data53_)
{
	g_atomic_int_inc (&_data53_->_ref_count_);
	return _data53_;
}

static void
block53_data_unref (void * _userdata_)
{
	Block53Data* _data53_;
	_data53_ = (Block53Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data53_->_ref_count_)) {
		ObjectsItem* self;
		self = _data53_->self;
		_g_object_unref0 (_data53_->file_dialog);
		_g_free0 (_data53_->content);
		_g_object_unref0 (self);
		g_slice_free (Block53Data, _data53_);
	}
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static void
__lambda91_ (Block53Data* _data53_,
             GObject* obj,
             GAsyncResult* res)
{
	ObjectsItem* self;
	GError* _inner_error0_ = NULL;
	self = _data53_->self;
	g_return_if_fail (res != NULL);
	{
		GFile* file = NULL;
		GtkFileDialog* _tmp0_;
		GFile* _tmp1_;
		GFile* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gboolean _tmp7_;
		GFileOutputStream* stream = NULL;
		GFile* _tmp14_;
		GFileOutputStream* _tmp15_;
		GFileOutputStream* _tmp16_;
		const gchar* _tmp17_;
		guint8* _tmp18_;
		gint _tmp18__length1;
		gint _tmp19_ = 0;
		guint8* _tmp20_;
		gint _tmp20__length1;
		GFileOutputStream* _tmp21_;
		ServicesEventBus* _tmp22_;
		ServicesEventBus* _tmp23_;
		Util* _tmp24_;
		Util* _tmp25_;
		AdwToast* _tmp26_;
		AdwToast* _tmp27_;
		_tmp0_ = _data53_->file_dialog;
		_tmp1_ = gtk_file_dialog_save_finish (_tmp0_, res, &_inner_error0_);
		file = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = file;
		_tmp3_ = g_file_get_basename (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_utf8_strdown (_tmp4_, (gssize) -1);
		_tmp6_ = _tmp5_;
		_tmp7_ = !g_str_has_suffix (_tmp6_, ".ics");
		_g_free0 (_tmp6_);
		_g_free0 (_tmp4_);
		if (_tmp7_) {
			GFile* _tmp8_;
			gchar* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			GFile* _tmp13_;
			_tmp8_ = file;
			_tmp9_ = g_file_get_path (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp11_ = g_strconcat (_tmp10_, ".ics", NULL);
			_tmp12_ = _tmp11_;
			_tmp13_ = g_file_new_for_path (_tmp12_);
			_g_object_unref0 (file);
			file = _tmp13_;
			_g_free0 (_tmp12_);
			_g_free0 (_tmp10_);
		}
		_tmp14_ = file;
		_tmp15_ = g_file_replace (_tmp14_, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &_inner_error0_);
		stream = _tmp15_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (file);
			goto __catch0_g_error;
		}
		_tmp16_ = stream;
		_tmp17_ = _data53_->content;
		_tmp18_ = string_get_data (_tmp17_, &_tmp19_);
		_tmp18__length1 = _tmp19_;
		_tmp20_ = _tmp18_;
		_tmp20__length1 = _tmp18__length1;
		g_output_stream_write ((GOutputStream*) _tmp16_, _tmp20_, (gsize) _tmp20__length1, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (stream);
			_g_object_unref0 (file);
			goto __catch0_g_error;
		}
		_tmp21_ = stream;
		g_output_stream_close ((GOutputStream*) _tmp21_, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (stream);
			_g_object_unref0 (file);
			goto __catch0_g_error;
		}
		_tmp22_ = services_event_bus_get_default ();
		_tmp23_ = _tmp22_;
		_tmp24_ = util_get_default ();
		_tmp25_ = _tmp24_;
		_tmp26_ = util_create_toast (_tmp25_, _ ("Task exported successfully"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
		_tmp27_ = _tmp26_;
		g_signal_emit_by_name (_tmp23_, "send-toast", _tmp27_);
		_g_object_unref0 (_tmp27_);
		_g_object_unref0 (_tmp25_);
		_g_object_unref0 (_tmp23_);
		_g_object_unref0 (stream);
		_g_object_unref0 (file);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp28_;
		const gchar* _tmp29_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp28_ = e;
		_tmp29_ = _tmp28_->message;
		g_debug ("Item.vala:1563: Error exporting .ics: %s", _tmp29_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
___lambda91__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda91_ (self, source_object, res);
	block53_data_unref (self);
}

void
objects_item_export_ics (ObjectsItem* self,
                         GtkWindow* window)
{
	Block53Data* _data53_;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	gchar* _tmp4_;
	GtkFileDialog* _tmp5_;
	GtkFileDialog* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkFileFilter* filter = NULL;
	GtkFileFilter* _tmp11_;
	GtkFileFilter* _tmp12_;
	GtkFileFilter* _tmp13_;
	GListStore* filters = NULL;
	GListStore* _tmp14_;
	GListStore* _tmp15_;
	GtkFileFilter* _tmp16_;
	GtkFileDialog* _tmp17_;
	GListStore* _tmp18_;
	GtkFileDialog* _tmp19_;
	GtkFileFilter* _tmp20_;
	GtkFileDialog* _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_data53_ = g_slice_new0 (Block53Data);
	_data53_->_ref_count_ = 1;
	_data53_->self = g_object_ref (self);
	_tmp0_ = objects_item_get_project (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_source_type (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != SOURCE_TYPE_CALDAV) {
		block53_data_unref (_data53_);
		_data53_ = NULL;
		return;
	}
	_tmp4_ = objects_item_get_ics_content (self);
	_data53_->content = _tmp4_;
	_tmp5_ = gtk_file_dialog_new ();
	_data53_->file_dialog = _tmp5_;
	_tmp6_ = _data53_->file_dialog;
	_tmp7_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strdup_printf ("%s.ics", _tmp8_);
	_tmp10_ = _tmp9_;
	gtk_file_dialog_set_initial_name (_tmp6_, _tmp10_);
	_g_free0 (_tmp10_);
	_tmp11_ = gtk_file_filter_new ();
	filter = _tmp11_;
	_tmp12_ = filter;
	gtk_file_filter_add_pattern (_tmp12_, "*.ics");
	_tmp13_ = filter;
	gtk_file_filter_set_name (_tmp13_, _ ("iCalendar Files"));
	_tmp14_ = g_list_store_new (gtk_file_filter_get_type ());
	filters = _tmp14_;
	_tmp15_ = filters;
	_tmp16_ = filter;
	g_list_store_append (_tmp15_, (GObject*) _tmp16_);
	_tmp17_ = _data53_->file_dialog;
	_tmp18_ = filters;
	gtk_file_dialog_set_filters (_tmp17_, (GListModel*) _tmp18_);
	_tmp19_ = _data53_->file_dialog;
	_tmp20_ = filter;
	gtk_file_dialog_set_default_filter (_tmp19_, _tmp20_);
	_tmp21_ = _data53_->file_dialog;
	gtk_file_dialog_save (_tmp21_, window, NULL, ___lambda91__gasync_ready_callback, block53_data_ref (_data53_));
	_g_object_unref0 (filters);
	_g_object_unref0 (filter);
	block53_data_unref (_data53_);
	_data53_ = NULL;
}

ObjectsItem*
objects_item_generate_copy (ObjectsItem* self)
{
	ObjectsItem* new_item = NULL;
	ObjectsItem* _tmp0_;
	Util* _tmp1_;
	Util* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gboolean _tmp7_;
	ObjectsDueDate* _tmp8_;
	gint _tmp9_;
	ObjectsItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = objects_item_new ();
	new_item = _tmp0_;
	_tmp1_ = util_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = util_generate_id (_tmp2_, (ObjectsBaseObject*) new_item);
	_tmp4_ = _tmp3_;
	objects_base_object_set_id ((ObjectsBaseObject*) new_item, _tmp4_);
	_g_free0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	_tmp5_ = self->priv->_content;
	objects_item_set_content (new_item, _tmp5_);
	_tmp6_ = self->priv->_description;
	objects_item_set_description (new_item, _tmp6_);
	_tmp7_ = self->priv->_pinned;
	objects_item_set_pinned (new_item, _tmp7_);
	_tmp8_ = self->priv->_due;
	objects_item_set_due (new_item, _tmp8_);
	_tmp9_ = self->priv->_priority;
	objects_item_set_priority (new_item, _tmp9_);
	result = new_item;
	return result;
}

ObjectsItem*
objects_item_duplicate (ObjectsItem* self)
{
	ObjectsItem* new_item = NULL;
	ObjectsItem* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	ObjectsDueDate* _tmp3_;
	ObjectsDueDate* _tmp4_;
	ObjectsDueDate* _tmp5_;
	gboolean _tmp6_;
	gint _tmp7_;
	GeeArrayList* _tmp8_;
	ItemType _tmp9_;
	ObjectsItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = objects_item_new ();
	new_item = _tmp0_;
	_tmp1_ = self->priv->_content;
	objects_item_set_content (new_item, _tmp1_);
	_tmp2_ = self->priv->_description;
	objects_item_set_description (new_item, _tmp2_);
	_tmp3_ = self->priv->_due;
	_tmp4_ = objects_due_date_duplicate (_tmp3_);
	_tmp5_ = _tmp4_;
	objects_item_set_due (new_item, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->priv->_pinned;
	objects_item_set_pinned (new_item, _tmp6_);
	_tmp7_ = self->priv->_priority;
	objects_item_set_priority (new_item, _tmp7_);
	_tmp8_ = self->priv->_labels;
	objects_item_set_labels (new_item, _tmp8_);
	_tmp9_ = self->priv->_item_type;
	objects_item_set_item_type (new_item, _tmp9_);
	result = new_item;
	return result;
}

static void
____lambda79_ (ObjectsItem* self,
               GObject* obj,
               GAsyncResult* res)
{
	HttpResponse* response = NULL;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_delete_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	response = _tmp3_;
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	_tmp4_ = response;
	_tmp5_ = http_response_get_status (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		ServicesStore* _tmp7_;
		_tmp7_ = services_store_instance ();
		services_store_delete_item (_tmp7_, self);
	} else {
		ServicesEventBus* _tmp8_;
		ServicesEventBus* _tmp9_;
		HttpResponse* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		HttpResponse* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp8_ = services_event_bus_get_default ();
		_tmp9_ = _tmp8_;
		_tmp10_ = response;
		_tmp11_ = http_response_get_error_code (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = response;
		_tmp14_ = http_response_get_error (_tmp13_);
		_tmp15_ = _tmp14_;
		g_signal_emit_by_name (_tmp9_, "send-error-toast", _tmp12_, _tmp15_);
		_g_object_unref0 (_tmp9_);
	}
	_http_response_unref0 (response);
}

static void
_____lambda79__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda79_ ((ObjectsItem*) self, source_object, res);
	g_object_unref (self);
}

void
objects_item_delete_item (ObjectsItem* self)
{
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = objects_item_get_project (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_project_get_source_type (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == SOURCE_TYPE_LOCAL) {
		ServicesStore* _tmp4_;
		_tmp4_ = services_store_instance ();
		services_store_delete_item (_tmp4_, self);
	} else {
		ObjectsProject* _tmp5_;
		ObjectsProject* _tmp6_;
		SourceType _tmp7_;
		SourceType _tmp8_;
		_tmp5_ = objects_item_get_project (self);
		_tmp6_ = _tmp5_;
		_tmp7_ = objects_project_get_source_type (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ == SOURCE_TYPE_TODOIST) {
			ServicesTodoist* _tmp9_;
			ServicesTodoist* _tmp10_;
			objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
			_tmp9_ = services_todoist_get_default ();
			_tmp10_ = _tmp9_;
			services_todoist_delete (_tmp10_, (ObjectsBaseObject*) self, _____lambda79__gasync_ready_callback, g_object_ref (self));
			_g_object_unref0 (_tmp10_);
		} else {
			ObjectsProject* _tmp11_;
			ObjectsProject* _tmp12_;
			SourceType _tmp13_;
			SourceType _tmp14_;
			_tmp11_ = objects_item_get_project (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = objects_project_get_source_type (_tmp12_);
			_tmp14_ = _tmp13_;
			if (_tmp14_ == SOURCE_TYPE_CALDAV) {
				objects_item_delete_caldav (self, NULL, NULL);
			}
		}
	}
}

static void
objects_item_delete_caldav_data_free (gpointer _data)
{
	ObjectsItemDeleteCaldavData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ObjectsItemDeleteCaldavData, _data_);
}

static void
objects_item_delete_caldav (ObjectsItem* self,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	ObjectsItemDeleteCaldavData* _data_;
	ObjectsItem* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ObjectsItemDeleteCaldavData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, objects_item_delete_caldav_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	objects_item_delete_caldav_co (_data_);
}

static void
objects_item_delete_caldav_finish (ObjectsItem* self,
                                   GAsyncResult* _res_)
{
	ObjectsItemDeleteCaldavData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
objects_item_delete_caldav_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_)
{
	ObjectsItemDeleteCaldavData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	objects_item_delete_caldav_co (_data_);
}

static gboolean
objects_item_delete_caldav_co (ObjectsItemDeleteCaldavData* _data_)
{
	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:
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, TRUE);
	_data_->_tmp0_ = services_cal_dav_core_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = objects_item_get_project (_data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = objects_project_get_source (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = services_cal_dav_core_get_client (_data_->_tmp1_, _data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_g_object_unref0 (_data_->_tmp1_);
	_data_->caldav_client = _data_->_tmp7_;
	{
		_data_->_tmp8_ = _data_->caldav_client;
		_data_->_state_ = 1;
		objects_item_delete_subitems_caldav (_data_->self, _data_->self, _data_->_tmp8_, objects_item_delete_caldav_ready, _data_);
		return FALSE;
		_state_1:
		objects_item_delete_subitems_caldav_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp9_ = _data_->caldav_client;
		_data_->_state_ = 2;
		services_cal_dav_cal_dav_client_delete_item (_data_->_tmp9_, _data_->self, objects_item_delete_caldav_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp10_ = services_cal_dav_cal_dav_client_delete_item_finish (_data_->_tmp9_, _data_->_res_);
		_data_->response = _data_->_tmp10_;
		_data_->_tmp11_ = _data_->response;
		_data_->_tmp12_ = http_response_get_status (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		if (!_data_->_tmp13_) {
			_data_->_tmp14_ = _data_->response;
			_data_->_tmp15_ = http_response_get_error (_data_->_tmp14_);
			_data_->_tmp16_ = _data_->_tmp15_;
			_data_->_tmp17_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp16_);
			_data_->_inner_error0_ = _data_->_tmp17_;
			_http_response_unref0 (_data_->response);
			goto __catch0_g_error;
		}
		_data_->_tmp18_ = services_store_instance ();
		services_store_delete_item (_data_->_tmp18_, _data_->self);
		_http_response_unref0 (_data_->response);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp19_ = services_event_bus_get_default ();
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = _data_->e;
		_data_->_tmp22_ = _data_->_tmp21_->message;
		g_signal_emit_by_name (_data_->_tmp20_, "send-error-toast", 0, _data_->_tmp22_);
		_g_object_unref0 (_data_->_tmp20_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->caldav_client);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, FALSE);
	_g_object_unref0 (_data_->caldav_client);
	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;
}

static void
objects_item_delete_subitems_caldav_data_free (gpointer _data)
{
	ObjectsItemDeleteSubitemsCaldavData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->caldav_client);
	_g_object_unref0 (_data_->self);
	g_slice_free (ObjectsItemDeleteSubitemsCaldavData, _data_);
}

static void
objects_item_delete_subitems_caldav (ObjectsItem* self,
                                     ObjectsItem* item,
                                     ServicesCalDAVCalDAVClient* caldav_client,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	ObjectsItemDeleteSubitemsCaldavData* _data_;
	ObjectsItem* _tmp0_;
	ObjectsItem* _tmp1_;
	ServicesCalDAVCalDAVClient* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (caldav_client != NULL);
	_data_ = g_slice_new0 (ObjectsItemDeleteSubitemsCaldavData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, objects_item_delete_subitems_caldav_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	_tmp2_ = _g_object_ref0 (caldav_client);
	_g_object_unref0 (_data_->caldav_client);
	_data_->caldav_client = _tmp2_;
	objects_item_delete_subitems_caldav_co (_data_);
}

static void
objects_item_delete_subitems_caldav_finish (ObjectsItem* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	ObjectsItemDeleteSubitemsCaldavData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
objects_item_delete_subitems_caldav_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	ObjectsItemDeleteSubitemsCaldavData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	objects_item_delete_subitems_caldav_co (_data_);
}

static gboolean
objects_item_delete_subitems_caldav_co (ObjectsItemDeleteSubitemsCaldavData* _data_)
{
	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_ = services_store_instance ();
		_data_->_tmp1_ = services_store_get_subitems (_data_->_tmp0_, _data_->item);
		_data_->_subitem_list = _data_->_tmp1_;
		_data_->_tmp2_ = _data_->_subitem_list;
		_data_->_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_subitem_size = _data_->_tmp4_;
		_data_->_subitem_index = -1;
		while (TRUE) {
			_data_->_subitem_index = _data_->_subitem_index + 1;
			_data_->_tmp5_ = _data_->_subitem_index;
			_data_->_tmp6_ = _data_->_subitem_size;
			if (!(_data_->_tmp5_ < _data_->_tmp6_)) {
				break;
			}
			_data_->_tmp7_ = _data_->_subitem_list;
			_data_->_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp7_, _data_->_subitem_index);
			_data_->subitem = (ObjectsItem*) _data_->_tmp8_;
			_data_->_tmp9_ = _data_->subitem;
			_data_->_state_ = 1;
			objects_item_delete_subitems_caldav (_data_->self, _data_->_tmp9_, _data_->caldav_client, objects_item_delete_subitems_caldav_ready, _data_);
			return FALSE;
			_state_1:
			objects_item_delete_subitems_caldav_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->subitem);
				_g_object_unref0 (_data_->_subitem_list);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp10_ = _data_->subitem;
			_data_->_state_ = 2;
			services_cal_dav_cal_dav_client_delete_item (_data_->caldav_client, _data_->_tmp10_, objects_item_delete_subitems_caldav_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp11_ = services_cal_dav_cal_dav_client_delete_item_finish (_data_->caldav_client, _data_->_res_);
			_data_->response = _data_->_tmp11_;
			_data_->_tmp12_ = _data_->response;
			_data_->_tmp13_ = http_response_get_status (_data_->_tmp12_);
			_data_->_tmp14_ = _data_->_tmp13_;
			if (!_data_->_tmp14_) {
				_data_->_tmp15_ = _data_->response;
				_data_->_tmp16_ = http_response_get_error (_data_->_tmp15_);
				_data_->_tmp17_ = _data_->_tmp16_;
				_data_->_tmp18_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp17_);
				_data_->_inner_error0_ = _data_->_tmp18_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_http_response_unref0 (_data_->response);
				_g_object_unref0 (_data_->subitem);
				_g_object_unref0 (_data_->_subitem_list);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp19_ = services_store_instance ();
			_data_->_tmp20_ = _data_->subitem;
			services_store_delete_item (_data_->_tmp19_, _data_->_tmp20_);
			_http_response_unref0 (_data_->response);
			_g_object_unref0 (_data_->subitem);
		}
		_g_object_unref0 (_data_->_subitem_list);
	}
	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;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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 glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

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

gchar*
objects_item_get_labels_names (ObjectsItem* self,
                               GeeArrayList* labels)
{
	gchar* return_value = NULL;
	gchar* _tmp0_;
	const gchar* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (labels != NULL, NULL);
	_tmp0_ = g_strdup ("");
	return_value = _tmp0_;
	{
		GeeArrayList* _label_list = NULL;
		gint _label_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _label_index = 0;
		_label_list = labels;
		_tmp1_ = _label_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_label_size = _tmp3_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			const gchar* _tmp8_;
			ObjectsLabel* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			_label_index = _label_index + 1;
			_tmp4_ = _label_index;
			_tmp5_ = _label_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _label_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _label_index);
			label = (ObjectsLabel*) _tmp7_;
			_tmp8_ = return_value;
			_tmp9_ = label;
			_tmp10_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = string_replace (_tmp11_, ",", "\\,");
			_tmp13_ = _tmp12_;
			_tmp14_ = g_strconcat (_tmp13_, ",", NULL);
			_tmp15_ = _tmp14_;
			_tmp16_ = g_strconcat (_tmp8_, _tmp15_, NULL);
			_g_free0 (return_value);
			return_value = _tmp16_;
			_g_free0 (_tmp15_);
			_g_free0 (_tmp13_);
			_g_object_unref0 (label);
		}
	}
	_tmp17_ = return_value;
	_tmp18_ = strlen (_tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_ > 0) {
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		gint _tmp22_;
		gint _tmp23_;
		gchar* _tmp24_;
		_tmp20_ = return_value;
		_tmp21_ = return_value;
		_tmp22_ = strlen (_tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = string_substring (_tmp20_, (glong) 0, (glong) (_tmp23_ - 1));
		_g_free0 (return_value);
		return_value = _tmp24_;
	}
	result = return_value;
	return result;
}

static gpointer
_g_date_time_ref0 (gpointer self)
{
	return self ? g_date_time_ref (self) : NULL;
}

void
objects_item_set_recurrency (ObjectsItem* self,
                             ObjectsDueDate* duedate)
{
	ObjectsDueDate* _tmp0_;
	ObjectsDueDate* _tmp1_;
	gboolean _tmp2_ = FALSE;
	RecurrencyType _tmp3_;
	RecurrencyType _tmp4_;
	ObjectsDueDate* _tmp57_;
	gboolean _tmp58_;
	gboolean _tmp59_;
	ObjectsDueDate* _tmp60_;
	RecurrencyType _tmp61_;
	RecurrencyType _tmp62_;
	ObjectsDueDate* _tmp63_;
	gint _tmp64_;
	gint _tmp65_;
	ObjectsDueDate* _tmp66_;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	ObjectsDueDate* _tmp69_;
	gint _tmp70_;
	gint _tmp71_;
	ObjectsDueDate* _tmp72_;
	const gchar* _tmp73_;
	const gchar* _tmp74_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (duedate != NULL);
	_tmp0_ = self->priv->_due;
	if (objects_due_date_is_recurrency_equal (_tmp0_, duedate)) {
		return;
	}
	_tmp1_ = self->priv->_due;
	objects_due_date_set_recurrence_string (_tmp1_, "");
	_tmp3_ = objects_due_date_get_recurrency_type (duedate);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == RECURRENCY_TYPE_MINUTELY) {
		_tmp2_ = TRUE;
	} else {
		RecurrencyType _tmp5_;
		RecurrencyType _tmp6_;
		_tmp5_ = objects_due_date_get_recurrency_type (duedate);
		_tmp6_ = _tmp5_;
		_tmp2_ = _tmp6_ == RECURRENCY_TYPE_HOURLY;
	}
	if (_tmp2_) {
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp7_ = objects_item_get_has_due (self);
		_tmp8_ = _tmp7_;
		if (!_tmp8_) {
			ObjectsDueDate* _tmp9_;
			GDateTime* _tmp10_;
			GDateTime* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			_tmp9_ = self->priv->_due;
			_tmp10_ = g_date_time_new_now_local ();
			_tmp11_ = _tmp10_;
			_tmp12_ = utils_datetime_get_todoist_datetime_format (_tmp11_);
			_tmp13_ = _tmp12_;
			objects_due_date_set_date (_tmp9_, _tmp13_);
			_g_free0 (_tmp13_);
			_g_date_time_unref0 (_tmp11_);
		}
	} else {
		gboolean _tmp14_ = FALSE;
		gboolean _tmp15_ = FALSE;
		RecurrencyType _tmp16_;
		RecurrencyType _tmp17_;
		_tmp16_ = objects_due_date_get_recurrency_type (duedate);
		_tmp17_ = _tmp16_;
		if (_tmp17_ == RECURRENCY_TYPE_EVERY_DAY) {
			_tmp15_ = TRUE;
		} else {
			RecurrencyType _tmp18_;
			RecurrencyType _tmp19_;
			_tmp18_ = objects_due_date_get_recurrency_type (duedate);
			_tmp19_ = _tmp18_;
			_tmp15_ = _tmp19_ == RECURRENCY_TYPE_EVERY_MONTH;
		}
		if (_tmp15_) {
			_tmp14_ = TRUE;
		} else {
			RecurrencyType _tmp20_;
			RecurrencyType _tmp21_;
			_tmp20_ = objects_due_date_get_recurrency_type (duedate);
			_tmp21_ = _tmp20_;
			_tmp14_ = _tmp21_ == RECURRENCY_TYPE_EVERY_YEAR;
		}
		if (_tmp14_) {
			gboolean _tmp22_;
			gboolean _tmp23_;
			_tmp22_ = objects_item_get_has_due (self);
			_tmp23_ = _tmp22_;
			if (!_tmp23_) {
				ObjectsDueDate* _tmp24_;
				GDateTime* _tmp25_;
				GDateTime* _tmp26_;
				gchar* _tmp27_;
				gchar* _tmp28_;
				_tmp24_ = self->priv->_due;
				_tmp25_ = utils_datetime_get_today_format_date ();
				_tmp26_ = _tmp25_;
				_tmp27_ = utils_datetime_get_todoist_datetime_format (_tmp26_);
				_tmp28_ = _tmp27_;
				objects_due_date_set_date (_tmp24_, _tmp28_);
				_g_free0 (_tmp28_);
				_g_date_time_unref0 (_tmp26_);
			}
		} else {
			RecurrencyType _tmp29_;
			RecurrencyType _tmp30_;
			_tmp29_ = objects_due_date_get_recurrency_type (duedate);
			_tmp30_ = _tmp29_;
			if (_tmp30_ == RECURRENCY_TYPE_EVERY_WEEK) {
				gboolean _tmp31_;
				gboolean _tmp32_;
				_tmp31_ = objects_due_date_get_has_weeks (duedate);
				_tmp32_ = _tmp31_;
				if (_tmp32_) {
					GDateTime* due_selected = NULL;
					GDateTime* _tmp33_;
					gboolean _tmp34_;
					gboolean _tmp35_;
					gint day_of_week = 0;
					GDateTime* _tmp40_;
					gint next_day = 0;
					GDateTime* _tmp41_;
					GDateTime* due_date = NULL;
					ObjectsDueDate* _tmp46_;
					GDateTime* _tmp47_;
					gchar* _tmp48_;
					gchar* _tmp49_;
					_tmp33_ = utils_datetime_get_today_format_date ();
					due_selected = _tmp33_;
					_tmp34_ = objects_item_get_has_due (self);
					_tmp35_ = _tmp34_;
					if (_tmp35_) {
						ObjectsDueDate* _tmp36_;
						GDateTime* _tmp37_;
						GDateTime* _tmp38_;
						GDateTime* _tmp39_;
						_tmp36_ = self->priv->_due;
						_tmp37_ = objects_due_date_get_datetime (_tmp36_);
						_tmp38_ = _tmp37_;
						_tmp39_ = _g_date_time_ref0 (_tmp38_);
						_g_date_time_unref0 (due_selected);
						due_selected = _tmp39_;
					}
					_tmp40_ = due_selected;
					day_of_week = g_date_time_get_day_of_week (_tmp40_);
					_tmp41_ = due_selected;
					next_day = utils_datetime_get_next_day_of_week_from_recurrency_week (_tmp41_, duedate);
					due_date = NULL;
					if (day_of_week == next_day) {
						GDateTime* _tmp42_;
						GDateTime* _tmp43_;
						_tmp42_ = due_selected;
						_tmp43_ = _g_date_time_ref0 (_tmp42_);
						_g_date_time_unref0 (due_date);
						due_date = _tmp43_;
					} else {
						GDateTime* _tmp44_;
						GDateTime* _tmp45_;
						_tmp44_ = due_selected;
						_tmp45_ = utils_datetime_next_recurrency_week (_tmp44_, duedate, FALSE);
						_g_date_time_unref0 (due_date);
						due_date = _tmp45_;
					}
					_tmp46_ = self->priv->_due;
					_tmp47_ = due_date;
					_tmp48_ = utils_datetime_get_todoist_datetime_format (_tmp47_);
					_tmp49_ = _tmp48_;
					objects_due_date_set_date (_tmp46_, _tmp49_);
					_g_free0 (_tmp49_);
					_g_date_time_unref0 (due_date);
					_g_date_time_unref0 (due_selected);
				} else {
					gboolean _tmp50_;
					gboolean _tmp51_;
					_tmp50_ = objects_item_get_has_due (self);
					_tmp51_ = _tmp50_;
					if (!_tmp51_) {
						ObjectsDueDate* _tmp52_;
						GDateTime* _tmp53_;
						GDateTime* _tmp54_;
						gchar* _tmp55_;
						gchar* _tmp56_;
						_tmp52_ = self->priv->_due;
						_tmp53_ = utils_datetime_get_today_format_date ();
						_tmp54_ = _tmp53_;
						_tmp55_ = utils_datetime_get_todoist_datetime_format (_tmp54_);
						_tmp56_ = _tmp55_;
						objects_due_date_set_date (_tmp52_, _tmp56_);
						_g_free0 (_tmp56_);
						_g_date_time_unref0 (_tmp54_);
					}
				}
			}
		}
	}
	_tmp57_ = self->priv->_due;
	_tmp58_ = objects_due_date_get_is_recurring (duedate);
	_tmp59_ = _tmp58_;
	objects_due_date_set_is_recurring (_tmp57_, _tmp59_);
	_tmp60_ = self->priv->_due;
	_tmp61_ = objects_due_date_get_recurrency_type (duedate);
	_tmp62_ = _tmp61_;
	objects_due_date_set_recurrency_type (_tmp60_, _tmp62_);
	_tmp63_ = self->priv->_due;
	_tmp64_ = objects_due_date_get_recurrency_interval (duedate);
	_tmp65_ = _tmp64_;
	objects_due_date_set_recurrency_interval (_tmp63_, _tmp65_);
	_tmp66_ = self->priv->_due;
	_tmp67_ = objects_due_date_get_recurrency_weeks (duedate);
	_tmp68_ = _tmp67_;
	objects_due_date_set_recurrency_weeks (_tmp66_, _tmp68_);
	_tmp69_ = self->priv->_due;
	_tmp70_ = objects_due_date_get_recurrency_count (duedate);
	_tmp71_ = _tmp70_;
	objects_due_date_set_recurrency_count (_tmp69_, _tmp71_);
	_tmp72_ = self->priv->_due;
	_tmp73_ = objects_due_date_get_recurrency_end (duedate);
	_tmp74_ = _tmp73_;
	objects_due_date_set_recurrency_end (_tmp72_, _tmp74_);
	objects_item_update_async (self, "");
}

static void
objects_item_update_next_recurrency_data_free (gpointer _data)
{
	ObjectsItemUpdateNextRecurrencyData* _data_;
	_data_ = _data;
	_g_date_time_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ObjectsItemUpdateNextRecurrencyData, _data_);
}

void
objects_item_update_next_recurrency (ObjectsItem* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	ObjectsItemUpdateNextRecurrencyData* _data_;
	ObjectsItem* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ObjectsItemUpdateNextRecurrencyData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, objects_item_update_next_recurrency_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	objects_item_update_next_recurrency_co (_data_);
}

GDateTime*
objects_item_update_next_recurrency_finish (ObjectsItem* self,
                                            GAsyncResult* _res_)
{
	GDateTime* result;
	ObjectsItemUpdateNextRecurrencyData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
objects_item_update_next_recurrency_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	ObjectsItemUpdateNextRecurrencyData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	objects_item_update_next_recurrency_co (_data_);
}

static gboolean
objects_item_update_next_recurrency_co (ObjectsItemUpdateNextRecurrencyData* _data_)
{
	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_ = _data_->self->priv->_due;
	_data_->_tmp1_ = objects_due_date_get_datetime (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->self->priv->_due;
	_data_->_tmp4_ = utils_datetime_next_recurrency (_data_->_tmp2_, _data_->_tmp3_);
	_data_->next_recurrency = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->self->priv->_due;
	_data_->_tmp6_ = _data_->next_recurrency;
	_data_->_tmp7_ = utils_datetime_get_todoist_datetime_format (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	objects_due_date_set_date (_data_->_tmp5_, _data_->_tmp8_);
	_g_free0 (_data_->_tmp8_);
	_data_->_tmp9_ = _data_->self->priv->_due;
	_data_->_tmp10_ = objects_due_date_get_end_type (_data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	if (_data_->_tmp11_ == RECURRENCY_END_TYPE_AFTER) {
		_data_->_tmp12_ = _data_->self->priv->_due;
		_data_->_tmp13_ = _data_->self->priv->_due;
		_data_->_tmp14_ = objects_due_date_get_recurrency_count (_data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		objects_due_date_set_recurrency_count (_data_->_tmp12_, _data_->_tmp15_ - 1);
	}
	{
		_data_->_tmp16_ = services_store_instance ();
		_data_->_tmp17_ = services_store_get_subitems (_data_->_tmp16_, _data_->self);
		_data_->_subitem_list = _data_->_tmp17_;
		_data_->_tmp18_ = _data_->_subitem_list;
		_data_->_tmp19_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_subitem_size = _data_->_tmp20_;
		_data_->_subitem_index = -1;
		while (TRUE) {
			_data_->_subitem_index = _data_->_subitem_index + 1;
			_data_->_tmp21_ = _data_->_subitem_index;
			_data_->_tmp22_ = _data_->_subitem_size;
			if (!(_data_->_tmp21_ < _data_->_tmp22_)) {
				break;
			}
			_data_->_tmp23_ = _data_->_subitem_list;
			_data_->_tmp24_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp23_, _data_->_subitem_index);
			_data_->subitem = (ObjectsItem*) _data_->_tmp24_;
			_data_->_tmp25_ = _data_->subitem;
			_data_->_tmp26_ = _data_->_tmp25_->priv->_checked;
			if (_data_->_tmp26_) {
				_data_->_tmp27_ = _data_->subitem;
				_data_->_tmp28_ = _data_->_tmp27_->priv->_checked;
				_data_->old_checked = _data_->_tmp28_;
				_data_->_tmp29_ = _data_->subitem;
				objects_item_set_checked (_data_->_tmp29_, FALSE);
				_data_->_tmp30_ = _data_->subitem;
				objects_item_set_completed_at (_data_->_tmp30_, "");
				_data_->_tmp31_ = _data_->subitem;
				objects_item_update_async (_data_->_tmp31_, "");
				_data_->_tmp32_ = services_event_bus_get_default ();
				_data_->_tmp33_ = _data_->_tmp32_;
				_data_->_tmp34_ = _data_->subitem;
				g_signal_emit_by_name (_data_->_tmp33_, "checked-toggled", _data_->_tmp34_, _data_->old_checked);
				_g_object_unref0 (_data_->_tmp33_);
			}
			_g_object_unref0 (_data_->subitem);
		}
		_g_object_unref0 (_data_->_subitem_list);
	}
	_data_->_tmp35_ = objects_item_get_project (_data_->self);
	_data_->_tmp36_ = _data_->_tmp35_;
	_data_->_tmp37_ = objects_project_get_source_type (_data_->_tmp36_);
	_data_->_tmp38_ = _data_->_tmp37_;
	if (_data_->_tmp38_ == SOURCE_TYPE_LOCAL) {
		_data_->_tmp39_ = services_store_instance ();
		services_store_update_item (_data_->_tmp39_, _data_->self, "");
	} else {
		_data_->_tmp40_ = objects_item_get_project (_data_->self);
		_data_->_tmp41_ = _data_->_tmp40_;
		_data_->_tmp42_ = objects_project_get_source_type (_data_->_tmp41_);
		_data_->_tmp43_ = _data_->_tmp42_;
		if (_data_->_tmp43_ == SOURCE_TYPE_TODOIST) {
			objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, TRUE);
			_data_->_tmp44_ = services_todoist_get_default ();
			_data_->_tmp45_ = _data_->_tmp44_;
			_data_->_state_ = 1;
			services_todoist_close_item (_data_->_tmp45_, _data_->self, objects_item_update_next_recurrency_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp46_ = services_todoist_close_item_finish (_data_->_tmp45_, _data_->_res_);
			_data_->_tmp47_ = _data_->_tmp46_;
			_g_object_unref0 (_data_->_tmp45_);
			_data_->response = _data_->_tmp47_;
			objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, FALSE);
			_data_->_tmp48_ = _data_->response;
			_data_->_tmp49_ = http_response_get_status (_data_->_tmp48_);
			_data_->_tmp50_ = _data_->_tmp49_;
			if (_data_->_tmp50_) {
				_data_->_tmp51_ = services_store_instance ();
				services_store_update_item (_data_->_tmp51_, _data_->self, "");
			} else {
				_data_->result = NULL;
				_http_response_unref0 (_data_->response);
				_g_date_time_unref0 (_data_->next_recurrency);
				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;
			}
			_http_response_unref0 (_data_->response);
		} else {
			_data_->_tmp52_ = objects_item_get_project (_data_->self);
			_data_->_tmp53_ = _data_->_tmp52_;
			_data_->_tmp54_ = objects_project_get_source_type (_data_->_tmp53_);
			_data_->_tmp55_ = _data_->_tmp54_;
			if (_data_->_tmp55_ == SOURCE_TYPE_CALDAV) {
				objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, TRUE);
				_data_->_tmp56_ = services_cal_dav_core_get_default ();
				_data_->_tmp57_ = _data_->_tmp56_;
				_data_->_tmp58_ = objects_item_get_project (_data_->self);
				_data_->_tmp59_ = _data_->_tmp58_;
				_data_->_tmp60_ = objects_project_get_source (_data_->_tmp59_);
				_data_->_tmp61_ = _data_->_tmp60_;
				_data_->_tmp62_ = services_cal_dav_core_get_client (_data_->_tmp57_, _data_->_tmp61_);
				_data_->_tmp63_ = _data_->_tmp62_;
				_g_object_unref0 (_data_->_tmp57_);
				_data_->caldav_client = _data_->_tmp63_;
				_data_->_tmp64_ = _data_->caldav_client;
				_data_->_state_ = 2;
				services_cal_dav_cal_dav_client_add_item (_data_->_tmp64_, _data_->self, TRUE, objects_item_update_next_recurrency_ready, _data_);
				return FALSE;
				_state_2:
				_data_->_tmp65_ = services_cal_dav_cal_dav_client_add_item_finish (_data_->_tmp64_, _data_->_res_);
				_data_->_vala1_response = _data_->_tmp65_;
				objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, FALSE);
				_data_->_tmp66_ = _data_->_vala1_response;
				_data_->_tmp67_ = http_response_get_status (_data_->_tmp66_);
				_data_->_tmp68_ = _data_->_tmp67_;
				if (_data_->_tmp68_) {
					_data_->_tmp69_ = services_store_instance ();
					services_store_update_item (_data_->_tmp69_, _data_->self, "");
				} else {
					_data_->result = NULL;
					_http_response_unref0 (_data_->_vala1_response);
					_g_object_unref0 (_data_->caldav_client);
					_g_date_time_unref0 (_data_->next_recurrency);
					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;
				}
				_http_response_unref0 (_data_->_vala1_response);
				_g_object_unref0 (_data_->caldav_client);
			}
		}
	}
	_data_->_tmp70_ = _data_->self->priv->_due;
	_data_->_tmp71_ = objects_due_date_get_datetime (_data_->_tmp70_);
	_data_->_tmp72_ = _data_->_tmp71_;
	_data_->_tmp73_ = _g_date_time_ref0 (_data_->_tmp72_);
	_data_->result = _data_->_tmp73_;
	_g_date_time_unref0 (_data_->next_recurrency);
	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;
}

static Block54Data*
block54_data_ref (Block54Data* _data54_)
{
	g_atomic_int_inc (&_data54_->_ref_count_);
	return _data54_;
}

static void
block54_data_unref (void * _userdata_)
{
	Block54Data* _data54_;
	_data54_ = (Block54Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data54_->_ref_count_)) {
		ObjectsItem* self;
		self = _data54_->self;
		_g_object_unref0 (_data54_->project);
		_g_free0 (_data54_->_section_id);
		_g_object_unref0 (self);
		g_slice_free (Block54Data, _data54_);
	}
}

static void
____lambda92_ (Block54Data* _data54_,
               GObject* obj,
               GAsyncResult* res)
{
	ObjectsItem* self;
	HttpResponse* response = NULL;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	self = _data54_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_move_item_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	response = _tmp3_;
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	_tmp4_ = response;
	_tmp5_ = http_response_get_status (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp7_ = objects_base_object_get_id ((ObjectsBaseObject*) _data54_->project);
		_tmp8_ = _tmp7_;
		_objects_item_move (self, _tmp8_, _data54_->_section_id, _data54_->notify);
	} else {
		ServicesEventBus* _tmp9_;
		ServicesEventBus* _tmp10_;
		HttpResponse* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		HttpResponse* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp9_ = services_event_bus_get_default ();
		_tmp10_ = _tmp9_;
		_tmp11_ = response;
		_tmp12_ = http_response_get_error_code (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = response;
		_tmp15_ = http_response_get_error (_tmp14_);
		_tmp16_ = _tmp15_;
		g_signal_emit_by_name (_tmp10_, "send-error-toast", _tmp13_, _tmp16_);
		_g_object_unref0 (_tmp10_);
	}
	_http_response_unref0 (response);
}

static void
_____lambda92__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda92_ (self, source_object, res);
	block54_data_unref (self);
}

void
objects_item_move (ObjectsItem* self,
                   ObjectsProject* project,
                   const gchar* _section_id,
                   gboolean notify)
{
	Block54Data* _data54_;
	ObjectsProject* _tmp0_;
	gchar* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (_section_id != NULL);
	_data54_ = g_slice_new0 (Block54Data);
	_data54_->_ref_count_ = 1;
	_data54_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (project);
	_g_object_unref0 (_data54_->project);
	_data54_->project = _tmp0_;
	_tmp1_ = g_strdup (_section_id);
	_g_free0 (_data54_->_section_id);
	_data54_->_section_id = _tmp1_;
	_data54_->notify = notify;
	_tmp2_ = objects_project_get_source_type (_data54_->project);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == SOURCE_TYPE_LOCAL) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) _data54_->project);
		_tmp5_ = _tmp4_;
		_objects_item_move (self, _tmp5_, _data54_->_section_id, _data54_->notify);
	} else {
		SourceType _tmp6_;
		SourceType _tmp7_;
		_tmp6_ = objects_project_get_source_type (_data54_->project);
		_tmp7_ = _tmp6_;
		if (_tmp7_ == SOURCE_TYPE_TODOIST) {
			gchar* move_id = NULL;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			gchar* _tmp10_;
			gchar* move_type = NULL;
			gchar* _tmp11_;
			ServicesTodoist* _tmp14_;
			ServicesTodoist* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
			objects_base_object_set_sensitive ((ObjectsBaseObject*) self, FALSE);
			_tmp8_ = objects_base_object_get_id ((ObjectsBaseObject*) _data54_->project);
			_tmp9_ = _tmp8_;
			_tmp10_ = g_strdup (_tmp9_);
			move_id = _tmp10_;
			_tmp11_ = g_strdup ("project_id");
			move_type = _tmp11_;
			if (g_strcmp0 (_data54_->_section_id, "") != 0) {
				gchar* _tmp12_;
				gchar* _tmp13_;
				_tmp12_ = g_strdup ("section_id");
				_g_free0 (move_type);
				move_type = _tmp12_;
				_tmp13_ = g_strdup (_data54_->_section_id);
				_g_free0 (move_id);
				move_id = _tmp13_;
			}
			_tmp14_ = services_todoist_get_default ();
			_tmp15_ = _tmp14_;
			_tmp16_ = move_type;
			_tmp17_ = move_id;
			services_todoist_move_item (_tmp15_, self, _tmp16_, _tmp17_, _____lambda92__gasync_ready_callback, block54_data_ref (_data54_));
			_g_object_unref0 (_tmp15_);
			_g_free0 (move_type);
			_g_free0 (move_id);
		} else {
			SourceType _tmp18_;
			SourceType _tmp19_;
			_tmp18_ = objects_project_get_source_type (_data54_->project);
			_tmp19_ = _tmp18_;
			if (_tmp19_ == SOURCE_TYPE_CALDAV) {
				objects_base_object_set_loading ((ObjectsBaseObject*) self, TRUE);
				objects_base_object_set_sensitive ((ObjectsBaseObject*) self, FALSE);
				objects_item_move_caldav_recursive (self, _data54_->project, _data54_->_section_id, _data54_->notify, NULL, NULL);
			}
		}
	}
	block54_data_unref (_data54_);
	_data54_ = NULL;
}

static void
objects_item_move_caldav_recursive_data_free (gpointer _data)
{
	ObjectsItemMoveCaldavRecursiveData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->project);
	_g_free0 (_data_->_section_id);
	_g_object_unref0 (_data_->self);
	g_slice_free (ObjectsItemMoveCaldavRecursiveData, _data_);
}

static void
objects_item_move_caldav_recursive (ObjectsItem* self,
                                    ObjectsProject* project,
                                    const gchar* _section_id,
                                    gboolean notify,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	ObjectsItemMoveCaldavRecursiveData* _data_;
	ObjectsItem* _tmp0_;
	ObjectsProject* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (_section_id != NULL);
	_data_ = g_slice_new0 (ObjectsItemMoveCaldavRecursiveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, objects_item_move_caldav_recursive_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp1_;
	_tmp2_ = g_strdup (_section_id);
	_g_free0 (_data_->_section_id);
	_data_->_section_id = _tmp2_;
	_data_->notify = notify;
	objects_item_move_caldav_recursive_co (_data_);
}

static void
objects_item_move_caldav_recursive_finish (ObjectsItem* self,
                                           GAsyncResult* _res_)
{
	ObjectsItemMoveCaldavRecursiveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
objects_item_move_caldav_recursive_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	ObjectsItemMoveCaldavRecursiveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	objects_item_move_caldav_recursive_co (_data_);
}

static gboolean
objects_item_move_caldav_recursive_co (ObjectsItemMoveCaldavRecursiveData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = services_cal_dav_core_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = objects_project_get_source (_data_->project);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = services_cal_dav_core_get_client (_data_->_tmp1_, _data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_g_object_unref0 (_data_->_tmp1_);
	_data_->caldav_client = _data_->_tmp5_;
	{
		_data_->_tmp6_ = _data_->caldav_client;
		_data_->_state_ = 1;
		services_cal_dav_cal_dav_client_move_item (_data_->_tmp6_, _data_->self, _data_->project, objects_item_move_caldav_recursive_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp7_ = services_cal_dav_cal_dav_client_move_item_finish (_data_->_tmp6_, _data_->_res_);
		_data_->response = _data_->_tmp7_;
		_data_->_tmp8_ = _data_->response;
		_data_->_tmp9_ = http_response_get_status (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		if (!_data_->_tmp10_) {
			_data_->_tmp11_ = _data_->response;
			_data_->_tmp12_ = http_response_get_error (_data_->_tmp11_);
			_data_->_tmp13_ = _data_->_tmp12_;
			_data_->_tmp14_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp13_);
			_data_->_inner_error0_ = _data_->_tmp14_;
			_http_response_unref0 (_data_->response);
			goto __catch0_g_error;
		}
		_data_->_tmp15_ = objects_item_get_parent_id (_data_->self);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp17_ = g_strdup (_data_->_tmp16_);
		_data_->old_parent_id = _data_->_tmp17_;
		_data_->_tmp18_ = _data_->old_parent_id;
		if (g_strcmp0 (_data_->_tmp18_, "") != 0) {
			objects_item_set_parent_id (_data_->self, "");
			_data_->_tmp19_ = _data_->caldav_client;
			_data_->_state_ = 2;
			services_cal_dav_cal_dav_client_add_item (_data_->_tmp19_, _data_->self, TRUE, objects_item_move_caldav_recursive_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp20_ = services_cal_dav_cal_dav_client_add_item_finish (_data_->_tmp19_, _data_->_res_);
			_http_response_unref0 (_data_->response);
			_data_->response = _data_->_tmp20_;
			_data_->_tmp21_ = _data_->response;
			_data_->_tmp22_ = http_response_get_status (_data_->_tmp21_);
			_data_->_tmp23_ = _data_->_tmp22_;
			if (!_data_->_tmp23_) {
				_data_->_tmp24_ = _data_->response;
				_data_->_tmp25_ = http_response_get_error (_data_->_tmp24_);
				_data_->_tmp26_ = _data_->_tmp25_;
				_data_->_tmp27_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp26_);
				_data_->_inner_error0_ = _data_->_tmp27_;
				_g_free0 (_data_->old_parent_id);
				_http_response_unref0 (_data_->response);
				goto __catch0_g_error;
			}
			_data_->_tmp28_ = services_event_bus_get_default ();
			_data_->_tmp29_ = _data_->_tmp28_;
			_data_->_tmp30_ = objects_item_get_project_id (_data_->self);
			_data_->_tmp31_ = _data_->_tmp30_;
			_data_->_tmp32_ = objects_item_get_section_id (_data_->self);
			_data_->_tmp33_ = _data_->_tmp32_;
			_data_->_tmp34_ = _data_->old_parent_id;
			g_signal_emit_by_name (_data_->_tmp29_, "item-moved", _data_->self, _data_->_tmp31_, _data_->_tmp33_, _data_->_tmp34_);
			_g_object_unref0 (_data_->_tmp29_);
		}
		_data_->_tmp35_ = _data_->caldav_client;
		_data_->_state_ = 3;
		objects_item_move_all_subitems_caldav (_data_->self, _data_->self, _data_->project, _data_->_tmp35_, objects_item_move_caldav_recursive_ready, _data_);
		return FALSE;
		_state_3:
		objects_item_move_all_subitems_caldav_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->old_parent_id);
			_http_response_unref0 (_data_->response);
			goto __catch0_g_error;
		}
		_data_->_tmp36_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->project);
		_data_->_tmp37_ = _data_->_tmp36_;
		_objects_item_move (_data_->self, _data_->_tmp37_, _data_->_section_id, _data_->notify);
		_g_free0 (_data_->old_parent_id);
		_http_response_unref0 (_data_->response);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp38_ = services_event_bus_get_default ();
		_data_->_tmp39_ = _data_->_tmp38_;
		_data_->_tmp40_ = _data_->e;
		_data_->_tmp41_ = _data_->_tmp40_->message;
		g_signal_emit_by_name (_data_->_tmp39_, "send-error-toast", 0, _data_->_tmp41_);
		_g_object_unref0 (_data_->_tmp39_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->caldav_client);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, FALSE);
	objects_item_set_show_item (_data_->self, TRUE);
	_g_object_unref0 (_data_->caldav_client);
	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;
}

static void
objects_item_move_all_subitems_caldav_data_free (gpointer _data)
{
	ObjectsItemMoveAllSubitemsCaldavData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->project);
	_g_object_unref0 (_data_->caldav_client);
	_g_object_unref0 (_data_->self);
	g_slice_free (ObjectsItemMoveAllSubitemsCaldavData, _data_);
}

static void
objects_item_move_all_subitems_caldav (ObjectsItem* self,
                                       ObjectsItem* item,
                                       ObjectsProject* project,
                                       ServicesCalDAVCalDAVClient* caldav_client,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	ObjectsItemMoveAllSubitemsCaldavData* _data_;
	ObjectsItem* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsProject* _tmp2_;
	ServicesCalDAVCalDAVClient* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (caldav_client != NULL);
	_data_ = g_slice_new0 (ObjectsItemMoveAllSubitemsCaldavData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, objects_item_move_all_subitems_caldav_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	_tmp2_ = _g_object_ref0 (project);
	_g_object_unref0 (_data_->project);
	_data_->project = _tmp2_;
	_tmp3_ = _g_object_ref0 (caldav_client);
	_g_object_unref0 (_data_->caldav_client);
	_data_->caldav_client = _tmp3_;
	objects_item_move_all_subitems_caldav_co (_data_);
}

static void
objects_item_move_all_subitems_caldav_finish (ObjectsItem* self,
                                              GAsyncResult* _res_,
                                              GError** error)
{
	ObjectsItemMoveAllSubitemsCaldavData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
objects_item_move_all_subitems_caldav_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	ObjectsItemMoveAllSubitemsCaldavData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	objects_item_move_all_subitems_caldav_co (_data_);
}

static gboolean
objects_item_move_all_subitems_caldav_co (ObjectsItemMoveAllSubitemsCaldavData* _data_)
{
	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_ = services_store_instance ();
		_data_->_tmp1_ = services_store_get_subitems (_data_->_tmp0_, _data_->item);
		_data_->_subitem_list = _data_->_tmp1_;
		_data_->_tmp2_ = _data_->_subitem_list;
		_data_->_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_subitem_size = _data_->_tmp4_;
		_data_->_subitem_index = -1;
		while (TRUE) {
			_data_->_subitem_index = _data_->_subitem_index + 1;
			_data_->_tmp5_ = _data_->_subitem_index;
			_data_->_tmp6_ = _data_->_subitem_size;
			if (!(_data_->_tmp5_ < _data_->_tmp6_)) {
				break;
			}
			_data_->_tmp7_ = _data_->_subitem_list;
			_data_->_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp7_, _data_->_subitem_index);
			_data_->subitem = (ObjectsItem*) _data_->_tmp8_;
			_data_->_tmp9_ = _data_->subitem;
			_data_->_state_ = 1;
			services_cal_dav_cal_dav_client_move_item (_data_->caldav_client, _data_->_tmp9_, _data_->project, objects_item_move_all_subitems_caldav_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp10_ = services_cal_dav_cal_dav_client_move_item_finish (_data_->caldav_client, _data_->_res_);
			_data_->response = _data_->_tmp10_;
			_data_->_tmp11_ = _data_->response;
			_data_->_tmp12_ = http_response_get_status (_data_->_tmp11_);
			_data_->_tmp13_ = _data_->_tmp12_;
			if (!_data_->_tmp13_) {
				_data_->_tmp14_ = _data_->response;
				_data_->_tmp15_ = http_response_get_error (_data_->_tmp14_);
				_data_->_tmp16_ = _data_->_tmp15_;
				_data_->_tmp17_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp16_);
				_data_->_inner_error0_ = _data_->_tmp17_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_http_response_unref0 (_data_->response);
				_g_object_unref0 (_data_->subitem);
				_g_object_unref0 (_data_->_subitem_list);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp18_ = _data_->subitem;
			_data_->_state_ = 2;
			objects_item_move_all_subitems_caldav (_data_->self, _data_->_tmp18_, _data_->project, _data_->caldav_client, objects_item_move_all_subitems_caldav_ready, _data_);
			return FALSE;
			_state_2:
			objects_item_move_all_subitems_caldav_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_http_response_unref0 (_data_->response);
				_g_object_unref0 (_data_->subitem);
				_g_object_unref0 (_data_->_subitem_list);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_http_response_unref0 (_data_->response);
			_g_object_unref0 (_data_->subitem);
		}
		_g_object_unref0 (_data_->_subitem_list);
	}
	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;
}

static void
_objects_item_move (ObjectsItem* self,
                    const gchar* _project_id,
                    const gchar* _section_id,
                    gboolean notify)
{
	gchar* old_project_id = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* old_section_id = NULL;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* old_parent_id = NULL;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	ServicesStore* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	ServicesEventBus* _tmp13_;
	ServicesEventBus* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	ServicesEventBus* _tmp18_;
	ServicesEventBus* _tmp19_;
	const gchar* _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_project_id != NULL);
	g_return_if_fail (_section_id != NULL);
	_tmp0_ = objects_item_get_project_id (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	old_project_id = _tmp2_;
	_tmp3_ = objects_item_get_section_id (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup (_tmp4_);
	old_section_id = _tmp5_;
	_tmp6_ = objects_item_get_parent_id (self);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup (_tmp7_);
	old_parent_id = _tmp8_;
	objects_item_set_project_id (self, _project_id);
	objects_item_set_section_id (self, _section_id);
	objects_item_set_parent_id (self, "");
	_tmp9_ = services_store_instance ();
	_tmp10_ = old_project_id;
	_tmp11_ = old_section_id;
	_tmp12_ = old_parent_id;
	services_store_move_item (_tmp9_, self, _tmp10_, _tmp11_, _tmp12_);
	_tmp13_ = services_event_bus_get_default ();
	_tmp14_ = _tmp13_;
	_tmp15_ = old_project_id;
	_tmp16_ = old_section_id;
	_tmp17_ = old_parent_id;
	g_signal_emit_by_name (_tmp14_, "item-moved", self, _tmp15_, _tmp16_, _tmp17_);
	_g_object_unref0 (_tmp14_);
	_tmp18_ = services_event_bus_get_default ();
	_tmp19_ = _tmp18_;
	_tmp20_ = old_project_id;
	g_signal_emit_by_name (_tmp19_, "drag-n-drop-active", _tmp20_, FALSE);
	_g_object_unref0 (_tmp19_);
	if (notify) {
		ServicesEventBus* _tmp21_;
		ServicesEventBus* _tmp22_;
		Util* _tmp23_;
		Util* _tmp24_;
		ObjectsProject* _tmp25_;
		ObjectsProject* _tmp26_;
		const gchar* _tmp27_;
		const gchar* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		AdwToast* _tmp31_;
		AdwToast* _tmp32_;
		_tmp21_ = services_event_bus_get_default ();
		_tmp22_ = _tmp21_;
		_tmp23_ = util_get_default ();
		_tmp24_ = _tmp23_;
		_tmp25_ = objects_item_get_project (self);
		_tmp26_ = _tmp25_;
		_tmp27_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = g_strdup_printf ("Moved to %s", _tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = util_create_toast (_tmp24_, _ (_tmp30_), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
		_tmp32_ = _tmp31_;
		g_signal_emit_by_name (_tmp22_, "send-toast", _tmp32_);
		_g_object_unref0 (_tmp32_);
		_g_free0 (_tmp30_);
		_g_object_unref0 (_tmp24_);
		_g_object_unref0 (_tmp22_);
	}
	_g_free0 (old_parent_id);
	_g_free0 (old_section_id);
	_g_free0 (old_project_id);
}

gboolean
objects_item_was_archived (ObjectsItem* self)
{
	GeeHashSet* _tmp0_;
	GeeHashSet* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = objects_item_was_archived_internal (self, (GeeSet*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

static gboolean
objects_item_was_archived_internal (ObjectsItem* self,
                                    GeeSet* visited)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	ObjectsProject* project_item = NULL;
	ObjectsProject* _tmp24_;
	ObjectsProject* _tmp25_;
	ObjectsProject* _tmp26_;
	ObjectsProject* _tmp27_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (visited != NULL, FALSE);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp1_ = _tmp0_;
	if (gee_collection_contains ((GeeCollection*) visited, _tmp1_)) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
		_tmp3_ = _tmp2_;
		g_warning ("Item.vala:1868: Item/Task %s has a circular reference", _tmp3_);
		result = FALSE;
		return result;
	}
	_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp5_ = _tmp4_;
	gee_collection_add ((GeeCollection*) visited, _tmp5_);
	_tmp7_ = objects_item_get_has_parent (self);
	_tmp8_ = _tmp7_;
	if (_tmp8_) {
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp9_ = self->priv->_parent_id;
		_tmp10_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
		_tmp11_ = _tmp10_;
		_tmp6_ = g_strcmp0 (_tmp9_, _tmp11_) != 0;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		ObjectsItem* parent_item = NULL;
		ObjectsItem* _tmp12_;
		ObjectsItem* _tmp13_;
		ObjectsItem* _tmp14_;
		ObjectsItem* _tmp15_;
		_tmp12_ = objects_item_get_parent (self);
		_tmp13_ = _tmp12_;
		_tmp14_ = _g_object_ref0 (_tmp13_);
		parent_item = _tmp14_;
		_tmp15_ = parent_item;
		if (_tmp15_ != NULL) {
			ObjectsItem* _tmp16_;
			_tmp16_ = parent_item;
			result = objects_item_was_archived_internal (_tmp16_, visited);
			_g_object_unref0 (parent_item);
			return result;
		}
		_g_object_unref0 (parent_item);
	}
	_tmp17_ = objects_item_get_has_section (self);
	_tmp18_ = _tmp17_;
	if (_tmp18_) {
		ObjectsSection* section_item = NULL;
		ObjectsSection* _tmp19_;
		ObjectsSection* _tmp20_;
		ObjectsSection* _tmp21_;
		ObjectsSection* _tmp22_;
		_tmp19_ = objects_item_get_section (self);
		_tmp20_ = _tmp19_;
		_tmp21_ = _g_object_ref0 (_tmp20_);
		section_item = _tmp21_;
		_tmp22_ = section_item;
		if (_tmp22_ != NULL) {
			ObjectsSection* _tmp23_;
			_tmp23_ = section_item;
			result = objects_section_was_archived (_tmp23_);
			_g_object_unref0 (section_item);
			return result;
		}
		_g_object_unref0 (section_item);
	}
	_tmp24_ = objects_item_get_project (self);
	_tmp25_ = _tmp24_;
	_tmp26_ = _g_object_ref0 (_tmp25_);
	project_item = _tmp26_;
	_tmp27_ = project_item;
	if (_tmp27_ != NULL) {
		ObjectsProject* _tmp28_;
		gboolean _tmp29_;
		gboolean _tmp30_;
		_tmp28_ = project_item;
		_tmp29_ = objects_project_get_is_archived (_tmp28_);
		_tmp30_ = _tmp29_;
		result = _tmp30_;
		_g_object_unref0 (project_item);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (project_item);
	return result;
}

gboolean
objects_item_exists_project (ObjectsItem* self,
                             ObjectsProject* project)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (project != NULL, FALSE);
	_tmp0_ = self->priv->_project_id;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp2_ = _tmp1_;
	result = g_strcmp0 (_tmp0_, _tmp2_) == 0;
	return result;
}

gchar*
objects_item_to_markdown (ObjectsItem* self,
                          gint level)
{
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_;
	gchar* text = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_checked;
	if (_tmp1_) {
		_tmp0_ = "[x]";
	} else {
		_tmp0_ = "[ ]";
	}
	_tmp2_ = utils_datetime_get_markdown_format_date (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->_content;
	_tmp5_ = g_strdup_printf ("%*s- %s%s%s\n", level * 2, "", _tmp0_, _tmp3_, _tmp4_);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp3_);
	text = _tmp6_;
	{
		GeeArrayList* _item_list = NULL;
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		gint _item_size = 0;
		GeeArrayList* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		gint _item_index = 0;
		_tmp7_ = objects_item_get_items (self);
		_tmp8_ = _tmp7_;
		_item_list = _tmp8_;
		_tmp9_ = _item_list;
		_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_item_size = _tmp11_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp12_;
			gint _tmp13_;
			ObjectsItem* item = NULL;
			GeeArrayList* _tmp14_;
			gpointer _tmp15_;
			const gchar* _tmp16_;
			ObjectsItem* _tmp17_;
			gchar* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			_item_index = _item_index + 1;
			_tmp12_ = _item_index;
			_tmp13_ = _item_size;
			if (!(_tmp12_ < _tmp13_)) {
				break;
			}
			_tmp14_ = _item_list;
			_tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, _item_index);
			item = (ObjectsItem*) _tmp15_;
			_tmp16_ = text;
			_tmp17_ = item;
			_tmp18_ = objects_item_to_markdown (_tmp17_, level + 1);
			_tmp19_ = _tmp18_;
			_tmp20_ = g_strconcat (_tmp16_, _tmp19_, NULL);
			_g_free0 (text);
			text = _tmp20_;
			_g_free0 (_tmp19_);
			_g_object_unref0 (item);
		}
	}
	result = text;
	return result;
}

void
objects_item_update_date (ObjectsItem* self,
                          GDateTime* datetime)
{
	gchar* _tmp0_ = NULL;
	ObjectsDueDate* _tmp3_;
	ObjectsDueDate* _tmp4_;
	g_return_if_fail (self != NULL);
	if (datetime == NULL) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("");
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		gchar* _tmp2_;
		_tmp2_ = utils_datetime_get_todoist_datetime_format (datetime);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = self->priv->_due;
	objects_due_date_set_date (_tmp3_, _tmp0_);
	_tmp4_ = self->priv->_due;
	objects_item_update_due (self, _tmp4_);
	_g_free0 (_tmp0_);
}

void
objects_item_update_due (ObjectsItem* self,
                         ObjectsDueDate* duedate)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	gboolean _tmp3_;
	ObjectsDueDate* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	ObjectsDueDate* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	ObjectsDueDate* _tmp14_;
	RecurrencyType _tmp15_;
	RecurrencyType _tmp16_;
	ObjectsDueDate* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	ObjectsDueDate* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	ObjectsDueDate* _tmp23_;
	gint _tmp24_;
	gint _tmp25_;
	ObjectsDueDate* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	ObjectsDueDate* _tmp29_;
	gboolean _tmp30_;
	gboolean _tmp31_;
	gboolean _tmp32_ = FALSE;
	ServicesSettings* _tmp33_;
	ServicesSettings* _tmp34_;
	gboolean _tmp35_;
	ObjectsDueDate* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	gboolean _tmp46_;
	gboolean _tmp47_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (duedate != NULL);
	_tmp2_ = objects_due_date_get_is_recurring (duedate);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		_tmp1_ = TRUE;
	} else {
		RecurrencyType _tmp4_;
		RecurrencyType _tmp5_;
		_tmp4_ = objects_due_date_get_recurrency_type (duedate);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_ == RECURRENCY_TYPE_NONE;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		ObjectsDueDate* _tmp6_;
		_tmp6_ = self->priv->_due;
		_tmp0_ = !objects_due_date_is_recurrency_equal (_tmp6_, duedate);
	}
	if (_tmp0_) {
		ObjectsDueDate* _tmp7_;
		_tmp7_ = self->priv->_due;
		objects_due_date_set_recurrence_string (_tmp7_, "");
	}
	_tmp8_ = self->priv->_due;
	_tmp9_ = objects_due_date_get_date (duedate);
	_tmp10_ = _tmp9_;
	objects_due_date_set_date (_tmp8_, _tmp10_);
	_tmp11_ = self->priv->_due;
	_tmp12_ = objects_due_date_get_is_recurring (duedate);
	_tmp13_ = _tmp12_;
	objects_due_date_set_is_recurring (_tmp11_, _tmp13_);
	_tmp14_ = self->priv->_due;
	_tmp15_ = objects_due_date_get_recurrency_type (duedate);
	_tmp16_ = _tmp15_;
	objects_due_date_set_recurrency_type (_tmp14_, _tmp16_);
	_tmp17_ = self->priv->_due;
	_tmp18_ = objects_due_date_get_recurrency_interval (duedate);
	_tmp19_ = _tmp18_;
	objects_due_date_set_recurrency_interval (_tmp17_, _tmp19_);
	_tmp20_ = self->priv->_due;
	_tmp21_ = objects_due_date_get_recurrency_weeks (duedate);
	_tmp22_ = _tmp21_;
	objects_due_date_set_recurrency_weeks (_tmp20_, _tmp22_);
	_tmp23_ = self->priv->_due;
	_tmp24_ = objects_due_date_get_recurrency_count (duedate);
	_tmp25_ = _tmp24_;
	objects_due_date_set_recurrency_count (_tmp23_, _tmp25_);
	_tmp26_ = self->priv->_due;
	_tmp27_ = objects_due_date_get_recurrency_end (duedate);
	_tmp28_ = _tmp27_;
	objects_due_date_set_recurrency_end (_tmp26_, _tmp28_);
	_tmp29_ = self->priv->_due;
	_tmp30_ = objects_due_date_get_recurrency_last_day_of_month (duedate);
	_tmp31_ = _tmp30_;
	objects_due_date_set_recurrency_last_day_of_month (_tmp29_, _tmp31_);
	_tmp33_ = services_settings_get_default ();
	_tmp34_ = _tmp33_;
	_tmp35_ = services_settings_get_boolean (_tmp34_, "automatic-reminders-enabled");
	_g_object_unref0 (_tmp34_);
	if (_tmp35_) {
		gboolean _tmp36_;
		gboolean _tmp37_;
		_tmp36_ = objects_item_get_has_time (self);
		_tmp37_ = _tmp36_;
		_tmp32_ = _tmp37_;
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		ObjectsReminder* reminder = NULL;
		ObjectsReminder* _tmp38_;
		ObjectsReminder* _tmp39_;
		ObjectsReminder* _tmp40_;
		ObjectsReminder* _tmp41_;
		objects_item_remove_all_relative_reminders (self);
		_tmp38_ = objects_reminder_new ();
		reminder = _tmp38_;
		_tmp39_ = reminder;
		objects_reminder_set_mm_offset (_tmp39_, util_get_reminders_mm_offset ());
		_tmp40_ = reminder;
		objects_reminder_set_reminder_type (_tmp40_, REMINDER_TYPE_RELATIVE);
		_tmp41_ = reminder;
		objects_item_add_reminder (self, _tmp41_);
		_g_object_unref0 (reminder);
	}
	_tmp42_ = self->priv->_due;
	_tmp43_ = objects_due_date_get_date (_tmp42_);
	_tmp44_ = _tmp43_;
	if (g_strcmp0 (_tmp44_, "") == 0) {
		ObjectsDueDate* _tmp45_;
		_tmp45_ = self->priv->_due;
		objects_due_date_reset (_tmp45_);
		objects_item_remove_all_relative_reminders (self);
	}
	_tmp46_ = objects_item_get_has_time (self);
	_tmp47_ = _tmp46_;
	if (!_tmp47_) {
		objects_item_remove_all_relative_reminders (self);
	}
	objects_item_update_async (self, "");
}

static Block55Data*
block55_data_ref (Block55Data* _data55_)
{
	g_atomic_int_inc (&_data55_->_ref_count_);
	return _data55_;
}

static void
block55_data_unref (void * _userdata_)
{
	Block55Data* _data55_;
	_data55_ = (Block55Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data55_->_ref_count_)) {
		ObjectsItem* self;
		self = _data55_->self;
		_g_object_unref0 (_data55_->reminder);
		_g_object_unref0 (self);
		g_slice_free (Block55Data, _data55_);
	}
}

static void
___lambda93_ (Block55Data* _data55_,
              GObject* obj,
              GAsyncResult* res)
{
	ObjectsItem* self;
	HttpResponse* response = NULL;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	HttpResponse* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	ObjectsReminder* _tmp14_;
	ObjectsReminder* _tmp15_;
	self = _data55_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_add_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	response = _tmp3_;
	objects_base_object_set_loading ((ObjectsBaseObject*) self, FALSE);
	_tmp4_ = response;
	_tmp5_ = http_response_get_status (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		HttpResponse* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp7_ = response;
		_tmp8_ = http_response_get_data (_tmp7_);
		_tmp9_ = _tmp8_;
		objects_base_object_set_id ((ObjectsBaseObject*) _data55_->reminder, _tmp9_);
	} else {
		Util* _tmp10_;
		Util* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp10_ = util_get_default ();
		_tmp11_ = _tmp10_;
		_tmp12_ = util_generate_id (_tmp11_, (ObjectsBaseObject*) _data55_->reminder);
		_tmp13_ = _tmp12_;
		objects_base_object_set_id ((ObjectsBaseObject*) _data55_->reminder, _tmp13_);
		_g_free0 (_tmp13_);
		_g_object_unref0 (_tmp11_);
	}
	_tmp14_ = objects_item_add_reminder_if_not_exists (self, _data55_->reminder, TRUE);
	_tmp15_ = _tmp14_;
	_g_object_unref0 (_tmp15_);
	_http_response_unref0 (response);
}

static void
____lambda93__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda93_ (self, source_object, res);
	block55_data_unref (self);
}

void
objects_item_add_reminder (ObjectsItem* self,
                           ObjectsReminder* reminder)
{
	Block55Data* _data55_;
	ObjectsReminder* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	ObjectsProject* _tmp3_;
	ObjectsProject* _tmp4_;
	SourceType _tmp5_;
	SourceType _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reminder != NULL);
	_data55_ = g_slice_new0 (Block55Data);
	_data55_->_ref_count_ = 1;
	_data55_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (reminder);
	_g_object_unref0 (_data55_->reminder);
	_data55_->reminder = _tmp0_;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp2_ = _tmp1_;
	objects_reminder_set_item_id (_data55_->reminder, _tmp2_);
	_tmp3_ = objects_item_get_project (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = objects_project_get_source_type (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == SOURCE_TYPE_TODOIST) {
		ServicesTodoist* _tmp7_;
		ServicesTodoist* _tmp8_;
		_tmp7_ = services_todoist_get_default ();
		_tmp8_ = _tmp7_;
		services_todoist_add (_tmp8_, (ObjectsBaseObject*) _data55_->reminder, ____lambda93__gasync_ready_callback, block55_data_ref (_data55_));
		_g_object_unref0 (_tmp8_);
	} else {
		Util* _tmp9_;
		Util* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		ObjectsReminder* _tmp13_;
		ObjectsReminder* _tmp14_;
		_tmp9_ = util_get_default ();
		_tmp10_ = _tmp9_;
		_tmp11_ = util_generate_id (_tmp10_, (ObjectsBaseObject*) _data55_->reminder);
		_tmp12_ = _tmp11_;
		objects_base_object_set_id ((ObjectsBaseObject*) _data55_->reminder, _tmp12_);
		_g_free0 (_tmp12_);
		_g_object_unref0 (_tmp10_);
		_tmp13_ = objects_item_add_reminder_if_not_exists (self, _data55_->reminder, TRUE);
		_tmp14_ = _tmp13_;
		_g_object_unref0 (_tmp14_);
	}
	block55_data_unref (_data55_);
	_data55_ = NULL;
}

void
objects_item_add_reminder_events (ObjectsItem* self,
                                  ObjectsReminder* reminder)
{
	ServicesStore* _tmp0_;
	ServicesStore* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	ObjectsItem* _tmp4_;
	ObjectsItem* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reminder != NULL);
	_tmp0_ = services_store_instance ();
	g_signal_emit_by_name (_tmp0_, "reminder-added", reminder);
	_tmp1_ = services_store_instance ();
	_tmp2_ = services_store_get_reminders (_tmp1_);
	_tmp3_ = _tmp2_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, reminder);
	_tmp4_ = objects_reminder_get_item (reminder);
	_tmp5_ = _tmp4_;
	g_signal_emit (_tmp5_, objects_item_signals[OBJECTS_ITEM_REMINDER_ADDED_SIGNAL], 0, reminder);
	_objects_item_add_reminder (self, reminder);
}

static void
objects_item_remove_all_relative_reminders (ObjectsItem* self)
{
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _reminder_list = NULL;
		GeeArrayList* _tmp0_;
		GeeArrayList* _tmp1_;
		gint _reminder_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _reminder_index = 0;
		_tmp0_ = objects_item_get_reminders (self);
		_tmp1_ = _tmp0_;
		_reminder_list = _tmp1_;
		_tmp2_ = _reminder_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_reminder_size = _tmp4_;
		_reminder_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ObjectsReminder* reminder = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			ObjectsReminder* _tmp9_;
			ReminderType _tmp10_;
			ReminderType _tmp11_;
			_reminder_index = _reminder_index + 1;
			_tmp5_ = _reminder_index;
			_tmp6_ = _reminder_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _reminder_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _reminder_index);
			reminder = (ObjectsReminder*) _tmp8_;
			_tmp9_ = reminder;
			_tmp10_ = objects_reminder_get_reminder_type (_tmp9_);
			_tmp11_ = _tmp10_;
			if (_tmp11_ == REMINDER_TYPE_RELATIVE) {
				ObjectsReminder* _tmp12_;
				_tmp12_ = reminder;
				objects_reminder_delete (_tmp12_);
			}
			_g_object_unref0 (reminder);
		}
	}
}

static void
objects_item_complete_item_data_free (gpointer _data)
{
	ObjectsItemCompleteItemData* _data_;
	_data_ = _data;
	_http_response_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ObjectsItemCompleteItemData, _data_);
}

void
objects_item_complete_item (ObjectsItem* self,
                            gboolean old_checked,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	ObjectsItemCompleteItemData* _data_;
	ObjectsItem* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ObjectsItemCompleteItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, objects_item_complete_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->old_checked = old_checked;
	objects_item_complete_item_co (_data_);
}

HttpResponse*
objects_item_complete_item_finish (ObjectsItem* self,
                                   GAsyncResult* _res_)
{
	HttpResponse* result;
	ObjectsItemCompleteItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
objects_item_complete_item_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_)
{
	ObjectsItemCompleteItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	objects_item_complete_item_co (_data_);
}

static gboolean
objects_item_complete_item_co (ObjectsItemCompleteItemData* _data_)
{
	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_ = http_response_new ();
	_data_->response = _data_->_tmp0_;
	_data_->_tmp1_ = objects_item_get_project (_data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = objects_project_get_source_type (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	if (_data_->_tmp4_ == SOURCE_TYPE_LOCAL) {
		_data_->_tmp5_ = services_store_instance ();
		services_store_complete_item (_data_->_tmp5_, _data_->self, _data_->old_checked, TRUE);
		_data_->_tmp6_ = _data_->response;
		http_response_set_status (_data_->_tmp6_, TRUE);
		_data_->result = _data_->response;
		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;
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, TRUE);
	_data_->_tmp7_ = objects_item_get_project (_data_->self);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = objects_project_get_source_type (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	if (_data_->_tmp10_ == SOURCE_TYPE_TODOIST) {
		_data_->_tmp11_ = services_todoist_get_default ();
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_state_ = 1;
		services_todoist_complete_item (_data_->_tmp12_, _data_->self, objects_item_complete_item_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp13_ = services_todoist_complete_item_finish (_data_->_tmp12_, _data_->_res_);
		_http_response_unref0 (_data_->response);
		_data_->response = _data_->_tmp13_;
		_g_object_unref0 (_data_->_tmp12_);
	} else {
		_data_->_tmp14_ = services_cal_dav_core_get_default ();
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp16_ = objects_item_get_project (_data_->self);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = objects_project_get_source (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = services_cal_dav_core_get_client (_data_->_tmp15_, _data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_g_object_unref0 (_data_->_tmp15_);
		_data_->caldav_client = _data_->_tmp21_;
		_data_->_tmp22_ = _data_->caldav_client;
		_data_->_state_ = 2;
		services_cal_dav_cal_dav_client_complete_item (_data_->_tmp22_, _data_->self, objects_item_complete_item_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp23_ = services_cal_dav_cal_dav_client_complete_item_finish (_data_->_tmp22_, _data_->_res_);
		_http_response_unref0 (_data_->response);
		_data_->response = _data_->_tmp23_;
		_g_object_unref0 (_data_->caldav_client);
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, FALSE);
	_data_->_tmp24_ = _data_->response;
	_data_->_tmp25_ = http_response_get_status (_data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	if (_data_->_tmp26_) {
		_data_->_tmp27_ = objects_item_get_project (_data_->self);
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_tmp29_ = objects_project_get_source_type (_data_->_tmp28_);
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->complete_subitems = _data_->_tmp30_ != SOURCE_TYPE_CALDAV;
		_data_->_tmp31_ = services_store_instance ();
		services_store_complete_item (_data_->_tmp31_, _data_->self, _data_->old_checked, _data_->complete_subitems);
		_data_->_tmp32_ = objects_item_get_project (_data_->self);
		_data_->_tmp33_ = _data_->_tmp32_;
		_data_->_tmp34_ = objects_project_get_source_type (_data_->_tmp33_);
		_data_->_tmp35_ = _data_->_tmp34_;
		if (_data_->_tmp35_ == SOURCE_TYPE_CALDAV) {
			{
				_data_->_tmp36_ = services_store_instance ();
				_data_->_tmp37_ = services_store_get_subitems (_data_->_tmp36_, _data_->self);
				_data_->_subitem_list = _data_->_tmp37_;
				_data_->_tmp38_ = _data_->_subitem_list;
				_data_->_tmp39_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp38_);
				_data_->_tmp40_ = _data_->_tmp39_;
				_data_->_subitem_size = _data_->_tmp40_;
				_data_->_subitem_index = -1;
				while (TRUE) {
					_data_->_subitem_index = _data_->_subitem_index + 1;
					_data_->_tmp41_ = _data_->_subitem_index;
					_data_->_tmp42_ = _data_->_subitem_size;
					if (!(_data_->_tmp41_ < _data_->_tmp42_)) {
						break;
					}
					_data_->_tmp43_ = _data_->_subitem_list;
					_data_->_tmp44_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp43_, _data_->_subitem_index);
					_data_->subitem = (ObjectsItem*) _data_->_tmp44_;
					_data_->_tmp45_ = _data_->subitem;
					_data_->_tmp46_ = _data_->self->priv->_checked;
					objects_item_set_checked (_data_->_tmp45_, _data_->_tmp46_);
					_data_->_tmp47_ = _data_->subitem;
					_data_->_tmp48_ = _data_->self->priv->_completed_at;
					objects_item_set_completed_at (_data_->_tmp47_, _data_->_tmp48_);
					_data_->_tmp49_ = _data_->subitem;
					objects_item_complete_item (_data_->_tmp49_, _data_->old_checked, NULL, NULL);
					_g_object_unref0 (_data_->subitem);
				}
				_g_object_unref0 (_data_->_subitem_list);
			}
		}
	} else {
		_data_->_tmp50_ = _data_->response;
		_data_->_tmp51_ = http_response_get_error_code (_data_->_tmp50_);
		_data_->_tmp52_ = _data_->_tmp51_;
		if (_data_->_tmp52_ == 412) {
			objects_base_object_set_loading ((ObjectsBaseObject*) _data_->self, FALSE);
			_data_->_tmp53_ = services_event_bus_get_default ();
			_data_->_tmp54_ = _data_->_tmp53_;
			_data_->_tmp55_ = objects_item_get_project (_data_->self);
			_data_->_tmp56_ = _data_->_tmp55_;
			_data_->_tmp57_ = objects_project_get_source (_data_->_tmp56_);
			_data_->_tmp58_ = _data_->_tmp57_;
			g_signal_emit_by_name (_data_->_tmp54_, "send-conflict-toast", _data_->_tmp58_);
			_g_object_unref0 (_data_->_tmp54_);
		}
	}
	_data_->result = _data_->response;
	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
objects_item_update_labels (ObjectsItem* self,
                            GeeHashMap* new_labels)
{
	gboolean update = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_labels != NULL);
	update = FALSE;
	{
		GeeIterator* _entry_it = NULL;
		GeeSet* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_;
		GeeIterator* _tmp4_;
		_tmp0_ = gee_abstract_map_get_entries ((GeeAbstractMap*) new_labels);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_entry_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp6_;
			gpointer _tmp7_;
			GeeMapEntry* _tmp8_;
			gconstpointer _tmp9_;
			gconstpointer _tmp10_;
			ObjectsLabel* _tmp11_;
			ObjectsLabel* _tmp12_;
			gboolean _tmp13_;
			_tmp5_ = _entry_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _entry_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			entry = (GeeMapEntry*) _tmp7_;
			_tmp8_ = entry;
			_tmp9_ = gee_map_entry_get_key (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp11_ = objects_item_get_label (self, (const gchar*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = _tmp12_ == NULL;
			_g_object_unref0 (_tmp12_);
			if (_tmp13_) {
				GeeMapEntry* _tmp14_;
				gconstpointer _tmp15_;
				gconstpointer _tmp16_;
				ObjectsLabel* _tmp17_;
				ObjectsLabel* _tmp18_;
				_tmp14_ = entry;
				_tmp15_ = gee_map_entry_get_value (_tmp14_);
				_tmp16_ = _tmp15_;
				_tmp17_ = objects_item_add_label_if_not_exists (self, (ObjectsLabel*) _tmp16_);
				_tmp18_ = _tmp17_;
				_g_object_unref0 (_tmp18_);
				update = TRUE;
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	{
		GeeArrayList* _label_list = NULL;
		GeeArrayList* _tmp19_;
		gint _label_size = 0;
		GeeArrayList* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		gint _label_index = 0;
		_tmp19_ = objects_item_get_labels_list (self);
		_label_list = _tmp19_;
		_tmp20_ = _label_list;
		_tmp21_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp20_);
		_tmp22_ = _tmp21_;
		_label_size = _tmp22_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp23_;
			gint _tmp24_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp25_;
			gpointer _tmp26_;
			ObjectsLabel* _tmp27_;
			const gchar* _tmp28_;
			const gchar* _tmp29_;
			_label_index = _label_index + 1;
			_tmp23_ = _label_index;
			_tmp24_ = _label_size;
			if (!(_tmp23_ < _tmp24_)) {
				break;
			}
			_tmp25_ = _label_list;
			_tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _tmp25_, _label_index);
			label = (ObjectsLabel*) _tmp26_;
			_tmp27_ = label;
			_tmp28_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp27_);
			_tmp29_ = _tmp28_;
			if (!gee_abstract_map_has_key ((GeeAbstractMap*) new_labels, _tmp29_)) {
				ObjectsLabel* _tmp30_;
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				ObjectsLabel* _tmp33_;
				ObjectsLabel* _tmp34_;
				_tmp30_ = label;
				_tmp31_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = objects_item_delete_item_label (self, _tmp32_);
				_tmp34_ = _tmp33_;
				_g_object_unref0 (_tmp34_);
				update = TRUE;
			}
			_g_object_unref0 (label);
		}
		_g_object_unref0 (_label_list);
	}
	if (!update) {
		return;
	}
	objects_item_update_async (self, "");
}

void
objects_item_to_string (ObjectsItem* self)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gint _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_ = NULL;
	gboolean _tmp14_;
	const gchar* _tmp15_ = NULL;
	gboolean _tmp16_;
	const gchar* _tmp17_ = NULL;
	gboolean _tmp18_;
	gboolean _tmp19_;
	gboolean _tmp20_;
	gboolean _tmp21_;
	gint _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	GeeArrayList* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	g_return_if_fail (self != NULL);
	g_print ("_________________________________\n");
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) self);
	_tmp1_ = _tmp0_;
	g_print ("ID: %s\n", _tmp1_);
	_tmp2_ = self->priv->_content;
	g_print ("Content: %s\n", _tmp2_);
	_tmp3_ = self->priv->_description;
	g_print ("Description: %s\n", _tmp3_);
	_tmp4_ = objects_item_get_project_id (self);
	_tmp5_ = _tmp4_;
	g_print ("Project ID: %s\n", _tmp5_);
	_tmp6_ = objects_item_get_section_id (self);
	_tmp7_ = _tmp6_;
	g_print ("Section ID: %s\n", _tmp7_);
	_tmp8_ = objects_item_get_parent_id (self);
	_tmp9_ = _tmp8_;
	g_print ("Parent ID: %s\n", _tmp9_);
	_tmp10_ = self->priv->_priority;
	_tmp11_ = objects_item_get_priority_text (self);
	_tmp12_ = _tmp11_;
	g_print ("Priority: %d (%s)\n", _tmp10_, _tmp12_);
	_tmp14_ = self->priv->_checked;
	if (_tmp14_) {
		_tmp13_ = "true";
	} else {
		_tmp13_ = "false";
	}
	g_print ("Checked: %s\n", _tmp13_);
	_tmp16_ = self->priv->_pinned;
	if (_tmp16_) {
		_tmp15_ = "true";
	} else {
		_tmp15_ = "false";
	}
	g_print ("Pinned: %s\n", _tmp15_);
	_tmp18_ = objects_item_get_has_due (self);
	_tmp19_ = _tmp18_;
	if (_tmp19_) {
		_tmp17_ = "true";
	} else {
		_tmp17_ = "false";
	}
	g_print ("Has Due: %s\n", _tmp17_);
	_tmp20_ = objects_item_get_has_due (self);
	_tmp21_ = _tmp20_;
	if (_tmp21_) {
		ObjectsDueDate* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		_tmp22_ = self->priv->_due;
		_tmp23_ = objects_due_date_get_date (_tmp22_);
		_tmp24_ = _tmp23_;
		g_print ("Due Date: %s\n", _tmp24_);
	}
	_tmp25_ = self->priv->_child_order;
	g_print ("Child Order: %d\n", _tmp25_);
	_tmp26_ = self->priv->_added_at;
	g_print ("Added At: %s\n", _tmp26_);
	_tmp27_ = self->priv->_completed_at;
	g_print ("Completed At: %s\n", _tmp27_);
	_tmp28_ = self->priv->_labels;
	_tmp29_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp28_);
	_tmp30_ = _tmp29_;
	g_print ("Labels: %d\n", _tmp30_);
	{
		GeeArrayList* _label_list = NULL;
		GeeArrayList* _tmp31_;
		gint _label_size = 0;
		GeeArrayList* _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		gint _label_index = 0;
		_tmp31_ = self->priv->_labels;
		_label_list = _tmp31_;
		_tmp32_ = _label_list;
		_tmp33_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp32_);
		_tmp34_ = _tmp33_;
		_label_size = _tmp34_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp35_;
			gint _tmp36_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp37_;
			gpointer _tmp38_;
			ObjectsLabel* _tmp39_;
			const gchar* _tmp40_;
			const gchar* _tmp41_;
			_label_index = _label_index + 1;
			_tmp35_ = _label_index;
			_tmp36_ = _label_size;
			if (!(_tmp35_ < _tmp36_)) {
				break;
			}
			_tmp37_ = _label_list;
			_tmp38_ = gee_abstract_list_get ((GeeAbstractList*) _tmp37_, _label_index);
			label = (ObjectsLabel*) _tmp38_;
			_tmp39_ = label;
			_tmp40_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp39_);
			_tmp41_ = _tmp40_;
			g_print ("  - %s\n", _tmp41_);
			_g_object_unref0 (label);
		}
	}
	g_print ("---------------------------------\n");
}

ObjectsItem*
objects_item_construct (GType object_type)
{
	ObjectsItem * self = NULL;
	self = (ObjectsItem*) objects_base_object_construct (object_type);
	return self;
}

ObjectsItem*
objects_item_new (void)
{
	return objects_item_construct (OBJECTS_TYPE_ITEM);
}

const gchar*
objects_item_get_content (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content;
	result = _tmp0_;
	return result;
}

void
objects_item_set_content (ObjectsItem* self,
                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_content (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_content);
		self->priv->_content = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_CONTENT_PROPERTY]);
	}
}

const gchar*
objects_item_get_description (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_description;
	result = _tmp0_;
	return result;
}

void
objects_item_set_description (ObjectsItem* self,
                              const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_description (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_description);
		self->priv->_description = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_DESCRIPTION_PROPERTY]);
	}
}

const gchar*
objects_item_get_added_at (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_added_at;
	result = _tmp0_;
	return result;
}

void
objects_item_set_added_at (ObjectsItem* self,
                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_added_at (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_added_at);
		self->priv->_added_at = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_ADDED_AT_PROPERTY]);
	}
}

const gchar*
objects_item_get_completed_at (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_completed_at;
	result = _tmp0_;
	return result;
}

void
objects_item_set_completed_at (ObjectsItem* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_completed_at (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_completed_at);
		self->priv->_completed_at = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_COMPLETED_AT_PROPERTY]);
	}
}

const gchar*
objects_item_get_updated_at (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_updated_at;
	result = _tmp0_;
	return result;
}

void
objects_item_set_updated_at (ObjectsItem* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_updated_at (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_updated_at);
		self->priv->_updated_at = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_UPDATED_AT_PROPERTY]);
	}
}

const gchar*
objects_item_get_calendar_event_uid (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_calendar_event_uid;
	result = _tmp0_;
	return result;
}

void
objects_item_set_calendar_event_uid (ObjectsItem* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_calendar_event_uid (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_calendar_event_uid);
		self->priv->_calendar_event_uid = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_CALENDAR_EVENT_UID_PROPERTY]);
	}
}

const gchar*
objects_item_get_deadline_date (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_deadline_date;
	result = _tmp0_;
	return result;
}

void
objects_item_set_deadline_date (ObjectsItem* self,
                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_deadline_date (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_deadline_date);
		self->priv->_deadline_date = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_DEADLINE_DATE_PROPERTY]);
	}
}

const gchar*
objects_item_get_section_id (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_section_id;
	result = _tmp0_;
	return result;
}

void
objects_item_set_section_id (ObjectsItem* self,
                             const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_section_id);
	self->priv->_section_id = _tmp0_;
	_g_object_unref0 (self->priv->_section);
	self->priv->_section = NULL;
	g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_SECTION_ID_PROPERTY]);
}

const gchar*
objects_item_get_project_id (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_project_id;
	result = _tmp0_;
	return result;
}

void
objects_item_set_project_id (ObjectsItem* self,
                             const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_project_id);
	self->priv->_project_id = _tmp0_;
	_g_object_unref0 (self->priv->_project);
	self->priv->_project = NULL;
	g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_PROJECT_ID_PROPERTY]);
}

const gchar*
objects_item_get_parent_id (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_parent_id;
	result = _tmp0_;
	return result;
}

void
objects_item_set_parent_id (ObjectsItem* self,
                            const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_parent_id);
	self->priv->_parent_id = _tmp0_;
	_g_object_unref0 (self->priv->_parent);
	self->priv->_parent = NULL;
	g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_PARENT_ID_PROPERTY]);
}

const gchar*
objects_item_get_extra_data (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_extra_data;
	result = _tmp0_;
	return result;
}

void
objects_item_set_extra_data (ObjectsItem* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_extra_data (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_extra_data);
		self->priv->_extra_data = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_EXTRA_DATA_PROPERTY]);
	}
}

ItemType
objects_item_get_item_type (ObjectsItem* self)
{
	ItemType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_item_type;
	return result;
}

void
objects_item_set_item_type (ObjectsItem* self,
                            ItemType value)
{
	ItemType old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_item_type (self);
	if (old_value != value) {
		self->priv->_item_type = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_ITEM_TYPE_PROPERTY]);
	}
}

const gchar*
objects_item_get_responsible_uid (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_responsible_uid;
	result = _tmp0_;
	return result;
}

void
objects_item_set_responsible_uid (ObjectsItem* self,
                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_responsible_uid (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_responsible_uid);
		self->priv->_responsible_uid = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_RESPONSIBLE_UID_PROPERTY]);
	}
}

ObjectsDueDate*
objects_item_get_due (ObjectsItem* self)
{
	ObjectsDueDate* result;
	ObjectsDueDate* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_due;
	result = _tmp0_;
	return result;
}

void
objects_item_set_due (ObjectsItem* self,
                      ObjectsDueDate* value)
{
	ObjectsDueDate* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_due (self);
	if (old_value != value) {
		ObjectsDueDate* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_due);
		self->priv->_due = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_DUE_PROPERTY]);
	}
}

GeeArrayList*
objects_item_get_labels (ObjectsItem* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_labels;
	result = _tmp0_;
	return result;
}

void
objects_item_set_labels (ObjectsItem* self,
                         GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_labels (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_labels);
		self->priv->_labels = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_LABELS_PROPERTY]);
	}
}

gint
objects_item_get_priority (ObjectsItem* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_priority;
	return result;
}

void
objects_item_set_priority (ObjectsItem* self,
                           gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_priority (self);
	if (old_value != value) {
		self->priv->_priority = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_PRIORITY_PROPERTY]);
	}
}

gboolean
objects_item_get_activate_name_editable (ObjectsItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_activate_name_editable;
	return result;
}

void
objects_item_set_activate_name_editable (ObjectsItem* self,
                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_activate_name_editable (self);
	if (old_value != value) {
		self->priv->_activate_name_editable = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_ACTIVATE_NAME_EDITABLE_PROPERTY]);
	}
}

const gchar*
objects_item_get_short_content (ObjectsItem* self)
{
	const gchar* result;
	Util* _tmp0_;
	Util* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = util_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_content;
	_tmp3_ = util_get_short_name (_tmp1_, _tmp2_, CONSTANTS_SHORT_NAME_SIZE);
	_g_free0 (self->priv->_short_content);
	self->priv->_short_content = _tmp3_;
	_g_object_unref0 (_tmp1_);
	_tmp4_ = self->priv->_short_content;
	result = _tmp4_;
	return result;
}

const gchar*
objects_item_get_priority_icon (ObjectsItem* self)
{
	const gchar* result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_priority;
	if (_tmp0_ == CONSTANTS_PRIORITY_1) {
		result = "planner-priority-1";
		return result;
	} else {
		gint _tmp1_;
		_tmp1_ = self->priv->_priority;
		if (_tmp1_ == CONSTANTS_PRIORITY_2) {
			result = "planner-priority-2";
			return result;
		} else {
			gint _tmp2_;
			_tmp2_ = self->priv->_priority;
			if (_tmp2_ == CONSTANTS_PRIORITY_3) {
				result = "planner-priority-3";
				return result;
			} else {
				result = "planner-flag";
				return result;
			}
		}
	}
}

const gchar*
objects_item_get_priority_color (ObjectsItem* self)
{
	const gchar* result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_priority;
	if (_tmp0_ == CONSTANTS_PRIORITY_1) {
		result = "#ff7066";
		return result;
	} else {
		gint _tmp1_;
		_tmp1_ = self->priv->_priority;
		if (_tmp1_ == CONSTANTS_PRIORITY_2) {
			result = "#ff9914";
			return result;
		} else {
			gint _tmp2_;
			_tmp2_ = self->priv->_priority;
			if (_tmp2_ == CONSTANTS_PRIORITY_3) {
				result = "#5297ff";
				return result;
			} else {
				result = "@text_color";
				return result;
			}
		}
	}
}

const gchar*
objects_item_get_priority_text (ObjectsItem* self)
{
	const gchar* result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_priority;
	if (_tmp0_ == CONSTANTS_PRIORITY_1) {
		result = _ ("Priority 1: high");
		return result;
	} else {
		gint _tmp1_;
		_tmp1_ = self->priv->_priority;
		if (_tmp1_ == CONSTANTS_PRIORITY_2) {
			result = _ ("Priority 2: medium");
			return result;
		} else {
			gint _tmp2_;
			_tmp2_ = self->priv->_priority;
			if (_tmp2_ == CONSTANTS_PRIORITY_3) {
				result = _ ("Priority 3: low");
				return result;
			} else {
				result = _ ("Priority 4: none");
				return result;
			}
		}
	}
}

gint
objects_item_get_child_order (ObjectsItem* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_child_order;
	return result;
}

void
objects_item_set_child_order (ObjectsItem* self,
                              gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_child_order (self);
	if (old_value != value) {
		self->priv->_child_order = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_CHILD_ORDER_PROPERTY]);
	}
}

gint
objects_item_get_day_order (ObjectsItem* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_day_order;
	return result;
}

void
objects_item_set_day_order (ObjectsItem* self,
                            gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_day_order (self);
	if (old_value != value) {
		self->priv->_day_order = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_DAY_ORDER_PROPERTY]);
	}
}

gboolean
objects_item_get_checked (ObjectsItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_checked;
	return result;
}

void
objects_item_set_checked (ObjectsItem* self,
                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_checked (self);
	if (old_value != value) {
		self->priv->_checked = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_CHECKED_PROPERTY]);
	}
}

gboolean
objects_item_get_is_deleted (ObjectsItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_deleted;
	return result;
}

void
objects_item_set_is_deleted (ObjectsItem* self,
                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_is_deleted (self);
	if (old_value != value) {
		self->priv->_is_deleted = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_IS_DELETED_PROPERTY]);
	}
}

gboolean
objects_item_get_collapsed (ObjectsItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_collapsed;
	return result;
}

void
objects_item_set_collapsed (ObjectsItem* self,
                            gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_collapsed = value;
	g_signal_emit (self, objects_item_signals[OBJECTS_ITEM_COLLAPSED_CHANGE_SIGNAL], 0);
	g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_COLLAPSED_PROPERTY]);
}

gboolean
objects_item_get_pinned (ObjectsItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_pinned;
	return result;
}

void
objects_item_set_pinned (ObjectsItem* self,
                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_item_get_pinned (self);
	if (old_value != value) {
		self->priv->_pinned = value;
		g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_PINNED_PROPERTY]);
	}
}

const gchar*
objects_item_get_pinned_icon (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_pinned;
	if (_tmp1_) {
		_tmp0_ = "planner-pin-tack";
	} else {
		_tmp0_ = "planner-pinned";
	}
	result = _tmp0_;
	return result;
}

gboolean
objects_item_get_completed (ObjectsItem* self)
{
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_checked;
	result = _tmp0_;
	return result;
}

gboolean
objects_item_get_has_due (ObjectsItem* self)
{
	gboolean result;
	gboolean _tmp0_ = FALSE;
	ObjectsDueDate* _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->_due;
	if (_tmp1_ != NULL) {
		ObjectsDueDate* _tmp2_;
		GDateTime* _tmp3_;
		GDateTime* _tmp4_;
		_tmp2_ = self->priv->_due;
		_tmp3_ = objects_due_date_get_datetime (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
objects_item_get_has_time (ObjectsItem* self)
{
	gboolean result;
	ObjectsDueDate* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	ObjectsDueDate* _tmp3_;
	GDateTime* _tmp4_;
	GDateTime* _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_due;
	_tmp1_ = objects_due_date_get_datetime (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp3_ = self->priv->_due;
	_tmp4_ = objects_due_date_get_datetime (_tmp3_);
	_tmp5_ = _tmp4_;
	result = utils_datetime_has_time (_tmp5_);
	return result;
}

GDateTime*
objects_item_get_completed_date (ObjectsItem* self)
{
	GDateTime* result;
	const gchar* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_completed_at;
	_tmp1_ = utils_datetime_get_date_from_string (_tmp0_);
	_g_date_time_unref0 (self->priv->_completed_date);
	self->priv->_completed_date = _tmp1_;
	_tmp2_ = self->priv->_completed_date;
	result = _tmp2_;
	return result;
}

gboolean
objects_item_get_has_parent (ObjectsItem* self)
{
	gboolean result;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->_parent_id;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->_parent_id;
		_tmp0_ = g_strcmp0 (_tmp2_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
objects_item_get_has_section (ObjectsItem* self)
{
	gboolean result;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->_section_id;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		_tmp2_ = self->priv->_section_id;
		_tmp0_ = g_strcmp0 (_tmp2_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
objects_item_get_show_item (ObjectsItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_item;
	return result;
}

void
objects_item_set_show_item (ObjectsItem* self,
                            gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_show_item = value;
	g_signal_emit (self, objects_item_signals[OBJECTS_ITEM_SHOW_ITEM_CHANGED_SIGNAL], 0);
	g_object_notify_by_pspec ((GObject *) self, objects_item_properties[OBJECTS_ITEM_SHOW_ITEM_PROPERTY]);
}

const gchar*
objects_item_get_ical_url (ObjectsItem* self)
{
	const gchar* result;
	JsonObject* json_object = NULL;
	const gchar* _tmp0_;
	JsonObject* _tmp1_;
	JsonObject* _tmp2_;
	const gchar* _tmp12_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_extra_data;
	_tmp1_ = utils_json_utils_get_object (_tmp0_);
	json_object = _tmp1_;
	_tmp2_ = json_object;
	if (json_object_has_member (_tmp2_, "ics")) {
		ObjectsProject* _tmp3_;
		ObjectsProject* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		JsonObject* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp3_ = objects_item_get_project (self);
		_tmp4_ = _tmp3_;
		_tmp5_ = objects_project_get_calendar_url (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = json_object;
		_tmp8_ = json_object_get_string_member (_tmp7_, "ics");
		_tmp9_ = g_strdup_printf ("%s/%s", _tmp6_, _tmp8_);
		_g_free0 (self->priv->_ical_url);
		self->priv->_ical_url = _tmp9_;
	} else {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = self->priv->_extra_data;
		_tmp11_ = utils_json_utils_get_string (_tmp10_, "ical_url");
		_g_free0 (self->priv->_ical_url);
		self->priv->_ical_url = _tmp11_;
	}
	_tmp12_ = self->priv->_ical_url;
	result = _tmp12_;
	_json_object_unref0 (json_object);
	return result;
}

const gchar*
objects_item_get_calendar_data (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_extra_data;
	_tmp1_ = utils_json_utils_get_string (_tmp0_, "calendar-data");
	_g_free0 (self->priv->_calendar_data);
	self->priv->_calendar_data = _tmp1_;
	_tmp2_ = self->priv->_calendar_data;
	result = _tmp2_;
	return result;
}

const gchar*
objects_item_get_etag (ObjectsItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_extra_data;
	_tmp1_ = utils_json_utils_get_string (_tmp0_, "etag");
	_g_free0 (self->priv->_etag);
	self->priv->_etag = _tmp1_;
	_tmp2_ = self->priv->_etag;
	result = _tmp2_;
	return result;
}

GDateTime*
objects_item_get_added_datetime (ObjectsItem* self)
{
	GDateTime* result;
	const gchar* _tmp0_;
	GTimeZone* _tmp1_;
	GTimeZone* _tmp2_;
	GDateTime* _tmp3_;
	GDateTime* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_added_at;
	_tmp1_ = g_time_zone_new_local ();
	_tmp2_ = _tmp1_;
	_tmp3_ = g_date_time_new_from_iso8601 (_tmp0_, _tmp2_);
	_g_date_time_unref0 (self->priv->_added_datetime);
	self->priv->_added_datetime = _tmp3_;
	_g_time_zone_unref0 (_tmp2_);
	_tmp4_ = self->priv->_added_datetime;
	result = _tmp4_;
	return result;
}

GDateTime*
objects_item_get_updated_datetime (ObjectsItem* self)
{
	GDateTime* result;
	const gchar* _tmp0_;
	GTimeZone* _tmp1_;
	GTimeZone* _tmp2_;
	GDateTime* _tmp3_;
	GDateTime* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_updated_at;
	_tmp1_ = g_time_zone_new_local ();
	_tmp2_ = _tmp1_;
	_tmp3_ = g_date_time_new_from_iso8601 (_tmp0_, _tmp2_);
	_g_date_time_unref0 (self->priv->_updated_datetime);
	self->priv->_updated_datetime = _tmp3_;
	_g_time_zone_unref0 (_tmp2_);
	_tmp4_ = self->priv->_updated_datetime;
	result = _tmp4_;
	return result;
}

GDateTime*
objects_item_get_deadline_datetime (ObjectsItem* self)
{
	GDateTime* result;
	gboolean _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp2_;
	GTimeZone* _tmp3_;
	GTimeZone* _tmp4_;
	GDateTime* _tmp5_;
	GDateTime* _tmp6_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = objects_item_get_has_deadline (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = NULL;
		return result;
	}
	_tmp2_ = self->priv->_deadline_date;
	_tmp3_ = g_time_zone_new_local ();
	_tmp4_ = _tmp3_;
	_tmp5_ = g_date_time_new_from_iso8601 (_tmp2_, _tmp4_);
	_g_date_time_unref0 (self->priv->_deadline_datetime);
	self->priv->_deadline_datetime = _tmp5_;
	_g_time_zone_unref0 (_tmp4_);
	_tmp6_ = self->priv->_deadline_datetime;
	result = _tmp6_;
	return result;
}

gboolean
objects_item_get_has_deadline (ObjectsItem* self)
{
	gboolean result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_deadline_date;
	result = g_strcmp0 (_tmp0_, "") != 0;
	return result;
}

JsonBuilder*
objects_item_get_builder (ObjectsItem* self)
{
	JsonBuilder* result;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_builder;
	if (_tmp0_ == NULL) {
		JsonBuilder* _tmp1_;
		_tmp1_ = json_builder_new ();
		_g_object_unref0 (self->priv->_builder);
		self->priv->_builder = _tmp1_;
	}
	_tmp2_ = self->priv->_builder;
	result = _tmp2_;
	return result;
}

ObjectsItem*
objects_item_get_parent (ObjectsItem* self)
{
	ObjectsItem* result;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ObjectsItem* _tmp2_;
	ObjectsItem* _tmp8_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp2_ = self->priv->_parent;
	if (_tmp2_ == NULL) {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->_parent_id;
		_tmp1_ = _tmp3_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp4_;
		_tmp4_ = self->priv->_parent_id;
		_tmp0_ = g_strcmp0 (_tmp4_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ServicesStore* _tmp5_;
		const gchar* _tmp6_;
		ObjectsItem* _tmp7_;
		_tmp5_ = services_store_instance ();
		_tmp6_ = self->priv->_parent_id;
		_tmp7_ = services_store_get_item (_tmp5_, _tmp6_);
		_g_object_unref0 (self->priv->_parent);
		self->priv->_parent = _tmp7_;
	}
	_tmp8_ = self->priv->_parent;
	result = _tmp8_;
	return result;
}

ObjectsProject*
objects_item_get_project (ObjectsItem* self)
{
	ObjectsProject* result;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ObjectsProject* _tmp2_;
	ObjectsProject* _tmp8_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp2_ = self->priv->_project;
	if (_tmp2_ == NULL) {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->_project_id;
		_tmp1_ = _tmp3_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp4_;
		_tmp4_ = self->priv->_project_id;
		_tmp0_ = g_strcmp0 (_tmp4_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ServicesStore* _tmp5_;
		const gchar* _tmp6_;
		ObjectsProject* _tmp7_;
		_tmp5_ = services_store_instance ();
		_tmp6_ = self->priv->_project_id;
		_tmp7_ = services_store_get_project (_tmp5_, _tmp6_);
		_g_object_unref0 (self->priv->_project);
		self->priv->_project = _tmp7_;
	}
	_tmp8_ = self->priv->_project;
	result = _tmp8_;
	return result;
}

ObjectsSection*
objects_item_get_section (ObjectsItem* self)
{
	ObjectsSection* result;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ObjectsSection* _tmp2_;
	ObjectsSection* _tmp8_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp2_ = self->priv->_section;
	if (_tmp2_ == NULL) {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->_section_id;
		_tmp1_ = _tmp3_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp4_;
		_tmp4_ = self->priv->_section_id;
		_tmp0_ = g_strcmp0 (_tmp4_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ServicesStore* _tmp5_;
		const gchar* _tmp6_;
		ObjectsSection* _tmp7_;
		_tmp5_ = services_store_instance ();
		_tmp6_ = self->priv->_section_id;
		_tmp7_ = services_store_get_section (_tmp5_, _tmp6_);
		_g_object_unref0 (self->priv->_section);
		self->priv->_section = _tmp7_;
	}
	_tmp8_ = self->priv->_section;
	result = _tmp8_;
	return result;
}

static gint
_objects_item_items___lambda9_ (ObjectsItem* self,
                                ObjectsItem* a,
                                ObjectsItem* 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_ = a->priv->_child_order;
	_tmp1_ = b->priv->_child_order;
	if (_tmp0_ > _tmp1_) {
		result = 1;
		return result;
	}
	_tmp2_ = a->priv->_child_order;
	_tmp3_ = b->priv->_child_order;
	if (_tmp2_ == _tmp3_) {
		result = 0;
		return result;
	}
	result = -1;
	return result;
}

static gint
__objects_item_items___lambda9__gcompare_data_func (gconstpointer a,
                                                    gconstpointer b,
                                                    gpointer self)
{
	gint result;
	result = _objects_item_items___lambda9_ ((ObjectsItem*) self, (ObjectsItem*) a, (ObjectsItem*) b);
	return result;
}

GeeArrayList*
objects_item_get_items (ObjectsItem* self)
{
	GeeArrayList* result;
	ServicesStore* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_store_get_subitems (_tmp0_, self);
	_g_object_unref0 (self->priv->_items);
	self->priv->_items = _tmp1_;
	_tmp2_ = self->priv->_items;
	gee_list_sort ((GeeList*) _tmp2_, __objects_item_items___lambda9__gcompare_data_func, g_object_ref (self), g_object_unref);
	_tmp3_ = self->priv->_items;
	result = _tmp3_;
	return result;
}

GeeArrayList*
objects_item_get_items_uncomplete (ObjectsItem* self)
{
	GeeArrayList* result;
	ServicesStore* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_store_get_subitems_uncomplete (_tmp0_, self);
	_g_object_unref0 (self->priv->_items_uncomplete);
	self->priv->_items_uncomplete = _tmp1_;
	_tmp2_ = self->priv->_items_uncomplete;
	result = _tmp2_;
	return result;
}

GeeArrayList*
objects_item_get_reminders (ObjectsItem* self)
{
	GeeArrayList* result;
	ServicesStore* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_store_get_reminders_by_item (_tmp0_, self);
	_g_object_unref0 (self->priv->_reminders);
	self->priv->_reminders = _tmp1_;
	_tmp2_ = self->priv->_reminders;
	result = _tmp2_;
	return result;
}

GeeArrayList*
objects_item_get_attachments (ObjectsItem* self)
{
	GeeArrayList* result;
	ServicesStore* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_store_get_attachments_by_item (_tmp0_, self);
	_g_object_unref0 (self->priv->_attachments);
	self->priv->_attachments = _tmp1_;
	_tmp2_ = self->priv->_attachments;
	result = _tmp2_;
	return result;
}

static void
objects_item_class_init (ObjectsItemClass * klass,
                         gpointer klass_data)
{
	objects_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ObjectsItem_private_offset);
	((ObjectsBaseObjectClass *) klass)->get_add_json = (gchar* (*) (ObjectsBaseObject*, const gchar*, const gchar*)) objects_item_real_get_add_json;
	((ObjectsBaseObjectClass *) klass)->get_update_json = (gchar* (*) (ObjectsBaseObject*, const gchar*, const gchar*)) objects_item_real_get_update_json;
	((ObjectsBaseObjectClass *) klass)->to_json = (gchar* (*) (ObjectsBaseObject*)) objects_item_real_to_json;
	G_OBJECT_CLASS (klass)->get_property = _vala_objects_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_objects_item_set_property;
	G_OBJECT_CLASS (klass)->finalize = objects_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_CONTENT_PROPERTY, objects_item_properties[OBJECTS_ITEM_CONTENT_PROPERTY] = g_param_spec_string ("content", "content", "content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_DESCRIPTION_PROPERTY, objects_item_properties[OBJECTS_ITEM_DESCRIPTION_PROPERTY] = g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_ADDED_AT_PROPERTY, objects_item_properties[OBJECTS_ITEM_ADDED_AT_PROPERTY] = g_param_spec_string ("added-at", "added-at", "added-at", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_COMPLETED_AT_PROPERTY, objects_item_properties[OBJECTS_ITEM_COMPLETED_AT_PROPERTY] = g_param_spec_string ("completed-at", "completed-at", "completed-at", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_UPDATED_AT_PROPERTY, objects_item_properties[OBJECTS_ITEM_UPDATED_AT_PROPERTY] = g_param_spec_string ("updated-at", "updated-at", "updated-at", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_CALENDAR_EVENT_UID_PROPERTY, objects_item_properties[OBJECTS_ITEM_CALENDAR_EVENT_UID_PROPERTY] = g_param_spec_string ("calendar-event-uid", "calendar-event-uid", "calendar-event-uid", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_DEADLINE_DATE_PROPERTY, objects_item_properties[OBJECTS_ITEM_DEADLINE_DATE_PROPERTY] = g_param_spec_string ("deadline-date", "deadline-date", "deadline-date", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_SECTION_ID_PROPERTY, objects_item_properties[OBJECTS_ITEM_SECTION_ID_PROPERTY] = g_param_spec_string ("section-id", "section-id", "section-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PROJECT_ID_PROPERTY, objects_item_properties[OBJECTS_ITEM_PROJECT_ID_PROPERTY] = g_param_spec_string ("project-id", "project-id", "project-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PARENT_ID_PROPERTY, objects_item_properties[OBJECTS_ITEM_PARENT_ID_PROPERTY] = g_param_spec_string ("parent-id", "parent-id", "parent-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_EXTRA_DATA_PROPERTY, objects_item_properties[OBJECTS_ITEM_EXTRA_DATA_PROPERTY] = g_param_spec_string ("extra-data", "extra-data", "extra-data", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_ITEM_TYPE_PROPERTY, objects_item_properties[OBJECTS_ITEM_ITEM_TYPE_PROPERTY] = g_param_spec_enum ("item-type", "item-type", "item-type", TYPE_ITEM_TYPE, ITEM_TYPE_TASK, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_RESPONSIBLE_UID_PROPERTY, objects_item_properties[OBJECTS_ITEM_RESPONSIBLE_UID_PROPERTY] = g_param_spec_string ("responsible-uid", "responsible-uid", "responsible-uid", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_DUE_PROPERTY, objects_item_properties[OBJECTS_ITEM_DUE_PROPERTY] = g_param_spec_object ("due", "due", "due", OBJECTS_TYPE_DUE_DATE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_LABELS_PROPERTY, objects_item_properties[OBJECTS_ITEM_LABELS_PROPERTY] = g_param_spec_object ("labels", "labels", "labels", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PRIORITY_PROPERTY, objects_item_properties[OBJECTS_ITEM_PRIORITY_PROPERTY] = g_param_spec_int ("priority", "priority", "priority", G_MININT, G_MAXINT, CONSTANTS_PRIORITY_4, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_ACTIVATE_NAME_EDITABLE_PROPERTY, objects_item_properties[OBJECTS_ITEM_ACTIVATE_NAME_EDITABLE_PROPERTY] = g_param_spec_boolean ("activate-name-editable", "activate-name-editable", "activate-name-editable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_SHORT_CONTENT_PROPERTY, objects_item_properties[OBJECTS_ITEM_SHORT_CONTENT_PROPERTY] = g_param_spec_string ("short-content", "short-content", "short-content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PRIORITY_ICON_PROPERTY, objects_item_properties[OBJECTS_ITEM_PRIORITY_ICON_PROPERTY] = g_param_spec_string ("priority-icon", "priority-icon", "priority-icon", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PRIORITY_COLOR_PROPERTY, objects_item_properties[OBJECTS_ITEM_PRIORITY_COLOR_PROPERTY] = g_param_spec_string ("priority-color", "priority-color", "priority-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PRIORITY_TEXT_PROPERTY, objects_item_properties[OBJECTS_ITEM_PRIORITY_TEXT_PROPERTY] = g_param_spec_string ("priority-text", "priority-text", "priority-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_CHILD_ORDER_PROPERTY, objects_item_properties[OBJECTS_ITEM_CHILD_ORDER_PROPERTY] = g_param_spec_int ("child-order", "child-order", "child-order", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_DAY_ORDER_PROPERTY, objects_item_properties[OBJECTS_ITEM_DAY_ORDER_PROPERTY] = g_param_spec_int ("day-order", "day-order", "day-order", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_CHECKED_PROPERTY, objects_item_properties[OBJECTS_ITEM_CHECKED_PROPERTY] = g_param_spec_boolean ("checked", "checked", "checked", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_IS_DELETED_PROPERTY, objects_item_properties[OBJECTS_ITEM_IS_DELETED_PROPERTY] = g_param_spec_boolean ("is-deleted", "is-deleted", "is-deleted", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_COLLAPSED_PROPERTY, objects_item_properties[OBJECTS_ITEM_COLLAPSED_PROPERTY] = g_param_spec_boolean ("collapsed", "collapsed", "collapsed", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PINNED_PROPERTY, objects_item_properties[OBJECTS_ITEM_PINNED_PROPERTY] = g_param_spec_boolean ("pinned", "pinned", "pinned", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PINNED_ICON_PROPERTY, objects_item_properties[OBJECTS_ITEM_PINNED_ICON_PROPERTY] = g_param_spec_string ("pinned-icon", "pinned-icon", "pinned-icon", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_COMPLETED_PROPERTY, objects_item_properties[OBJECTS_ITEM_COMPLETED_PROPERTY] = g_param_spec_boolean ("completed", "completed", "completed", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_HAS_DUE_PROPERTY, objects_item_properties[OBJECTS_ITEM_HAS_DUE_PROPERTY] = g_param_spec_boolean ("has-due", "has-due", "has-due", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_HAS_TIME_PROPERTY, objects_item_properties[OBJECTS_ITEM_HAS_TIME_PROPERTY] = g_param_spec_boolean ("has-time", "has-time", "has-time", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_COMPLETED_DATE_PROPERTY, objects_item_properties[OBJECTS_ITEM_COMPLETED_DATE_PROPERTY] = g_param_spec_boxed ("completed-date", "completed-date", "completed-date", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_HAS_PARENT_PROPERTY, objects_item_properties[OBJECTS_ITEM_HAS_PARENT_PROPERTY] = g_param_spec_boolean ("has-parent", "has-parent", "has-parent", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_HAS_SECTION_PROPERTY, objects_item_properties[OBJECTS_ITEM_HAS_SECTION_PROPERTY] = g_param_spec_boolean ("has-section", "has-section", "has-section", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_SHOW_ITEM_PROPERTY, objects_item_properties[OBJECTS_ITEM_SHOW_ITEM_PROPERTY] = g_param_spec_boolean ("show-item", "show-item", "show-item", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_ICAL_URL_PROPERTY, objects_item_properties[OBJECTS_ITEM_ICAL_URL_PROPERTY] = g_param_spec_string ("ical-url", "ical-url", "ical-url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_CALENDAR_DATA_PROPERTY, objects_item_properties[OBJECTS_ITEM_CALENDAR_DATA_PROPERTY] = g_param_spec_string ("calendar-data", "calendar-data", "calendar-data", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_ETAG_PROPERTY, objects_item_properties[OBJECTS_ITEM_ETAG_PROPERTY] = g_param_spec_string ("etag", "etag", "etag", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_ADDED_DATETIME_PROPERTY, objects_item_properties[OBJECTS_ITEM_ADDED_DATETIME_PROPERTY] = g_param_spec_boxed ("added-datetime", "added-datetime", "added-datetime", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_UPDATED_DATETIME_PROPERTY, objects_item_properties[OBJECTS_ITEM_UPDATED_DATETIME_PROPERTY] = g_param_spec_boxed ("updated-datetime", "updated-datetime", "updated-datetime", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_DEADLINE_DATETIME_PROPERTY, objects_item_properties[OBJECTS_ITEM_DEADLINE_DATETIME_PROPERTY] = g_param_spec_boxed ("deadline-datetime", "deadline-datetime", "deadline-datetime", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_HAS_DEADLINE_PROPERTY, objects_item_properties[OBJECTS_ITEM_HAS_DEADLINE_PROPERTY] = g_param_spec_boolean ("has-deadline", "has-deadline", "has-deadline", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_BUILDER_PROPERTY, objects_item_properties[OBJECTS_ITEM_BUILDER_PROPERTY] = g_param_spec_object ("builder", "builder", "builder", json_builder_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PARENT_PROPERTY, objects_item_properties[OBJECTS_ITEM_PARENT_PROPERTY] = g_param_spec_object ("parent", "parent", "parent", OBJECTS_TYPE_ITEM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_PROJECT_PROPERTY, objects_item_properties[OBJECTS_ITEM_PROJECT_PROPERTY] = g_param_spec_object ("project", "project", "project", OBJECTS_TYPE_PROJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_SECTION_PROPERTY, objects_item_properties[OBJECTS_ITEM_SECTION_PROPERTY] = g_param_spec_object ("section", "section", "section", OBJECTS_TYPE_SECTION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_ITEMS_PROPERTY, objects_item_properties[OBJECTS_ITEM_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), OBJECTS_ITEM_ITEMS_UNCOMPLETE_PROPERTY, objects_item_properties[OBJECTS_ITEM_ITEMS_UNCOMPLETE_PROPERTY] = g_param_spec_object ("items-uncomplete", "items-uncomplete", "items-uncomplete", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_ITEM_REMINDERS_PROPERTY, objects_item_properties[OBJECTS_ITEM_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), OBJECTS_ITEM_ATTACHMENTS_PROPERTY, objects_item_properties[OBJECTS_ITEM_ATTACHMENTS_PROPERTY] = g_param_spec_object ("attachments", "attachments", "attachments", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	objects_item_signals[OBJECTS_ITEM_ITEM_LABEL_ADDED_SIGNAL] = g_signal_new ("item-label-added", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
	objects_item_signals[OBJECTS_ITEM_ITEM_LABEL_DELETED_SIGNAL] = g_signal_new ("item-label-deleted", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
	objects_item_signals[OBJECTS_ITEM_ITEM_ADDED_SIGNAL] = g_signal_new ("item-added", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ITEM);
	objects_item_signals[OBJECTS_ITEM_REMINDER_ADDED_SIGNAL] = g_signal_new ("reminder-added", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_REMINDER);
	objects_item_signals[OBJECTS_ITEM_REMINDER_DELETED_SIGNAL] = g_signal_new ("reminder-deleted", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_REMINDER);
	objects_item_signals[OBJECTS_ITEM_SHOW_ITEM_CHANGED_SIGNAL] = g_signal_new ("show-item-changed", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	objects_item_signals[OBJECTS_ITEM_COLLAPSED_CHANGE_SIGNAL] = g_signal_new ("collapsed-change", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	objects_item_signals[OBJECTS_ITEM_ATTACHMENT_ADDED_SIGNAL] = g_signal_new ("attachment-added", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ATTACHMENT);
	objects_item_signals[OBJECTS_ITEM_ATTACHMENT_DELETED_SIGNAL] = g_signal_new ("attachment-deleted", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_ATTACHMENT);
	objects_item_signals[OBJECTS_ITEM_PIN_UPDATED_SIGNAL] = g_signal_new ("pin-updated", OBJECTS_TYPE_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
objects_item_instance_init (ObjectsItem * self,
                            gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	ObjectsDueDate* _tmp14_;
	GeeArrayList* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	self->priv = objects_item_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_content = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->_description = _tmp1_;
	_tmp2_ = g_date_time_new_now_local ();
	_tmp3_ = _tmp2_;
	_tmp4_ = g_date_time_to_string (_tmp3_);
	self->priv->_added_at = _tmp4_;
	_g_date_time_unref0 (_tmp3_);
	_tmp5_ = g_strdup ("");
	self->priv->_completed_at = _tmp5_;
	_tmp6_ = g_strdup ("");
	self->priv->_updated_at = _tmp6_;
	_tmp7_ = g_strdup ("");
	self->priv->_calendar_event_uid = _tmp7_;
	_tmp8_ = g_strdup ("");
	self->priv->_deadline_date = _tmp8_;
	_tmp9_ = g_strdup ("");
	self->priv->_section_id = _tmp9_;
	_tmp10_ = g_strdup ("");
	self->priv->_project_id = _tmp10_;
	_tmp11_ = g_strdup ("");
	self->priv->_parent_id = _tmp11_;
	_tmp12_ = g_strdup ("");
	self->priv->_extra_data = _tmp12_;
	self->priv->_item_type = ITEM_TYPE_TASK;
	_tmp13_ = g_strdup ("");
	self->priv->_responsible_uid = _tmp13_;
	_tmp14_ = objects_due_date_new ();
	self->priv->_due = _tmp14_;
	_tmp15_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_labels = _tmp15_;
	self->priv->_priority = CONSTANTS_PRIORITY_4;
	self->priv->_activate_name_editable = FALSE;
	self->priv->_child_order = 0;
	self->priv->_day_order = 0;
	self->priv->_checked = FALSE;
	self->priv->_is_deleted = FALSE;
	self->priv->_collapsed = FALSE;
	self->priv->_pinned = FALSE;
	self->priv->_show_item = TRUE;
	_tmp16_ = g_strdup ("");
	self->priv->_ical_url = _tmp16_;
	_tmp17_ = g_strdup ("");
	self->priv->_calendar_data = _tmp17_;
	_tmp18_ = g_strdup ("");
	self->priv->_etag = _tmp18_;
	g_rec_mutex_init (&self->priv->__lock__items);
	g_rec_mutex_init (&self->priv->__lock__reminders);
	g_rec_mutex_init (&self->priv->__lock__attachments);
}

static void
objects_item_finalize (GObject * obj)
{
	ObjectsItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_TYPE_ITEM, ObjectsItem);
	_g_free0 (self->priv->_content);
	_g_free0 (self->priv->_description);
	_g_free0 (self->priv->_added_at);
	_g_free0 (self->priv->_completed_at);
	_g_free0 (self->priv->_updated_at);
	_g_free0 (self->priv->_calendar_event_uid);
	_g_free0 (self->priv->_deadline_date);
	_g_free0 (self->priv->_section_id);
	_g_free0 (self->priv->_project_id);
	_g_free0 (self->priv->_parent_id);
	_g_free0 (self->priv->_extra_data);
	_g_free0 (self->priv->_responsible_uid);
	_g_object_unref0 (self->priv->_due);
	_g_object_unref0 (self->priv->_labels);
	_g_free0 (self->priv->_short_content);
	_g_date_time_unref0 (self->priv->_completed_date);
	_g_free0 (self->priv->_ical_url);
	_g_free0 (self->priv->_calendar_data);
	_g_free0 (self->priv->_etag);
	_g_date_time_unref0 (self->priv->_added_datetime);
	_g_date_time_unref0 (self->priv->_updated_datetime);
	_g_date_time_unref0 (self->priv->_deadline_datetime);
	_g_object_unref0 (self->priv->_builder);
	_g_object_unref0 (self->priv->_parent);
	_g_object_unref0 (self->priv->_project);
	_g_object_unref0 (self->priv->_section);
	g_rec_mutex_clear (&self->priv->__lock__items);
	_g_object_unref0 (self->priv->_items);
	_g_object_unref0 (self->priv->_items_uncomplete);
	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 (objects_item_parent_class)->finalize (obj);
}

static GType
objects_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ObjectsItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) objects_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ObjectsItem), 0, (GInstanceInitFunc) objects_item_instance_init, NULL };
	GType objects_item_type_id;
	objects_item_type_id = g_type_register_static (OBJECTS_TYPE_BASE_OBJECT, "ObjectsItem", &g_define_type_info, 0);
	ObjectsItem_private_offset = g_type_add_instance_private (objects_item_type_id, sizeof (ObjectsItemPrivate));
	return objects_item_type_id;
}

GType
objects_item_get_type (void)
{
	static volatile gsize objects_item_type_id__once = 0;
	if (g_once_init_enter (&objects_item_type_id__once)) {
		GType objects_item_type_id;
		objects_item_type_id = objects_item_get_type_once ();
		g_once_init_leave (&objects_item_type_id__once, objects_item_type_id);
	}
	return objects_item_type_id__once;
}

static void
_vala_objects_item_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	ObjectsItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_ITEM, ObjectsItem);
	switch (property_id) {
		case OBJECTS_ITEM_CONTENT_PROPERTY:
		g_value_set_string (value, objects_item_get_content (self));
		break;
		case OBJECTS_ITEM_DESCRIPTION_PROPERTY:
		g_value_set_string (value, objects_item_get_description (self));
		break;
		case OBJECTS_ITEM_ADDED_AT_PROPERTY:
		g_value_set_string (value, objects_item_get_added_at (self));
		break;
		case OBJECTS_ITEM_COMPLETED_AT_PROPERTY:
		g_value_set_string (value, objects_item_get_completed_at (self));
		break;
		case OBJECTS_ITEM_UPDATED_AT_PROPERTY:
		g_value_set_string (value, objects_item_get_updated_at (self));
		break;
		case OBJECTS_ITEM_CALENDAR_EVENT_UID_PROPERTY:
		g_value_set_string (value, objects_item_get_calendar_event_uid (self));
		break;
		case OBJECTS_ITEM_DEADLINE_DATE_PROPERTY:
		g_value_set_string (value, objects_item_get_deadline_date (self));
		break;
		case OBJECTS_ITEM_SECTION_ID_PROPERTY:
		g_value_set_string (value, objects_item_get_section_id (self));
		break;
		case OBJECTS_ITEM_PROJECT_ID_PROPERTY:
		g_value_set_string (value, objects_item_get_project_id (self));
		break;
		case OBJECTS_ITEM_PARENT_ID_PROPERTY:
		g_value_set_string (value, objects_item_get_parent_id (self));
		break;
		case OBJECTS_ITEM_EXTRA_DATA_PROPERTY:
		g_value_set_string (value, objects_item_get_extra_data (self));
		break;
		case OBJECTS_ITEM_ITEM_TYPE_PROPERTY:
		g_value_set_enum (value, objects_item_get_item_type (self));
		break;
		case OBJECTS_ITEM_RESPONSIBLE_UID_PROPERTY:
		g_value_set_string (value, objects_item_get_responsible_uid (self));
		break;
		case OBJECTS_ITEM_DUE_PROPERTY:
		g_value_set_object (value, objects_item_get_due (self));
		break;
		case OBJECTS_ITEM_LABELS_PROPERTY:
		g_value_set_object (value, objects_item_get_labels (self));
		break;
		case OBJECTS_ITEM_PRIORITY_PROPERTY:
		g_value_set_int (value, objects_item_get_priority (self));
		break;
		case OBJECTS_ITEM_ACTIVATE_NAME_EDITABLE_PROPERTY:
		g_value_set_boolean (value, objects_item_get_activate_name_editable (self));
		break;
		case OBJECTS_ITEM_SHORT_CONTENT_PROPERTY:
		g_value_set_string (value, objects_item_get_short_content (self));
		break;
		case OBJECTS_ITEM_PRIORITY_ICON_PROPERTY:
		g_value_set_string (value, objects_item_get_priority_icon (self));
		break;
		case OBJECTS_ITEM_PRIORITY_COLOR_PROPERTY:
		g_value_set_string (value, objects_item_get_priority_color (self));
		break;
		case OBJECTS_ITEM_PRIORITY_TEXT_PROPERTY:
		g_value_set_string (value, objects_item_get_priority_text (self));
		break;
		case OBJECTS_ITEM_CHILD_ORDER_PROPERTY:
		g_value_set_int (value, objects_item_get_child_order (self));
		break;
		case OBJECTS_ITEM_DAY_ORDER_PROPERTY:
		g_value_set_int (value, objects_item_get_day_order (self));
		break;
		case OBJECTS_ITEM_CHECKED_PROPERTY:
		g_value_set_boolean (value, objects_item_get_checked (self));
		break;
		case OBJECTS_ITEM_IS_DELETED_PROPERTY:
		g_value_set_boolean (value, objects_item_get_is_deleted (self));
		break;
		case OBJECTS_ITEM_COLLAPSED_PROPERTY:
		g_value_set_boolean (value, objects_item_get_collapsed (self));
		break;
		case OBJECTS_ITEM_PINNED_PROPERTY:
		g_value_set_boolean (value, objects_item_get_pinned (self));
		break;
		case OBJECTS_ITEM_PINNED_ICON_PROPERTY:
		g_value_set_string (value, objects_item_get_pinned_icon (self));
		break;
		case OBJECTS_ITEM_COMPLETED_PROPERTY:
		g_value_set_boolean (value, objects_item_get_completed (self));
		break;
		case OBJECTS_ITEM_HAS_DUE_PROPERTY:
		g_value_set_boolean (value, objects_item_get_has_due (self));
		break;
		case OBJECTS_ITEM_HAS_TIME_PROPERTY:
		g_value_set_boolean (value, objects_item_get_has_time (self));
		break;
		case OBJECTS_ITEM_COMPLETED_DATE_PROPERTY:
		g_value_set_boxed (value, objects_item_get_completed_date (self));
		break;
		case OBJECTS_ITEM_HAS_PARENT_PROPERTY:
		g_value_set_boolean (value, objects_item_get_has_parent (self));
		break;
		case OBJECTS_ITEM_HAS_SECTION_PROPERTY:
		g_value_set_boolean (value, objects_item_get_has_section (self));
		break;
		case OBJECTS_ITEM_SHOW_ITEM_PROPERTY:
		g_value_set_boolean (value, objects_item_get_show_item (self));
		break;
		case OBJECTS_ITEM_ICAL_URL_PROPERTY:
		g_value_set_string (value, objects_item_get_ical_url (self));
		break;
		case OBJECTS_ITEM_CALENDAR_DATA_PROPERTY:
		g_value_set_string (value, objects_item_get_calendar_data (self));
		break;
		case OBJECTS_ITEM_ETAG_PROPERTY:
		g_value_set_string (value, objects_item_get_etag (self));
		break;
		case OBJECTS_ITEM_ADDED_DATETIME_PROPERTY:
		g_value_set_boxed (value, objects_item_get_added_datetime (self));
		break;
		case OBJECTS_ITEM_UPDATED_DATETIME_PROPERTY:
		g_value_set_boxed (value, objects_item_get_updated_datetime (self));
		break;
		case OBJECTS_ITEM_DEADLINE_DATETIME_PROPERTY:
		g_value_set_boxed (value, objects_item_get_deadline_datetime (self));
		break;
		case OBJECTS_ITEM_HAS_DEADLINE_PROPERTY:
		g_value_set_boolean (value, objects_item_get_has_deadline (self));
		break;
		case OBJECTS_ITEM_BUILDER_PROPERTY:
		g_value_set_object (value, objects_item_get_builder (self));
		break;
		case OBJECTS_ITEM_PARENT_PROPERTY:
		g_value_set_object (value, objects_item_get_parent (self));
		break;
		case OBJECTS_ITEM_PROJECT_PROPERTY:
		g_value_set_object (value, objects_item_get_project (self));
		break;
		case OBJECTS_ITEM_SECTION_PROPERTY:
		g_value_set_object (value, objects_item_get_section (self));
		break;
		case OBJECTS_ITEM_ITEMS_PROPERTY:
		g_value_set_object (value, objects_item_get_items (self));
		break;
		case OBJECTS_ITEM_ITEMS_UNCOMPLETE_PROPERTY:
		g_value_set_object (value, objects_item_get_items_uncomplete (self));
		break;
		case OBJECTS_ITEM_REMINDERS_PROPERTY:
		g_value_set_object (value, objects_item_get_reminders (self));
		break;
		case OBJECTS_ITEM_ATTACHMENTS_PROPERTY:
		g_value_set_object (value, objects_item_get_attachments (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_objects_item_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	ObjectsItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_ITEM, ObjectsItem);
	switch (property_id) {
		case OBJECTS_ITEM_CONTENT_PROPERTY:
		objects_item_set_content (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_DESCRIPTION_PROPERTY:
		objects_item_set_description (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_ADDED_AT_PROPERTY:
		objects_item_set_added_at (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_COMPLETED_AT_PROPERTY:
		objects_item_set_completed_at (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_UPDATED_AT_PROPERTY:
		objects_item_set_updated_at (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_CALENDAR_EVENT_UID_PROPERTY:
		objects_item_set_calendar_event_uid (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_DEADLINE_DATE_PROPERTY:
		objects_item_set_deadline_date (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_SECTION_ID_PROPERTY:
		objects_item_set_section_id (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_PROJECT_ID_PROPERTY:
		objects_item_set_project_id (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_PARENT_ID_PROPERTY:
		objects_item_set_parent_id (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_EXTRA_DATA_PROPERTY:
		objects_item_set_extra_data (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_ITEM_TYPE_PROPERTY:
		objects_item_set_item_type (self, g_value_get_enum (value));
		break;
		case OBJECTS_ITEM_RESPONSIBLE_UID_PROPERTY:
		objects_item_set_responsible_uid (self, g_value_get_string (value));
		break;
		case OBJECTS_ITEM_DUE_PROPERTY:
		objects_item_set_due (self, g_value_get_object (value));
		break;
		case OBJECTS_ITEM_LABELS_PROPERTY:
		objects_item_set_labels (self, g_value_get_object (value));
		break;
		case OBJECTS_ITEM_PRIORITY_PROPERTY:
		objects_item_set_priority (self, g_value_get_int (value));
		break;
		case OBJECTS_ITEM_ACTIVATE_NAME_EDITABLE_PROPERTY:
		objects_item_set_activate_name_editable (self, g_value_get_boolean (value));
		break;
		case OBJECTS_ITEM_CHILD_ORDER_PROPERTY:
		objects_item_set_child_order (self, g_value_get_int (value));
		break;
		case OBJECTS_ITEM_DAY_ORDER_PROPERTY:
		objects_item_set_day_order (self, g_value_get_int (value));
		break;
		case OBJECTS_ITEM_CHECKED_PROPERTY:
		objects_item_set_checked (self, g_value_get_boolean (value));
		break;
		case OBJECTS_ITEM_IS_DELETED_PROPERTY:
		objects_item_set_is_deleted (self, g_value_get_boolean (value));
		break;
		case OBJECTS_ITEM_COLLAPSED_PROPERTY:
		objects_item_set_collapsed (self, g_value_get_boolean (value));
		break;
		case OBJECTS_ITEM_PINNED_PROPERTY:
		objects_item_set_pinned (self, g_value_get_boolean (value));
		break;
		case OBJECTS_ITEM_SHOW_ITEM_PROPERTY:
		objects_item_set_show_item (self, g_value_get_boolean (value));
		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;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

