/* Util.c generated by valac 0.56.19, the Vala compiler
 * generated from Util.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 <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <adwaita.h>
#include <float.h>
#include <math.h>
#include <json-glib/json-glib.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  {
	UTIL_0_PROPERTY,
	UTIL_NUM_PROPERTIES
};
static GParamSpec* util_properties[UTIL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block8Data Block8Data;
typedef struct _Block9Data Block9Data;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define __vala_GdkRGBA_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkRGBA_free (var), NULL)))
typedef struct _Block10Data Block10Data;
typedef struct _Block11Data Block11Data;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))
typedef struct _UtilMoveBackendTypeItemData UtilMoveBackendTypeItemData;
typedef struct _UtilAddFinalDuplicateItemData UtilAddFinalDuplicateItemData;
typedef struct _UtilDuplicateItemData UtilDuplicateItemData;
typedef struct _UtilInsertDuplicateItemData UtilInsertDuplicateItemData;
typedef struct _UtilDuplicateSectionData UtilDuplicateSectionData;
typedef struct _UtilInsertDuplicateSectionData UtilInsertDuplicateSectionData;
typedef struct _Block12Data Block12Data;
typedef struct _UtilDuplicateProjectData UtilDuplicateProjectData;
typedef struct _Block13Data Block13Data;
typedef struct _UtilNapData UtilNapData;
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

struct _UtilPrivate {
	GeeHashMap* colors;
	GeeHashMap* providers;
	GRegex* line_break_to_space_regex;
	GtkMediaFile* _audio_media;
};

struct _Block8Data {
	int _ref_count_;
	Util* self;
	GFile* file_from_uri;
};

struct _Block9Data {
	int _ref_count_;
	Block8Data * _data8_;
	GMainLoop* loop;
};

struct _Block10Data {
	int _ref_count_;
	Util* self;
	GtkWindow* window;
};

struct _Block11Data {
	int _ref_count_;
	Util* self;
	GtkWindow* window;
};

struct _UtilMoveBackendTypeItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Util* self;
	ObjectsItem* item;
	ObjectsProject* target_project;
	gchar* parent_id;
	gboolean notify;
	ObjectsItem* new_item;
	ObjectsItem* _tmp0_;
	ObjectsItem* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ObjectsItem* _tmp4_;
	SourceType _tmp5_;
	SourceType _tmp6_;
	ObjectsItem* _tmp7_;
	Util* _tmp8_;
	Util* _tmp9_;
	ObjectsItem* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	ObjectsItem* _tmp13_;
	SourceType _tmp14_;
	SourceType _tmp15_;
	HttpResponse* response;
	ServicesTodoist* _tmp16_;
	ServicesTodoist* _tmp17_;
	ObjectsItem* _tmp18_;
	HttpResponse* _tmp19_;
	HttpResponse* _tmp20_;
	HttpResponse* _tmp21_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	ObjectsItem* _tmp24_;
	HttpResponse* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	ObjectsItem* _tmp28_;
	SourceType _tmp29_;
	SourceType _tmp30_;
	ObjectsItem* _tmp31_;
	Util* _tmp32_;
	Util* _tmp33_;
	ObjectsItem* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	ServicesCalDAVCalDAVClient* caldav_client;
	ServicesCalDAVCore* _tmp37_;
	ServicesCalDAVCore* _tmp38_;
	ObjectsItem* _tmp39_;
	ObjectsProject* _tmp40_;
	ObjectsProject* _tmp41_;
	ObjectsSource* _tmp42_;
	ObjectsSource* _tmp43_;
	ServicesCalDAVCalDAVClient* _tmp44_;
	ServicesCalDAVCalDAVClient* _tmp45_;
	HttpResponse* _vala1_response;
	ServicesCalDAVCalDAVClient* _tmp46_;
	ObjectsItem* _tmp47_;
	HttpResponse* _tmp48_;
	HttpResponse* _tmp49_;
	gboolean _tmp50_;
	gboolean _tmp51_;
	ObjectsItem* _tmp52_;
};

struct _UtilAddFinalDuplicateItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Util* self;
	ObjectsItem* new_item;
	ObjectsItem* item;
	gboolean notify;
	gboolean _tmp0_;
	gboolean _tmp1_;
	ObjectsItem* _tmp2_;
	ObjectsItem* _tmp3_;
	ObjectsItem* _tmp4_;
	ObjectsItem* _tmp5_;
	ObjectsProject* _tmp6_;
	ObjectsProject* _tmp7_;
	ObjectsItem* _tmp8_;
	ObjectsItem* _tmp9_;
	GeeArrayList* _reminder_list;
	GeeArrayList* _tmp10_;
	GeeArrayList* _tmp11_;
	gint _reminder_size;
	GeeArrayList* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	gint _reminder_index;
	gint _tmp15_;
	gint _tmp16_;
	ObjectsReminder* reminder;
	GeeArrayList* _tmp17_;
	gpointer _tmp18_;
	ObjectsReminder* _reminder;
	ObjectsReminder* _tmp19_;
	ObjectsReminder* _tmp20_;
	ObjectsReminder* _tmp21_;
	Util* _tmp22_;
	Util* _tmp23_;
	ObjectsReminder* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	ObjectsReminder* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	ObjectsReminder* _tmp30_;
	ObjectsReminder* _tmp31_;
	ObjectsReminder* _tmp32_;
	GeeArrayList* _attachment_list;
	GeeArrayList* _tmp33_;
	GeeArrayList* _tmp34_;
	gint _attachment_size;
	GeeArrayList* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	gint _attachment_index;
	gint _tmp38_;
	gint _tmp39_;
	ObjectsAttachment* attachment;
	GeeArrayList* _tmp40_;
	gpointer _tmp41_;
	ObjectsAttachment* _attachment;
	ObjectsAttachment* _tmp42_;
	ObjectsAttachment* _tmp43_;
	ObjectsAttachment* _tmp44_;
	Util* _tmp45_;
	Util* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	ObjectsAttachment* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	ObjectsAttachment* _tmp52_;
	ObjectsAttachment* _tmp53_;
	ObjectsAttachment* _tmp54_;
	GeeArrayList* _subitem_list;
	GeeArrayList* _tmp55_;
	GeeArrayList* _tmp56_;
	gint _subitem_size;
	GeeArrayList* _tmp57_;
	gint _tmp58_;
	gint _tmp59_;
	gint _subitem_index;
	gint _tmp60_;
	gint _tmp61_;
	ObjectsItem* subitem;
	GeeArrayList* _tmp62_;
	gpointer _tmp63_;
	ObjectsItem* _tmp64_;
	ObjectsProject* _tmp65_;
	ObjectsProject* _tmp66_;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	ServicesEventBus* _tmp69_;
	ServicesEventBus* _tmp70_;
	ObjectsProject* _tmp71_;
	ObjectsProject* _tmp72_;
	const gchar* _tmp73_;
	const gchar* _tmp74_;
	gchar* _tmp75_;
	gchar* _tmp76_;
	AdwToast* _tmp77_;
	AdwToast* _tmp78_;
};

struct _UtilDuplicateItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Util* self;
	ObjectsItem* item;
	gchar* project_id;
	gchar* section_id;
	gchar* parent_id;
	gboolean notify;
	ObjectsItem* new_item;
	ObjectsItem* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsItem* _tmp2_;
	ObjectsItem* _tmp3_;
	ObjectsItem* _tmp4_;
	ObjectsProject* _tmp5_;
	ObjectsProject* _tmp6_;
	SourceType _tmp7_;
	SourceType _tmp8_;
	ObjectsItem* _tmp9_;
	Util* _tmp10_;
	Util* _tmp11_;
	ObjectsItem* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	ObjectsItem* _tmp15_;
	ObjectsItem* _tmp16_;
	ObjectsProject* _tmp17_;
	ObjectsProject* _tmp18_;
	SourceType _tmp19_;
	SourceType _tmp20_;
	HttpResponse* response;
	ServicesTodoist* _tmp21_;
	ServicesTodoist* _tmp22_;
	ObjectsItem* _tmp23_;
	HttpResponse* _tmp24_;
	HttpResponse* _tmp25_;
	HttpResponse* _tmp26_;
	gboolean _tmp27_;
	gboolean _tmp28_;
	ObjectsItem* _tmp29_;
	HttpResponse* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	ObjectsItem* _tmp33_;
	ObjectsItem* _tmp34_;
	ObjectsProject* _tmp35_;
	ObjectsProject* _tmp36_;
	SourceType _tmp37_;
	SourceType _tmp38_;
	ObjectsItem* _tmp39_;
	Util* _tmp40_;
	Util* _tmp41_;
	ObjectsItem* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	ServicesCalDAVCalDAVClient* caldav_client;
	ServicesCalDAVCore* _tmp45_;
	ServicesCalDAVCore* _tmp46_;
	ObjectsItem* _tmp47_;
	ObjectsProject* _tmp48_;
	ObjectsProject* _tmp49_;
	ObjectsSource* _tmp50_;
	ObjectsSource* _tmp51_;
	ServicesCalDAVCalDAVClient* _tmp52_;
	ServicesCalDAVCalDAVClient* _tmp53_;
	HttpResponse* _vala1_response;
	ServicesCalDAVCalDAVClient* _tmp54_;
	ObjectsItem* _tmp55_;
	HttpResponse* _tmp56_;
	HttpResponse* _tmp57_;
	gboolean _tmp58_;
	gboolean _tmp59_;
	ObjectsItem* _tmp60_;
};

struct _UtilInsertDuplicateItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Util* self;
	ObjectsItem* new_item;
	ObjectsItem* item;
	gboolean notify;
	gboolean _tmp0_;
	gboolean _tmp1_;
	ObjectsItem* _tmp2_;
	ObjectsItem* _tmp3_;
	ObjectsItem* _tmp4_;
	ObjectsItem* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	ObjectsSection* _tmp8_;
	ObjectsSection* _tmp9_;
	ObjectsItem* _tmp10_;
	ObjectsItem* _tmp11_;
	ObjectsProject* _tmp12_;
	ObjectsProject* _tmp13_;
	ObjectsItem* _tmp14_;
	ObjectsItem* _tmp15_;
	ServicesEventBus* _tmp16_;
	ServicesEventBus* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	GeeArrayList* _reminder_list;
	GeeArrayList* _tmp22_;
	GeeArrayList* _tmp23_;
	gint _reminder_size;
	GeeArrayList* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	gint _reminder_index;
	gint _tmp27_;
	gint _tmp28_;
	ObjectsReminder* reminder;
	GeeArrayList* _tmp29_;
	gpointer _tmp30_;
	ObjectsReminder* _reminder;
	ObjectsReminder* _tmp31_;
	ObjectsReminder* _tmp32_;
	ObjectsReminder* _tmp33_;
	Util* _tmp34_;
	Util* _tmp35_;
	ObjectsReminder* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	ObjectsReminder* _tmp39_;
	const gchar* _tmp40_;
	const gchar* _tmp41_;
	ObjectsReminder* _tmp42_;
	ObjectsReminder* _tmp43_;
	ObjectsReminder* _tmp44_;
	GeeArrayList* _attachment_list;
	GeeArrayList* _tmp45_;
	GeeArrayList* _tmp46_;
	gint _attachment_size;
	GeeArrayList* _tmp47_;
	gint _tmp48_;
	gint _tmp49_;
	gint _attachment_index;
	gint _tmp50_;
	gint _tmp51_;
	ObjectsAttachment* attachment;
	GeeArrayList* _tmp52_;
	gpointer _tmp53_;
	ObjectsAttachment* _attachment;
	ObjectsAttachment* _tmp54_;
	ObjectsAttachment* _tmp55_;
	ObjectsAttachment* _tmp56_;
	Util* _tmp57_;
	Util* _tmp58_;
	gchar* _tmp59_;
	gchar* _tmp60_;
	ObjectsAttachment* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	ObjectsAttachment* _tmp64_;
	ObjectsAttachment* _tmp65_;
	ObjectsAttachment* _tmp66_;
	GeeArrayList* _subitem_list;
	GeeArrayList* _tmp67_;
	GeeArrayList* _tmp68_;
	gint _subitem_size;
	GeeArrayList* _tmp69_;
	gint _tmp70_;
	gint _tmp71_;
	gint _subitem_index;
	gint _tmp72_;
	gint _tmp73_;
	ObjectsItem* subitem;
	GeeArrayList* _tmp74_;
	gpointer _tmp75_;
	ObjectsItem* _tmp76_;
	const gchar* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	const gchar* _tmp82_;
	ServicesEventBus* _tmp83_;
	ServicesEventBus* _tmp84_;
	Util* _tmp85_;
	Util* _tmp86_;
	AdwToast* _tmp87_;
	AdwToast* _tmp88_;
};

struct _UtilDuplicateSectionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Util* self;
	ObjectsSection* section;
	gchar* project_id;
	gboolean notify;
	ObjectsSection* new_section;
	ObjectsSection* _tmp0_;
	ObjectsSection* _tmp1_;
	ObjectsSection* _tmp2_;
	ObjectsProject* _tmp3_;
	ObjectsProject* _tmp4_;
	SourceType _tmp5_;
	SourceType _tmp6_;
	ObjectsSection* _tmp7_;
	Util* _tmp8_;
	Util* _tmp9_;
	ObjectsSection* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	ObjectsSection* _tmp13_;
	ObjectsSection* _tmp14_;
	ObjectsProject* _tmp15_;
	ObjectsProject* _tmp16_;
	SourceType _tmp17_;
	SourceType _tmp18_;
	HttpResponse* response;
	ServicesTodoist* _tmp19_;
	ServicesTodoist* _tmp20_;
	ObjectsSection* _tmp21_;
	HttpResponse* _tmp22_;
	HttpResponse* _tmp23_;
	HttpResponse* _tmp24_;
	gboolean _tmp25_;
	gboolean _tmp26_;
	ObjectsSection* _tmp27_;
	HttpResponse* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	ObjectsSection* _tmp31_;
};

struct _UtilInsertDuplicateSectionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Util* self;
	ObjectsSection* new_section;
	ObjectsSection* section;
	gboolean notify;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsSection* _tmp2_;
	ObjectsSection* _tmp3_;
	GeeArrayList* _item_list;
	GeeArrayList* _tmp4_;
	GeeArrayList* _tmp5_;
	gint _item_size;
	GeeArrayList* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gint _item_index;
	gint _tmp9_;
	gint _tmp10_;
	ObjectsItem* item;
	GeeArrayList* _tmp11_;
	gpointer _tmp12_;
	ObjectsItem* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	ObjectsItem* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	ServicesEventBus* _tmp21_;
	ServicesEventBus* _tmp22_;
	Util* _tmp23_;
	Util* _tmp24_;
	AdwToast* _tmp25_;
	AdwToast* _tmp26_;
};

struct _Block12Data {
	int _ref_count_;
	Util* self;
	ObjectsProject* project;
	gpointer _async_data_;
};

struct _UtilDuplicateProjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	Util* self;
	ObjectsProject* project;
	gchar* parent_id;
	Block12Data* _data12_;
	ObjectsProject* new_project;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	SourceType _tmp2_;
	SourceType _tmp3_;
	ObjectsProject* _tmp4_;
	Util* _tmp5_;
	Util* _tmp6_;
	ObjectsProject* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	ServicesStore* _tmp10_;
	ObjectsProject* _tmp11_;
	GeeArrayList* _item_list;
	GeeArrayList* _tmp12_;
	GeeArrayList* _tmp13_;
	gint _item_size;
	GeeArrayList* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gint _item_index;
	gint _tmp17_;
	gint _tmp18_;
	ObjectsItem* item;
	GeeArrayList* _tmp19_;
	gpointer _tmp20_;
	ObjectsItem* _tmp21_;
	ObjectsProject* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	ObjectsItem* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	ObjectsItem* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GeeArrayList* _section_list;
	GeeArrayList* _tmp31_;
	GeeArrayList* _tmp32_;
	gint _section_size;
	GeeArrayList* _tmp33_;
	gint _tmp34_;
	gint _tmp35_;
	gint _section_index;
	gint _tmp36_;
	gint _tmp37_;
	ObjectsSection* section;
	GeeArrayList* _tmp38_;
	gpointer _tmp39_;
	ObjectsSection* _tmp40_;
	ObjectsProject* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	ServicesEventBus* _tmp44_;
	ServicesEventBus* _tmp45_;
	Util* _tmp46_;
	Util* _tmp47_;
	AdwToast* _tmp48_;
	AdwToast* _tmp49_;
	SourceType _tmp50_;
	SourceType _tmp51_;
	ServicesTodoist* _tmp52_;
	ServicesTodoist* _tmp53_;
	SourceType _tmp54_;
	SourceType _tmp55_;
	ObjectsProject* _tmp56_;
	Util* _tmp57_;
	Util* _tmp58_;
	ObjectsProject* _tmp59_;
	gchar* _tmp60_;
	gchar* _tmp61_;
	ServicesCalDAVCalDAVClient* caldav_client;
	ServicesCalDAVCore* _tmp62_;
	ServicesCalDAVCore* _tmp63_;
	ObjectsProject* _tmp64_;
	ObjectsSource* _tmp65_;
	ObjectsSource* _tmp66_;
	ServicesCalDAVCalDAVClient* _tmp67_;
	ServicesCalDAVCalDAVClient* _tmp68_;
	HttpResponse* response;
	ServicesCalDAVCalDAVClient* _tmp69_;
	ObjectsProject* _tmp70_;
	HttpResponse* _tmp71_;
	HttpResponse* _tmp72_;
	gboolean _tmp73_;
	gboolean _tmp74_;
	ServicesStore* _tmp75_;
	ObjectsProject* _tmp76_;
	GeeArrayList* _vala1__item_list;
	GeeArrayList* _tmp77_;
	GeeArrayList* _tmp78_;
	gint _vala1__item_size;
	GeeArrayList* _tmp79_;
	gint _tmp80_;
	gint _tmp81_;
	gint _vala1__item_index;
	gint _tmp82_;
	gint _tmp83_;
	ObjectsItem* _vala1_item;
	GeeArrayList* _tmp84_;
	gpointer _tmp85_;
	ObjectsItem* _tmp86_;
	ObjectsProject* _tmp87_;
	const gchar* _tmp88_;
	const gchar* _tmp89_;
	ObjectsItem* _tmp90_;
	const gchar* _tmp91_;
	const gchar* _tmp92_;
	ServicesEventBus* _tmp93_;
	ServicesEventBus* _tmp94_;
	Util* _tmp95_;
	Util* _tmp96_;
	AdwToast* _tmp97_;
	AdwToast* _tmp98_;
};

struct _Block13Data {
	int _ref_count_;
	gpointer _async_data_;
};

struct _UtilNapData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	guint interval;
	gint priority;
	Block13Data* _data13_;
};

static gint Util_private_offset;
static gpointer util_parent_class = NULL;
static Util* util__instance;
static Util* util__instance = NULL;

static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void ___lambda4_ (Block9Data* _data9_,
                  gint64 current_num_bytes,
                  gint64 total_num_bytes);
static void ____lambda4__gfile_progress_callback (gint64 current_num_bytes,
                                           gint64 total_num_bytes,
                                           gpointer self);
static void ___lambda5_ (Block9Data* _data9_,
                  GObject* obj,
                  GAsyncResult* res);
static void ____lambda5__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static gboolean util_check_id_exists (Util* self,
                               GeeArrayList* items,
                               const gchar* id);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static void _vala_GdkRGBA_free (GdkRGBA* self);
static void __lambda76_ (Util* self);
static void ___lambda76__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void __lambda77_ (Block10Data* _data10_,
                  const gchar* response);
static void ___lambda77__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                             const gchar* response,
                                             gpointer self);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
static void __lambda78_ (Block11Data* _data11_,
                  const gchar* response);
static void ___lambda78__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                             const gchar* response,
                                             gpointer self);
static void _vala_JsonNode_free (JsonNode* self);
static void util_move_backend_type_item_data_free (gpointer _data);
static gboolean util_move_backend_type_item_co (UtilMoveBackendTypeItemData* _data_);
static void util_move_backend_type_item_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_);
static void util_add_final_duplicate_item_data_free (gpointer _data);
static gboolean util_add_final_duplicate_item_co (UtilAddFinalDuplicateItemData* _data_);
static void util_add_final_duplicate_item_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void util_duplicate_item_data_free (gpointer _data);
static gboolean util_duplicate_item_co (UtilDuplicateItemData* _data_);
static void util_insert_duplicate_item (Util* self,
                                 ObjectsItem* new_item,
                                 ObjectsItem* item,
                                 gboolean notify,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
static void util_insert_duplicate_item_finish (Util* self,
                                        GAsyncResult* _res_);
static void util_duplicate_item_ready (GObject* source_object,
                                GAsyncResult* _res_,
                                gpointer _user_data_);
static void util_insert_duplicate_item_data_free (gpointer _data);
static gboolean util_insert_duplicate_item_co (UtilInsertDuplicateItemData* _data_);
static void util_insert_duplicate_item_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_);
static void util_duplicate_section_data_free (gpointer _data);
static gboolean util_duplicate_section_co (UtilDuplicateSectionData* _data_);
static void util_insert_duplicate_section (Util* self,
                                    ObjectsSection* new_section,
                                    ObjectsSection* section,
                                    gboolean notify,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void util_insert_duplicate_section_finish (Util* self,
                                           GAsyncResult* _res_);
static void util_duplicate_section_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_);
static void util_insert_duplicate_section_data_free (gpointer _data);
static gboolean util_insert_duplicate_section_co (UtilInsertDuplicateSectionData* _data_);
static void util_insert_duplicate_section_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void util_duplicate_project_data_free (gpointer _data);
static gboolean util_duplicate_project_co (UtilDuplicateProjectData* _data_);
static Block12Data* block12_data_ref (Block12Data* _data12_);
static void block12_data_unref (void * _userdata_);
static void util_duplicate_project_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_);
static void ____lambda80_ (Block12Data* _data12_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda80__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void util_nap_data_free (gpointer _data);
static gboolean util_nap_co (UtilNapData* _data_);
static Block13Data* block13_data_ref (Block13Data* _data13_);
static void block13_data_unref (void * _userdata_);
static gboolean __lambda24_ (Block13Data* _data13_);
static gboolean ___lambda24__gsource_func (gpointer self);
static void util_finalize (GObject * obj);
static GType util_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
util_get_instance_private (Util* self)
{
	return G_STRUCT_MEMBER_P (self, Util_private_offset);
}

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

Util*
util_get_default (void)
{
	Util* _tmp0_;
	Util* _tmp2_;
	Util* _tmp3_;
	Util* result;
	_tmp0_ = util__instance;
	if (_tmp0_ == NULL) {
		Util* _tmp1_;
		_tmp1_ = util_new ();
		_g_object_unref0 (util__instance);
		util__instance = _tmp1_;
	}
	_tmp2_ = util__instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

GeeHashMap*
util_get_colors (Util* self)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp62_;
	GeeHashMap* _tmp63_;
	GeeHashMap* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->colors;
	if (_tmp0_ == NULL) {
		GeeHashMap* _tmp1_;
		GeeHashMap* _tmp2_;
		ObjectsColor* _tmp3_;
		ObjectsColor* _tmp4_;
		GeeHashMap* _tmp5_;
		ObjectsColor* _tmp6_;
		ObjectsColor* _tmp7_;
		GeeHashMap* _tmp8_;
		ObjectsColor* _tmp9_;
		ObjectsColor* _tmp10_;
		GeeHashMap* _tmp11_;
		ObjectsColor* _tmp12_;
		ObjectsColor* _tmp13_;
		GeeHashMap* _tmp14_;
		ObjectsColor* _tmp15_;
		ObjectsColor* _tmp16_;
		GeeHashMap* _tmp17_;
		ObjectsColor* _tmp18_;
		ObjectsColor* _tmp19_;
		GeeHashMap* _tmp20_;
		ObjectsColor* _tmp21_;
		ObjectsColor* _tmp22_;
		GeeHashMap* _tmp23_;
		ObjectsColor* _tmp24_;
		ObjectsColor* _tmp25_;
		GeeHashMap* _tmp26_;
		ObjectsColor* _tmp27_;
		ObjectsColor* _tmp28_;
		GeeHashMap* _tmp29_;
		ObjectsColor* _tmp30_;
		ObjectsColor* _tmp31_;
		GeeHashMap* _tmp32_;
		ObjectsColor* _tmp33_;
		ObjectsColor* _tmp34_;
		GeeHashMap* _tmp35_;
		ObjectsColor* _tmp36_;
		ObjectsColor* _tmp37_;
		GeeHashMap* _tmp38_;
		ObjectsColor* _tmp39_;
		ObjectsColor* _tmp40_;
		GeeHashMap* _tmp41_;
		ObjectsColor* _tmp42_;
		ObjectsColor* _tmp43_;
		GeeHashMap* _tmp44_;
		ObjectsColor* _tmp45_;
		ObjectsColor* _tmp46_;
		GeeHashMap* _tmp47_;
		ObjectsColor* _tmp48_;
		ObjectsColor* _tmp49_;
		GeeHashMap* _tmp50_;
		ObjectsColor* _tmp51_;
		ObjectsColor* _tmp52_;
		GeeHashMap* _tmp53_;
		ObjectsColor* _tmp54_;
		ObjectsColor* _tmp55_;
		GeeHashMap* _tmp56_;
		ObjectsColor* _tmp57_;
		ObjectsColor* _tmp58_;
		GeeHashMap* _tmp59_;
		ObjectsColor* _tmp60_;
		ObjectsColor* _tmp61_;
		_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, OBJECTS_TYPE_COLOR, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->colors);
		self->priv->colors = _tmp1_;
		_tmp2_ = self->priv->colors;
		_tmp3_ = objects_color_new (30, _ ("Berry Red"), "berry_red", "#c42d78");
		_tmp4_ = _tmp3_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, "berry_red", _tmp4_);
		_g_object_unref0 (_tmp4_);
		_tmp5_ = self->priv->colors;
		_tmp6_ = objects_color_new (31, _ ("Red"), "red", "#e23d3d");
		_tmp7_ = _tmp6_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, "red", _tmp7_);
		_g_object_unref0 (_tmp7_);
		_tmp8_ = self->priv->colors;
		_tmp9_ = objects_color_new (32, _ ("Orange"), "orange", "#ff8a2a");
		_tmp10_ = _tmp9_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp8_, "orange", _tmp10_);
		_g_object_unref0 (_tmp10_);
		_tmp11_ = self->priv->colors;
		_tmp12_ = objects_color_new (33, _ ("Yellow"), "yellow", "#f5c400");
		_tmp13_ = _tmp12_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp11_, "yellow", _tmp13_);
		_g_object_unref0 (_tmp13_);
		_tmp14_ = self->priv->colors;
		_tmp15_ = objects_color_new (34, _ ("Olive Green"), "olive_green", "#9cab3a");
		_tmp16_ = _tmp15_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp14_, "olive_green", _tmp16_);
		_g_object_unref0 (_tmp16_);
		_tmp17_ = self->priv->colors;
		_tmp18_ = objects_color_new (35, _ ("Lime Green"), "lime_green", "#70c741");
		_tmp19_ = _tmp18_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp17_, "lime_green", _tmp19_);
		_g_object_unref0 (_tmp19_);
		_tmp20_ = self->priv->colors;
		_tmp21_ = objects_color_new (36, _ ("Green"), "green", "#27983a");
		_tmp22_ = _tmp21_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp20_, "green", _tmp22_);
		_g_object_unref0 (_tmp22_);
		_tmp23_ = self->priv->colors;
		_tmp24_ = objects_color_new (37, _ ("Mint Green"), "mint_green", "#55cbb0");
		_tmp25_ = _tmp24_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp23_, "mint_green", _tmp25_);
		_g_object_unref0 (_tmp25_);
		_tmp26_ = self->priv->colors;
		_tmp27_ = objects_color_new (38, _ ("Teal"), "teal", "#1492b2");
		_tmp28_ = _tmp27_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp26_, "teal", _tmp28_);
		_g_object_unref0 (_tmp28_);
		_tmp29_ = self->priv->colors;
		_tmp30_ = objects_color_new (39, _ ("Sky Blue"), "sky_blue", "#139ef7");
		_tmp31_ = _tmp30_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp29_, "sky_blue", _tmp31_);
		_g_object_unref0 (_tmp31_);
		_tmp32_ = self->priv->colors;
		_tmp33_ = objects_color_new (40, _ ("Light Blue"), "light_blue", "#7fb9e8");
		_tmp34_ = _tmp33_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp32_, "light_blue", _tmp34_);
		_g_object_unref0 (_tmp34_);
		_tmp35_ = self->priv->colors;
		_tmp36_ = objects_color_new (41, _ ("Blue"), "blue", "#3c6dff");
		_tmp37_ = _tmp36_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp35_, "blue", _tmp37_);
		_g_object_unref0 (_tmp37_);
		_tmp38_ = self->priv->colors;
		_tmp39_ = objects_color_new (42, _ ("Grape"), "grape", "#7b44e6");
		_tmp40_ = _tmp39_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp38_, "grape", _tmp40_);
		_g_object_unref0 (_tmp40_);
		_tmp41_ = self->priv->colors;
		_tmp42_ = objects_color_new (43, _ ("Violet"), "violet", "#a02adb");
		_tmp43_ = _tmp42_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp41_, "violet", _tmp43_);
		_g_object_unref0 (_tmp43_);
		_tmp44_ = self->priv->colors;
		_tmp45_ = objects_color_new (44, _ ("Lavender"), "lavender", "#d89ae8");
		_tmp46_ = _tmp45_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp44_, "lavender", _tmp46_);
		_g_object_unref0 (_tmp46_);
		_tmp47_ = self->priv->colors;
		_tmp48_ = objects_color_new (45, _ ("Magenta"), "magenta", "#d6458d");
		_tmp49_ = _tmp48_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp47_, "magenta", _tmp49_);
		_g_object_unref0 (_tmp49_);
		_tmp50_ = self->priv->colors;
		_tmp51_ = objects_color_new (46, _ ("Salmon"), "salmon", "#f77c70");
		_tmp52_ = _tmp51_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp50_, "salmon", _tmp52_);
		_g_object_unref0 (_tmp52_);
		_tmp53_ = self->priv->colors;
		_tmp54_ = objects_color_new (47, _ ("Charcoal"), "charcoal", "#666666");
		_tmp55_ = _tmp54_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp53_, "charcoal", _tmp55_);
		_g_object_unref0 (_tmp55_);
		_tmp56_ = self->priv->colors;
		_tmp57_ = objects_color_new (48, _ ("Grey"), "grey", "#a0a0a0");
		_tmp58_ = _tmp57_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp56_, "grey", _tmp58_);
		_g_object_unref0 (_tmp58_);
		_tmp59_ = self->priv->colors;
		_tmp60_ = objects_color_new (49, _ ("Taupe"), "taupe", "#b99780");
		_tmp61_ = _tmp60_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp59_, "taupe", _tmp61_);
		_g_object_unref0 (_tmp61_);
	}
	_tmp62_ = self->priv->colors;
	_tmp63_ = _g_object_ref0 (_tmp62_);
	result = _tmp63_;
	return result;
}

gchar*
util_get_color_name (Util* self,
                     const gchar* key)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	ObjectsColor* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (key != NULL, NULL);
	_tmp0_ = util_get_colors (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, key);
	_tmp3_ = (ObjectsColor*) _tmp2_;
	_tmp4_ = objects_color_get_name (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup (_tmp5_);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	result = _tmp7_;
	return result;
}

gchar*
util_get_color (Util* self,
                const gchar* key)
{
	gboolean _tmp0_ = FALSE;
	GeeHashMap* _tmp2_;
	GeeHashMap* _tmp3_;
	gboolean _tmp4_;
	GdkRGBA rgba = {0};
	gchar* _tmp14_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (key == NULL) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (key, "") == 0;
	}
	if (_tmp0_) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("#1e63ec");
		result = _tmp1_;
		return result;
	}
	_tmp2_ = util_get_colors (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, key);
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		GeeHashMap* _tmp5_;
		GeeHashMap* _tmp6_;
		gpointer _tmp7_;
		ObjectsColor* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		_tmp5_ = util_get_colors (self);
		_tmp6_ = _tmp5_;
		_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp6_, key);
		_tmp8_ = (ObjectsColor*) _tmp7_;
		_tmp9_ = objects_color_get_hexadecimal (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_strdup (_tmp10_);
		_tmp12_ = _tmp11_;
		_g_object_unref0 (_tmp8_);
		_g_object_unref0 (_tmp6_);
		result = _tmp12_;
		return result;
	}
	memset (&rgba, 0, sizeof (GdkRGBA));
	if (gdk_rgba_parse (&rgba, key)) {
		gchar* _tmp13_;
		_tmp13_ = g_strdup (key);
		result = _tmp13_;
		return result;
	}
	_tmp14_ = g_strdup ("#1e63ec");
	result = _tmp14_;
	return result;
}

gchar*
util_get_random_color (Util* self)
{
	gchar* returned = NULL;
	gchar* _tmp0_;
	gint random = 0;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("berry_red");
	returned = _tmp0_;
	random = (gint) g_random_int_range ((gint32) 30, (gint32) 50);
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp1_;
		GeeHashMap* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeSet* _tmp5_;
		GeeIterator* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp1_ = util_get_colors (self);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_iterable_iterator ((GeeIterable*) _tmp5_);
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp5_);
		_g_object_unref0 (_tmp2_);
		_entry_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			GeeMapEntry* _tmp11_;
			gconstpointer _tmp12_;
			gconstpointer _tmp13_;
			gint _tmp14_;
			gint _tmp15_;
			_tmp8_ = _entry_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _entry_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			entry = (GeeMapEntry*) _tmp10_;
			_tmp11_ = entry;
			_tmp12_ = gee_map_entry_get_value (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = objects_color_get_id ((ObjectsColor*) _tmp13_);
			_tmp15_ = _tmp14_;
			if (_tmp15_ == random) {
				GeeMapEntry* _tmp16_;
				gconstpointer _tmp17_;
				gconstpointer _tmp18_;
				gchar* _tmp19_;
				_tmp16_ = entry;
				_tmp17_ = gee_map_entry_get_key (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = g_strdup ((const gchar*) _tmp18_);
				_g_free0 (returned);
				returned = _tmp19_;
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	result = returned;
	return result;
}

void
util_set_widget_color (Util* self,
                       const gchar* color,
                       GtkWidget* widget)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GeeHashMap* _tmp2_;
	GeeHashMap* _tmp4_;
	GtkStyleContext* style_context = NULL;
	GtkStyleContext* _tmp11_;
	GtkStyleContext* _tmp12_;
	GeeHashMap* _tmp13_;
	gpointer _tmp14_;
	GtkCssProvider* _tmp15_;
	g_return_if_fail (self != NULL);
	if (color == NULL) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = g_strcmp0 (color, "") == 0;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = widget == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp2_ = self->priv->providers;
	if (_tmp2_ == NULL) {
		GeeHashMap* _tmp3_;
		_tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, gtk_css_provider_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->providers);
		self->priv->providers = _tmp3_;
	}
	_tmp4_ = self->priv->providers;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp4_, color)) {
		gchar* style = NULL;
		gchar* _tmp5_;
		GtkCssProvider* style_provider = NULL;
		GtkCssProvider* _tmp6_;
		GtkCssProvider* _tmp7_;
		const gchar* _tmp8_;
		GeeHashMap* _tmp9_;
		GtkCssProvider* _tmp10_;
		_tmp5_ = g_strdup_printf ("\n" \
"                @define-color colorAccent %s;\n" \
"                @define-color accent_color %s;\n" \
"            ", color, color);
		style = _tmp5_;
		_tmp6_ = gtk_css_provider_new ();
		style_provider = _tmp6_;
		_tmp7_ = style_provider;
		_tmp8_ = style;
		gtk_css_provider_load_from_string (_tmp7_, _tmp8_);
		_tmp9_ = self->priv->providers;
		_tmp10_ = style_provider;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp9_, color, _tmp10_);
		_g_object_unref0 (style_provider);
		_g_free0 (style);
	}
	_tmp11_ = gtk_widget_get_style_context (widget);
	style_context = _tmp11_;
	_tmp12_ = style_context;
	_tmp13_ = self->priv->providers;
	_tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp13_, color);
	_tmp15_ = (GtkCssProvider*) _tmp14_;
	gtk_style_context_add_provider (_tmp12_, (GtkStyleProvider*) _tmp15_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_g_object_unref0 (_tmp15_);
}

void
util_set_widget_priority (Util* self,
                          gint priority,
                          GtkWidget* widget)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	gtk_widget_remove_css_class (widget, "priority-1-color");
	gtk_widget_remove_css_class (widget, "priority-2-color");
	gtk_widget_remove_css_class (widget, "priority-3-color");
	gtk_widget_remove_css_class (widget, "priority-4-color");
	if (priority == CONSTANTS_PRIORITY_1) {
		gtk_widget_add_css_class (widget, "priority-1-color");
	} else {
		if (priority == CONSTANTS_PRIORITY_2) {
			gtk_widget_add_css_class (widget, "priority-2-color");
		} else {
			if (priority == CONSTANTS_PRIORITY_3) {
				gtk_widget_add_css_class (widget, "priority-3-color");
			} else {
				if (priority == CONSTANTS_PRIORITY_4) {
					gtk_widget_add_css_class (widget, "priority-4-color");
				}
			}
		}
	}
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		Util* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->file_from_uri);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		Util* self;
		self = _data9_->_data8_->self;
		_g_main_loop_unref0 (_data9_->loop);
		block8_data_unref (_data9_->_data8_);
		_data9_->_data8_ = NULL;
		g_slice_free (Block9Data, _data9_);
	}
}

static void
___lambda4_ (Block9Data* _data9_,
             gint64 current_num_bytes,
             gint64 total_num_bytes)
{
	Block8Data* _data8_;
	Util* self;
	_data8_ = _data9_->_data8_;
	self = _data8_->self;
}

static void
____lambda4__gfile_progress_callback (gint64 current_num_bytes,
                                      gint64 total_num_bytes,
                                      gpointer self)
{
	___lambda4_ (self, current_num_bytes, total_num_bytes);
}

static void
___lambda5_ (Block9Data* _data9_,
             GObject* obj,
             GAsyncResult* res)
{
	Block8Data* _data8_;
	Util* self;
	GMainLoop* _tmp4_;
	GError* _inner_error0_ = NULL;
	_data8_ = _data9_->_data8_;
	self = _data8_->self;
	g_return_if_fail (res != NULL);
	{
		gboolean _tmp0_ = FALSE;
		GFile* _tmp1_;
		_tmp1_ = _data8_->file_from_uri;
		_tmp0_ = g_file_copy_finish (_tmp1_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_tmp0_) {
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_debug ("Util.vala:161: Error: %s\n", _tmp3_);
		_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;
	}
	_tmp4_ = _data9_->loop;
	g_main_loop_quit (_tmp4_);
}

static void
____lambda5__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	___lambda5_ (self, source_object, res);
	block9_data_unref (self);
}

void
util_download_profile_image (Util* self,
                             const gchar* id,
                             const gchar* avatar_url)
{
	Block8Data* _data8_;
	GFile* file_path = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (avatar_url != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	if (id == NULL) {
		block8_data_unref (_data8_);
		_data8_ = NULL;
		return;
	}
	_tmp0_ = util_get_avatar_path (self, id);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_file_new_for_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	file_path = _tmp3_;
	_tmp4_ = g_file_new_for_uri (avatar_url);
	_data8_->file_from_uri = _tmp4_;
	_tmp5_ = file_path;
	if (!g_file_query_exists (_tmp5_, NULL)) {
		Block9Data* _data9_;
		GMainLoop* _tmp6_;
		GFile* _tmp7_;
		GFile* _tmp8_;
		GMainLoop* _tmp9_;
		_data9_ = g_slice_new0 (Block9Data);
		_data9_->_ref_count_ = 1;
		_data9_->_data8_ = block8_data_ref (_data8_);
		_tmp6_ = g_main_loop_new (NULL, FALSE);
		_data9_->loop = _tmp6_;
		_tmp7_ = _data8_->file_from_uri;
		_tmp8_ = file_path;
		g_file_copy_async (_tmp7_, _tmp8_, 0, G_PRIORITY_DEFAULT, NULL, ____lambda4__gfile_progress_callback, _data9_, ____lambda5__gasync_ready_callback, block9_data_ref (_data9_));
		_tmp9_ = _data9_->loop;
		g_main_loop_run (_tmp9_);
		block9_data_unref (_data9_);
		_data9_ = NULL;
	}
	_g_object_unref0 (file_path);
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

gchar*
util_get_avatar_path (Util* self,
                      const gchar* id)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	_tmp0_ = g_get_user_data_dir ();
	_tmp1_ = g_strconcat (_tmp0_, "/io.github.alainm23.planify", NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat (id, ".jpg", NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_build_filename (_tmp2_, _tmp4_, NULL);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	result = _tmp6_;
	return result;
}

gchar*
util_generate_id (Util* self,
                  ObjectsBaseObject* base_object)
{
	GeeArrayList* collection = NULL;
	ServicesStore* _tmp1_;
	GeeArrayList* _tmp2_;
	gchar* id = NULL;
	gchar* _tmp3_;
	GeeArrayList* _tmp4_;
	const gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (base_object == NULL) {
		gchar* _tmp0_;
		_tmp0_ = g_uuid_string_random ();
		result = _tmp0_;
		return result;
	}
	_tmp1_ = services_store_instance ();
	_tmp2_ = services_store_get_collection_by_type (_tmp1_, base_object);
	collection = _tmp2_;
	_tmp3_ = g_uuid_string_random ();
	id = _tmp3_;
	_tmp4_ = collection;
	_tmp5_ = id;
	if (util_check_id_exists (self, _tmp4_, _tmp5_)) {
		gchar* _tmp6_;
		_tmp6_ = util_generate_id (self, base_object);
		result = _tmp6_;
		_g_free0 (id);
		_g_object_unref0 (collection);
		return result;
	}
	result = id;
	_g_object_unref0 (collection);
	return result;
}

static gboolean
util_check_id_exists (Util* self,
                      GeeArrayList* items,
                      const gchar* id)
{
	gboolean returned = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (items != NULL, FALSE);
	g_return_val_if_fail (id != NULL, FALSE);
	returned = FALSE;
	{
		GeeArrayList* _base_object_list = NULL;
		gint _base_object_size = 0;
		GeeArrayList* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gint _base_object_index = 0;
		_base_object_list = items;
		_tmp0_ = _base_object_list;
		_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
		_tmp2_ = _tmp1_;
		_base_object_size = _tmp2_;
		_base_object_index = -1;
		while (TRUE) {
			gint _tmp3_;
			gint _tmp4_;
			ObjectsBaseObject* base_object = NULL;
			GeeArrayList* _tmp5_;
			gpointer _tmp6_;
			ObjectsBaseObject* _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			_base_object_index = _base_object_index + 1;
			_tmp3_ = _base_object_index;
			_tmp4_ = _base_object_size;
			if (!(_tmp3_ < _tmp4_)) {
				break;
			}
			_tmp5_ = _base_object_list;
			_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, _base_object_index);
			base_object = (ObjectsBaseObject*) _tmp6_;
			_tmp7_ = base_object;
			_tmp8_ = objects_base_object_get_id (_tmp7_);
			_tmp9_ = _tmp8_;
			if (g_strcmp0 (_tmp9_, id) == 0) {
				returned = TRUE;
				_g_object_unref0 (base_object);
				break;
			}
			_g_object_unref0 (base_object);
		}
	}
	result = returned;
	return result;
}

gchar*
util_generate_string (Util* self)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = util_generate_id (self, NULL);
	result = _tmp0_;
	return result;
}

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

gchar*
util_get_encode_text (Util* self,
                      const gchar* text)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = string_replace (text, "&", "%26");
	_tmp1_ = _tmp0_;
	_tmp2_ = string_replace (_tmp1_, "#", "%23");
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

gchar*
util_get_theme_name (Util* self)
{
	gchar* returned = NULL;
	gchar* _tmp0_;
	gint appearance_mode = 0;
	ServicesSettings* _tmp1_;
	ServicesSettings* _tmp2_;
	GSettings* _tmp3_;
	gint _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	returned = _tmp0_;
	_tmp1_ = services_settings_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_->settings;
	_tmp4_ = g_settings_get_enum (_tmp3_, "appearance");
	_g_object_unref0 (_tmp2_);
	appearance_mode = _tmp4_;
	switch (appearance_mode) {
		case 0:
		{
			gchar* _tmp5_;
			_tmp5_ = g_strdup (_ ("Light"));
			_g_free0 (returned);
			returned = _tmp5_;
			break;
		}
		case 1:
		{
			gchar* _tmp6_;
			_tmp6_ = g_strdup (_ ("Dark"));
			_g_free0 (returned);
			returned = _tmp6_;
			break;
		}
		case 2:
		{
			gchar* _tmp7_;
			_tmp7_ = g_strdup (_ ("Dark Blue"));
			_g_free0 (returned);
			returned = _tmp7_;
			break;
		}
		default:
		break;
	}
	result = returned;
	return result;
}

static gchar**
_vala_array_dup1 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

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

gchar*
util_get_user_language (void)
{
	gchar** languages = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gint languages_length1;
	gint _languages_size_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar* _tmp23_;
	gchar* result;
	_tmp1_ = _tmp0_ = g_get_language_names ();
	_tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup1 (_tmp1_, _vala_array_length (_tmp0_)) : _tmp1_;
	_tmp2__length1 = _vala_array_length (_tmp0_);
	languages = _tmp2_;
	languages_length1 = _tmp2__length1;
	_languages_size_ = languages_length1;
	_tmp3_ = languages;
	_tmp3__length1 = languages_length1;
	if (_tmp3__length1 > 0) {
		gchar* lang = NULL;
		gchar** _tmp4_;
		gint _tmp4__length1;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp21_;
		gchar* _tmp22_;
		_tmp4_ = languages;
		_tmp4__length1 = languages_length1;
		_tmp5_ = _tmp4_[0];
		_tmp6_ = g_strdup (_tmp5_);
		lang = _tmp6_;
		_tmp7_ = lang;
		if (string_contains (_tmp7_, "_")) {
			const gchar* _tmp8_;
			gchar** _tmp9_;
			gchar** _tmp10_;
			gchar** _tmp11_;
			gint _tmp11__length1;
			const gchar* _tmp12_;
			gchar* _tmp13_;
			_tmp8_ = lang;
			_tmp10_ = _tmp9_ = g_strsplit (_tmp8_, "_", 0);
			_tmp11_ = _tmp10_;
			_tmp11__length1 = _vala_array_length (_tmp9_);
			_tmp12_ = _tmp11_[0];
			_tmp13_ = g_strdup (_tmp12_);
			_g_free0 (lang);
			lang = _tmp13_;
			_tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_free), NULL);
		} else {
			const gchar* _tmp14_;
			_tmp14_ = lang;
			if (string_contains (_tmp14_, ".")) {
				const gchar* _tmp15_;
				gchar** _tmp16_;
				gchar** _tmp17_;
				gchar** _tmp18_;
				gint _tmp18__length1;
				const gchar* _tmp19_;
				gchar* _tmp20_;
				_tmp15_ = lang;
				_tmp17_ = _tmp16_ = g_strsplit (_tmp15_, ".", 0);
				_tmp18_ = _tmp17_;
				_tmp18__length1 = _vala_array_length (_tmp16_);
				_tmp19_ = _tmp18_[0];
				_tmp20_ = g_strdup (_tmp19_);
				_g_free0 (lang);
				lang = _tmp20_;
				_tmp18_ = (_vala_array_free (_tmp18_, _tmp18__length1, (GDestroyNotify) g_free), NULL);
			}
		}
		_tmp21_ = lang;
		_tmp22_ = g_utf8_strdown (_tmp21_, (gssize) -1);
		result = _tmp22_;
		_g_free0 (lang);
		languages = (_vala_array_free (languages, languages_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp23_ = g_strdup ("en");
	result = _tmp23_;
	languages = (_vala_array_free (languages, languages_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

gchar*
util_get_badge_name (Util* self)
{
	gchar* returned = NULL;
	gchar* _tmp0_;
	gint badge_count = 0;
	ServicesSettings* _tmp1_;
	ServicesSettings* _tmp2_;
	GSettings* _tmp3_;
	gint _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	returned = _tmp0_;
	_tmp1_ = services_settings_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_->settings;
	_tmp4_ = g_settings_get_enum (_tmp3_, "badge-count");
	_g_object_unref0 (_tmp2_);
	badge_count = _tmp4_;
	switch (badge_count) {
		case 0:
		{
			gchar* _tmp5_;
			_tmp5_ = g_strdup (_ ("None"));
			_g_free0 (returned);
			returned = _tmp5_;
			break;
		}
		case 1:
		{
			gchar* _tmp6_;
			_tmp6_ = g_strdup (_ ("Inbox"));
			_g_free0 (returned);
			returned = _tmp6_;
			break;
		}
		case 2:
		{
			gchar* _tmp7_;
			_tmp7_ = g_strdup (_ ("Today"));
			_g_free0 (returned);
			returned = _tmp7_;
			break;
		}
		case 3:
		{
			gchar* _tmp8_;
			_tmp8_ = g_strdup (_ ("Today + Inbox"));
			_g_free0 (returned);
			returned = _tmp8_;
			break;
		}
		default:
		break;
	}
	result = returned;
	return result;
}

static void
_vala_GdkRGBA_free (GdkRGBA* self)
{
	g_boxed_free (gdk_rgba_get_type (), self);
}

gchar*
util_get_accent_color (Util* self)
{
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "use-system-accent");
	_g_object_unref0 (_tmp1_);
	if (_tmp3_) {
		AdwStyleManager* _tmp4_;
		_tmp4_ = adw_style_manager_get_default ();
		if (adw_style_manager_get_system_supports_accent_colors (_tmp4_)) {
			GdkRGBA* rgba = NULL;
			AdwStyleManager* _tmp5_;
			GdkRGBA* _tmp6_;
			GdkRGBA* _tmp7_;
			GdkRGBA* _tmp8_;
			GdkRGBA* _tmp9_;
			gchar* _tmp10_;
			_tmp5_ = adw_style_manager_get_default ();
			_tmp6_ = adw_style_manager_get_accent_color_rgba (_tmp5_);
			rgba = _tmp6_;
			_tmp7_ = rgba;
			_tmp8_ = rgba;
			_tmp9_ = rgba;
			_tmp10_ = g_strdup_printf ("#%02x%02x%02x", (guint) ((*_tmp7_).red * 255), (guint) ((*_tmp8_).green * 255), (guint) ((*_tmp9_).blue * 255));
			result = _tmp10_;
			__vala_GdkRGBA_free0 (rgba);
			return result;
		}
	}
	_tmp11_ = g_strdup (CONSTANTS_DEFAULT_ACCENT_COLOR);
	result = _tmp11_;
	return result;
}

void
util_update_theme (Util* self)
{
	Appearance appearance_mode = 0;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	Appearance _tmp3_;
	gboolean dark_mode = FALSE;
	ServicesSettings* _tmp4_;
	ServicesSettings* _tmp5_;
	GSettings* _tmp6_;
	gboolean _tmp7_;
	gboolean system_appearance = FALSE;
	ServicesSettings* _tmp8_;
	ServicesSettings* _tmp9_;
	GSettings* _tmp10_;
	gboolean _tmp11_;
	ColorSchemeSettingsSettings* color_scheme_settings = NULL;
	ColorSchemeSettingsSettings* _tmp12_;
	ColorSchemeSettingsSettings* _tmp13_;
	gchar* accent_color = NULL;
	gchar* _tmp17_;
	gchar* window_bg_color = NULL;
	gchar* _tmp18_;
	gchar* popover_bg_color = NULL;
	gchar* _tmp19_;
	gchar* sidebar_bg_color = NULL;
	gchar* _tmp20_;
	gchar* item_border_color = NULL;
	gchar* _tmp21_;
	gchar* upcoming_bg_color = NULL;
	gchar* _tmp22_;
	gchar* upcoming_fg_color = NULL;
	gchar* _tmp23_;
	gchar* selected_color = NULL;
	gchar* _tmp24_;
	gchar* card_bg_color = NULL;
	gchar* _tmp25_;
	gchar* css = NULL;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	gchar* _tmp63_;
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp64_;
	GdkDisplay* _tmp65_;
	ServicesEventBus* _tmp66_;
	ServicesEventBus* _tmp67_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = appearance_parse (g_settings_get_enum (_tmp2_, "appearance"));
	_g_object_unref0 (_tmp1_);
	appearance_mode = _tmp3_;
	_tmp4_ = services_settings_get_default ();
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_->settings;
	_tmp7_ = g_settings_get_boolean (_tmp6_, "dark-mode");
	_g_object_unref0 (_tmp5_);
	dark_mode = _tmp7_;
	_tmp8_ = services_settings_get_default ();
	_tmp9_ = _tmp8_;
	_tmp10_ = _tmp9_->settings;
	_tmp11_ = g_settings_get_boolean (_tmp10_, "system-appearance");
	_g_object_unref0 (_tmp9_);
	system_appearance = _tmp11_;
	_tmp12_ = color_scheme_settings_settings_get_default ();
	_tmp13_ = _g_object_ref0 (_tmp12_);
	color_scheme_settings = _tmp13_;
	if (system_appearance) {
		ColorSchemeSettingsSettings* _tmp14_;
		ColorSchemeSettingsSettingsColorScheme _tmp15_;
		ColorSchemeSettingsSettingsColorScheme _tmp16_;
		_tmp14_ = color_scheme_settings;
		_tmp15_ = color_scheme_settings_settings_get_prefers_color_scheme (_tmp14_);
		_tmp16_ = _tmp15_;
		dark_mode = _tmp16_ == COLOR_SCHEME_SETTINGS_SETTINGS_COLOR_SCHEME_DARK;
	}
	_tmp17_ = util_get_accent_color (self);
	accent_color = _tmp17_;
	_tmp18_ = g_strdup ("");
	window_bg_color = _tmp18_;
	_tmp19_ = g_strdup ("");
	popover_bg_color = _tmp19_;
	_tmp20_ = g_strdup ("");
	sidebar_bg_color = _tmp20_;
	_tmp21_ = g_strdup ("");
	item_border_color = _tmp21_;
	_tmp22_ = g_strdup ("");
	upcoming_bg_color = _tmp22_;
	_tmp23_ = g_strdup ("");
	upcoming_fg_color = _tmp23_;
	_tmp24_ = g_strdup ("");
	selected_color = _tmp24_;
	_tmp25_ = g_strdup ("");
	card_bg_color = _tmp25_;
	if (dark_mode) {
		if (appearance_mode == APPEARANCE_DARK) {
			gchar* _tmp26_;
			gchar* _tmp27_;
			gchar* _tmp28_;
			gchar* _tmp29_;
			gchar* _tmp30_;
			gchar* _tmp31_;
			gchar* _tmp32_;
			gchar* _tmp33_;
			AdwStyleManager* _tmp34_;
			_tmp26_ = g_strdup ("#181818");
			_g_free0 (window_bg_color);
			window_bg_color = _tmp26_;
			_tmp27_ = g_strdup ("#202020");
			_g_free0 (popover_bg_color);
			popover_bg_color = _tmp27_;
			_tmp28_ = g_strdup ("#1f1f1f");
			_g_free0 (sidebar_bg_color);
			sidebar_bg_color = _tmp28_;
			_tmp29_ = g_strdup ("#3a3a3a");
			_g_free0 (item_border_color);
			item_border_color = _tmp29_;
			_tmp30_ = g_strdup ("#2d2d2d");
			_g_free0 (upcoming_bg_color);
			upcoming_bg_color = _tmp30_;
			_tmp31_ = g_strdup ("#f0f0f0");
			_g_free0 (upcoming_fg_color);
			upcoming_fg_color = _tmp31_;
			_tmp32_ = g_strdup ("#2e3a46");
			_g_free0 (selected_color);
			selected_color = _tmp32_;
			_tmp33_ = g_strdup ("#222222");
			_g_free0 (card_bg_color);
			card_bg_color = _tmp33_;
			_tmp34_ = adw_style_manager_get_default ();
			adw_style_manager_set_color_scheme (_tmp34_, ADW_COLOR_SCHEME_FORCE_DARK);
		} else {
			gchar* _tmp35_;
			gchar* _tmp36_;
			gchar* _tmp37_;
			gchar* _tmp38_;
			gchar* _tmp39_;
			gchar* _tmp40_;
			gchar* _tmp41_;
			gchar* _tmp42_;
			AdwStyleManager* _tmp43_;
			_tmp35_ = g_strdup ("#0C0D12");
			_g_free0 (window_bg_color);
			window_bg_color = _tmp35_;
			_tmp36_ = g_strdup ("#16171D");
			_g_free0 (popover_bg_color);
			popover_bg_color = _tmp36_;
			_tmp37_ = g_strdup ("#14151a");
			_g_free0 (sidebar_bg_color);
			sidebar_bg_color = _tmp37_;
			_tmp38_ = g_strdup ("#2d2f35");
			_g_free0 (item_border_color);
			item_border_color = _tmp38_;
			_tmp39_ = g_strdup ("#2a2d34");
			_g_free0 (upcoming_bg_color);
			upcoming_bg_color = _tmp39_;
			_tmp40_ = g_strdup ("#e6e9ef");
			_g_free0 (upcoming_fg_color);
			upcoming_fg_color = _tmp40_;
			_tmp41_ = g_strdup ("#2a303a");
			_g_free0 (selected_color);
			selected_color = _tmp41_;
			_tmp42_ = g_strdup ("#1E2026");
			_g_free0 (card_bg_color);
			card_bg_color = _tmp42_;
			_tmp43_ = adw_style_manager_get_default ();
			adw_style_manager_set_color_scheme (_tmp43_, ADW_COLOR_SCHEME_FORCE_DARK);
		}
	} else {
		gchar* _tmp44_;
		gchar* _tmp45_;
		gchar* _tmp46_;
		gchar* _tmp47_;
		gchar* _tmp48_;
		gchar* _tmp49_;
		gchar* _tmp50_;
		gchar* _tmp51_;
		AdwStyleManager* _tmp52_;
		_tmp44_ = g_strdup ("#f9f9f9");
		_g_free0 (window_bg_color);
		window_bg_color = _tmp44_;
		_tmp45_ = g_strdup ("#ffffff");
		_g_free0 (popover_bg_color);
		popover_bg_color = _tmp45_;
		_tmp46_ = g_strdup ("#f3f4f6");
		_g_free0 (sidebar_bg_color);
		sidebar_bg_color = _tmp46_;
		_tmp47_ = g_strdup ("#dcdfe3");
		_g_free0 (item_border_color);
		item_border_color = _tmp47_;
		_tmp48_ = g_strdup ("#f0f1f3");
		_g_free0 (upcoming_bg_color);
		upcoming_bg_color = _tmp48_;
		_tmp49_ = g_strdup ("#2d2e32");
		_g_free0 (upcoming_fg_color);
		upcoming_fg_color = _tmp49_;
		_tmp50_ = g_strdup ("#dbeafe");
		_g_free0 (selected_color);
		selected_color = _tmp50_;
		_tmp51_ = g_strdup ("#ffffff");
		_g_free0 (card_bg_color);
		card_bg_color = _tmp51_;
		_tmp52_ = adw_style_manager_get_default ();
		adw_style_manager_set_color_scheme (_tmp52_, ADW_COLOR_SCHEME_FORCE_LIGHT);
	}
	_tmp53_ = window_bg_color;
	_tmp54_ = popover_bg_color;
	_tmp55_ = sidebar_bg_color;
	_tmp56_ = item_border_color;
	_tmp57_ = upcoming_bg_color;
	_tmp58_ = upcoming_fg_color;
	_tmp59_ = selected_color;
	_tmp60_ = card_bg_color;
	_tmp61_ = accent_color;
	_tmp62_ = accent_color;
	_tmp63_ = g_strdup_printf ("\n" \
"            @define-color window_bg_color %s;\n" \
"            @define-color popover_bg_color %s;\n" \
"            @define-color sidebar_bg_color %s;\n" \
"            @define-color item_border_color %s;\n" \
"            @define-color upcoming_bg_color %s;\n" \
"            @define-color upcoming_fg_color %s;\n" \
"            @define-color selected_color %s;\n" \
"            @define-color card_bg_color %s;\n" \
"            @define-color accent_color %s;\n" \
"            @define-color accent_bg_color %s;\n" \
"        ", _tmp53_, _tmp54_, _tmp55_, _tmp56_, _tmp57_, _tmp58_, _tmp59_, _tmp60_, _tmp61_, _tmp62_);
	css = _tmp63_;
	_tmp64_ = gtk_css_provider_new ();
	provider = _tmp64_;
	gtk_css_provider_load_from_string (provider, css);
	_tmp65_ = gdk_display_get_default ();
	gtk_style_context_add_provider_for_display (_tmp65_, (GtkStyleProvider*) provider, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_tmp66_ = services_event_bus_get_default ();
	_tmp67_ = _tmp66_;
	g_signal_emit_by_name (_tmp67_, "theme-changed");
	_g_object_unref0 (_tmp67_);
	_g_object_unref0 (provider);
	_g_free0 (css);
	_g_free0 (card_bg_color);
	_g_free0 (selected_color);
	_g_free0 (upcoming_fg_color);
	_g_free0 (upcoming_bg_color);
	_g_free0 (item_border_color);
	_g_free0 (sidebar_bg_color);
	_g_free0 (popover_bg_color);
	_g_free0 (window_bg_color);
	_g_free0 (accent_color);
	_g_object_unref0 (color_scheme_settings);
}

static gchar*
double_to_string (gdouble self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint _tmp1__length1;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE);
	_tmp1_ = _tmp0_;
	_tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE;
	_tmp2_ = g_ascii_dtostr (_tmp1_, (gint) G_ASCII_DTOSTR_BUF_SIZE, self);
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp1_ = (g_free (_tmp1_), NULL);
	result = _tmp4_;
	return result;
}

void
util_update_font_scale (Util* self)
{
	gchar* _css = NULL;
	gchar* _tmp0_;
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("\n" \
"            popover,\n" \
"            window {\n" \
"                font-size: %s%;\n" \
"            }\n" \
"        ");
	_css = _tmp0_;
	_tmp1_ = gtk_css_provider_new ();
	provider = _tmp1_;
	{
		gchar* scale = NULL;
		ServicesSettings* _tmp2_;
		ServicesSettings* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* css = NULL;
		gchar* _tmp6_;
		GdkDisplay* _tmp7_;
		_tmp2_ = services_settings_get_default ();
		_tmp3_ = _tmp2_;
		_tmp4_ = double_to_string (100 * services_settings_get_double (_tmp3_, "font-scale"));
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		scale = _tmp5_;
		_tmp6_ = g_strdup_printf (_css, scale);
		css = _tmp6_;
		gtk_css_provider_load_from_string (provider, css);
		_tmp7_ = gdk_display_get_default ();
		gtk_style_context_add_provider_for_display (_tmp7_, (GtkStyleProvider*) provider, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
		_g_free0 (css);
		_g_free0 (scale);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp8_;
		const gchar* _tmp9_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = e;
		_tmp9_ = _tmp8_->message;
		g_debug ("Util.vala:395: %s", _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (provider);
		_g_free0 (_css);
		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;
	}
	_g_object_unref0 (provider);
	_g_free0 (_css);
}

gchar*
util_line_break_to_space (Util* self,
                          const gchar* str)
{
	GRegex* _tmp0_;
	gchar* _tmp14_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (str != NULL, NULL);
	_tmp0_ = self->priv->line_break_to_space_regex;
	if (_tmp0_ == NULL) {
		{
			GRegex* _tmp1_ = NULL;
			GRegex* _tmp2_;
			GRegex* _tmp3_;
			_tmp2_ = g_regex_new ("(^\\s+|\\s+$|\n|\\s\\s+)", 0, 0, &_inner_error0_);
			_tmp1_ = _tmp2_;
			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;
			}
			_tmp3_ = _tmp1_;
			_tmp1_ = NULL;
			_g_regex_unref0 (self->priv->line_break_to_space_regex);
			self->priv->line_break_to_space_regex = _tmp3_;
			_g_regex_unref0 (_tmp1_);
		}
		goto __finally0;
		__catch0_g_regex_error:
		{
			GError* e = NULL;
			GError* _tmp4_;
			const gchar* _tmp5_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp4_ = e;
			_tmp5_ = _tmp4_->message;
			g_critical ("Util.vala:410: %s", _tmp5_);
			_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 NULL;
		}
	}
	{
		gchar* _tmp6_ = NULL;
		GRegex* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp7_ = self->priv->line_break_to_space_regex;
		_tmp8_ = strlen (str);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_regex_replace (_tmp7_, str, (gssize) _tmp9_, 0, " ", 0, &_inner_error0_);
		_tmp6_ = _tmp10_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch1_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;
		}
		_tmp11_ = _tmp6_;
		_tmp6_ = NULL;
		result = _tmp11_;
		_g_free0 (_tmp6_);
		return result;
	}
	goto __finally1;
	__catch1_g_regex_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		g_warning ("Util.vala:417: %s", _tmp13_);
		_g_error_free0 (e);
	}
	__finally1:
	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 NULL;
	}
	_tmp14_ = g_strdup (str);
	result = _tmp14_;
	return result;
}

static void
__lambda76_ (Util* self)
{
	_g_object_unref0 (self->priv->_audio_media);
	self->priv->_audio_media = NULL;
}

static void
___lambda76__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda76_ ((Util*) self);
}

void
util_play_audio (Util* self)
{
	GtkMediaFile* _tmp0_;
	GtkMediaFile* _tmp1_;
	GtkMediaFile* _tmp2_;
	GtkMediaFile* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkMediaFile*) gtk_media_file_new_for_resource ("/io/github/alainm23/planify/success.ogg");
	_g_object_unref0 (self->priv->_audio_media);
	self->priv->_audio_media = _tmp0_;
	_tmp1_ = self->priv->_audio_media;
	gtk_media_stream_set_loop ((GtkMediaStream*) _tmp1_, FALSE);
	_tmp2_ = self->priv->_audio_media;
	g_signal_connect_object ((GObject*) _tmp2_, "notify::ended", (GCallback) ___lambda76__g_object_notify, self, 0);
	_tmp3_ = self->priv->_audio_media;
	G_TYPE_INSTANCE_GET_CLASS ((GtkMediaStream*) _tmp3_, gtk_media_stream_get_type (), GtkMediaStreamClass)->play ((GtkMediaStream*) _tmp3_);
}

gboolean
util_is_input_valid (Util* self,
                     GtkEntry* entry)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	result = ((gint) gtk_entry_get_text_length (entry)) > 0;
	return result;
}

gboolean
util_is_text_valid (Util* self,
                    const gchar* text)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (text != NULL, FALSE);
	_tmp0_ = strlen (text);
	_tmp1_ = _tmp0_;
	result = _tmp1_ > 0;
	return result;
}

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

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

static gint
string_index_of_nth_char (const gchar* self,
                          glong c)
{
	gchar* _tmp0_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = g_utf8_offset_to_pointer (self, c);
	result = (gint) (_tmp0_ - ((gchar*) self));
	return result;
}

gchar*
util_get_short_name (Util* self,
                     const gchar* name,
                     gint size)
{
	gchar* returned = NULL;
	gchar* _tmp0_;
	gint char_count = 0;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = g_strdup (name);
	returned = _tmp0_;
	char_count = g_utf8_strlen (name, (gssize) -1);
	if (char_count > size) {
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp1_ = string_substring (name, (glong) 0, (glong) string_index_of_nth_char (name, (glong) size));
		_tmp2_ = _tmp1_;
		_tmp3_ = g_strconcat (_tmp2_, "…", NULL);
		_g_free0 (returned);
		returned = _tmp3_;
		_g_free0 (_tmp2_);
	}
	result = returned;
	return result;
}

static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		Util* self;
		self = _data10_->self;
		_g_object_unref0 (_data10_->window);
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static void
__lambda77_ (Block10Data* _data10_,
             const gchar* response)
{
	Util* self;
	self = _data10_->self;
	g_return_if_fail (response != NULL);
	if (g_strcmp0 (response, "delete") == 0) {
		ServicesDatabase* _tmp0_;
		ServicesDatabase* _tmp1_;
		ServicesSettings* _tmp2_;
		ServicesSettings* _tmp3_;
		_tmp0_ = services_database_get_default ();
		_tmp1_ = _tmp0_;
		services_database_clear_database (_tmp1_);
		_g_object_unref0 (_tmp1_);
		_tmp2_ = services_settings_get_default ();
		_tmp3_ = _tmp2_;
		services_settings_reset_settings (_tmp3_);
		_g_object_unref0 (_tmp3_);
		util_show_alert_destroy (self, _data10_->window);
	}
}

static void
___lambda77__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                        const gchar* response,
                                        gpointer self)
{
	__lambda77_ (self, response);
}

void
util_clear_database (Util* self,
                     const gchar* title,
                     const gchar* message,
                     GtkWindow* window)
{
	Block10Data* _data10_;
	GtkWindow* _tmp0_;
	AdwAlertDialog* dialog = NULL;
	AdwAlertDialog* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	g_return_if_fail (message != NULL);
	g_return_if_fail (window != NULL);
	_data10_ = g_slice_new0 (Block10Data);
	_data10_->_ref_count_ = 1;
	_data10_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (_data10_->window);
	_data10_->window = _tmp0_;
	_tmp1_ = (AdwAlertDialog*) adw_alert_dialog_new (title, message);
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	adw_alert_dialog_set_body_use_markup (dialog, TRUE);
	adw_alert_dialog_add_response (dialog, "cancel", _ ("Cancel"));
	adw_alert_dialog_add_response (dialog, "delete", _ ("Delete All"));
	adw_alert_dialog_set_response_appearance (dialog, "delete", ADW_RESPONSE_DESTRUCTIVE);
	adw_dialog_present ((AdwDialog*) dialog, (GtkWidget*) _data10_->window);
	g_signal_connect_data (dialog, "response", (GCallback) ___lambda77__adw_alert_dialog_response, block10_data_ref (_data10_), (GClosureNotify) block10_data_unref, 0);
	_g_object_unref0 (dialog);
	block10_data_unref (_data10_);
	_data10_ = NULL;
}

static Block11Data*
block11_data_ref (Block11Data* _data11_)
{
	g_atomic_int_inc (&_data11_->_ref_count_);
	return _data11_;
}

static void
block11_data_unref (void * _userdata_)
{
	Block11Data* _data11_;
	_data11_ = (Block11Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
		Util* self;
		self = _data11_->self;
		_g_object_unref0 (_data11_->window);
		_g_object_unref0 (self);
		g_slice_free (Block11Data, _data11_);
	}
}

static void
__lambda78_ (Block11Data* _data11_,
             const gchar* response)
{
	Util* self;
	self = _data11_->self;
	g_return_if_fail (response != NULL);
	gtk_window_destroy (_data11_->window);
}

static void
___lambda78__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                        const gchar* response,
                                        gpointer self)
{
	__lambda78_ (self, response);
}

void
util_show_alert_destroy (Util* self,
                         GtkWindow* window)
{
	Block11Data* _data11_;
	GtkWindow* _tmp0_;
	AdwAlertDialog* dialog = NULL;
	AdwAlertDialog* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_data11_ = g_slice_new0 (Block11Data);
	_data11_->_ref_count_ = 1;
	_data11_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (_data11_->window);
	_data11_->window = _tmp0_;
	_tmp1_ = (AdwAlertDialog*) adw_alert_dialog_new (NULL, _ ("Process completed, you need to start Planify again."));
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	adw_alert_dialog_add_response (dialog, "ok", _ ("Ok"));
	adw_dialog_present ((AdwDialog*) dialog, (GtkWidget*) _data11_->window);
	g_signal_connect_data (dialog, "response", (GCallback) ___lambda78__adw_alert_dialog_response, block11_data_ref (_data11_), (GClosureNotify) block11_data_unref, 0);
	_g_object_unref0 (dialog);
	block11_data_unref (_data11_);
	_data11_ = NULL;
}

gint
util_get_default_priority (Util* self)
{
	gint default_priority = 0;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gint _tmp3_;
	gint returned = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_enum (_tmp2_, "default-priority");
	_g_object_unref0 (_tmp1_);
	default_priority = _tmp3_;
	returned = 1;
	if (default_priority == 0) {
		returned = 4;
	} else {
		if (default_priority == 1) {
			returned = 3;
		} else {
			if (default_priority == 2) {
				returned = 2;
			} else {
				if (default_priority == 3) {
					returned = 1;
				}
			}
		}
	}
	result = returned;
	return result;
}

gint
util_to_caldav_priority (Util* self,
                         gint priority)
{
	gint returned = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	returned = 1;
	if (priority == 4) {
		returned = 1;
	} else {
		if (priority == 3) {
			returned = 5;
		} else {
			if (priority == 2) {
				returned = 9;
			} else {
				returned = 0;
			}
		}
	}
	result = returned;
	return result;
}

gboolean
util_is_dark_theme (Util* self)
{
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "dark-mode");
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

gboolean
util_is_flatpak (Util* self)
{
	gchar* is_flatpak = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = g_getenv ("FLATPAK_ID");
	_tmp1_ = g_strdup (_tmp0_);
	is_flatpak = _tmp1_;
	_tmp2_ = is_flatpak;
	if (_tmp2_ != NULL) {
		result = TRUE;
		_g_free0 (is_flatpak);
		return result;
	}
	result = FALSE;
	_g_free0 (is_flatpak);
	return result;
}

GList*
util_get_children (Util* self,
                   GtkListBox* list)
{
	GList* response = NULL;
	GtkListBoxRow* item_row = NULL;
	gint row_index = 0;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (list != NULL, NULL);
	response = NULL;
	item_row = NULL;
	row_index = 0;
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			GtkListBoxRow* _tmp2_;
			GtkListBoxRow* _tmp3_;
			GtkListBoxRow* _tmp4_;
			gint _tmp7_;
			if (!_tmp0_) {
				GtkListBoxRow* _tmp1_;
				_tmp1_ = item_row;
				if (!(_tmp1_ != NULL)) {
					break;
				}
			}
			_tmp0_ = FALSE;
			_tmp2_ = gtk_list_box_get_row_at_index (list, row_index);
			_tmp3_ = _g_object_ref0 (_tmp2_);
			_g_object_unref0 (item_row);
			item_row = _tmp3_;
			_tmp4_ = item_row;
			if (_tmp4_ != NULL) {
				GtkListBoxRow* _tmp5_;
				GtkListBoxRow* _tmp6_;
				_tmp5_ = item_row;
				_tmp6_ = _g_object_ref0 (_tmp5_);
				response = g_list_append (response, _tmp6_);
			}
			_tmp7_ = row_index;
			row_index = _tmp7_ + 1;
		}
	}
	result = response;
	_g_object_unref0 (item_row);
	return result;
}

GList*
util_get_flowbox_children (Util* self,
                           GtkFlowBox* list)
{
	GList* response = NULL;
	GtkFlowBoxChild* item_row = NULL;
	gint row_index = 0;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (list != NULL, NULL);
	response = NULL;
	item_row = NULL;
	row_index = 0;
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			GtkFlowBoxChild* _tmp2_;
			GtkFlowBoxChild* _tmp3_;
			GtkFlowBoxChild* _tmp4_;
			gint _tmp7_;
			if (!_tmp0_) {
				GtkFlowBoxChild* _tmp1_;
				_tmp1_ = item_row;
				if (!(_tmp1_ != NULL)) {
					break;
				}
			}
			_tmp0_ = FALSE;
			_tmp2_ = gtk_flow_box_get_child_at_index (list, row_index);
			_tmp3_ = _g_object_ref0 (_tmp2_);
			_g_object_unref0 (item_row);
			item_row = _tmp3_;
			_tmp4_ = item_row;
			if (_tmp4_ != NULL) {
				GtkFlowBoxChild* _tmp5_;
				GtkFlowBoxChild* _tmp6_;
				_tmp5_ = item_row;
				_tmp6_ = _g_object_ref0 (_tmp5_);
				response = g_list_append (response, _tmp6_);
			}
			_tmp7_ = row_index;
			row_index = _tmp7_ + 1;
		}
	}
	result = response;
	_g_object_unref0 (item_row);
	return result;
}

AdwToast*
util_create_toast (Util* self,
                   const gchar* title,
                   guint timeout,
                   AdwToastPriority priority)
{
	AdwToast* toast = NULL;
	AdwToast* _tmp0_;
	AdwToast* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = adw_toast_new (title);
	toast = _tmp0_;
	adw_toast_set_timeout (toast, timeout);
	adw_toast_set_priority (toast, priority);
	result = toast;
	return result;
}

ObjectsSource*
util_create_local_source (Util* self)
{
	ObjectsSource* local_source = NULL;
	ObjectsSource* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	ServicesStore* _tmp3_;
	ObjectsSource* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = objects_source_new ();
	local_source = _tmp0_;
	_tmp1_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp2_ = _tmp1_;
	objects_base_object_set_id ((ObjectsBaseObject*) local_source, _tmp2_);
	_g_free0 (_tmp2_);
	objects_source_set_source_type (local_source, SOURCE_TYPE_LOCAL);
	objects_source_set_display_name (local_source, _ ("On This Computer"));
	_tmp3_ = services_store_instance ();
	services_store_insert_source (_tmp3_, local_source);
	result = local_source;
	return result;
}

ObjectsProject*
util_create_inbox_project (Util* self)
{
	ObjectsProject* inbox_project = NULL;
	ObjectsProject* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	Util* _tmp3_;
	Util* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	ServicesStore* _tmp7_;
	ServicesSettings* _tmp8_;
	ServicesSettings* _tmp9_;
	GSettings* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	ObjectsProject* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = objects_project_new ();
	inbox_project = _tmp0_;
	_tmp1_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp2_ = _tmp1_;
	objects_project_set_source_id (inbox_project, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = util_get_default ();
	_tmp4_ = _tmp3_;
	_tmp5_ = util_generate_id (_tmp4_, (ObjectsBaseObject*) inbox_project);
	_tmp6_ = _tmp5_;
	objects_base_object_set_id ((ObjectsBaseObject*) inbox_project, _tmp6_);
	_g_free0 (_tmp6_);
	_g_object_unref0 (_tmp4_);
	objects_base_object_set_name ((ObjectsBaseObject*) inbox_project, _ ("Inbox"));
	objects_project_set_inbox_project (inbox_project, TRUE);
	objects_base_object_set_color ((ObjectsBaseObject*) inbox_project, "blue");
	_tmp7_ = services_store_instance ();
	services_store_insert_project (_tmp7_, inbox_project);
	_tmp8_ = services_settings_get_default ();
	_tmp9_ = _tmp8_;
	_tmp10_ = _tmp9_->settings;
	_tmp11_ = objects_base_object_get_id ((ObjectsBaseObject*) inbox_project);
	_tmp12_ = _tmp11_;
	g_settings_set_string (_tmp10_, "local-inbox-project-id", _tmp12_);
	_g_object_unref0 (_tmp9_);
	result = inbox_project;
	return result;
}

void
util_create_tutorial_project (Util* self)
{
	ObjectsProject* project = NULL;
	ObjectsProject* _tmp0_;
	Util* _tmp1_;
	Util* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	ServicesStore* _tmp7_;
	ObjectsItem* item_01 = NULL;
	ObjectsItem* _tmp8_;
	Util* _tmp9_;
	Util* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	ObjectsItem* item_02 = NULL;
	ObjectsItem* _tmp15_;
	Util* _tmp16_;
	Util* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	ObjectsItem* item_03 = NULL;
	ObjectsItem* _tmp22_;
	Util* _tmp23_;
	Util* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	ObjectsItem* item_04 = NULL;
	ObjectsItem* _tmp29_;
	Util* _tmp30_;
	Util* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	ObjectsItem* item_05 = NULL;
	ObjectsItem* _tmp36_;
	Util* _tmp37_;
	Util* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	ObjectsItem* item_06 = NULL;
	ObjectsItem* _tmp43_;
	Util* _tmp44_;
	Util* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	const gchar* _tmp48_;
	const gchar* _tmp49_;
	ObjectsItem* _tmp50_;
	ObjectsItem* _tmp51_;
	ObjectsItem* _tmp52_;
	ObjectsItem* _tmp53_;
	ObjectsItem* _tmp54_;
	ObjectsItem* _tmp55_;
	ObjectsItem* _tmp56_;
	ObjectsItem* _tmp57_;
	ObjectsItem* _tmp58_;
	ObjectsItem* _tmp59_;
	ObjectsItem* _tmp60_;
	ObjectsItem* _tmp61_;
	ObjectsSection* section_01 = NULL;
	ObjectsSection* _tmp62_;
	Util* _tmp63_;
	Util* _tmp64_;
	gchar* _tmp65_;
	gchar* _tmp66_;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	ObjectsSection* _tmp69_;
	ObjectsSection* _tmp70_;
	ObjectsItem* item_02_01 = NULL;
	ObjectsItem* _tmp71_;
	Util* _tmp72_;
	Util* _tmp73_;
	gchar* _tmp74_;
	gchar* _tmp75_;
	const gchar* _tmp76_;
	const gchar* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	ObjectsItem* item_02_02 = NULL;
	ObjectsItem* _tmp80_;
	Util* _tmp81_;
	Util* _tmp82_;
	gchar* _tmp83_;
	gchar* _tmp84_;
	const gchar* _tmp85_;
	const gchar* _tmp86_;
	const gchar* _tmp87_;
	const gchar* _tmp88_;
	ObjectsItem* _tmp89_;
	ObjectsItem* _tmp90_;
	ObjectsItem* _tmp91_;
	ObjectsItem* _tmp92_;
	ObjectsSection* section_02 = NULL;
	ObjectsSection* _tmp93_;
	Util* _tmp94_;
	Util* _tmp95_;
	gchar* _tmp96_;
	gchar* _tmp97_;
	const gchar* _tmp98_;
	const gchar* _tmp99_;
	ObjectsSection* _tmp100_;
	ObjectsSection* _tmp101_;
	ObjectsItem* item_03_01 = NULL;
	ObjectsItem* _tmp102_;
	Util* _tmp103_;
	Util* _tmp104_;
	gchar* _tmp105_;
	gchar* _tmp106_;
	const gchar* _tmp107_;
	const gchar* _tmp108_;
	const gchar* _tmp109_;
	const gchar* _tmp110_;
	ObjectsItem* item_03_02 = NULL;
	ObjectsItem* _tmp111_;
	Util* _tmp112_;
	Util* _tmp113_;
	gchar* _tmp114_;
	gchar* _tmp115_;
	const gchar* _tmp116_;
	const gchar* _tmp117_;
	const gchar* _tmp118_;
	const gchar* _tmp119_;
	ObjectsItem* item_03_03 = NULL;
	ObjectsItem* _tmp120_;
	Util* _tmp121_;
	Util* _tmp122_;
	gchar* _tmp123_;
	gchar* _tmp124_;
	const gchar* _tmp125_;
	const gchar* _tmp126_;
	const gchar* _tmp127_;
	const gchar* _tmp128_;
	ObjectsItem* _tmp129_;
	ObjectsItem* _tmp130_;
	ObjectsItem* _tmp131_;
	ObjectsItem* _tmp132_;
	ObjectsItem* _tmp133_;
	ObjectsItem* _tmp134_;
	g_return_if_fail (self != NULL);
	_tmp0_ = objects_project_new ();
	project = _tmp0_;
	_tmp1_ = util_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = util_generate_id (_tmp2_, (ObjectsBaseObject*) project);
	_tmp4_ = _tmp3_;
	objects_base_object_set_id ((ObjectsBaseObject*) project, _tmp4_);
	_g_free0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	_tmp5_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp6_ = _tmp5_;
	objects_project_set_source_id (project, _tmp6_);
	_g_free0 (_tmp6_);
	objects_project_set_icon_style (project, PROJECT_ICON_STYLE_EMOJI);
	objects_project_set_emoji (project, "🚀️");
	objects_base_object_set_name ((ObjectsBaseObject*) project, _ ("Meet Planify"));
	objects_base_object_set_color ((ObjectsBaseObject*) project, "blue");
	objects_project_set_show_completed (project, TRUE);
	objects_project_set_description (project, _ ("This project shows you everything you need to know to hit the ground r" \
"unning. Don’t hesitate to play around with it – you can always recreat" \
"e it from Preferences."));
	_tmp7_ = services_store_instance ();
	services_store_insert_project (_tmp7_, project);
	_tmp8_ = objects_item_new ();
	item_01 = _tmp8_;
	_tmp9_ = util_get_default ();
	_tmp10_ = _tmp9_;
	_tmp11_ = util_generate_id (_tmp10_, (ObjectsBaseObject*) item_01);
	_tmp12_ = _tmp11_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_01, _tmp12_);
	_g_free0 (_tmp12_);
	_g_object_unref0 (_tmp10_);
	_tmp13_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp14_ = _tmp13_;
	objects_item_set_project_id (item_01, _tmp14_);
	objects_item_set_content (item_01, _ ("Tap this task"));
	objects_item_set_description (item_01, _ ("You're looking at a to-do! Complete it by tapping the checkbox on the " \
"left. "));
	_tmp15_ = objects_item_new ();
	item_02 = _tmp15_;
	_tmp16_ = util_get_default ();
	_tmp17_ = _tmp16_;
	_tmp18_ = util_generate_id (_tmp17_, (ObjectsBaseObject*) item_02);
	_tmp19_ = _tmp18_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_02, _tmp19_);
	_g_free0 (_tmp19_);
	_g_object_unref0 (_tmp17_);
	_tmp20_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp21_ = _tmp20_;
	objects_item_set_project_id (item_02, _tmp21_);
	objects_item_set_content (item_02, _ ("Create a new task"));
	objects_item_set_description (item_02, _ ("Now it's your turn! Tap the '+' button at the bottom of your project, " \
"enter a task description, and tap the 'Add Task' button."));
	_tmp22_ = objects_item_new ();
	item_03 = _tmp22_;
	_tmp23_ = util_get_default ();
	_tmp24_ = _tmp23_;
	_tmp25_ = util_generate_id (_tmp24_, (ObjectsBaseObject*) item_03);
	_tmp26_ = _tmp25_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_03, _tmp26_);
	_g_free0 (_tmp26_);
	_g_object_unref0 (_tmp24_);
	_tmp27_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp28_ = _tmp27_;
	objects_item_set_project_id (item_03, _tmp28_);
	objects_item_set_content (item_03, _ ("Plan this to-do for today or later"));
	objects_item_set_description (item_03, _ ("Tap the calendar button at the bottom to decide when to complete this " \
"to-do."));
	_tmp29_ = objects_item_new ();
	item_04 = _tmp29_;
	_tmp30_ = util_get_default ();
	_tmp31_ = _tmp30_;
	_tmp32_ = util_generate_id (_tmp31_, (ObjectsBaseObject*) item_04);
	_tmp33_ = _tmp32_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_04, _tmp33_);
	_g_free0 (_tmp33_);
	_g_object_unref0 (_tmp31_);
	_tmp34_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp35_ = _tmp34_;
	objects_item_set_project_id (item_04, _tmp35_);
	objects_item_set_content (item_04, _ ("Reorder your to-dos"));
	objects_item_set_description (item_04, _ ("To reorder your list, tap and hold a to-do, then drag it to where it s" \
"hould go."));
	_tmp36_ = objects_item_new ();
	item_05 = _tmp36_;
	_tmp37_ = util_get_default ();
	_tmp38_ = _tmp37_;
	_tmp39_ = util_generate_id (_tmp38_, (ObjectsBaseObject*) item_05);
	_tmp40_ = _tmp39_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_05, _tmp40_);
	_g_free0 (_tmp40_);
	_g_object_unref0 (_tmp38_);
	_tmp41_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp42_ = _tmp41_;
	objects_item_set_project_id (item_05, _tmp42_);
	objects_item_set_content (item_05, _ ("Create a project"));
	objects_item_set_description (item_05, _ ("Organize your to-dos better! Go to the left panel and click the '+' bu" \
"tton in the 'On This Computer' section and add a project of your own."));
	_tmp43_ = objects_item_new ();
	item_06 = _tmp43_;
	_tmp44_ = util_get_default ();
	_tmp45_ = _tmp44_;
	_tmp46_ = util_generate_id (_tmp45_, (ObjectsBaseObject*) item_06);
	_tmp47_ = _tmp46_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_06, _tmp47_);
	_g_free0 (_tmp47_);
	_g_object_unref0 (_tmp45_);
	_tmp48_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp49_ = _tmp48_;
	objects_item_set_project_id (item_06, _tmp49_);
	objects_item_set_content (item_06, _ ("You’re done!"));
	objects_item_set_description (item_06, _ ("That\342\200\231s all you really need to know. Feel free to start addi" \
"ng your own projects and to-dos.\n" \
"You can come back to this project later to learn the advanced features" \
" below.\n" \
"We hope you\342\200\231ll enjoy using Planify!"));
	_tmp50_ = objects_project_add_item_if_not_exists (project, item_01, TRUE);
	_tmp51_ = _tmp50_;
	_g_object_unref0 (_tmp51_);
	_tmp52_ = objects_project_add_item_if_not_exists (project, item_02, TRUE);
	_tmp53_ = _tmp52_;
	_g_object_unref0 (_tmp53_);
	_tmp54_ = objects_project_add_item_if_not_exists (project, item_03, TRUE);
	_tmp55_ = _tmp54_;
	_g_object_unref0 (_tmp55_);
	_tmp56_ = objects_project_add_item_if_not_exists (project, item_04, TRUE);
	_tmp57_ = _tmp56_;
	_g_object_unref0 (_tmp57_);
	_tmp58_ = objects_project_add_item_if_not_exists (project, item_05, TRUE);
	_tmp59_ = _tmp58_;
	_g_object_unref0 (_tmp59_);
	_tmp60_ = objects_project_add_item_if_not_exists (project, item_06, TRUE);
	_tmp61_ = _tmp60_;
	_g_object_unref0 (_tmp61_);
	_tmp62_ = objects_section_new ();
	section_01 = _tmp62_;
	_tmp63_ = util_get_default ();
	_tmp64_ = _tmp63_;
	_tmp65_ = util_generate_id (_tmp64_, (ObjectsBaseObject*) section_01);
	_tmp66_ = _tmp65_;
	objects_base_object_set_id ((ObjectsBaseObject*) section_01, _tmp66_);
	_g_free0 (_tmp66_);
	_g_object_unref0 (_tmp64_);
	_tmp67_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp68_ = _tmp67_;
	objects_section_set_project_id (section_01, _tmp68_);
	objects_base_object_set_name ((ObjectsBaseObject*) section_01, _ ("Tune your setup"));
	_tmp69_ = objects_project_add_section_if_not_exists (project, section_01);
	_tmp70_ = _tmp69_;
	_g_object_unref0 (_tmp70_);
	_tmp71_ = objects_item_new ();
	item_02_01 = _tmp71_;
	_tmp72_ = util_get_default ();
	_tmp73_ = _tmp72_;
	_tmp74_ = util_generate_id (_tmp73_, (ObjectsBaseObject*) item_02_01);
	_tmp75_ = _tmp74_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_02_01, _tmp75_);
	_g_free0 (_tmp75_);
	_g_object_unref0 (_tmp73_);
	_tmp76_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp77_ = _tmp76_;
	objects_item_set_project_id (item_02_01, _tmp77_);
	_tmp78_ = objects_base_object_get_id ((ObjectsBaseObject*) section_01);
	_tmp79_ = _tmp78_;
	objects_item_set_section_id (item_02_01, _tmp79_);
	objects_item_set_content (item_02_01, _ ("Show your calendar events"));
	objects_item_set_description (item_02_01, _ ("You can display your system's calendar events in Planify. Go to 'Prefe" \
"rences' 🡒 General 🡒 Calendar Events to turn it on."));
	_tmp80_ = objects_item_new ();
	item_02_02 = _tmp80_;
	_tmp81_ = util_get_default ();
	_tmp82_ = _tmp81_;
	_tmp83_ = util_generate_id (_tmp82_, (ObjectsBaseObject*) item_02_02);
	_tmp84_ = _tmp83_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_02_02, _tmp84_);
	_g_free0 (_tmp84_);
	_g_object_unref0 (_tmp82_);
	_tmp85_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp86_ = _tmp85_;
	objects_item_set_project_id (item_02_02, _tmp86_);
	_tmp87_ = objects_base_object_get_id ((ObjectsBaseObject*) section_01);
	_tmp88_ = _tmp87_;
	objects_item_set_section_id (item_02_02, _tmp88_);
	objects_item_set_content (item_02_02, _ ("Enable synchronization with third-party services"));
	objects_item_set_description (item_02_02, _ ("Planify not only creates tasks locally, but can also synchronize with " \
"your Todoist account. Go to 'Preferences' 🡒 'Accounts'."));
	_tmp89_ = objects_section_add_item_if_not_exists (section_01, item_02_01, TRUE);
	_tmp90_ = _tmp89_;
	_g_object_unref0 (_tmp90_);
	_tmp91_ = objects_section_add_item_if_not_exists (section_01, item_02_02, TRUE);
	_tmp92_ = _tmp91_;
	_g_object_unref0 (_tmp92_);
	_tmp93_ = objects_section_new ();
	section_02 = _tmp93_;
	_tmp94_ = util_get_default ();
	_tmp95_ = _tmp94_;
	_tmp96_ = util_generate_id (_tmp95_, (ObjectsBaseObject*) section_01);
	_tmp97_ = _tmp96_;
	objects_base_object_set_id ((ObjectsBaseObject*) section_02, _tmp97_);
	_g_free0 (_tmp97_);
	_g_object_unref0 (_tmp95_);
	_tmp98_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp99_ = _tmp98_;
	objects_section_set_project_id (section_02, _tmp99_);
	objects_base_object_set_name ((ObjectsBaseObject*) section_02, _ ("Boost your productivity"));
	_tmp100_ = objects_project_add_section_if_not_exists (project, section_02);
	_tmp101_ = _tmp100_;
	_g_object_unref0 (_tmp101_);
	_tmp102_ = objects_item_new ();
	item_03_01 = _tmp102_;
	_tmp103_ = util_get_default ();
	_tmp104_ = _tmp103_;
	_tmp105_ = util_generate_id (_tmp104_, (ObjectsBaseObject*) item_03_01);
	_tmp106_ = _tmp105_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_03_01, _tmp106_);
	_g_free0 (_tmp106_);
	_g_object_unref0 (_tmp104_);
	_tmp107_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp108_ = _tmp107_;
	objects_item_set_project_id (item_03_01, _tmp108_);
	_tmp109_ = objects_base_object_get_id ((ObjectsBaseObject*) section_02);
	_tmp110_ = _tmp109_;
	objects_item_set_section_id (item_03_01, _tmp110_);
	objects_item_set_content (item_03_01, _ ("Drag the plus button!"));
	objects_item_set_description (item_03_01, _ ("That blue button you see at the bottom of each screen is more powerful" \
" than it looks: it's made to move! Drag it up to create a task whereve" \
"r you want."));
	_tmp111_ = objects_item_new ();
	item_03_02 = _tmp111_;
	_tmp112_ = util_get_default ();
	_tmp113_ = _tmp112_;
	_tmp114_ = util_generate_id (_tmp113_, (ObjectsBaseObject*) item_03_02);
	_tmp115_ = _tmp114_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_03_02, _tmp115_);
	_g_free0 (_tmp115_);
	_g_object_unref0 (_tmp113_);
	_tmp116_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp117_ = _tmp116_;
	objects_item_set_project_id (item_03_02, _tmp117_);
	_tmp118_ = objects_base_object_get_id ((ObjectsBaseObject*) section_02);
	_tmp119_ = _tmp118_;
	objects_item_set_section_id (item_03_02, _tmp119_);
	objects_item_set_content (item_03_02, _ ("Add labels to your tasks!"));
	objects_item_set_description (item_03_02, _ ("Labels help you organize and categorize your tasks. To add a label, cl" \
"ick the label button at the bottom."));
	_tmp120_ = objects_item_new ();
	item_03_03 = _tmp120_;
	_tmp121_ = util_get_default ();
	_tmp122_ = _tmp121_;
	_tmp123_ = util_generate_id (_tmp122_, (ObjectsBaseObject*) item_03_03);
	_tmp124_ = _tmp123_;
	objects_base_object_set_id ((ObjectsBaseObject*) item_03_03, _tmp124_);
	_g_free0 (_tmp124_);
	_g_object_unref0 (_tmp122_);
	_tmp125_ = objects_base_object_get_id ((ObjectsBaseObject*) project);
	_tmp126_ = _tmp125_;
	objects_item_set_project_id (item_03_03, _tmp126_);
	_tmp127_ = objects_base_object_get_id ((ObjectsBaseObject*) section_02);
	_tmp128_ = _tmp127_;
	objects_item_set_section_id (item_03_03, _tmp128_);
	objects_item_set_content (item_03_03, _ ("Set timely reminders!"));
	objects_item_set_description (item_03_03, _ ("Get notified about important tasks or events. Tap the clock button bel" \
"ow to add a reminder."));
	_tmp129_ = objects_section_add_item_if_not_exists (section_02, item_03_01, TRUE);
	_tmp130_ = _tmp129_;
	_g_object_unref0 (_tmp130_);
	_tmp131_ = objects_section_add_item_if_not_exists (section_02, item_03_02, TRUE);
	_tmp132_ = _tmp131_;
	_g_object_unref0 (_tmp132_);
	_tmp133_ = objects_section_add_item_if_not_exists (section_02, item_03_03, TRUE);
	_tmp134_ = _tmp133_;
	_g_object_unref0 (_tmp134_);
	_g_object_unref0 (item_03_03);
	_g_object_unref0 (item_03_02);
	_g_object_unref0 (item_03_01);
	_g_object_unref0 (section_02);
	_g_object_unref0 (item_02_02);
	_g_object_unref0 (item_02_01);
	_g_object_unref0 (section_01);
	_g_object_unref0 (item_06);
	_g_object_unref0 (item_05);
	_g_object_unref0 (item_04);
	_g_object_unref0 (item_03);
	_g_object_unref0 (item_02);
	_g_object_unref0 (item_01);
	_g_object_unref0 (project);
}

void
util_create_default_labels (Util* self)
{
	ObjectsLabel* label_01 = NULL;
	ObjectsLabel* _tmp0_;
	Util* _tmp1_;
	Util* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	ObjectsLabel* label_02 = NULL;
	ObjectsLabel* _tmp7_;
	Util* _tmp8_;
	Util* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	ObjectsLabel* label_03 = NULL;
	ObjectsLabel* _tmp14_;
	Util* _tmp15_;
	Util* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	ObjectsLabel* label_04 = NULL;
	ObjectsLabel* _tmp21_;
	Util* _tmp22_;
	Util* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	ObjectsLabel* label_05 = NULL;
	ObjectsLabel* _tmp28_;
	Util* _tmp29_;
	Util* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	ServicesStore* _tmp35_;
	ServicesStore* _tmp36_;
	ServicesStore* _tmp37_;
	ServicesStore* _tmp38_;
	ServicesStore* _tmp39_;
	g_return_if_fail (self != NULL);
	_tmp0_ = objects_label_new ();
	label_01 = _tmp0_;
	_tmp1_ = util_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = util_generate_id (_tmp2_, (ObjectsBaseObject*) label_01);
	_tmp4_ = _tmp3_;
	objects_base_object_set_id ((ObjectsBaseObject*) label_01, _tmp4_);
	_g_free0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	_tmp5_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp6_ = _tmp5_;
	objects_label_set_source_id (label_01, _tmp6_);
	_g_free0 (_tmp6_);
	objects_base_object_set_name ((ObjectsBaseObject*) label_01, _ ("💼️Work"));
	objects_base_object_set_color ((ObjectsBaseObject*) label_01, "taupe");
	_tmp7_ = objects_label_new ();
	label_02 = _tmp7_;
	_tmp8_ = util_get_default ();
	_tmp9_ = _tmp8_;
	_tmp10_ = util_generate_id (_tmp9_, (ObjectsBaseObject*) label_02);
	_tmp11_ = _tmp10_;
	objects_base_object_set_id ((ObjectsBaseObject*) label_02, _tmp11_);
	_g_free0 (_tmp11_);
	_g_object_unref0 (_tmp9_);
	_tmp12_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp13_ = _tmp12_;
	objects_label_set_source_id (label_02, _tmp13_);
	_g_free0 (_tmp13_);
	objects_base_object_set_name ((ObjectsBaseObject*) label_02, _ ("🎒️School"));
	objects_base_object_set_color ((ObjectsBaseObject*) label_02, "berry_red");
	_tmp14_ = objects_label_new ();
	label_03 = _tmp14_;
	_tmp15_ = util_get_default ();
	_tmp16_ = _tmp15_;
	_tmp17_ = util_generate_id (_tmp16_, (ObjectsBaseObject*) label_03);
	_tmp18_ = _tmp17_;
	objects_base_object_set_id ((ObjectsBaseObject*) label_03, _tmp18_);
	_g_free0 (_tmp18_);
	_g_object_unref0 (_tmp16_);
	_tmp19_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp20_ = _tmp19_;
	objects_label_set_source_id (label_03, _tmp20_);
	_g_free0 (_tmp20_);
	objects_base_object_set_name ((ObjectsBaseObject*) label_03, _ ("👉️Delegated"));
	objects_base_object_set_color ((ObjectsBaseObject*) label_03, "yellow");
	_tmp21_ = objects_label_new ();
	label_04 = _tmp21_;
	_tmp22_ = util_get_default ();
	_tmp23_ = _tmp22_;
	_tmp24_ = util_generate_id (_tmp23_, (ObjectsBaseObject*) label_04);
	_tmp25_ = _tmp24_;
	objects_base_object_set_id ((ObjectsBaseObject*) label_04, _tmp25_);
	_g_free0 (_tmp25_);
	_g_object_unref0 (_tmp23_);
	_tmp26_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp27_ = _tmp26_;
	objects_label_set_source_id (label_04, _tmp27_);
	_g_free0 (_tmp27_);
	objects_base_object_set_name ((ObjectsBaseObject*) label_04, _ ("🏡️Home"));
	objects_base_object_set_color ((ObjectsBaseObject*) label_04, "lime_green");
	_tmp28_ = objects_label_new ();
	label_05 = _tmp28_;
	_tmp29_ = util_get_default ();
	_tmp30_ = _tmp29_;
	_tmp31_ = util_generate_id (_tmp30_, (ObjectsBaseObject*) label_05);
	_tmp32_ = _tmp31_;
	objects_base_object_set_id ((ObjectsBaseObject*) label_05, _tmp32_);
	_g_free0 (_tmp32_);
	_g_object_unref0 (_tmp30_);
	_tmp33_ = source_type_to_string (SOURCE_TYPE_LOCAL);
	_tmp34_ = _tmp33_;
	objects_label_set_source_id (label_05, _tmp34_);
	_g_free0 (_tmp34_);
	objects_base_object_set_name ((ObjectsBaseObject*) label_05, _ ("🏃‍♀️️Follow Up"));
	objects_base_object_set_color ((ObjectsBaseObject*) label_05, "grey");
	_tmp35_ = services_store_instance ();
	services_store_insert_label (_tmp35_, label_01);
	_tmp36_ = services_store_instance ();
	services_store_insert_label (_tmp36_, label_02);
	_tmp37_ = services_store_instance ();
	services_store_insert_label (_tmp37_, label_03);
	_tmp38_ = services_store_instance ();
	services_store_insert_label (_tmp38_, label_04);
	_tmp39_ = services_store_instance ();
	services_store_insert_label (_tmp39_, label_05);
	_g_object_unref0 (label_05);
	_g_object_unref0 (label_04);
	_g_object_unref0 (label_03);
	_g_object_unref0 (label_02);
	_g_object_unref0 (label_01);
}

gchar*
util_markup_accel_tooltip (Util* self,
                           const gchar* description,
                           const gchar* accel)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (description != NULL, NULL);
	g_return_val_if_fail (accel != NULL, NULL);
	_tmp0_ = g_strdup_printf ("<span weight=\"600\" size=\"smaller\" alpha=\"75%\">%s</span>", accel);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("%s\n%s", description, _tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

gchar*
util_markup_accels_tooltip (Util* self,
                            const gchar* description,
                            gchar** accels,
                            gint accels_length1)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (description != NULL, NULL);
	_tmp0_ = g_strdup_printf ("%s\n", description);
	_result_ = _tmp0_;
	{
		gint index = 0;
		index = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gchar* accel = NULL;
				const gchar* _tmp3_;
				gchar* _tmp4_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = index;
					index = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(index < accels_length1)) {
					break;
				}
				_tmp3_ = accels[index];
				_tmp4_ = g_strdup_printf ("<span weight=\"600\" size=\"smaller\" alpha=\"75%\">%s</span>", _tmp3_);
				accel = _tmp4_;
				if (index < (accels_length1 - 1)) {
					const gchar* _tmp5_;
					const gchar* _tmp6_;
					gchar* _tmp7_;
					gchar* _tmp8_;
					gchar* _tmp9_;
					_tmp5_ = _result_;
					_tmp6_ = accel;
					_tmp7_ = g_strconcat (_tmp6_, ", ", NULL);
					_tmp8_ = _tmp7_;
					_tmp9_ = g_strconcat (_tmp5_, _tmp8_, NULL);
					_g_free0 (_result_);
					_result_ = _tmp9_;
					_g_free0 (_tmp8_);
				} else {
					const gchar* _tmp10_;
					const gchar* _tmp11_;
					gchar* _tmp12_;
					_tmp10_ = _result_;
					_tmp11_ = accel;
					_tmp12_ = g_strconcat (_tmp10_, _tmp11_, NULL);
					_g_free0 (_result_);
					_result_ = _tmp12_;
				}
				_g_free0 (accel);
			}
		}
	}
	result = _result_;
	return result;
}

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

gchar*
util_generate_extra_data (const gchar* ical_url,
                          const gchar* etag,
                          const gchar* data)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp1_;
	JsonNode* root = NULL;
	JsonNode* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (ical_url != NULL, NULL);
	g_return_val_if_fail (etag != NULL, NULL);
	g_return_val_if_fail (data != NULL, NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	json_builder_begin_object (builder);
	json_builder_set_member_name (builder, "ical_url");
	json_builder_add_string_value (builder, ical_url);
	json_builder_set_member_name (builder, "etag");
	json_builder_add_string_value (builder, etag);
	json_builder_set_member_name (builder, "calendar-data");
	json_builder_add_string_value (builder, data);
	json_builder_end_object (builder);
	_tmp1_ = json_generator_new ();
	generator = _tmp1_;
	_tmp2_ = json_builder_get_root (builder);
	root = _tmp2_;
	json_generator_set_root (generator, root);
	_tmp3_ = json_generator_to_data (generator, NULL);
	result = _tmp3_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
	return result;
}

static void
util_move_backend_type_item_data_free (gpointer _data)
{
	UtilMoveBackendTypeItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->target_project);
	_g_free0 (_data_->parent_id);
	_g_object_unref0 (_data_->self);
	g_slice_free (UtilMoveBackendTypeItemData, _data_);
}

void
util_move_backend_type_item (Util* self,
                             ObjectsItem* item,
                             ObjectsProject* target_project,
                             const gchar* parent_id,
                             gboolean notify,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_)
{
	UtilMoveBackendTypeItemData* _data_;
	Util* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsProject* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (target_project != NULL);
	g_return_if_fail (parent_id != NULL);
	_data_ = g_slice_new0 (UtilMoveBackendTypeItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_move_backend_type_item_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 (target_project);
	_g_object_unref0 (_data_->target_project);
	_data_->target_project = _tmp2_;
	_tmp3_ = g_strdup (parent_id);
	_g_free0 (_data_->parent_id);
	_data_->parent_id = _tmp3_;
	_data_->notify = notify;
	util_move_backend_type_item_co (_data_);
}

void
util_move_backend_type_item_finish (Util* self,
                                    GAsyncResult* _res_)
{
	UtilMoveBackendTypeItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
util_move_backend_type_item_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_)
{
	UtilMoveBackendTypeItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	util_move_backend_type_item_co (_data_);
}

static gboolean
util_move_backend_type_item_co (UtilMoveBackendTypeItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = objects_item_duplicate (_data_->item);
	_data_->new_item = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->new_item;
	_data_->_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->target_project);
	_data_->_tmp3_ = _data_->_tmp2_;
	objects_item_set_project_id (_data_->_tmp1_, _data_->_tmp3_);
	_data_->_tmp4_ = _data_->new_item;
	objects_item_set_parent_id (_data_->_tmp4_, _data_->parent_id);
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->item, TRUE);
	objects_base_object_set_sensitive ((ObjectsBaseObject*) _data_->item, FALSE);
	_data_->_tmp5_ = objects_project_get_source_type (_data_->target_project);
	_data_->_tmp6_ = _data_->_tmp5_;
	if (_data_->_tmp6_ == SOURCE_TYPE_LOCAL) {
		_data_->_tmp7_ = _data_->new_item;
		_data_->_tmp8_ = util_get_default ();
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = _data_->new_item;
		_data_->_tmp11_ = util_generate_id (_data_->_tmp9_, (ObjectsBaseObject*) _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp7_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_g_object_unref0 (_data_->_tmp9_);
		_data_->_tmp13_ = _data_->new_item;
		_data_->_state_ = 1;
		util_add_final_duplicate_item (_data_->self, _data_->_tmp13_, _data_->item, _data_->notify, util_move_backend_type_item_ready, _data_);
		return FALSE;
		_state_1:
		util_add_final_duplicate_item_finish (_data_->self, _data_->_res_);
	} else {
		_data_->_tmp14_ = objects_project_get_source_type (_data_->target_project);
		_data_->_tmp15_ = _data_->_tmp14_;
		if (_data_->_tmp15_ == SOURCE_TYPE_TODOIST) {
			_data_->_tmp16_ = services_todoist_get_default ();
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp18_ = _data_->new_item;
			_data_->_state_ = 2;
			services_todoist_add (_data_->_tmp17_, (ObjectsBaseObject*) _data_->_tmp18_, util_move_backend_type_item_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp19_ = services_todoist_add_finish (_data_->_tmp17_, _data_->_res_);
			_data_->_tmp20_ = _data_->_tmp19_;
			_g_object_unref0 (_data_->_tmp17_);
			_data_->response = _data_->_tmp20_;
			objects_base_object_set_loading ((ObjectsBaseObject*) _data_->item, FALSE);
			_data_->_tmp21_ = _data_->response;
			_data_->_tmp22_ = http_response_get_status (_data_->_tmp21_);
			_data_->_tmp23_ = _data_->_tmp22_;
			if (_data_->_tmp23_) {
				_data_->_tmp24_ = _data_->new_item;
				_data_->_tmp25_ = _data_->response;
				_data_->_tmp26_ = http_response_get_data (_data_->_tmp25_);
				_data_->_tmp27_ = _data_->_tmp26_;
				objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp24_, _data_->_tmp27_);
				_data_->_tmp28_ = _data_->new_item;
				_data_->_state_ = 3;
				util_add_final_duplicate_item (_data_->self, _data_->_tmp28_, _data_->item, _data_->notify, util_move_backend_type_item_ready, _data_);
				return FALSE;
				_state_3:
				util_add_final_duplicate_item_finish (_data_->self, _data_->_res_);
			}
			_http_response_unref0 (_data_->response);
		} else {
			_data_->_tmp29_ = objects_project_get_source_type (_data_->target_project);
			_data_->_tmp30_ = _data_->_tmp29_;
			if (_data_->_tmp30_ == SOURCE_TYPE_CALDAV) {
				_data_->_tmp31_ = _data_->new_item;
				_data_->_tmp32_ = util_get_default ();
				_data_->_tmp33_ = _data_->_tmp32_;
				_data_->_tmp34_ = _data_->new_item;
				_data_->_tmp35_ = util_generate_id (_data_->_tmp33_, (ObjectsBaseObject*) _data_->_tmp34_);
				_data_->_tmp36_ = _data_->_tmp35_;
				objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp31_, _data_->_tmp36_);
				_g_free0 (_data_->_tmp36_);
				_g_object_unref0 (_data_->_tmp33_);
				_data_->_tmp37_ = services_cal_dav_core_get_default ();
				_data_->_tmp38_ = _data_->_tmp37_;
				_data_->_tmp39_ = _data_->new_item;
				_data_->_tmp40_ = objects_item_get_project (_data_->_tmp39_);
				_data_->_tmp41_ = _data_->_tmp40_;
				_data_->_tmp42_ = objects_project_get_source (_data_->_tmp41_);
				_data_->_tmp43_ = _data_->_tmp42_;
				_data_->_tmp44_ = services_cal_dav_core_get_client (_data_->_tmp38_, _data_->_tmp43_);
				_data_->_tmp45_ = _data_->_tmp44_;
				_g_object_unref0 (_data_->_tmp38_);
				_data_->caldav_client = _data_->_tmp45_;
				_data_->_tmp46_ = _data_->caldav_client;
				_data_->_tmp47_ = _data_->new_item;
				_data_->_state_ = 4;
				services_cal_dav_cal_dav_client_add_item (_data_->_tmp46_, _data_->_tmp47_, FALSE, util_move_backend_type_item_ready, _data_);
				return FALSE;
				_state_4:
				_data_->_tmp48_ = services_cal_dav_cal_dav_client_add_item_finish (_data_->_tmp46_, _data_->_res_);
				_data_->_vala1_response = _data_->_tmp48_;
				objects_base_object_set_loading ((ObjectsBaseObject*) _data_->item, FALSE);
				_data_->_tmp49_ = _data_->_vala1_response;
				_data_->_tmp50_ = http_response_get_status (_data_->_tmp49_);
				_data_->_tmp51_ = _data_->_tmp50_;
				if (_data_->_tmp51_) {
					_data_->_tmp52_ = _data_->new_item;
					_data_->_state_ = 5;
					util_add_final_duplicate_item (_data_->self, _data_->_tmp52_, _data_->item, _data_->notify, util_move_backend_type_item_ready, _data_);
					return FALSE;
					_state_5:
					util_add_final_duplicate_item_finish (_data_->self, _data_->_res_);
				}
				_http_response_unref0 (_data_->_vala1_response);
				_g_object_unref0 (_data_->caldav_client);
			}
		}
	}
	_g_object_unref0 (_data_->new_item);
	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
util_add_final_duplicate_item_data_free (gpointer _data)
{
	UtilAddFinalDuplicateItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->new_item);
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->self);
	g_slice_free (UtilAddFinalDuplicateItemData, _data_);
}

void
util_add_final_duplicate_item (Util* self,
                               ObjectsItem* new_item,
                               ObjectsItem* item,
                               gboolean notify,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	UtilAddFinalDuplicateItemData* _data_;
	Util* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsItem* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_item != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (UtilAddFinalDuplicateItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_add_final_duplicate_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (new_item);
	_g_object_unref0 (_data_->new_item);
	_data_->new_item = _tmp1_;
	_tmp2_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp2_;
	_data_->notify = notify;
	util_add_final_duplicate_item_co (_data_);
}

void
util_add_final_duplicate_item_finish (Util* self,
                                      GAsyncResult* _res_)
{
	UtilAddFinalDuplicateItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
util_add_final_duplicate_item_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	UtilAddFinalDuplicateItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	util_add_final_duplicate_item_co (_data_);
}

static gboolean
util_add_final_duplicate_item_co (UtilAddFinalDuplicateItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = objects_item_get_has_parent (_data_->new_item);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_) {
		_data_->_tmp2_ = objects_item_get_parent (_data_->new_item);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = objects_item_add_item_if_not_exists (_data_->_tmp3_, _data_->new_item, TRUE);
		_data_->_tmp5_ = _data_->_tmp4_;
		_g_object_unref0 (_data_->_tmp5_);
	} else {
		_data_->_tmp6_ = objects_item_get_project (_data_->new_item);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = objects_project_add_item_if_not_exists (_data_->_tmp7_, _data_->new_item, TRUE);
		_data_->_tmp9_ = _data_->_tmp8_;
		_g_object_unref0 (_data_->_tmp9_);
	}
	{
		_data_->_tmp10_ = objects_item_get_reminders (_data_->item);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_reminder_list = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->_reminder_list;
		_data_->_tmp13_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_reminder_size = _data_->_tmp14_;
		_data_->_reminder_index = -1;
		while (TRUE) {
			_data_->_reminder_index = _data_->_reminder_index + 1;
			_data_->_tmp15_ = _data_->_reminder_index;
			_data_->_tmp16_ = _data_->_reminder_size;
			if (!(_data_->_tmp15_ < _data_->_tmp16_)) {
				break;
			}
			_data_->_tmp17_ = _data_->_reminder_list;
			_data_->_tmp18_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp17_, _data_->_reminder_index);
			_data_->reminder = (ObjectsReminder*) _data_->_tmp18_;
			_data_->_tmp19_ = _data_->reminder;
			_data_->_tmp20_ = objects_reminder_duplicate (_data_->_tmp19_);
			_data_->_reminder = _data_->_tmp20_;
			_data_->_tmp21_ = _data_->_reminder;
			_data_->_tmp22_ = util_get_default ();
			_data_->_tmp23_ = _data_->_tmp22_;
			_data_->_tmp24_ = _data_->_reminder;
			_data_->_tmp25_ = util_generate_id (_data_->_tmp23_, (ObjectsBaseObject*) _data_->_tmp24_);
			_data_->_tmp26_ = _data_->_tmp25_;
			objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp21_, _data_->_tmp26_);
			_g_free0 (_data_->_tmp26_);
			_g_object_unref0 (_data_->_tmp23_);
			_data_->_tmp27_ = _data_->_reminder;
			_data_->_tmp28_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->new_item);
			_data_->_tmp29_ = _data_->_tmp28_;
			objects_reminder_set_item_id (_data_->_tmp27_, _data_->_tmp29_);
			_data_->_tmp30_ = _data_->_reminder;
			_data_->_tmp31_ = objects_item_add_reminder_if_not_exists (_data_->new_item, _data_->_tmp30_, TRUE);
			_data_->_tmp32_ = _data_->_tmp31_;
			_g_object_unref0 (_data_->_tmp32_);
			_g_object_unref0 (_data_->_reminder);
			_g_object_unref0 (_data_->reminder);
		}
	}
	{
		_data_->_tmp33_ = objects_item_get_attachments (_data_->item);
		_data_->_tmp34_ = _data_->_tmp33_;
		_data_->_attachment_list = _data_->_tmp34_;
		_data_->_tmp35_ = _data_->_attachment_list;
		_data_->_tmp36_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp35_);
		_data_->_tmp37_ = _data_->_tmp36_;
		_data_->_attachment_size = _data_->_tmp37_;
		_data_->_attachment_index = -1;
		while (TRUE) {
			_data_->_attachment_index = _data_->_attachment_index + 1;
			_data_->_tmp38_ = _data_->_attachment_index;
			_data_->_tmp39_ = _data_->_attachment_size;
			if (!(_data_->_tmp38_ < _data_->_tmp39_)) {
				break;
			}
			_data_->_tmp40_ = _data_->_attachment_list;
			_data_->_tmp41_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp40_, _data_->_attachment_index);
			_data_->attachment = (ObjectsAttachment*) _data_->_tmp41_;
			_data_->_tmp42_ = _data_->attachment;
			_data_->_tmp43_ = objects_attachment_duplicate (_data_->_tmp42_);
			_data_->_attachment = _data_->_tmp43_;
			_data_->_tmp44_ = _data_->_attachment;
			_data_->_tmp45_ = util_get_default ();
			_data_->_tmp46_ = _data_->_tmp45_;
			_data_->_tmp47_ = util_generate_id (_data_->_tmp46_, NULL);
			_data_->_tmp48_ = _data_->_tmp47_;
			objects_attachment_set_id (_data_->_tmp44_, _data_->_tmp48_);
			_g_free0 (_data_->_tmp48_);
			_g_object_unref0 (_data_->_tmp46_);
			_data_->_tmp49_ = _data_->_attachment;
			_data_->_tmp50_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->new_item);
			_data_->_tmp51_ = _data_->_tmp50_;
			objects_attachment_set_item_id (_data_->_tmp49_, _data_->_tmp51_);
			_data_->_tmp52_ = _data_->_attachment;
			_data_->_tmp53_ = objects_item_add_attachment_if_not_exists (_data_->new_item, _data_->_tmp52_);
			_data_->_tmp54_ = _data_->_tmp53_;
			_g_object_unref0 (_data_->_tmp54_);
			_g_object_unref0 (_data_->_attachment);
			_g_object_unref0 (_data_->attachment);
		}
	}
	{
		_data_->_tmp55_ = objects_item_get_items (_data_->item);
		_data_->_tmp56_ = _data_->_tmp55_;
		_data_->_subitem_list = _data_->_tmp56_;
		_data_->_tmp57_ = _data_->_subitem_list;
		_data_->_tmp58_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp57_);
		_data_->_tmp59_ = _data_->_tmp58_;
		_data_->_subitem_size = _data_->_tmp59_;
		_data_->_subitem_index = -1;
		while (TRUE) {
			_data_->_subitem_index = _data_->_subitem_index + 1;
			_data_->_tmp60_ = _data_->_subitem_index;
			_data_->_tmp61_ = _data_->_subitem_size;
			if (!(_data_->_tmp60_ < _data_->_tmp61_)) {
				break;
			}
			_data_->_tmp62_ = _data_->_subitem_list;
			_data_->_tmp63_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp62_, _data_->_subitem_index);
			_data_->subitem = (ObjectsItem*) _data_->_tmp63_;
			_data_->_tmp64_ = _data_->subitem;
			_data_->_tmp65_ = objects_item_get_project (_data_->new_item);
			_data_->_tmp66_ = _data_->_tmp65_;
			_data_->_tmp67_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->new_item);
			_data_->_tmp68_ = _data_->_tmp67_;
			_data_->_state_ = 1;
			util_move_backend_type_item (_data_->self, _data_->_tmp64_, _data_->_tmp66_, _data_->_tmp68_, FALSE, util_add_final_duplicate_item_ready, _data_);
			return FALSE;
			_state_1:
			util_move_backend_type_item_finish (_data_->self, _data_->_res_);
			_g_object_unref0 (_data_->subitem);
		}
	}
	if (_data_->notify) {
		_data_->_tmp69_ = services_event_bus_get_default ();
		_data_->_tmp70_ = _data_->_tmp69_;
		_data_->_tmp71_ = objects_item_get_project (_data_->new_item);
		_data_->_tmp72_ = _data_->_tmp71_;
		_data_->_tmp73_ = objects_base_object_get_name ((ObjectsBaseObject*) _data_->_tmp72_);
		_data_->_tmp74_ = _data_->_tmp73_;
		_data_->_tmp75_ = g_strdup_printf ("Moved to %s", _data_->_tmp74_);
		_data_->_tmp76_ = _data_->_tmp75_;
		_data_->_tmp77_ = util_create_toast (_data_->self, _ (_data_->_tmp76_), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
		_data_->_tmp78_ = _data_->_tmp77_;
		g_signal_emit_by_name (_data_->_tmp70_, "send-toast", _data_->_tmp78_);
		_g_object_unref0 (_data_->_tmp78_);
		_g_free0 (_data_->_tmp76_);
		_g_object_unref0 (_data_->_tmp70_);
	}
	objects_item_delete_item (_data_->item);
	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
util_duplicate_item_data_free (gpointer _data)
{
	UtilDuplicateItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_free0 (_data_->project_id);
	_g_free0 (_data_->section_id);
	_g_free0 (_data_->parent_id);
	_g_object_unref0 (_data_->self);
	g_slice_free (UtilDuplicateItemData, _data_);
}

void
util_duplicate_item (Util* self,
                     ObjectsItem* item,
                     const gchar* project_id,
                     const gchar* section_id,
                     const gchar* parent_id,
                     gboolean notify,
                     GAsyncReadyCallback _callback_,
                     gpointer _user_data_)
{
	UtilDuplicateItemData* _data_;
	Util* _tmp0_;
	ObjectsItem* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	g_return_if_fail (project_id != NULL);
	g_return_if_fail (section_id != NULL);
	g_return_if_fail (parent_id != NULL);
	_data_ = g_slice_new0 (UtilDuplicateItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_duplicate_item_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_strdup (project_id);
	_g_free0 (_data_->project_id);
	_data_->project_id = _tmp2_;
	_tmp3_ = g_strdup (section_id);
	_g_free0 (_data_->section_id);
	_data_->section_id = _tmp3_;
	_tmp4_ = g_strdup (parent_id);
	_g_free0 (_data_->parent_id);
	_data_->parent_id = _tmp4_;
	_data_->notify = notify;
	util_duplicate_item_co (_data_);
}

void
util_duplicate_item_finish (Util* self,
                            GAsyncResult* _res_)
{
	UtilDuplicateItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
util_duplicate_item_ready (GObject* source_object,
                           GAsyncResult* _res_,
                           gpointer _user_data_)
{
	UtilDuplicateItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	util_duplicate_item_co (_data_);
}

static gboolean
util_duplicate_item_co (UtilDuplicateItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = objects_item_duplicate (_data_->item);
	_data_->new_item = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->new_item;
	objects_item_set_project_id (_data_->_tmp1_, _data_->project_id);
	_data_->_tmp2_ = _data_->new_item;
	objects_item_set_section_id (_data_->_tmp2_, _data_->section_id);
	_data_->_tmp3_ = _data_->new_item;
	objects_item_set_parent_id (_data_->_tmp3_, _data_->parent_id);
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->item, TRUE);
	objects_base_object_set_sensitive ((ObjectsBaseObject*) _data_->item, FALSE);
	_data_->_tmp4_ = _data_->new_item;
	_data_->_tmp5_ = objects_item_get_project (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = objects_project_get_source_type (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	if (_data_->_tmp8_ == SOURCE_TYPE_LOCAL) {
		_data_->_tmp9_ = _data_->new_item;
		_data_->_tmp10_ = util_get_default ();
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_tmp12_ = _data_->new_item;
		_data_->_tmp13_ = util_generate_id (_data_->_tmp11_, (ObjectsBaseObject*) _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp9_, _data_->_tmp14_);
		_g_free0 (_data_->_tmp14_);
		_g_object_unref0 (_data_->_tmp11_);
		objects_base_object_set_loading ((ObjectsBaseObject*) _data_->item, FALSE);
		objects_base_object_set_sensitive ((ObjectsBaseObject*) _data_->item, TRUE);
		_data_->_tmp15_ = _data_->new_item;
		_data_->_state_ = 1;
		util_insert_duplicate_item (_data_->self, _data_->_tmp15_, _data_->item, _data_->notify, util_duplicate_item_ready, _data_);
		return FALSE;
		_state_1:
		util_insert_duplicate_item_finish (_data_->self, _data_->_res_);
	} else {
		_data_->_tmp16_ = _data_->new_item;
		_data_->_tmp17_ = objects_item_get_project (_data_->_tmp16_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp19_ = objects_project_get_source_type (_data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		if (_data_->_tmp20_ == SOURCE_TYPE_TODOIST) {
			_data_->_tmp21_ = services_todoist_get_default ();
			_data_->_tmp22_ = _data_->_tmp21_;
			_data_->_tmp23_ = _data_->new_item;
			_data_->_state_ = 2;
			services_todoist_add (_data_->_tmp22_, (ObjectsBaseObject*) _data_->_tmp23_, util_duplicate_item_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp24_ = services_todoist_add_finish (_data_->_tmp22_, _data_->_res_);
			_data_->_tmp25_ = _data_->_tmp24_;
			_g_object_unref0 (_data_->_tmp22_);
			_data_->response = _data_->_tmp25_;
			objects_base_object_set_loading ((ObjectsBaseObject*) _data_->item, FALSE);
			objects_base_object_set_sensitive ((ObjectsBaseObject*) _data_->item, TRUE);
			_data_->_tmp26_ = _data_->response;
			_data_->_tmp27_ = http_response_get_status (_data_->_tmp26_);
			_data_->_tmp28_ = _data_->_tmp27_;
			if (_data_->_tmp28_) {
				_data_->_tmp29_ = _data_->new_item;
				_data_->_tmp30_ = _data_->response;
				_data_->_tmp31_ = http_response_get_data (_data_->_tmp30_);
				_data_->_tmp32_ = _data_->_tmp31_;
				objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp29_, _data_->_tmp32_);
				_data_->_tmp33_ = _data_->new_item;
				_data_->_state_ = 3;
				util_insert_duplicate_item (_data_->self, _data_->_tmp33_, _data_->item, _data_->notify, util_duplicate_item_ready, _data_);
				return FALSE;
				_state_3:
				util_insert_duplicate_item_finish (_data_->self, _data_->_res_);
			}
			_http_response_unref0 (_data_->response);
		} else {
			_data_->_tmp34_ = _data_->new_item;
			_data_->_tmp35_ = objects_item_get_project (_data_->_tmp34_);
			_data_->_tmp36_ = _data_->_tmp35_;
			_data_->_tmp37_ = objects_project_get_source_type (_data_->_tmp36_);
			_data_->_tmp38_ = _data_->_tmp37_;
			if (_data_->_tmp38_ == SOURCE_TYPE_CALDAV) {
				_data_->_tmp39_ = _data_->new_item;
				_data_->_tmp40_ = util_get_default ();
				_data_->_tmp41_ = _data_->_tmp40_;
				_data_->_tmp42_ = _data_->new_item;
				_data_->_tmp43_ = util_generate_id (_data_->_tmp41_, (ObjectsBaseObject*) _data_->_tmp42_);
				_data_->_tmp44_ = _data_->_tmp43_;
				objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp39_, _data_->_tmp44_);
				_g_free0 (_data_->_tmp44_);
				_g_object_unref0 (_data_->_tmp41_);
				_data_->_tmp45_ = services_cal_dav_core_get_default ();
				_data_->_tmp46_ = _data_->_tmp45_;
				_data_->_tmp47_ = _data_->new_item;
				_data_->_tmp48_ = objects_item_get_project (_data_->_tmp47_);
				_data_->_tmp49_ = _data_->_tmp48_;
				_data_->_tmp50_ = objects_project_get_source (_data_->_tmp49_);
				_data_->_tmp51_ = _data_->_tmp50_;
				_data_->_tmp52_ = services_cal_dav_core_get_client (_data_->_tmp46_, _data_->_tmp51_);
				_data_->_tmp53_ = _data_->_tmp52_;
				_g_object_unref0 (_data_->_tmp46_);
				_data_->caldav_client = _data_->_tmp53_;
				_data_->_tmp54_ = _data_->caldav_client;
				_data_->_tmp55_ = _data_->new_item;
				_data_->_state_ = 4;
				services_cal_dav_cal_dav_client_add_item (_data_->_tmp54_, _data_->_tmp55_, FALSE, util_duplicate_item_ready, _data_);
				return FALSE;
				_state_4:
				_data_->_tmp56_ = services_cal_dav_cal_dav_client_add_item_finish (_data_->_tmp54_, _data_->_res_);
				_data_->_vala1_response = _data_->_tmp56_;
				objects_base_object_set_loading ((ObjectsBaseObject*) _data_->item, FALSE);
				objects_base_object_set_sensitive ((ObjectsBaseObject*) _data_->item, TRUE);
				_data_->_tmp57_ = _data_->_vala1_response;
				_data_->_tmp58_ = http_response_get_status (_data_->_tmp57_);
				_data_->_tmp59_ = _data_->_tmp58_;
				if (_data_->_tmp59_) {
					_data_->_tmp60_ = _data_->new_item;
					_data_->_state_ = 5;
					util_insert_duplicate_item (_data_->self, _data_->_tmp60_, _data_->item, _data_->notify, util_duplicate_item_ready, _data_);
					return FALSE;
					_state_5:
					util_insert_duplicate_item_finish (_data_->self, _data_->_res_);
				}
				_http_response_unref0 (_data_->_vala1_response);
				_g_object_unref0 (_data_->caldav_client);
			}
		}
	}
	_g_object_unref0 (_data_->new_item);
	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
util_insert_duplicate_item_data_free (gpointer _data)
{
	UtilInsertDuplicateItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->new_item);
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->self);
	g_slice_free (UtilInsertDuplicateItemData, _data_);
}

static void
util_insert_duplicate_item (Util* self,
                            ObjectsItem* new_item,
                            ObjectsItem* item,
                            gboolean notify,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	UtilInsertDuplicateItemData* _data_;
	Util* _tmp0_;
	ObjectsItem* _tmp1_;
	ObjectsItem* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_item != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (UtilInsertDuplicateItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_insert_duplicate_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (new_item);
	_g_object_unref0 (_data_->new_item);
	_data_->new_item = _tmp1_;
	_tmp2_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp2_;
	_data_->notify = notify;
	util_insert_duplicate_item_co (_data_);
}

static void
util_insert_duplicate_item_finish (Util* self,
                                   GAsyncResult* _res_)
{
	UtilInsertDuplicateItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
util_insert_duplicate_item_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_)
{
	UtilInsertDuplicateItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	util_insert_duplicate_item_co (_data_);
}

static gboolean
util_insert_duplicate_item_co (UtilInsertDuplicateItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = objects_item_get_has_parent (_data_->new_item);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_) {
		_data_->_tmp2_ = objects_item_get_parent (_data_->new_item);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = objects_item_add_item_if_not_exists (_data_->_tmp3_, _data_->new_item, TRUE);
		_data_->_tmp5_ = _data_->_tmp4_;
		_g_object_unref0 (_data_->_tmp5_);
	} else {
		_data_->_tmp6_ = objects_item_get_section_id (_data_->new_item);
		_data_->_tmp7_ = _data_->_tmp6_;
		if (g_strcmp0 (_data_->_tmp7_, "") != 0) {
			_data_->_tmp8_ = objects_item_get_section (_data_->new_item);
			_data_->_tmp9_ = _data_->_tmp8_;
			_data_->_tmp10_ = objects_section_add_item_if_not_exists (_data_->_tmp9_, _data_->new_item, TRUE);
			_data_->_tmp11_ = _data_->_tmp10_;
			_g_object_unref0 (_data_->_tmp11_);
		} else {
			_data_->_tmp12_ = objects_item_get_project (_data_->new_item);
			_data_->_tmp13_ = _data_->_tmp12_;
			_data_->_tmp14_ = objects_project_add_item_if_not_exists (_data_->_tmp13_, _data_->new_item, TRUE);
			_data_->_tmp15_ = _data_->_tmp14_;
			_g_object_unref0 (_data_->_tmp15_);
		}
	}
	_data_->_tmp16_ = services_event_bus_get_default ();
	_data_->_tmp17_ = _data_->_tmp16_;
	_data_->_tmp18_ = objects_item_get_project_id (_data_->new_item);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp20_ = objects_item_get_section_id (_data_->new_item);
	_data_->_tmp21_ = _data_->_tmp20_;
	g_signal_emit_by_name (_data_->_tmp17_, "update-section-sort-func", _data_->_tmp19_, _data_->_tmp21_, FALSE);
	_g_object_unref0 (_data_->_tmp17_);
	{
		_data_->_tmp22_ = objects_item_get_reminders (_data_->item);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_reminder_list = _data_->_tmp23_;
		_data_->_tmp24_ = _data_->_reminder_list;
		_data_->_tmp25_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp24_);
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_reminder_size = _data_->_tmp26_;
		_data_->_reminder_index = -1;
		while (TRUE) {
			_data_->_reminder_index = _data_->_reminder_index + 1;
			_data_->_tmp27_ = _data_->_reminder_index;
			_data_->_tmp28_ = _data_->_reminder_size;
			if (!(_data_->_tmp27_ < _data_->_tmp28_)) {
				break;
			}
			_data_->_tmp29_ = _data_->_reminder_list;
			_data_->_tmp30_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp29_, _data_->_reminder_index);
			_data_->reminder = (ObjectsReminder*) _data_->_tmp30_;
			_data_->_tmp31_ = _data_->reminder;
			_data_->_tmp32_ = objects_reminder_duplicate (_data_->_tmp31_);
			_data_->_reminder = _data_->_tmp32_;
			_data_->_tmp33_ = _data_->_reminder;
			_data_->_tmp34_ = util_get_default ();
			_data_->_tmp35_ = _data_->_tmp34_;
			_data_->_tmp36_ = _data_->_reminder;
			_data_->_tmp37_ = util_generate_id (_data_->_tmp35_, (ObjectsBaseObject*) _data_->_tmp36_);
			_data_->_tmp38_ = _data_->_tmp37_;
			objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp33_, _data_->_tmp38_);
			_g_free0 (_data_->_tmp38_);
			_g_object_unref0 (_data_->_tmp35_);
			_data_->_tmp39_ = _data_->_reminder;
			_data_->_tmp40_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->new_item);
			_data_->_tmp41_ = _data_->_tmp40_;
			objects_reminder_set_item_id (_data_->_tmp39_, _data_->_tmp41_);
			_data_->_tmp42_ = _data_->_reminder;
			_data_->_tmp43_ = objects_item_add_reminder_if_not_exists (_data_->new_item, _data_->_tmp42_, TRUE);
			_data_->_tmp44_ = _data_->_tmp43_;
			_g_object_unref0 (_data_->_tmp44_);
			_g_object_unref0 (_data_->_reminder);
			_g_object_unref0 (_data_->reminder);
		}
	}
	{
		_data_->_tmp45_ = objects_item_get_attachments (_data_->item);
		_data_->_tmp46_ = _data_->_tmp45_;
		_data_->_attachment_list = _data_->_tmp46_;
		_data_->_tmp47_ = _data_->_attachment_list;
		_data_->_tmp48_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp47_);
		_data_->_tmp49_ = _data_->_tmp48_;
		_data_->_attachment_size = _data_->_tmp49_;
		_data_->_attachment_index = -1;
		while (TRUE) {
			_data_->_attachment_index = _data_->_attachment_index + 1;
			_data_->_tmp50_ = _data_->_attachment_index;
			_data_->_tmp51_ = _data_->_attachment_size;
			if (!(_data_->_tmp50_ < _data_->_tmp51_)) {
				break;
			}
			_data_->_tmp52_ = _data_->_attachment_list;
			_data_->_tmp53_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp52_, _data_->_attachment_index);
			_data_->attachment = (ObjectsAttachment*) _data_->_tmp53_;
			_data_->_tmp54_ = _data_->attachment;
			_data_->_tmp55_ = objects_attachment_duplicate (_data_->_tmp54_);
			_data_->_attachment = _data_->_tmp55_;
			_data_->_tmp56_ = _data_->_attachment;
			_data_->_tmp57_ = util_get_default ();
			_data_->_tmp58_ = _data_->_tmp57_;
			_data_->_tmp59_ = util_generate_id (_data_->_tmp58_, NULL);
			_data_->_tmp60_ = _data_->_tmp59_;
			objects_attachment_set_id (_data_->_tmp56_, _data_->_tmp60_);
			_g_free0 (_data_->_tmp60_);
			_g_object_unref0 (_data_->_tmp58_);
			_data_->_tmp61_ = _data_->_attachment;
			_data_->_tmp62_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->new_item);
			_data_->_tmp63_ = _data_->_tmp62_;
			objects_attachment_set_item_id (_data_->_tmp61_, _data_->_tmp63_);
			_data_->_tmp64_ = _data_->_attachment;
			_data_->_tmp65_ = objects_item_add_attachment_if_not_exists (_data_->new_item, _data_->_tmp64_);
			_data_->_tmp66_ = _data_->_tmp65_;
			_g_object_unref0 (_data_->_tmp66_);
			_g_object_unref0 (_data_->_attachment);
			_g_object_unref0 (_data_->attachment);
		}
	}
	{
		_data_->_tmp67_ = objects_item_get_items (_data_->item);
		_data_->_tmp68_ = _data_->_tmp67_;
		_data_->_subitem_list = _data_->_tmp68_;
		_data_->_tmp69_ = _data_->_subitem_list;
		_data_->_tmp70_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp69_);
		_data_->_tmp71_ = _data_->_tmp70_;
		_data_->_subitem_size = _data_->_tmp71_;
		_data_->_subitem_index = -1;
		while (TRUE) {
			_data_->_subitem_index = _data_->_subitem_index + 1;
			_data_->_tmp72_ = _data_->_subitem_index;
			_data_->_tmp73_ = _data_->_subitem_size;
			if (!(_data_->_tmp72_ < _data_->_tmp73_)) {
				break;
			}
			_data_->_tmp74_ = _data_->_subitem_list;
			_data_->_tmp75_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp74_, _data_->_subitem_index);
			_data_->subitem = (ObjectsItem*) _data_->_tmp75_;
			_data_->_tmp76_ = _data_->subitem;
			_data_->_tmp77_ = objects_item_get_project_id (_data_->new_item);
			_data_->_tmp78_ = _data_->_tmp77_;
			_data_->_tmp79_ = objects_item_get_section_id (_data_->new_item);
			_data_->_tmp80_ = _data_->_tmp79_;
			_data_->_tmp81_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->new_item);
			_data_->_tmp82_ = _data_->_tmp81_;
			_data_->_state_ = 1;
			util_duplicate_item (_data_->self, _data_->_tmp76_, _data_->_tmp78_, _data_->_tmp80_, _data_->_tmp82_, _data_->notify, util_insert_duplicate_item_ready, _data_);
			return FALSE;
			_state_1:
			util_duplicate_item_finish (_data_->self, _data_->_res_);
			_g_object_unref0 (_data_->subitem);
		}
	}
	if (_data_->notify) {
		_data_->_tmp83_ = services_event_bus_get_default ();
		_data_->_tmp84_ = _data_->_tmp83_;
		_data_->_tmp85_ = util_get_default ();
		_data_->_tmp86_ = _data_->_tmp85_;
		_data_->_tmp87_ = util_create_toast (_data_->_tmp86_, _ ("Task duplicated"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
		_data_->_tmp88_ = _data_->_tmp87_;
		g_signal_emit_by_name (_data_->_tmp84_, "send-toast", _data_->_tmp88_);
		_g_object_unref0 (_data_->_tmp88_);
		_g_object_unref0 (_data_->_tmp86_);
		_g_object_unref0 (_data_->_tmp84_);
	}
	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
util_duplicate_section_data_free (gpointer _data)
{
	UtilDuplicateSectionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->section);
	_g_free0 (_data_->project_id);
	_g_object_unref0 (_data_->self);
	g_slice_free (UtilDuplicateSectionData, _data_);
}

void
util_duplicate_section (Util* self,
                        ObjectsSection* section,
                        const gchar* project_id,
                        gboolean notify,
                        GAsyncReadyCallback _callback_,
                        gpointer _user_data_)
{
	UtilDuplicateSectionData* _data_;
	Util* _tmp0_;
	ObjectsSection* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (section != NULL);
	g_return_if_fail (project_id != NULL);
	_data_ = g_slice_new0 (UtilDuplicateSectionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_duplicate_section_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (section);
	_g_object_unref0 (_data_->section);
	_data_->section = _tmp1_;
	_tmp2_ = g_strdup (project_id);
	_g_free0 (_data_->project_id);
	_data_->project_id = _tmp2_;
	_data_->notify = notify;
	util_duplicate_section_co (_data_);
}

void
util_duplicate_section_finish (Util* self,
                               GAsyncResult* _res_)
{
	UtilDuplicateSectionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
util_duplicate_section_ready (GObject* source_object,
                              GAsyncResult* _res_,
                              gpointer _user_data_)
{
	UtilDuplicateSectionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	util_duplicate_section_co (_data_);
}

static gboolean
util_duplicate_section_co (UtilDuplicateSectionData* _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_ = objects_section_duplicate (_data_->section);
	_data_->new_section = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->new_section;
	objects_section_set_project_id (_data_->_tmp1_, _data_->project_id);
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->section, TRUE);
	objects_base_object_set_sensitive ((ObjectsBaseObject*) _data_->section, FALSE);
	_data_->_tmp2_ = _data_->new_section;
	_data_->_tmp3_ = objects_section_get_project (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = objects_project_get_source_type (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	if (_data_->_tmp6_ == SOURCE_TYPE_LOCAL) {
		_data_->_tmp7_ = _data_->new_section;
		_data_->_tmp8_ = util_get_default ();
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = _data_->new_section;
		_data_->_tmp11_ = util_generate_id (_data_->_tmp9_, (ObjectsBaseObject*) _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp7_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_g_object_unref0 (_data_->_tmp9_);
		_data_->_tmp13_ = _data_->new_section;
		_data_->_state_ = 1;
		util_insert_duplicate_section (_data_->self, _data_->_tmp13_, _data_->section, _data_->notify, util_duplicate_section_ready, _data_);
		return FALSE;
		_state_1:
		util_insert_duplicate_section_finish (_data_->self, _data_->_res_);
	} else {
		_data_->_tmp14_ = _data_->new_section;
		_data_->_tmp15_ = objects_section_get_project (_data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp17_ = objects_project_get_source_type (_data_->_tmp16_);
		_data_->_tmp18_ = _data_->_tmp17_;
		if (_data_->_tmp18_ == SOURCE_TYPE_TODOIST) {
			_data_->_tmp19_ = services_todoist_get_default ();
			_data_->_tmp20_ = _data_->_tmp19_;
			_data_->_tmp21_ = _data_->new_section;
			_data_->_state_ = 2;
			services_todoist_add (_data_->_tmp20_, (ObjectsBaseObject*) _data_->_tmp21_, util_duplicate_section_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp22_ = services_todoist_add_finish (_data_->_tmp20_, _data_->_res_);
			_data_->_tmp23_ = _data_->_tmp22_;
			_g_object_unref0 (_data_->_tmp20_);
			_data_->response = _data_->_tmp23_;
			_data_->_tmp24_ = _data_->response;
			_data_->_tmp25_ = http_response_get_status (_data_->_tmp24_);
			_data_->_tmp26_ = _data_->_tmp25_;
			if (_data_->_tmp26_) {
				_data_->_tmp27_ = _data_->new_section;
				_data_->_tmp28_ = _data_->response;
				_data_->_tmp29_ = http_response_get_data (_data_->_tmp28_);
				_data_->_tmp30_ = _data_->_tmp29_;
				objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp27_, _data_->_tmp30_);
				_data_->_tmp31_ = _data_->new_section;
				_data_->_state_ = 3;
				util_insert_duplicate_section (_data_->self, _data_->_tmp31_, _data_->section, _data_->notify, util_duplicate_section_ready, _data_);
				return FALSE;
				_state_3:
				util_insert_duplicate_section_finish (_data_->self, _data_->_res_);
			}
			_http_response_unref0 (_data_->response);
		}
	}
	_g_object_unref0 (_data_->new_section);
	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
util_insert_duplicate_section_data_free (gpointer _data)
{
	UtilInsertDuplicateSectionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->new_section);
	_g_object_unref0 (_data_->section);
	_g_object_unref0 (_data_->self);
	g_slice_free (UtilInsertDuplicateSectionData, _data_);
}

static void
util_insert_duplicate_section (Util* self,
                               ObjectsSection* new_section,
                               ObjectsSection* section,
                               gboolean notify,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	UtilInsertDuplicateSectionData* _data_;
	Util* _tmp0_;
	ObjectsSection* _tmp1_;
	ObjectsSection* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_section != NULL);
	g_return_if_fail (section != NULL);
	_data_ = g_slice_new0 (UtilInsertDuplicateSectionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_insert_duplicate_section_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (new_section);
	_g_object_unref0 (_data_->new_section);
	_data_->new_section = _tmp1_;
	_tmp2_ = _g_object_ref0 (section);
	_g_object_unref0 (_data_->section);
	_data_->section = _tmp2_;
	_data_->notify = notify;
	util_insert_duplicate_section_co (_data_);
}

static void
util_insert_duplicate_section_finish (Util* self,
                                      GAsyncResult* _res_)
{
	UtilInsertDuplicateSectionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
util_insert_duplicate_section_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	UtilInsertDuplicateSectionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	util_insert_duplicate_section_co (_data_);
}

static gboolean
util_insert_duplicate_section_co (UtilInsertDuplicateSectionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = objects_section_get_project (_data_->new_section);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = objects_project_add_section_if_not_exists (_data_->_tmp1_, _data_->new_section);
	_data_->_tmp3_ = _data_->_tmp2_;
	_g_object_unref0 (_data_->_tmp3_);
	{
		_data_->_tmp4_ = objects_section_get_items (_data_->section);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_item_list = _data_->_tmp5_;
		_data_->_tmp6_ = _data_->_item_list;
		_data_->_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp6_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_item_size = _data_->_tmp8_;
		_data_->_item_index = -1;
		while (TRUE) {
			_data_->_item_index = _data_->_item_index + 1;
			_data_->_tmp9_ = _data_->_item_index;
			_data_->_tmp10_ = _data_->_item_size;
			if (!(_data_->_tmp9_ < _data_->_tmp10_)) {
				break;
			}
			_data_->_tmp11_ = _data_->_item_list;
			_data_->_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp11_, _data_->_item_index);
			_data_->item = (ObjectsItem*) _data_->_tmp12_;
			_data_->_tmp13_ = _data_->item;
			_data_->_tmp14_ = objects_section_get_project_id (_data_->new_section);
			_data_->_tmp15_ = _data_->_tmp14_;
			_data_->_tmp16_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->new_section);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp18_ = _data_->item;
			_data_->_tmp19_ = objects_item_get_parent_id (_data_->_tmp18_);
			_data_->_tmp20_ = _data_->_tmp19_;
			_data_->_state_ = 1;
			util_duplicate_item (_data_->self, _data_->_tmp13_, _data_->_tmp15_, _data_->_tmp17_, _data_->_tmp20_, FALSE, util_insert_duplicate_section_ready, _data_);
			return FALSE;
			_state_1:
			util_duplicate_item_finish (_data_->self, _data_->_res_);
			_g_object_unref0 (_data_->item);
		}
	}
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->section, FALSE);
	objects_base_object_set_sensitive ((ObjectsBaseObject*) _data_->section, TRUE);
	if (_data_->notify) {
		_data_->_tmp21_ = services_event_bus_get_default ();
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = util_get_default ();
		_data_->_tmp24_ = _data_->_tmp23_;
		_data_->_tmp25_ = util_create_toast (_data_->_tmp24_, _ ("Section duplicated"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
		_data_->_tmp26_ = _data_->_tmp25_;
		g_signal_emit_by_name (_data_->_tmp22_, "send-toast", _data_->_tmp26_);
		_g_object_unref0 (_data_->_tmp26_);
		_g_object_unref0 (_data_->_tmp24_);
		_g_object_unref0 (_data_->_tmp22_);
	}
	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
util_duplicate_project_data_free (gpointer _data)
{
	UtilDuplicateProjectData* _data_;
	_data_ = _data;
	_g_free0 (_data_->parent_id);
	_g_object_unref0 (_data_->self);
	g_slice_free (UtilDuplicateProjectData, _data_);
}

void
util_duplicate_project (Util* self,
                        ObjectsProject* project,
                        const gchar* parent_id,
                        GAsyncReadyCallback _callback_,
                        gpointer _user_data_)
{
	UtilDuplicateProjectData* _data_;
	Util* _tmp0_;
	ObjectsProject* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	g_return_if_fail (parent_id != NULL);
	_data_ = g_slice_new0 (UtilDuplicateProjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_duplicate_project_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 (parent_id);
	_g_free0 (_data_->parent_id);
	_data_->parent_id = _tmp2_;
	util_duplicate_project_co (_data_);
}

void
util_duplicate_project_finish (Util* self,
                               GAsyncResult* _res_)
{
	UtilDuplicateProjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block12Data*
block12_data_ref (Block12Data* _data12_)
{
	g_atomic_int_inc (&_data12_->_ref_count_);
	return _data12_;
}

static void
block12_data_unref (void * _userdata_)
{
	Block12Data* _data12_;
	_data12_ = (Block12Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data12_->_ref_count_)) {
		Util* self;
		self = _data12_->self;
		_g_object_unref0 (_data12_->project);
		_g_object_unref0 (self);
		g_slice_free (Block12Data, _data12_);
	}
}

static void
util_duplicate_project_ready (GObject* source_object,
                              GAsyncResult* _res_,
                              gpointer _user_data_)
{
	UtilDuplicateProjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	util_duplicate_project_co (_data_);
}

static void
____lambda80_ (Block12Data* _data12_,
               GObject* obj,
               GAsyncResult* res)
{
	Util* self;
	ServicesTodoist* _tmp0_;
	ServicesTodoist* _tmp1_;
	HttpResponse* _tmp2_;
	HttpResponse* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	self = _data12_->self;
	g_return_if_fail (res != NULL);
	objects_base_object_set_loading ((ObjectsBaseObject*) _data12_->project, FALSE);
	_tmp0_ = services_todoist_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_todoist_duplicate_project_finish (_tmp1_, res);
	_tmp3_ = _tmp2_;
	_tmp4_ = http_response_get_status (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_http_response_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	if (_tmp6_) {
		ServicesTodoist* _tmp7_;
		ServicesTodoist* _tmp8_;
		ObjectsSource* _tmp9_;
		ObjectsSource* _tmp10_;
		_tmp7_ = services_todoist_get_default ();
		_tmp8_ = _tmp7_;
		_tmp9_ = objects_project_get_source (_data12_->project);
		_tmp10_ = _tmp9_;
		services_todoist_sync (_tmp8_, _tmp10_, NULL, NULL);
		_g_object_unref0 (_tmp8_);
	}
}

static void
_____lambda80__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda80_ (self, source_object, res);
	block12_data_unref (self);
}

static gboolean
util_duplicate_project_co (UtilDuplicateProjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data12_ = g_slice_new0 (Block12Data);
	_data_->_data12_->_ref_count_ = 1;
	_data_->_data12_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data12_->project);
	_data_->_data12_->project = _data_->project;
	_data_->_data12_->_async_data_ = _data_;
	_data_->_tmp0_ = objects_project_duplicate (_data_->_data12_->project);
	_data_->new_project = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->new_project;
	objects_project_set_parent_id (_data_->_tmp1_, _data_->parent_id);
	objects_base_object_set_loading ((ObjectsBaseObject*) _data_->_data12_->project, TRUE);
	_data_->_tmp2_ = objects_project_get_source_type (_data_->_data12_->project);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (_data_->_tmp3_ == SOURCE_TYPE_LOCAL) {
		_data_->_tmp4_ = _data_->new_project;
		_data_->_tmp5_ = util_get_default ();
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = _data_->new_project;
		_data_->_tmp8_ = util_generate_id (_data_->_tmp6_, (ObjectsBaseObject*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp4_, _data_->_tmp9_);
		_g_free0 (_data_->_tmp9_);
		_g_object_unref0 (_data_->_tmp6_);
		_data_->_tmp10_ = services_store_instance ();
		_data_->_tmp11_ = _data_->new_project;
		services_store_insert_project (_data_->_tmp10_, _data_->_tmp11_);
		{
			_data_->_tmp12_ = objects_project_get_items (_data_->_data12_->project);
			_data_->_tmp13_ = _data_->_tmp12_;
			_data_->_item_list = _data_->_tmp13_;
			_data_->_tmp14_ = _data_->_item_list;
			_data_->_tmp15_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp14_);
			_data_->_tmp16_ = _data_->_tmp15_;
			_data_->_item_size = _data_->_tmp16_;
			_data_->_item_index = -1;
			while (TRUE) {
				_data_->_item_index = _data_->_item_index + 1;
				_data_->_tmp17_ = _data_->_item_index;
				_data_->_tmp18_ = _data_->_item_size;
				if (!(_data_->_tmp17_ < _data_->_tmp18_)) {
					break;
				}
				_data_->_tmp19_ = _data_->_item_list;
				_data_->_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp19_, _data_->_item_index);
				_data_->item = (ObjectsItem*) _data_->_tmp20_;
				_data_->_tmp21_ = _data_->item;
				_data_->_tmp22_ = _data_->new_project;
				_data_->_tmp23_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp22_);
				_data_->_tmp24_ = _data_->_tmp23_;
				_data_->_tmp25_ = _data_->item;
				_data_->_tmp26_ = objects_item_get_section_id (_data_->_tmp25_);
				_data_->_tmp27_ = _data_->_tmp26_;
				_data_->_tmp28_ = _data_->item;
				_data_->_tmp29_ = objects_item_get_parent_id (_data_->_tmp28_);
				_data_->_tmp30_ = _data_->_tmp29_;
				_data_->_state_ = 1;
				util_duplicate_item (_data_->self, _data_->_tmp21_, _data_->_tmp24_, _data_->_tmp27_, _data_->_tmp30_, FALSE, util_duplicate_project_ready, _data_);
				return FALSE;
				_state_1:
				util_duplicate_item_finish (_data_->self, _data_->_res_);
				_g_object_unref0 (_data_->item);
			}
		}
		{
			_data_->_tmp31_ = objects_project_get_sections (_data_->_data12_->project);
			_data_->_tmp32_ = _data_->_tmp31_;
			_data_->_section_list = _data_->_tmp32_;
			_data_->_tmp33_ = _data_->_section_list;
			_data_->_tmp34_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp33_);
			_data_->_tmp35_ = _data_->_tmp34_;
			_data_->_section_size = _data_->_tmp35_;
			_data_->_section_index = -1;
			while (TRUE) {
				_data_->_section_index = _data_->_section_index + 1;
				_data_->_tmp36_ = _data_->_section_index;
				_data_->_tmp37_ = _data_->_section_size;
				if (!(_data_->_tmp36_ < _data_->_tmp37_)) {
					break;
				}
				_data_->_tmp38_ = _data_->_section_list;
				_data_->_tmp39_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp38_, _data_->_section_index);
				_data_->section = (ObjectsSection*) _data_->_tmp39_;
				_data_->_tmp40_ = _data_->section;
				_data_->_tmp41_ = _data_->new_project;
				_data_->_tmp42_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp41_);
				_data_->_tmp43_ = _data_->_tmp42_;
				_data_->_state_ = 2;
				util_duplicate_section (_data_->self, _data_->_tmp40_, _data_->_tmp43_, FALSE, util_duplicate_project_ready, _data_);
				return FALSE;
				_state_2:
				util_duplicate_section_finish (_data_->self, _data_->_res_);
				_g_object_unref0 (_data_->section);
			}
		}
		objects_base_object_set_loading ((ObjectsBaseObject*) _data_->_data12_->project, FALSE);
		_data_->_tmp44_ = services_event_bus_get_default ();
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = util_get_default ();
		_data_->_tmp47_ = _data_->_tmp46_;
		_data_->_tmp48_ = util_create_toast (_data_->_tmp47_, _ ("Project duplicated"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
		_data_->_tmp49_ = _data_->_tmp48_;
		g_signal_emit_by_name (_data_->_tmp45_, "send-toast", _data_->_tmp49_);
		_g_object_unref0 (_data_->_tmp49_);
		_g_object_unref0 (_data_->_tmp47_);
		_g_object_unref0 (_data_->_tmp45_);
	} else {
		_data_->_tmp50_ = objects_project_get_source_type (_data_->_data12_->project);
		_data_->_tmp51_ = _data_->_tmp50_;
		if (_data_->_tmp51_ == SOURCE_TYPE_TODOIST) {
			_data_->_tmp52_ = services_todoist_get_default ();
			_data_->_tmp53_ = _data_->_tmp52_;
			services_todoist_duplicate_project (_data_->_tmp53_, _data_->_data12_->project, _____lambda80__gasync_ready_callback, block12_data_ref (_data_->_data12_));
			_g_object_unref0 (_data_->_tmp53_);
		} else {
			_data_->_tmp54_ = objects_project_get_source_type (_data_->_data12_->project);
			_data_->_tmp55_ = _data_->_tmp54_;
			if (_data_->_tmp55_ == SOURCE_TYPE_CALDAV) {
				_data_->_tmp56_ = _data_->new_project;
				_data_->_tmp57_ = util_get_default ();
				_data_->_tmp58_ = _data_->_tmp57_;
				_data_->_tmp59_ = _data_->new_project;
				_data_->_tmp60_ = util_generate_id (_data_->_tmp58_, (ObjectsBaseObject*) _data_->_tmp59_);
				_data_->_tmp61_ = _data_->_tmp60_;
				objects_base_object_set_id ((ObjectsBaseObject*) _data_->_tmp56_, _data_->_tmp61_);
				_g_free0 (_data_->_tmp61_);
				_g_object_unref0 (_data_->_tmp58_);
				_data_->_tmp62_ = services_cal_dav_core_get_default ();
				_data_->_tmp63_ = _data_->_tmp62_;
				_data_->_tmp64_ = _data_->new_project;
				_data_->_tmp65_ = objects_project_get_source (_data_->_tmp64_);
				_data_->_tmp66_ = _data_->_tmp65_;
				_data_->_tmp67_ = services_cal_dav_core_get_client (_data_->_tmp63_, _data_->_tmp66_);
				_data_->_tmp68_ = _data_->_tmp67_;
				_g_object_unref0 (_data_->_tmp63_);
				_data_->caldav_client = _data_->_tmp68_;
				_data_->_tmp69_ = _data_->caldav_client;
				_data_->_tmp70_ = _data_->new_project;
				_data_->_state_ = 3;
				services_cal_dav_cal_dav_client_create_project (_data_->_tmp69_, _data_->_tmp70_, util_duplicate_project_ready, _data_);
				return FALSE;
				_state_3:
				_data_->_tmp71_ = services_cal_dav_cal_dav_client_create_project_finish (_data_->_tmp69_, _data_->_res_);
				_data_->response = _data_->_tmp71_;
				_data_->_tmp72_ = _data_->response;
				_data_->_tmp73_ = http_response_get_status (_data_->_tmp72_);
				_data_->_tmp74_ = _data_->_tmp73_;
				if (_data_->_tmp74_) {
					_data_->_tmp75_ = services_store_instance ();
					_data_->_tmp76_ = _data_->new_project;
					services_store_insert_project (_data_->_tmp75_, _data_->_tmp76_);
					{
						_data_->_tmp77_ = objects_project_get_items (_data_->_data12_->project);
						_data_->_tmp78_ = _data_->_tmp77_;
						_data_->_vala1__item_list = _data_->_tmp78_;
						_data_->_tmp79_ = _data_->_vala1__item_list;
						_data_->_tmp80_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp79_);
						_data_->_tmp81_ = _data_->_tmp80_;
						_data_->_vala1__item_size = _data_->_tmp81_;
						_data_->_vala1__item_index = -1;
						while (TRUE) {
							_data_->_vala1__item_index = _data_->_vala1__item_index + 1;
							_data_->_tmp82_ = _data_->_vala1__item_index;
							_data_->_tmp83_ = _data_->_vala1__item_size;
							if (!(_data_->_tmp82_ < _data_->_tmp83_)) {
								break;
							}
							_data_->_tmp84_ = _data_->_vala1__item_list;
							_data_->_tmp85_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp84_, _data_->_vala1__item_index);
							_data_->_vala1_item = (ObjectsItem*) _data_->_tmp85_;
							_data_->_tmp86_ = _data_->_vala1_item;
							_data_->_tmp87_ = _data_->new_project;
							_data_->_tmp88_ = objects_base_object_get_id ((ObjectsBaseObject*) _data_->_tmp87_);
							_data_->_tmp89_ = _data_->_tmp88_;
							_data_->_tmp90_ = _data_->_vala1_item;
							_data_->_tmp91_ = objects_item_get_parent_id (_data_->_tmp90_);
							_data_->_tmp92_ = _data_->_tmp91_;
							_data_->_state_ = 4;
							util_duplicate_item (_data_->self, _data_->_tmp86_, _data_->_tmp89_, "", _data_->_tmp92_, FALSE, util_duplicate_project_ready, _data_);
							return FALSE;
							_state_4:
							util_duplicate_item_finish (_data_->self, _data_->_res_);
							_g_object_unref0 (_data_->_vala1_item);
						}
					}
					objects_base_object_set_loading ((ObjectsBaseObject*) _data_->_data12_->project, FALSE);
					_data_->_tmp93_ = services_event_bus_get_default ();
					_data_->_tmp94_ = _data_->_tmp93_;
					_data_->_tmp95_ = util_get_default ();
					_data_->_tmp96_ = _data_->_tmp95_;
					_data_->_tmp97_ = util_create_toast (_data_->_tmp96_, _ ("Project duplicated"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
					_data_->_tmp98_ = _data_->_tmp97_;
					g_signal_emit_by_name (_data_->_tmp94_, "send-toast", _data_->_tmp98_);
					_g_object_unref0 (_data_->_tmp98_);
					_g_object_unref0 (_data_->_tmp96_);
					_g_object_unref0 (_data_->_tmp94_);
				}
				_http_response_unref0 (_data_->response);
				_g_object_unref0 (_data_->caldav_client);
			}
		}
	}
	_g_object_unref0 (_data_->new_project);
	block12_data_unref (_data_->_data12_);
	_data_->_data12_ = NULL;
	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;
}

gint
util_get_reminders_mm_offset (void)
{
	gint value = 0;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gint _tmp3_;
	gint return_value = 0;
	gint result;
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_enum (_tmp2_, "automatic-reminders");
	_g_object_unref0 (_tmp1_);
	value = _tmp3_;
	return_value = 0;
	switch (value) {
		case 0:
		{
			return_value = 0;
			break;
		}
		case 1:
		{
			return_value = 10;
			break;
		}
		case 2:
		{
			return_value = 30;
			break;
		}
		case 3:
		{
			return_value = 45;
			break;
		}
		case 4:
		{
			return_value = 60;
			break;
		}
		case 5:
		{
			return_value = 120;
			break;
		}
		case 6:
		{
			return_value = 180;
			break;
		}
		default:
		break;
	}
	result = return_value;
	return result;
}

gchar*
util_get_reminders_mm_offset_text (gint value)
{
	gchar* return_value = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_strdup ("");
	return_value = _tmp0_;
	switch (value) {
		case 0:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup (_ ("At due time"));
			_g_free0 (return_value);
			return_value = _tmp1_;
			break;
		}
		case 10:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup (_ ("10 minutes before"));
			_g_free0 (return_value);
			return_value = _tmp2_;
			break;
		}
		case 30:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup (_ ("30 minutes before"));
			_g_free0 (return_value);
			return_value = _tmp3_;
			break;
		}
		case 45:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup (_ ("45 minutes before"));
			_g_free0 (return_value);
			return_value = _tmp4_;
			break;
		}
		case 60:
		{
			gchar* _tmp5_;
			_tmp5_ = g_strdup (_ ("1 hour before"));
			_g_free0 (return_value);
			return_value = _tmp5_;
			break;
		}
		case 120:
		{
			gchar* _tmp6_;
			_tmp6_ = g_strdup (_ ("2 hours before"));
			_g_free0 (return_value);
			return_value = _tmp6_;
			break;
		}
		case 180:
		{
			gchar* _tmp7_;
			_tmp7_ = g_strdup (_ ("3 hours before"));
			_g_free0 (return_value);
			return_value = _tmp7_;
			break;
		}
		default:
		break;
	}
	result = return_value;
	return result;
}

static void
util_nap_data_free (gpointer _data)
{
	UtilNapData* _data_;
	_data_ = _data;
	g_slice_free (UtilNapData, _data_);
}

void
util_nap (guint interval,
          gint priority,
          GAsyncReadyCallback _callback_,
          gpointer _user_data_)
{
	UtilNapData* _data_;
	_data_ = g_slice_new0 (UtilNapData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, util_nap_data_free);
	_data_->interval = interval;
	_data_->priority = priority;
	util_nap_co (_data_);
}

void
util_nap_finish (GAsyncResult* _res_)
{
	UtilNapData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block13Data*
block13_data_ref (Block13Data* _data13_)
{
	g_atomic_int_inc (&_data13_->_ref_count_);
	return _data13_;
}

static void
block13_data_unref (void * _userdata_)
{
	Block13Data* _data13_;
	_data13_ = (Block13Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data13_->_ref_count_)) {
		g_slice_free (Block13Data, _data13_);
	}
}

static gboolean
__lambda24_ (Block13Data* _data13_)
{
	gboolean result;
	util_nap_co (_data13_->_async_data_);
	result = FALSE;
	return result;
}

static gboolean
___lambda24__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda24_ (self);
	return result;
}

static gboolean
util_nap_co (UtilNapData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data13_ = g_slice_new0 (Block13Data);
	_data_->_data13_->_ref_count_ = 1;
	_data_->_data13_->_async_data_ = _data_;
	g_timeout_add_full (_data_->priority, _data_->interval, ___lambda24__gsource_func, block13_data_ref (_data_->_data13_), block13_data_unref);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	block13_data_unref (_data_->_data13_);
	_data_->_data13_ = NULL;
	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;
}

gint
util_natural_compare (Util* self,
                      const gchar* a,
                      const gchar* b)
{
	GRegex* regex = NULL;
	gint _tmp40_ = -1;
	GError* _inner_error0_ = NULL;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	{
		GRegex* _tmp0_ = NULL;
		GRegex* _tmp1_;
		GRegex* _tmp3_;
		GMatchInfo* ma = NULL;
		GMatchInfo* mb = NULL;
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		GRegex* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		GMatchInfo* _tmp9_ = NULL;
		gboolean _tmp10_;
		_tmp1_ = g_regex_new ("(\\d+)|(\\D+)", 0, 0, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gint _tmp2_ = -1;
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_regex_unref0 (regex);
			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 _tmp2_;
		}
		_tmp3_ = _tmp0_;
		_tmp0_ = NULL;
		_g_regex_unref0 (regex);
		regex = _tmp3_;
		ma = NULL;
		mb = NULL;
		_tmp6_ = regex;
		_tmp7_ = strlen (a);
		_tmp8_ = _tmp7_;
		_tmp10_ = g_regex_match_full (_tmp6_, a, (gssize) _tmp8_, 0, 0, &_tmp9_, &_inner_error0_);
		_g_match_info_unref0 (ma);
		ma = _tmp9_;
		_tmp5_ = _tmp10_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gint _tmp11_ = -1;
			_g_match_info_unref0 (mb);
			_g_match_info_unref0 (ma);
			_g_regex_unref0 (_tmp0_);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			_g_regex_unref0 (regex);
			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 _tmp11_;
		}
		if (!_tmp5_) {
			_tmp4_ = TRUE;
		} else {
			gboolean _tmp12_ = FALSE;
			GRegex* _tmp13_;
			gint _tmp14_;
			gint _tmp15_;
			GMatchInfo* _tmp16_ = NULL;
			gboolean _tmp17_;
			_tmp13_ = regex;
			_tmp14_ = strlen (b);
			_tmp15_ = _tmp14_;
			_tmp17_ = g_regex_match_full (_tmp13_, b, (gssize) _tmp15_, 0, 0, &_tmp16_, &_inner_error0_);
			_g_match_info_unref0 (mb);
			mb = _tmp16_;
			_tmp12_ = _tmp17_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				gint _tmp18_ = -1;
				_g_match_info_unref0 (mb);
				_g_match_info_unref0 (ma);
				_g_regex_unref0 (_tmp0_);
				if (_inner_error0_->domain == G_REGEX_ERROR) {
					goto __catch0_g_regex_error;
				}
				_g_regex_unref0 (regex);
				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 _tmp18_;
			}
			_tmp4_ = !_tmp12_;
		}
		if (_tmp4_) {
			result = g_utf8_collate (a, b);
			_g_match_info_unref0 (mb);
			_g_match_info_unref0 (ma);
			_g_regex_unref0 (_tmp0_);
			_g_regex_unref0 (regex);
			return result;
		}
		while (TRUE) {
			gboolean _tmp19_ = FALSE;
			GMatchInfo* _tmp20_;
			gchar* part_a = NULL;
			GMatchInfo* _tmp22_;
			gchar* _tmp23_;
			gchar* part_b = NULL;
			GMatchInfo* _tmp24_;
			gchar* _tmp25_;
			gboolean _tmp26_ = FALSE;
			const gchar* _tmp27_;
			gboolean _tmp33_ = FALSE;
			gboolean _tmp34_ = FALSE;
			GMatchInfo* _tmp35_;
			_tmp20_ = ma;
			if (g_match_info_matches (_tmp20_)) {
				GMatchInfo* _tmp21_;
				_tmp21_ = mb;
				_tmp19_ = g_match_info_matches (_tmp21_);
			} else {
				_tmp19_ = FALSE;
			}
			if (!_tmp19_) {
				break;
			}
			_tmp22_ = ma;
			_tmp23_ = g_match_info_fetch (_tmp22_, 0);
			part_a = _tmp23_;
			_tmp24_ = mb;
			_tmp25_ = g_match_info_fetch (_tmp24_, 0);
			part_b = _tmp25_;
			_tmp27_ = part_a;
			if (g_regex_match_simple ("^\\d+$", _tmp27_, 0, 0)) {
				const gchar* _tmp28_;
				_tmp28_ = part_b;
				_tmp26_ = g_regex_match_simple ("^\\d+$", _tmp28_, 0, 0);
			} else {
				_tmp26_ = FALSE;
			}
			if (_tmp26_) {
				gint na = 0;
				const gchar* _tmp29_;
				gint nb = 0;
				const gchar* _tmp30_;
				_tmp29_ = part_a;
				na = atoi (_tmp29_);
				_tmp30_ = part_b;
				nb = atoi (_tmp30_);
				if (na != nb) {
					result = na - nb;
					_g_free0 (part_b);
					_g_free0 (part_a);
					_g_match_info_unref0 (mb);
					_g_match_info_unref0 (ma);
					_g_regex_unref0 (_tmp0_);
					_g_regex_unref0 (regex);
					return result;
				}
			} else {
				gint _result_ = 0;
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				_tmp31_ = part_a;
				_tmp32_ = part_b;
				_result_ = g_utf8_collate (_tmp31_, _tmp32_);
				if (_result_ != 0) {
					result = _result_;
					_g_free0 (part_b);
					_g_free0 (part_a);
					_g_match_info_unref0 (mb);
					_g_match_info_unref0 (ma);
					_g_regex_unref0 (_tmp0_);
					_g_regex_unref0 (regex);
					return result;
				}
			}
			_tmp35_ = ma;
			_tmp34_ = g_match_info_next (_tmp35_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				gint _tmp36_ = -1;
				_g_free0 (part_b);
				_g_free0 (part_a);
				_g_match_info_unref0 (mb);
				_g_match_info_unref0 (ma);
				_g_regex_unref0 (_tmp0_);
				if (_inner_error0_->domain == G_REGEX_ERROR) {
					goto __catch0_g_regex_error;
				}
				_g_regex_unref0 (regex);
				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 _tmp36_;
			}
			if (!_tmp34_) {
				_tmp33_ = TRUE;
			} else {
				gboolean _tmp37_ = FALSE;
				GMatchInfo* _tmp38_;
				_tmp38_ = mb;
				_tmp37_ = g_match_info_next (_tmp38_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					gint _tmp39_ = -1;
					_g_free0 (part_b);
					_g_free0 (part_a);
					_g_match_info_unref0 (mb);
					_g_match_info_unref0 (ma);
					_g_regex_unref0 (_tmp0_);
					if (_inner_error0_->domain == G_REGEX_ERROR) {
						goto __catch0_g_regex_error;
					}
					_g_regex_unref0 (regex);
					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 _tmp39_;
				}
				_tmp33_ = !_tmp37_;
			}
			if (_tmp33_) {
				_g_free0 (part_b);
				_g_free0 (part_a);
				break;
			}
			_g_free0 (part_b);
			_g_free0 (part_a);
		}
		result = g_utf8_collate (a, b);
		_g_match_info_unref0 (mb);
		_g_match_info_unref0 (ma);
		_g_regex_unref0 (_tmp0_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		result = g_utf8_collate (a, b);
		_g_regex_unref0 (regex);
		return result;
	}
	__finally0:
	_g_regex_unref0 (regex);
	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 _tmp40_;
}

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

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

gint
util_set_item_sort_func (Util* self,
                         ObjectsItem* item1,
                         ObjectsItem* item2,
                         SortedByType sorted_by,
                         SortOrderType sort_order)
{
	gint _result_ = 0;
	gint _tmp79_ = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (item1 != NULL, -1);
	g_return_val_if_fail (item2 != NULL, -1);
	_result_ = 0;
	if (sorted_by == SORTED_BY_TYPE_MANUAL) {
		gint _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		_tmp0_ = objects_item_get_child_order (item1);
		_tmp1_ = _tmp0_;
		_tmp2_ = objects_item_get_child_order (item2);
		_tmp3_ = _tmp2_;
		_result_ = _tmp1_ - _tmp3_;
	} else {
		if (sorted_by == SORTED_BY_TYPE_NAME) {
			const gchar* _tmp4_ = NULL;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			gchar* content1 = NULL;
			gchar* _tmp7_;
			const gchar* _tmp8_ = NULL;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			gchar* content2 = NULL;
			gchar* _tmp11_;
			const gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			const gchar* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			_tmp5_ = objects_item_get_content (item1);
			_tmp6_ = _tmp5_;
			_tmp4_ = _tmp6_;
			if (_tmp4_ == NULL) {
				_tmp4_ = "";
			}
			_tmp7_ = g_strdup (_tmp4_);
			content1 = _tmp7_;
			_tmp9_ = objects_item_get_content (item2);
			_tmp10_ = _tmp9_;
			_tmp8_ = _tmp10_;
			if (_tmp8_ == NULL) {
				_tmp8_ = "";
			}
			_tmp11_ = g_strdup (_tmp8_);
			content2 = _tmp11_;
			_tmp12_ = content1;
			_tmp13_ = string_strip (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = content2;
			_tmp16_ = string_strip (_tmp15_);
			_tmp17_ = _tmp16_;
			_result_ = util_natural_compare (self, _tmp14_, _tmp17_);
			_g_free0 (_tmp17_);
			_g_free0 (_tmp14_);
			_g_free0 (content2);
			_g_free0 (content1);
		} else {
			if (sorted_by == SORTED_BY_TYPE_DUE_DATE) {
				gboolean _tmp18_ = FALSE;
				gboolean _tmp19_;
				gboolean _tmp20_;
				_tmp19_ = objects_item_get_has_due (item1);
				_tmp20_ = _tmp19_;
				if (_tmp20_) {
					gboolean _tmp21_;
					gboolean _tmp22_;
					_tmp21_ = objects_item_get_has_due (item2);
					_tmp22_ = _tmp21_;
					_tmp18_ = _tmp22_;
				} else {
					_tmp18_ = FALSE;
				}
				if (_tmp18_) {
					GDateTime* date1 = NULL;
					ObjectsDueDate* _tmp23_;
					ObjectsDueDate* _tmp24_;
					GDateTime* _tmp25_;
					GDateTime* _tmp26_;
					GDateTime* _tmp27_;
					GDateTime* date2 = NULL;
					ObjectsDueDate* _tmp28_;
					ObjectsDueDate* _tmp29_;
					GDateTime* _tmp30_;
					GDateTime* _tmp31_;
					GDateTime* _tmp32_;
					GDateTime* _tmp33_;
					GDateTime* _tmp34_;
					_tmp23_ = objects_item_get_due (item1);
					_tmp24_ = _tmp23_;
					_tmp25_ = objects_due_date_get_datetime (_tmp24_);
					_tmp26_ = _tmp25_;
					_tmp27_ = _g_date_time_ref0 (_tmp26_);
					date1 = _tmp27_;
					_tmp28_ = objects_item_get_due (item2);
					_tmp29_ = _tmp28_;
					_tmp30_ = objects_due_date_get_datetime (_tmp29_);
					_tmp31_ = _tmp30_;
					_tmp32_ = _g_date_time_ref0 (_tmp31_);
					date2 = _tmp32_;
					_tmp33_ = date1;
					_tmp34_ = date2;
					_result_ = g_date_time_compare (_tmp33_, _tmp34_);
					if (_result_ == 0) {
						gint _tmp35_;
						gint _tmp36_;
						gint _tmp37_;
						gint _tmp38_;
						_tmp35_ = objects_item_get_priority (item2);
						_tmp36_ = _tmp35_;
						_tmp37_ = objects_item_get_priority (item1);
						_tmp38_ = _tmp37_;
						_result_ = _tmp36_ - _tmp38_;
					}
					_g_date_time_unref0 (date2);
					_g_date_time_unref0 (date1);
				} else {
					gboolean _tmp39_ = FALSE;
					gboolean _tmp40_;
					gboolean _tmp41_;
					_tmp40_ = objects_item_get_has_due (item1);
					_tmp41_ = _tmp40_;
					if (!_tmp41_) {
						gboolean _tmp42_;
						gboolean _tmp43_;
						_tmp42_ = objects_item_get_has_due (item2);
						_tmp43_ = _tmp42_;
						_tmp39_ = _tmp43_;
					} else {
						_tmp39_ = FALSE;
					}
					if (_tmp39_) {
						_result_ = 1;
					} else {
						gboolean _tmp44_ = FALSE;
						gboolean _tmp45_;
						gboolean _tmp46_;
						_tmp45_ = objects_item_get_has_due (item1);
						_tmp46_ = _tmp45_;
						if (_tmp46_) {
							gboolean _tmp47_;
							gboolean _tmp48_;
							_tmp47_ = objects_item_get_has_due (item2);
							_tmp48_ = _tmp47_;
							_tmp44_ = !_tmp48_;
						} else {
							_tmp44_ = FALSE;
						}
						if (_tmp44_) {
							_result_ = -1;
						}
					}
				}
			} else {
				if (sorted_by == SORTED_BY_TYPE_ADDED_DATE) {
					GDateTime* _tmp49_;
					GDateTime* _tmp50_;
					GDateTime* _tmp51_;
					GDateTime* _tmp52_;
					_tmp49_ = objects_item_get_added_datetime (item1);
					_tmp50_ = _tmp49_;
					_tmp51_ = objects_item_get_added_datetime (item2);
					_tmp52_ = _tmp51_;
					_result_ = g_date_time_compare (_tmp50_, _tmp52_);
				} else {
					if (sorted_by == SORTED_BY_TYPE_UPDATED_DATE) {
						GDateTime* _tmp53_ = NULL;
						const gchar* _tmp54_;
						const gchar* _tmp55_;
						GDateTime* date1 = NULL;
						GDateTime* _tmp60_;
						GDateTime* _tmp61_ = NULL;
						const gchar* _tmp62_;
						const gchar* _tmp63_;
						GDateTime* date2 = NULL;
						GDateTime* _tmp68_;
						GDateTime* _tmp69_;
						GDateTime* _tmp70_;
						_tmp54_ = objects_item_get_updated_at (item1);
						_tmp55_ = _tmp54_;
						if (g_strcmp0 (_tmp55_, "") != 0) {
							GDateTime* _tmp56_;
							GDateTime* _tmp57_;
							_tmp56_ = objects_item_get_updated_datetime (item1);
							_tmp57_ = _tmp56_;
							_tmp53_ = _tmp57_;
						} else {
							GDateTime* _tmp58_;
							GDateTime* _tmp59_;
							_tmp58_ = objects_item_get_added_datetime (item1);
							_tmp59_ = _tmp58_;
							_tmp53_ = _tmp59_;
						}
						_tmp60_ = _g_date_time_ref0 (_tmp53_);
						date1 = _tmp60_;
						_tmp62_ = objects_item_get_updated_at (item2);
						_tmp63_ = _tmp62_;
						if (g_strcmp0 (_tmp63_, "") != 0) {
							GDateTime* _tmp64_;
							GDateTime* _tmp65_;
							_tmp64_ = objects_item_get_updated_datetime (item2);
							_tmp65_ = _tmp64_;
							_tmp61_ = _tmp65_;
						} else {
							GDateTime* _tmp66_;
							GDateTime* _tmp67_;
							_tmp66_ = objects_item_get_added_datetime (item2);
							_tmp67_ = _tmp66_;
							_tmp61_ = _tmp67_;
						}
						_tmp68_ = _g_date_time_ref0 (_tmp61_);
						date2 = _tmp68_;
						_tmp69_ = date1;
						_tmp70_ = date2;
						_result_ = g_date_time_compare (_tmp69_, _tmp70_);
						_g_date_time_unref0 (date2);
						_g_date_time_unref0 (date1);
					} else {
						if (sorted_by == SORTED_BY_TYPE_PRIORITY) {
							gint _tmp71_;
							gint _tmp72_;
							gint _tmp73_;
							gint _tmp74_;
							_tmp71_ = objects_item_get_priority (item2);
							_tmp72_ = _tmp71_;
							_tmp73_ = objects_item_get_priority (item1);
							_tmp74_ = _tmp73_;
							_result_ = _tmp72_ - _tmp74_;
							if (_result_ == 0) {
								GDateTime* _tmp75_;
								GDateTime* _tmp76_;
								GDateTime* _tmp77_;
								GDateTime* _tmp78_;
								_tmp75_ = objects_item_get_added_datetime (item1);
								_tmp76_ = _tmp75_;
								_tmp77_ = objects_item_get_added_datetime (item2);
								_tmp78_ = _tmp77_;
								_result_ = g_date_time_compare (_tmp76_, _tmp78_);
							}
						}
					}
				}
			}
		}
	}
	if (sort_order == SORT_ORDER_TYPE_ASC) {
		_tmp79_ = _result_;
	} else {
		_tmp79_ = -_result_;
	}
	result = _tmp79_;
	return result;
}

Util*
util_construct (GType object_type)
{
	Util * self = NULL;
	self = (Util*) g_object_new (object_type, NULL);
	return self;
}

Util*
util_new (void)
{
	return util_construct (TYPE_UTIL);
}

static void
util_class_init (UtilClass * klass,
                 gpointer klass_data)
{
	util_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &Util_private_offset);
	G_OBJECT_CLASS (klass)->finalize = util_finalize;
}

static void
util_instance_init (Util * self,
                    gpointer klass)
{
	self->priv = util_get_instance_private (self);
	self->priv->line_break_to_space_regex = NULL;
	self->priv->_audio_media = NULL;
}

static void
util_finalize (GObject * obj)
{
	Util * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_UTIL, Util);
	_g_object_unref0 (self->priv->colors);
	_g_object_unref0 (self->priv->providers);
	_g_regex_unref0 (self->priv->line_break_to_space_regex);
	_g_object_unref0 (self->priv->_audio_media);
	G_OBJECT_CLASS (util_parent_class)->finalize (obj);
}

static GType
util_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (UtilClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) util_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Util), 0, (GInstanceInitFunc) util_instance_init, NULL };
	GType util_type_id;
	util_type_id = g_type_register_static (G_TYPE_OBJECT, "Util", &g_define_type_info, 0);
	Util_private_offset = g_type_add_instance_private (util_type_id, sizeof (UtilPrivate));
	return util_type_id;
}

GType
util_get_type (void)
{
	static volatile gsize util_type_id__once = 0;
	if (g_once_init_enter (&util_type_id__once)) {
		GType util_type_id;
		util_type_id = util_get_type_once ();
		g_once_init_leave (&util_type_id__once, util_type_id);
	}
	return util_type_id__once;
}

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

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

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

