/* TaskModel.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from TaskModel.vala, do not modify */

/*
* Copyright 2020 elementary, Inc. (https://elementary.io)
*
* 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
*
*/

#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <libedataserver/libedataserver.h>
#include <stdlib.h>
#include <string.h>
#include <libecal/libecal.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <libical-glib/libical-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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TASKS_TYPE_TASK_MODEL_ERROR (tasks_task_model_error_get_type ())

#define TASKS_TYPE_TASK_MODEL (tasks_task_model_get_type ())
#define TASKS_TASK_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASKS_TYPE_TASK_MODEL, TasksTaskModel))
#define TASKS_TASK_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASKS_TYPE_TASK_MODEL, TasksTaskModelClass))
#define TASKS_IS_TASK_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASKS_TYPE_TASK_MODEL))
#define TASKS_IS_TASK_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TASKS_TYPE_TASK_MODEL))
#define TASKS_TASK_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TASKS_TYPE_TASK_MODEL, TasksTaskModelClass))

typedef struct _TasksTaskModel TasksTaskModel;
typedef struct _TasksTaskModelClass TasksTaskModelClass;
typedef struct _TasksTaskModelPrivate TasksTaskModelPrivate;
enum  {
	TASKS_TASK_MODEL_0_PROPERTY,
	TASKS_TASK_MODEL_NUM_PROPERTIES
};
static GParamSpec* tasks_task_model_properties[TASKS_TASK_MODEL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _TasksTaskModelGetRegistryData TasksTaskModelGetRegistryData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _gee_promise_unref0(var) ((var == NULL) ? NULL : (var = (gee_promise_unref (var), NULL)))
typedef struct _TasksTaskModelStartData TasksTaskModelStartData;
typedef struct _Block10Data Block10Data;
typedef struct _TasksTaskModelInitRegistryData TasksTaskModelInitRegistryData;
typedef struct _Block11Data Block11Data;
typedef struct _Block12Data Block12Data;
typedef struct _Block13Data Block13Data;
typedef struct _TasksTaskModelRefreshCollectionData TasksTaskModelRefreshCollectionData;
typedef struct _TasksTaskModelRefreshTaskListData TasksTaskModelRefreshTaskListData;
#define __vala_ENamedParameters_free0(var) ((var == NULL) ? NULL : (var = (_vala_ENamedParameters_free (var), NULL)))
#define _g_uri_unref0(var) ((var == NULL) ? NULL : (var = (g_uri_unref (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
typedef struct _TasksTaskModelAddTaskListData TasksTaskModelAddTaskListData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _TasksTaskModelRemoveTaskListData TasksTaskModelRemoveTaskListData;
typedef struct _Block14Data Block14Data;
#define __vala_EWebDAVDiscoveredSource_free0(var) ((var == NULL) ? NULL : (var = (_vala_EWebDAVDiscoveredSource_free (var), NULL)))
typedef struct _TasksTaskModelDiscoverWebdavServerUriData TasksTaskModelDiscoverWebdavServerUriData;
typedef struct _TasksTaskModelUpdateTaskListDisplayNameData TasksTaskModelUpdateTaskListDisplayNameData;
typedef struct _TasksTaskModelUpdateTaskListColorData TasksTaskModelUpdateTaskListColorData;
typedef struct _TasksTaskModelAddTaskData TasksTaskModelAddTaskData;
typedef struct _Block15Data Block15Data;
typedef struct _Block16Data Block16Data;
#define __vala_ECalComponentAlarmTrigger_free0(var) ((var == NULL) ? NULL : (var = (_vala_ECalComponentAlarmTrigger_free (var), NULL)))
#define __vala_ECalComponentAlarm_free0(var) ((var == NULL) ? NULL : (var = (_vala_ECalComponentAlarm_free (var), NULL)))
typedef struct _TasksTaskModelCompleteTaskData TasksTaskModelCompleteTaskData;
typedef struct _TasksTaskModelUpdateTaskData TasksTaskModelUpdateTaskData;
typedef struct _TasksTaskModelRemoveTaskData TasksTaskModelRemoveTaskData;
typedef struct _TasksTaskModelMoveTaskData TasksTaskModelMoveTaskData;
typedef void (*TasksTaskModelTasksAddedFunc) (GeeCollection* tasks, ESource* task_list, gpointer user_data);
typedef void (*TasksTaskModelTasksModifiedFunc) (GeeCollection* tasks, gpointer user_data);
typedef void (*TasksTaskModelTasksRemovedFunc) (GSList* cids, gpointer user_data);
typedef struct _Block17Data Block17Data;
typedef struct _Block18Data Block18Data;
typedef struct _Block19Data Block19Data;
enum  {
	TASKS_TASK_MODEL_TASK_LIST_ADDED_SIGNAL,
	TASKS_TASK_MODEL_TASK_LIST_MODIFIED_SIGNAL,
	TASKS_TASK_MODEL_TASK_LIST_REMOVED_SIGNAL,
	TASKS_TASK_MODEL_NUM_SIGNALS
};
static guint tasks_task_model_signals[TASKS_TASK_MODEL_NUM_SIGNALS] = {0};

typedef enum  {
	TASKS_TASK_MODEL_ERROR_CLIENT_NOT_AVAILABLE,
	TASKS_TASK_MODEL_ERROR_BACKEND_ERROR,
	TASKS_TASK_MODEL_ERROR_INVALID_ARGUMENT
} TasksTaskModelError;
#define TASKS_TASK_MODEL_ERROR tasks_task_model_error_quark ()

struct _TasksTaskModel {
	GObject parent_instance;
	TasksTaskModelPrivate * priv;
};

struct _TasksTaskModelClass {
	GObjectClass parent_class;
};

struct _TasksTaskModelPrivate {
	GeeFuture* registry;
	GHashTable* task_list_client;
	GRecMutex __lock_task_list_client;
	GHashTable* task_list_client_views;
	GRecMutex __lock_task_list_client_views;
	guint network_changed_debounce_timeout_id;
};

struct _TasksTaskModelGetRegistryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESourceRegistry* result;
	ESourceRegistry* _tmp0_;
	GeeFuture* _tmp1_;
	gconstpointer _tmp2_;
	ESourceRegistry* _tmp3_;
	GError* _inner_error0_;
};

struct _TasksTaskModelStartData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	GeePromise* promise;
	GeePromise* _tmp0_;
	GeeFuture* _tmp1_;
	GeeFuture* _tmp2_;
	GeeFuture* _tmp3_;
	GNetworkMonitor* _tmp4_;
};

struct _Block10Data {
	int _ref_count_;
	TasksTaskModel* self;
	ESourceRegistry* registry;
};

struct _TasksTaskModelInitRegistryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	GeePromise* promise;
	Block10Data* _data10_;
	ESourceRegistry* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	ESourceRegistry* _tmp3_;
	GError* e;
	GError* _tmp4_;
	const gchar* _tmp5_;
	GError* _tmp6_;
	GError* _tmp7_;
	GError* _inner_error0_;
};

struct _Block11Data {
	int _ref_count_;
	TasksTaskModel* self;
	gboolean network_available;
};

struct _Block12Data {
	int _ref_count_;
	TasksTaskModel* self;
	ESource* task_list;
};

struct _Block13Data {
	int _ref_count_;
	TasksTaskModel* self;
	ESource* collection_source;
};

struct _TasksTaskModelRefreshCollectionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* collection_source;
	GCancellable* cancellable;
	gboolean result;
	gboolean _tmp0_;
	GNetworkMonitor* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GeeFuture* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gboolean _tmp9_;
	GeeFuture* _tmp10_;
	gconstpointer _tmp11_;
	gconstpointer _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gboolean _tmp15_;
	GError* _inner_error0_;
};

struct _TasksTaskModelRefreshTaskListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* task_list;
	GCancellable* cancellable;
	gboolean result;
	gboolean _tmp0_;
	GNetworkMonitor* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GHashTable* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	ECalClient* client;
	GHashTable* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gconstpointer _tmp10_;
	ECalClient* _tmp11_;
	ECalClient* _tmp12_;
	ECalClient* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gboolean _tmp16_;
	ECalClient* _tmp17_;
	GError* _inner_error0_;
};

struct _TasksTaskModelAddTaskListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* task_list;
	ESource* collection_or_sibling;
	ESourceRegistry* registry;
	ESourceRegistry* _tmp0_;
	ESourceTaskList* task_list_extension;
	ESourceExtension* _tmp1_;
	gchar* backend_name;
	ESourceRegistry* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GQuark _tmp8_;
	ESource* collection_source;
	ESourceRegistry* _tmp9_;
	ESource* _tmp10_;
	EWebDAVSession* collection_source_webdav_session;
	ESource* _tmp11_;
	EWebDAVSession* _tmp12_;
	ESourceCredentialsProvider* credentials_provider;
	ESourceRegistry* _tmp13_;
	ESourceCredentialsProvider* _tmp14_;
	ENamedParameters* credentials;
	ESourceCredentialsProvider* _tmp15_;
	ESource* _tmp16_;
	ENamedParameters* _tmp17_;
	EWebDAVSession* _tmp18_;
	ENamedParameters* _tmp19_;
	GUri* webdav_task_list_uri;
	ENamedParameters* _tmp20_;
	ESource* _tmp21_;
	GUri* _tmp22_;
	GUri* _tmp23_;
	GUri* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	GUri* _tmp29_;
	GUri* _tmp30_;
	GUri* _tmp31_;
	GError* e;
	GError* _tmp32_;
	const gchar* _tmp33_;
	EWebDAVSession* _tmp34_;
	GUri* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	ESourceTaskList* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	ESourceRegistry* _tmp43_;
	ESource* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	ESource* _vala1_collection_source;
	ESourceRegistry* _tmp47_;
	ESource* _tmp48_;
	EGDataSession* session;
	EGDataSession* _tmp49_;
	JsonObject* inserted_tasklist;
	EGDataSession* _tmp50_;
	const gchar* _tmp51_;
	const gchar* _tmp52_;
	JsonObject* _tmp53_;
	GError* _vala1_e;
	GError* _tmp54_;
	const gchar* _tmp55_;
	ESourceRegistry* _tmp56_;
	ESource* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	ESourceTaskList* _tmp60_;
	ESourceRegistry* _tmp61_;
	const gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	GError* _tmp65_;
	GError* _tmp66_;
	GError* _inner_error0_;
};

struct _TasksTaskModelRemoveTaskListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* task_list;
	ESourceRegistry* registry;
	ESourceRegistry* _tmp0_;
	gchar* backend_name;
	ESourceRegistry* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GQuark _tmp7_;
	ESource* collection_source;
	ESourceRegistry* _tmp8_;
	ESource* _tmp9_;
	EWebDAVSession* collection_source_webdav_session;
	ESource* _tmp10_;
	EWebDAVSession* _tmp11_;
	ESourceCredentialsProvider* credentials_provider;
	ESourceRegistry* _tmp12_;
	ESourceCredentialsProvider* _tmp13_;
	ENamedParameters* credentials;
	ESourceCredentialsProvider* _tmp14_;
	ESource* _tmp15_;
	ENamedParameters* _tmp16_;
	EWebDAVSession* _tmp17_;
	ENamedParameters* _tmp18_;
	ESourceWebdav* task_list_webdav_extension;
	ESourceExtension* _tmp19_;
	ESourceWebdav* _tmp20_;
	EWebDAVSession* _tmp21_;
	ESourceWebdav* _tmp22_;
	GUri* _tmp23_;
	GUri* _tmp24_;
	GUri* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	ESourceRegistry* _tmp28_;
	ESource* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	ESource* _vala1_collection_source;
	ESourceRegistry* _tmp32_;
	ESource* _tmp33_;
	gchar* id;
	ESourceExtension* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	EGDataSession* session;
	EGDataSession* _tmp38_;
	EGDataSession* _tmp39_;
	const gchar* _tmp40_;
	GError* e;
	GError* _tmp41_;
	const gchar* _tmp42_;
	ESourceRegistry* _tmp43_;
	ESource* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	GError* _tmp50_;
	GError* _tmp51_;
	GError* _inner_error0_;
};

struct _Block14Data {
	int _ref_count_;
	TasksTaskModel* self;
	GUri* webdav_server_uri;
	GError* webdav_error;
	ESource* collection_source;
	gpointer _async_data_;
};

struct _TasksTaskModelDiscoverWebdavServerUriData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ENamedParameters* credentials;
	ESource* collection_source;
	GUri* result;
	Block14Data* _data14_;
	ESourceCollection* collection_source_extension;
	ESourceExtension* _tmp0_;
	ESourceCollection* _tmp1_;
	ESourceCollection* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GError* _tmp5_;
	GError* _tmp6_;
	GError* _tmp7_;
	GUri* _tmp8_;
	GUri* _tmp9_;
	GError* _inner_error0_;
};

struct _TasksTaskModelUpdateTaskListDisplayNameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* task_list;
	gchar* display_name;
	ESourceRegistry* registry;
	ESourceRegistry* _tmp0_;
	ESource* collection_source;
	ESourceRegistry* _tmp1_;
	ESource* _tmp2_;
	gboolean _tmp3_;
	ESource* _tmp4_;
	const gchar* _tmp5_;
	EWebDAVSession* collection_source_webdav_session;
	ESource* _tmp6_;
	EWebDAVSession* _tmp7_;
	ESourceWebdav* source_webdav_extension;
	ESourceExtension* _tmp8_;
	ESourceCredentialsProvider* credentials_provider;
	ESourceRegistry* _tmp9_;
	ESourceCredentialsProvider* _tmp10_;
	ENamedParameters* credentials;
	ESourceCredentialsProvider* _tmp11_;
	ESource* _tmp12_;
	ENamedParameters* _tmp13_;
	EWebDAVSession* _tmp14_;
	ENamedParameters* _tmp15_;
	GSList* changes;
	EWebDAVPropertyChange* _tmp16_;
	EWebDAVSession* _tmp17_;
	ESourceWebdav* _tmp18_;
	GUri* _tmp19_;
	GUri* _tmp20_;
	GUri* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	GSList* _tmp24_;
	ESourceRegistry* _tmp25_;
	ESource* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gboolean _tmp29_;
	ESourceExtension* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* task_list_id;
	ESourceExtension* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	EGDataSession* session;
	EGDataSession* _tmp38_;
	JsonObject* tasklist;
	JsonBuilder* properties;
	JsonBuilder* _tmp39_;
	JsonBuilder* _tmp40_;
	JsonBuilder* _tmp41_;
	JsonBuilder* _tmp42_;
	JsonBuilder* _tmp43_;
	EGDataSession* _tmp44_;
	const gchar* _tmp45_;
	JsonBuilder* _tmp46_;
	JsonObject* _tmp47_;
	GError* e;
	GError* _tmp48_;
	const gchar* _tmp49_;
	ESourceRegistry* _tmp50_;
	ESource* _tmp51_;
	const gchar* _tmp52_;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	ESourceRegistry* _tmp57_;
	GError* _tmp58_;
	GError* _inner_error0_;
};

struct _TasksTaskModelUpdateTaskListColorData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* task_list;
	gchar* color;
	GError* _tmp0_;
	ESourceTaskList* task_list_extension;
	ESourceExtension* _tmp1_;
	gchar* previous_color;
	ESourceTaskList* _tmp2_;
	gchar* _tmp3_;
	ESourceRegistry* registry;
	ESourceRegistry* _tmp4_;
	ESource* collection_source;
	ESourceRegistry* _tmp5_;
	ESource* _tmp6_;
	gchar* backend_name;
	gchar* _tmp7_;
	ESource* _tmp8_;
	ESource* _tmp9_;
	ESourceRegistry* _tmp10_;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	ESourceTaskList* _tmp13_;
	ESourceRegistry* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GQuark _tmp19_;
	gboolean _tmp20_;
	ESource* _tmp21_;
	GError* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	EWebDAVSession* collection_source_webdav_session;
	ESource* _tmp25_;
	EWebDAVSession* _tmp26_;
	ESourceWebdav* source_webdav_extension;
	ESourceExtension* _tmp27_;
	ESourceCredentialsProvider* credentials_provider;
	ESourceRegistry* _tmp28_;
	ESourceCredentialsProvider* _tmp29_;
	ENamedParameters* credentials;
	ESourceCredentialsProvider* _tmp30_;
	ESource* _tmp31_;
	ENamedParameters* _tmp32_;
	EWebDAVSession* _tmp33_;
	ENamedParameters* _tmp34_;
	GSList* changes;
	EWebDAVPropertyChange* _tmp35_;
	EWebDAVSession* _tmp36_;
	ESourceWebdav* _tmp37_;
	GUri* _tmp38_;
	GUri* _tmp39_;
	GUri* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	GSList* _tmp43_;
	ESourceRegistry* _tmp44_;
	ESource* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	GError* _tmp49_;
	GError* e;
	const gchar* _tmp50_;
	ESourceTaskList* _tmp51_;
	const gchar* _tmp52_;
	ESourceRegistry* _tmp53_;
	GError* _tmp54_;
	GError* _tmp55_;
	GError* _inner_error0_;
};

struct _TasksTaskModelAddTaskData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* list;
	ECalComponent* task;
	ECalClient* client;
	ECalClient* _tmp0_;
	ICalComponent* comp;
	ICalComponent* _tmp1_;
	ICalComponent* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* uid;
	ECalClient* _tmp7_;
	ICalComponent* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	ICalComponent* _tmp11_;
	const gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _Block15Data {
	int _ref_count_;
	TasksTaskModel* self;
	ECalClient* client;
	gpointer _async_data_;
};

struct _Block16Data {
	int _ref_count_;
	Block15Data * _data15_;
	ECalComponent* instance;
};

struct _TasksTaskModelCompleteTaskData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* list;
	ECalComponent* task;
	Block15Data* _data15_;
	ECalClient* _tmp0_;
	ICalComponent* comp;
	ICalComponent* _tmp1_;
	gboolean was_completed;
	ICalComponent* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	ICalComponent* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	ICalComponent* _tmp10_;
	ICalTime* _tmp11_;
	ICalTime* _tmp12_;
	ECalClient* _tmp13_;
	ICalComponent* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	ICalComponent* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	ICalComponent* _tmp22_;
	ICalTime* _tmp23_;
	ICalTime* _tmp24_;
	ECalClient* _tmp25_;
	ICalComponent* _tmp26_;
	gboolean _tmp27_;
	ICalDuration* duration;
	ICalDuration* _tmp28_;
	ICalDuration* _tmp29_;
	ICalTime* today;
	ICalTime* _tmp30_;
	ICalTime* start;
	ICalComponent* _tmp31_;
	ICalTime* _tmp32_;
	ICalTime* _tmp33_;
	ICalTime* _tmp34_;
	ICalTime* _tmp35_;
	ICalTime* _tmp36_;
	ICalTime* end;
	ICalTime* _tmp37_;
	ICalDuration* _tmp38_;
	ICalTime* _tmp39_;
	ECalRecurInstanceCb recur_instance_callback;
	gpointer recur_instance_callback_target;
	GDestroyNotify recur_instance_callback_target_destroy_notify;
	ECalClient* _tmp40_;
	ICalComponent* _tmp41_;
	ICalTime* _tmp42_;
	ICalTime* _tmp43_;
	ECalRecurInstanceCb _tmp44_;
	gpointer _tmp44__target;
	GError* _inner_error0_;
};

struct _TasksTaskModelUpdateTaskData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* list;
	ECalComponent* task;
	ECalObjModType mod_type;
	ECalClient* client;
	ECalClient* _tmp0_;
	ICalComponent* comp;
	ICalComponent* _tmp1_;
	ICalComponent* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	ECalClient* _tmp8_;
	ICalComponent* _tmp9_;
	GError* _inner_error0_;
};

struct _TasksTaskModelRemoveTaskData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* list;
	ECalComponent* task;
	ECalObjModType mod_type;
	ECalClient* client;
	ECalClient* _tmp0_;
	ICalComponent* comp;
	ICalComponent* _tmp1_;
	gchar* uid;
	ICalComponent* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* rid;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	ECalClient* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	GError* _inner_error0_;
};

struct _TasksTaskModelMoveTaskData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TasksTaskModel* self;
	ESource* source_list;
	ESource* destination_list;
	gchar* task_uid;
	gboolean result;
	ECalClient* source_client;
	ECalClient* _tmp0_;
	gboolean source_remove_success;
	ECalClient* destination_client;
	ECalClient* _tmp1_;
	gboolean destination_create_success;
	GSList* ecal_components;
	gboolean _tmp2_;
	ECalClient* _tmp3_;
	GSList* _tmp4_;
	gboolean _tmp5_;
	GSList* ical_components;
	GSList* _tmp6_;
	GSList* ecal_component_collection;
	GSList* ecal_component_it;
	ECalComponent* _tmp7_;
	ECalComponent* ecal_component;
	ICalComponent* ical_component;
	ECalComponent* _tmp8_;
	ICalComponent* _tmp9_;
	ICalComponent* _tmp10_;
	ICalComponent* _tmp11_;
	ICalComponent* _tmp12_;
	GSList* _tmp13_;
	gboolean _tmp14_;
	ECalClient* _tmp15_;
	GSList* _tmp16_;
	GSList* ecal_component_ids;
	ECalComponentId* _tmp17_;
	gboolean _tmp18_;
	ECalClient* _tmp19_;
	GSList* _tmp20_;
	gboolean _tmp21_;
	GError* _inner_error0_;
};

struct _Block17Data {
	int _ref_count_;
	TasksTaskModel* self;
	ECalClient* client;
	ESource* task_list;
	TasksTaskModelTasksAddedFunc on_tasks_added;
	gpointer on_tasks_added_target;
	TasksTaskModelTasksModifiedFunc on_tasks_modified;
	gpointer on_tasks_modified_target;
	TasksTaskModelTasksRemovedFunc on_tasks_removed;
	gpointer on_tasks_removed_target;
};

struct _Block18Data {
	int _ref_count_;
	TasksTaskModel* self;
	GeeArrayList* added_tasks;
	ESource* task_list;
	ECalClient* client;
};

struct _Block19Data {
	int _ref_count_;
	TasksTaskModel* self;
	GeeArrayList* updated_tasks;
	ESource* task_list;
	ECalClient* client;
};

static gint TasksTaskModel_private_offset;
static gpointer tasks_task_model_parent_class = NULL;

VALA_EXTERN GQuark tasks_task_model_error_quark (void);
VALA_EXTERN GType tasks_task_model_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType tasks_task_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TasksTaskModel, g_object_unref)
static void tasks_task_model_get_registry_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_get_registry (TasksTaskModel* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN ESourceRegistry* tasks_task_model_get_registry_finish (TasksTaskModel* self,
                                                       GAsyncResult* _res_,
                                                       GError** error);
static gboolean tasks_task_model_get_registry_co (TasksTaskModelGetRegistryData* _data_);
static void tasks_task_model_get_registry_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN ESourceRegistry* tasks_task_model_get_registry_sync (TasksTaskModel* self,
                                                     GError** error);
static ECalClient* tasks_task_model_get_client (TasksTaskModel* self,
                                         ESource* task_list,
                                         GError** error);
static void tasks_task_model_configure_task_list (TasksTaskModel* self,
                                           ESource* task_list,
                                           ESourceRegistry* registry,
                                           GError** error);
static void tasks_task_model_create_task_list_client (TasksTaskModel* self,
                                               ESource* task_list);
static void tasks_task_model_destroy_task_list_client (TasksTaskModel* self,
                                                ESource* task_list,
                                                ECalClient* client);
static GeeCollection* tasks_task_model_get_views (TasksTaskModel* self,
                                           ECalClient* client);
static void tasks_task_model_start_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_start (TasksTaskModel* self,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
VALA_EXTERN void tasks_task_model_start_finish (TasksTaskModel* self,
                                    GAsyncResult* _res_);
static gboolean tasks_task_model_start_co (TasksTaskModelStartData* _data_);
static void tasks_task_model_init_registry (TasksTaskModel* self,
                                     GeePromise* promise,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void tasks_task_model_init_registry_finish (TasksTaskModel* self,
                                            GAsyncResult* _res_);
static void tasks_task_model_start_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_);
static void tasks_task_model_network_changed (TasksTaskModel* self,
                                       gboolean network_available);
static void _tasks_task_model_network_changed_g_network_monitor_network_changed (GNetworkMonitor* _sender,
                                                                          gboolean network_available,
                                                                          gpointer self);
static void tasks_task_model_init_registry_data_free (gpointer _data);
static gboolean tasks_task_model_init_registry_co (TasksTaskModelInitRegistryData* _data_);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void tasks_task_model_init_registry_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static void ___lambda4_ (Block10Data* _data10_,
                  ESource* task_list);
static void ____lambda4__e_source_registry_source_added (ESourceRegistry* _sender,
                                                  ESource* source,
                                                  gpointer self);
static void ___lambda5_ (TasksTaskModel* self,
                  ESource* task_list);
static void ____lambda5__e_source_registry_source_changed (ESourceRegistry* _sender,
                                                    ESource* source,
                                                    gpointer self);
static void ___lambda6_ (TasksTaskModel* self,
                  ESource* task_list);
static void ____lambda6__e_source_registry_source_removed (ESourceRegistry* _sender,
                                                    ESource* source,
                                                    gpointer self);
static void ___lambda7_ (Block10Data* _data10_,
                  ESource* task_list);
static void ____lambda7__gfunc (gconstpointer data,
                         gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
static gboolean __lambda8_ (Block11Data* _data11_);
static void ___lambda9_ (TasksTaskModel* self,
                  ESource* task_list);
static Block12Data* block12_data_ref (Block12Data* _data12_);
static void block12_data_unref (void * _userdata_);
VALA_EXTERN void tasks_task_model_refresh_task_list (TasksTaskModel* self,
                                         ESource* task_list,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
VALA_EXTERN gboolean tasks_task_model_refresh_task_list_finish (TasksTaskModel* self,
                                                    GAsyncResult* _res_,
                                                    GError** error);
static void __lambda10_ (Block12Data* _data12_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda10__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void ____lambda9__gfunc (gconstpointer data,
                         gpointer self);
static void ___lambda11_ (TasksTaskModel* self,
                   ESource* collection_source);
static Block13Data* block13_data_ref (Block13Data* _data13_);
static void block13_data_unref (void * _userdata_);
static void tasks_task_model_refresh_collection (TasksTaskModel* self,
                                          ESource* collection_source,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static gboolean tasks_task_model_refresh_collection_finish (TasksTaskModel* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
static void __lambda12_ (Block13Data* _data13_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda12__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void ____lambda11__gfunc (gconstpointer data,
                          gpointer self);
static gboolean ___lambda8__gsource_func (gpointer self);
static void tasks_task_model_refresh_collection_data_free (gpointer _data);
static gboolean tasks_task_model_refresh_collection_co (TasksTaskModelRefreshCollectionData* _data_);
static void tasks_task_model_refresh_collection_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void tasks_task_model_refresh_task_list_data_free (gpointer _data);
static gboolean tasks_task_model_refresh_task_list_co (TasksTaskModelRefreshTaskListData* _data_);
static void tasks_task_model_refresh_task_list_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void tasks_task_model_add_task_list_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_add_task_list (TasksTaskModel* self,
                                     ESource* task_list,
                                     ESource* collection_or_sibling,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void tasks_task_model_add_task_list_finish (TasksTaskModel* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static gboolean tasks_task_model_add_task_list_co (TasksTaskModelAddTaskListData* _data_);
VALA_EXTERN gchar* tasks_task_model_get_collection_backend_name (TasksTaskModel* self,
                                                     ESource* source,
                                                     ESourceRegistry* registry);
static void _vala_ENamedParameters_free (ENamedParameters* self);
static void tasks_task_model_discover_webdav_server_uri (TasksTaskModel* self,
                                                  ENamedParameters* credentials,
                                                  ESource* collection_source,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
static GUri* tasks_task_model_discover_webdav_server_uri_finish (TasksTaskModel* self,
                                                          GAsyncResult* _res_,
                                                          GError** error);
static void tasks_task_model_add_task_list_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static void tasks_task_model_remove_task_list_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_remove_task_list (TasksTaskModel* self,
                                        ESource* task_list,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN void tasks_task_model_remove_task_list_finish (TasksTaskModel* self,
                                               GAsyncResult* _res_,
                                               GError** error);
static gboolean tasks_task_model_remove_task_list_co (TasksTaskModelRemoveTaskListData* _data_);
static void tasks_task_model_remove_task_list_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN gboolean tasks_task_model_is_add_task_list_supported (TasksTaskModel* self,
                                                      ESource* source);
VALA_EXTERN gboolean tasks_task_model_is_remove_task_list_supported (TasksTaskModel* self,
                                                         ESource* source);
static gboolean tasks_task_model_is_gtasks_default_task_list (TasksTaskModel* self,
                                                       ESource* task_list,
                                                       ESourceRegistry* registry,
                                                       GError** error);
static void tasks_task_model_discover_webdav_server_uri_data_free (gpointer _data);
static ENamedParameters* _vala_ENamedParameters_copy (ENamedParameters* self);
static gboolean tasks_task_model_discover_webdav_server_uri_co (TasksTaskModelDiscoverWebdavServerUriData* _data_);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
static void __lambda13_ (Block14Data* _data14_,
                  GObject* obj,
                  GAsyncResult* res);
static GTlsCertificateFlags* _g_tls_certificate_flags_dup (GTlsCertificateFlags* self);
static void _vala_EWebDAVDiscoveredSource_free (EWebDAVDiscoveredSource* self);
static void __vala_EWebDAVDiscoveredSource_free0_ (gpointer var);
static inline void _g_slist_free___vala_EWebDAVDiscoveredSource_free0_ (GSList* self);
static void _g_free0_ (gpointer var);
static inline void _g_slist_free__g_free0_ (GSList* self);
static EWebDAVDiscoveredSource* _vala_EWebDAVDiscoveredSource_copy (EWebDAVDiscoveredSource* self);
static void ___lambda13__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void tasks_task_model_update_task_list_display_name_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_update_task_list_display_name (TasksTaskModel* self,
                                                     ESource* task_list,
                                                     const gchar* display_name,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN void tasks_task_model_update_task_list_display_name_finish (TasksTaskModel* self,
                                                            GAsyncResult* _res_,
                                                            GError** error);
static gboolean tasks_task_model_update_task_list_display_name_co (TasksTaskModelUpdateTaskListDisplayNameData* _data_);
static void _vala_EWebDAVPropertyChange_free (EWebDAVPropertyChange* self);
static void __vala_EWebDAVPropertyChange_free0_ (gpointer var);
static inline void _g_slist_free___vala_EWebDAVPropertyChange_free0_ (GSList* self);
static void tasks_task_model_update_task_list_display_name_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_);
static void tasks_task_model_update_task_list_color_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_update_task_list_color (TasksTaskModel* self,
                                              ESource* task_list,
                                              const gchar* color,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
VALA_EXTERN void tasks_task_model_update_task_list_color_finish (TasksTaskModel* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
static gboolean tasks_task_model_update_task_list_color_co (TasksTaskModelUpdateTaskListColorData* _data_);
static void tasks_task_model_add_task_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_add_task (TasksTaskModel* self,
                                ESource* list,
                                ECalComponent* task,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void tasks_task_model_add_task_finish (TasksTaskModel* self,
                                       GAsyncResult* _res_,
                                       GError** error);
static gboolean tasks_task_model_add_task_co (TasksTaskModelAddTaskData* _data_);
static void tasks_task_model_add_task_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_);
static void tasks_task_model_complete_task_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_complete_task (TasksTaskModel* self,
                                     ESource* list,
                                     ECalComponent* task,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void tasks_task_model_complete_task_finish (TasksTaskModel* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static gboolean tasks_task_model_complete_task_co (TasksTaskModelCompleteTaskData* _data_);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
static void tasks_task_model_complete_task_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static gboolean ___lambda14_ (Block15Data* _data15_,
                       ICalComponent* instance_comp,
                       ICalTime* instance_start_timet,
                       ICalTime* instance_end_timet,
                       GCancellable* cancellable,
                       GError** error);
static Block16Data* block16_data_ref (Block16Data* _data16_);
static void block16_data_unref (void * _userdata_);
static void ___lambda15_ (Block16Data* _data16_,
                   const gchar* alarm_uid);
static void _vala_ECalComponentAlarmTrigger_free (ECalComponentAlarmTrigger* self);
static void _vala_ECalComponentAlarm_free (ECalComponentAlarm* self);
static void ____lambda15__gfunc (gconstpointer data,
                          gpointer self);
static gboolean ____lambda14__ecal_recur_instance_cb (ICalComponent* icomp,
                                               ICalTime* instance_start,
                                               ICalTime* instance_end,
                                               gpointer self,
                                               GCancellable* cancellable,
                                               GError** error);
static void tasks_task_model_update_task_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_update_task (TasksTaskModel* self,
                                   ESource* list,
                                   ECalComponent* task,
                                   ECalObjModType mod_type,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void tasks_task_model_update_task_finish (TasksTaskModel* self,
                                          GAsyncResult* _res_,
                                          GError** error);
static gboolean tasks_task_model_update_task_co (TasksTaskModelUpdateTaskData* _data_);
static void tasks_task_model_update_task_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
static void tasks_task_model_remove_task_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_remove_task (TasksTaskModel* self,
                                   ESource* list,
                                   ECalComponent* task,
                                   ECalObjModType mod_type,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void tasks_task_model_remove_task_finish (TasksTaskModel* self,
                                          GAsyncResult* _res_,
                                          GError** error);
static gboolean tasks_task_model_remove_task_co (TasksTaskModelRemoveTaskData* _data_);
static void tasks_task_model_remove_task_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
static void tasks_task_model_move_task_data_free (gpointer _data);
VALA_EXTERN void tasks_task_model_move_task (TasksTaskModel* self,
                                 ESource* source_list,
                                 ESource* destination_list,
                                 const gchar* task_uid,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
VALA_EXTERN gboolean tasks_task_model_move_task_finish (TasksTaskModel* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static gboolean tasks_task_model_move_task_co (TasksTaskModelMoveTaskData* _data_);
static void tasks_task_model_move_task_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_);
static inline void _g_slist_free__g_object_unref0_ (GSList* self);
static void _vala_ECalComponentId_free (ECalComponentId* self);
static void __vala_ECalComponentId_free0_ (gpointer var);
static inline void _g_slist_free___vala_ECalComponentId_free0_ (GSList* self);
static void tasks_task_model_debug_task (TasksTaskModel* self,
                                  ESource* task_list,
                                  ECalComponent* task);
VALA_EXTERN ECalClientView* tasks_task_model_create_task_list_view (TasksTaskModel* self,
                                                        ESource* task_list,
                                                        const gchar* query,
                                                        TasksTaskModelTasksAddedFunc on_tasks_added,
                                                        gpointer on_tasks_added_target,
                                                        TasksTaskModelTasksModifiedFunc on_tasks_modified,
                                                        gpointer on_tasks_modified_target,
                                                        TasksTaskModelTasksRemovedFunc on_tasks_removed,
                                                        gpointer on_tasks_removed_target,
                                                        GError** error);
static Block17Data* block17_data_ref (Block17Data* _data17_);
static void block17_data_unref (void * _userdata_);
static void __lambda16_ (Block17Data* _data17_,
                  GSList* objects);
static void tasks_task_model_on_objects_added (TasksTaskModel* self,
                                        ESource* task_list,
                                        ECalClient* client,
                                        GSList* objects,
                                        TasksTaskModelTasksAddedFunc on_tasks_added,
                                        gpointer on_tasks_added_target);
static void ___lambda16__e_cal_client_view_objects_added (ECalClientView* _sender,
                                                   GSList* objects,
                                                   gpointer self);
static void __lambda19_ (Block17Data* _data17_,
                  GSList* objects);
static void tasks_task_model_on_objects_removed (TasksTaskModel* self,
                                          ESource* task_list,
                                          ECalClient* client,
                                          GSList* cids,
                                          TasksTaskModelTasksRemovedFunc on_tasks_removed,
                                          gpointer on_tasks_removed_target);
static void ___lambda19__e_cal_client_view_objects_removed (ECalClientView* _sender,
                                                     GSList* uids,
                                                     gpointer self);
static void __lambda20_ (Block17Data* _data17_,
                  GSList* objects);
static void tasks_task_model_on_objects_modified (TasksTaskModel* self,
                                           ESource* task_list,
                                           ECalClient* client,
                                           GSList* objects,
                                           TasksTaskModelTasksModifiedFunc on_tasks_modified,
                                           gpointer on_tasks_modified_target);
static void ___lambda20__e_cal_client_view_objects_modified (ECalClientView* _sender,
                                                      GSList* objects,
                                                      gpointer self);
VALA_EXTERN void tasks_task_model_destroy_task_list_view (TasksTaskModel* self,
                                              ECalClientView* view);
static Block18Data* block18_data_ref (Block18Data* _data18_);
static void block18_data_unref (void * _userdata_);
VALA_EXTERN gboolean tasks_util_calcomponent_equal_func (ECalComponent* a,
                                             ECalComponent* b);
static void __lambda17_ (Block18Data* _data18_,
                  ICalComponent* ical_comp);
static void ___lambda18_ (Block18Data* _data18_,
                   ECalComponent* task);
static void ____lambda18__gfunc (gconstpointer data,
                          gpointer self);
static void ___lambda17__gfunc (gconstpointer data,
                         gpointer self);
static Block19Data* block19_data_ref (Block19Data* _data19_);
static void block19_data_unref (void * _userdata_);
static void __lambda21_ (Block19Data* _data19_,
                  ICalComponent* comp);
static void ___lambda22_ (Block19Data* _data19_,
                   ECalComponent* task);
static void ____lambda22__gfunc (gconstpointer data,
                          gpointer self);
static void ___lambda21__gfunc (gconstpointer data,
                         gpointer self);
VALA_EXTERN TasksTaskModel* tasks_task_model_new (void);
VALA_EXTERN TasksTaskModel* tasks_task_model_construct (GType object_type);
static GObject * tasks_task_model_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties);
static void tasks_task_model_finalize (GObject * obj);
static GType tasks_task_model_get_type_once (void);

GQuark
tasks_task_model_error_quark (void)
{
	return g_quark_from_static_string ("tasks-task-model-error-quark");
}

 G_GNUC_NO_INLINE static GType
tasks_task_model_error_get_type_once (void)
{
	static const GEnumValue values[] = {{TASKS_TASK_MODEL_ERROR_CLIENT_NOT_AVAILABLE, "TASKS_TASK_MODEL_ERROR_CLIENT_NOT_AVAILABLE", "client-not-available"}, {TASKS_TASK_MODEL_ERROR_BACKEND_ERROR, "TASKS_TASK_MODEL_ERROR_BACKEND_ERROR", "backend-error"}, {TASKS_TASK_MODEL_ERROR_INVALID_ARGUMENT, "TASKS_TASK_MODEL_ERROR_INVALID_ARGUMENT", "invalid-argument"}, {0, NULL, NULL}};
	GType tasks_task_model_error_type_id;
	tasks_task_model_error_type_id = g_enum_register_static ("TasksTaskModelError", values);
	return tasks_task_model_error_type_id;
}

GType
tasks_task_model_error_get_type (void)
{
	static gsize tasks_task_model_error_type_id__once = 0;
	if (g_once_init_enter (&tasks_task_model_error_type_id__once)) {
		GType tasks_task_model_error_type_id;
		tasks_task_model_error_type_id = tasks_task_model_error_get_type_once ();
		g_once_init_leave (&tasks_task_model_error_type_id__once, tasks_task_model_error_type_id);
	}
	return tasks_task_model_error_type_id__once;
}

static inline gpointer
tasks_task_model_get_instance_private (TasksTaskModel* self)
{
	return G_STRUCT_MEMBER_P (self, TasksTaskModel_private_offset);
}

static void
tasks_task_model_get_registry_data_free (gpointer _data)
{
	TasksTaskModelGetRegistryData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelGetRegistryData, _data_);
}

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

void
tasks_task_model_get_registry (TasksTaskModel* self,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	TasksTaskModelGetRegistryData* _data_;
	TasksTaskModel* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TasksTaskModelGetRegistryData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_get_registry_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tasks_task_model_get_registry_co (_data_);
}

ESourceRegistry*
tasks_task_model_get_registry_finish (TasksTaskModel* self,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	ESourceRegistry* result;
	TasksTaskModelGetRegistryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
tasks_task_model_get_registry_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	TasksTaskModelGetRegistryData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_get_registry_co (_data_);
}

static gboolean
tasks_task_model_get_registry_co (TasksTaskModelGetRegistryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->registry;
	_data_->_state_ = 1;
	gee_future_wait_async (_data_->_tmp1_, tasks_task_model_get_registry_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = gee_future_wait_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp0_ = (ESourceRegistry*) _data_->_tmp2_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _g_object_ref0 (_data_->_tmp0_);
	_data_->result = _data_->_tmp3_;
	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;
}

ESourceRegistry*
tasks_task_model_get_registry_sync (TasksTaskModel* self,
                                    GError** error)
{
	GeeFuture* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GeeFuture* _tmp4_;
	gconstpointer _tmp5_;
	gconstpointer _tmp6_;
	ESourceRegistry* _tmp7_;
	GError* _inner_error0_ = NULL;
	ESourceRegistry* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->registry;
	_tmp1_ = gee_future_get_ready (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		GeeFuture* _tmp3_;
		g_debug ("TaskModel.vala:48: Blocking until registry is loaded…");
		_tmp3_ = self->priv->registry;
		gee_future_wait (_tmp3_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		}
	}
	_tmp4_ = self->priv->registry;
	_tmp5_ = gee_future_get_value (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _g_object_ref0 ((ESourceRegistry*) _tmp6_);
	result = _tmp7_;
	return result;
}

static ECalClient*
tasks_task_model_get_client (TasksTaskModel* self,
                             ESource* task_list,
                             GError** error)
{
	ECalClient* client = NULL;
	ECalClient* _tmp7_;
	GError* _inner_error0_ = NULL;
	ECalClient* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (task_list != NULL, NULL);
	{
		GHashTable* _tmp0_;
		_tmp0_ = self->priv->task_list_client;
		g_rec_mutex_lock (&self->priv->__lock_task_list_client);
		{
			GHashTable* _tmp1_;
			gchar* _tmp2_;
			gchar* _tmp3_;
			gconstpointer _tmp4_;
			ECalClient* _tmp5_;
			_tmp1_ = self->priv->task_list_client;
			_tmp2_ = e_source_dup_uid (task_list);
			_tmp3_ = _tmp2_;
			_tmp4_ = g_hash_table_lookup (_tmp1_, _tmp3_);
			_tmp5_ = _g_object_ref0 ((ECalClient*) _tmp4_);
			_g_object_unref0 (client);
			client = _tmp5_;
			_g_free0 (_tmp3_);
		}
		__finally0:
		{
			GHashTable* _tmp6_;
			_tmp6_ = self->priv->task_list_client;
			g_rec_mutex_unlock (&self->priv->__lock_task_list_client);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (client);
			return NULL;
		}
	}
	_tmp7_ = client;
	if (_tmp7_ == NULL) {
		gchar* _tmp8_;
		gchar* _tmp9_;
		GError* _tmp10_;
		GError* _tmp11_;
		_tmp8_ = e_source_dup_display_name (task_list);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_error_new (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_CLIENT_NOT_AVAILABLE, "No client available for task list '%s'", _tmp9_);
		_tmp11_ = _tmp10_;
		_g_free0 (_tmp9_);
		_inner_error0_ = _tmp11_;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (client);
		return NULL;
	}
	result = client;
	return result;
}

static void
tasks_task_model_configure_task_list (TasksTaskModel* self,
                                      ESource* task_list,
                                      ESourceRegistry* registry,
                                      GError** error)
{
	ESource* collection_source = NULL;
	ESource* _tmp0_;
	ESource* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (registry != NULL);
	_tmp0_ = e_source_registry_find_extension (registry, task_list, E_SOURCE_EXTENSION_COLLECTION);
	collection_source = _tmp0_;
	_tmp1_ = collection_source;
	if (_tmp1_ != NULL) {
		ESource* _tmp2_;
		ESource* _tmp10_;
		_tmp2_ = collection_source;
		if (e_source_has_extension (_tmp2_, E_SOURCE_EXTENSION_OFFLINE)) {
			ESourceOffline* collection_offline_extension = NULL;
			ESource* _tmp3_;
			ESourceExtension* _tmp4_;
			ESourceOffline* task_list_offline_extension = NULL;
			ESourceExtension* _tmp5_;
			ESourceOffline* _tmp6_;
			ESourceOffline* _tmp7_;
			gboolean _tmp8_;
			gboolean _tmp9_;
			_tmp3_ = collection_source;
			_tmp4_ = e_source_get_extension (_tmp3_, E_SOURCE_EXTENSION_OFFLINE);
			collection_offline_extension = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, e_source_offline_get_type (), ESourceOffline);
			_tmp5_ = e_source_get_extension (task_list, E_SOURCE_EXTENSION_OFFLINE);
			task_list_offline_extension = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, e_source_offline_get_type (), ESourceOffline);
			_tmp6_ = task_list_offline_extension;
			_tmp7_ = collection_offline_extension;
			_tmp8_ = e_source_offline_get_stay_synchronized (_tmp7_);
			_tmp9_ = _tmp8_;
			e_source_offline_set_stay_synchronized (_tmp6_, _tmp9_);
		}
		_tmp10_ = collection_source;
		if (e_source_has_extension (_tmp10_, E_SOURCE_EXTENSION_REFRESH)) {
			ESourceRefresh* collection_refresh_extension = NULL;
			ESource* _tmp11_;
			ESourceExtension* _tmp12_;
			ESourceRefresh* task_list_refresh_extension = NULL;
			ESourceExtension* _tmp13_;
			ESourceRefresh* _tmp14_;
			ESourceRefresh* _tmp15_;
			gboolean _tmp16_;
			gboolean _tmp17_;
			ESourceRefresh* _tmp18_;
			ESourceRefresh* _tmp19_;
			guint _tmp20_;
			guint _tmp21_;
			_tmp11_ = collection_source;
			_tmp12_ = e_source_get_extension (_tmp11_, E_SOURCE_EXTENSION_REFRESH);
			collection_refresh_extension = G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, e_source_refresh_get_type (), ESourceRefresh);
			_tmp13_ = e_source_get_extension (task_list, E_SOURCE_EXTENSION_REFRESH);
			task_list_refresh_extension = G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, e_source_refresh_get_type (), ESourceRefresh);
			_tmp14_ = task_list_refresh_extension;
			_tmp15_ = collection_refresh_extension;
			_tmp16_ = e_source_refresh_get_enabled (_tmp15_);
			_tmp17_ = _tmp16_;
			e_source_refresh_set_enabled (_tmp14_, _tmp17_);
			_tmp18_ = task_list_refresh_extension;
			_tmp19_ = collection_refresh_extension;
			_tmp20_ = e_source_refresh_get_interval_minutes (_tmp19_);
			_tmp21_ = _tmp20_;
			e_source_refresh_set_interval_minutes (_tmp18_, _tmp21_);
		}
		e_source_registry_commit_source_sync (registry, task_list, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (collection_source);
			return;
		}
	}
	_g_object_unref0 (collection_source);
}

static void
tasks_task_model_create_task_list_client (TasksTaskModel* self,
                                          ESource* task_list)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	{
		EClient* _tmp0_ = NULL;
		EClient* _tmp1_;
		ECalClient* client = NULL;
		ECalClient* _tmp2_;
		_tmp1_ = e_cal_client_connect_sync (task_list, E_CAL_CLIENT_SOURCE_TYPE_TASKS, (guint32) -1, NULL, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, e_cal_client_get_type (), ECalClient));
		client = _tmp2_;
		{
			GHashTable* _tmp3_;
			_tmp3_ = self->priv->task_list_client;
			g_rec_mutex_lock (&self->priv->__lock_task_list_client);
			{
				GHashTable* _tmp4_;
				gchar* _tmp5_;
				ECalClient* _tmp6_;
				_tmp4_ = self->priv->task_list_client;
				_tmp5_ = e_source_dup_uid (task_list);
				_tmp6_ = _g_object_ref0 (client);
				g_hash_table_insert (_tmp4_, _tmp5_, _tmp6_);
			}
			__finally1:
			{
				GHashTable* _tmp7_;
				_tmp7_ = self->priv->task_list_client;
				g_rec_mutex_unlock (&self->priv->__lock_task_list_client);
			}
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (client);
				_g_object_unref0 (_tmp0_);
				goto __catch0_g_error;
			}
		}
		_g_object_unref0 (client);
		_g_object_unref0 (_tmp0_);
	}
	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_critical ("TaskModel.vala:98: %s", _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
tasks_task_model_destroy_task_list_client (TasksTaskModel* self,
                                           ESource* task_list,
                                           ECalClient* client)
{
	GeeCollection* views = NULL;
	GeeCollection* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (client != NULL);
	_tmp0_ = tasks_task_model_get_views (self, client);
	views = _tmp0_;
	{
		GeeIterator* _view_it = NULL;
		GeeCollection* _tmp1_;
		GeeIterator* _tmp2_;
		_tmp1_ = views;
		_tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
		_view_it = _tmp2_;
		while (TRUE) {
			GeeIterator* _tmp3_;
			ECalClientView* view = NULL;
			GeeIterator* _tmp4_;
			gpointer _tmp5_;
			_tmp3_ = _view_it;
			if (!gee_iterator_next (_tmp3_)) {
				break;
			}
			_tmp4_ = _view_it;
			_tmp5_ = gee_iterator_get (_tmp4_);
			view = (ECalClientView*) _tmp5_;
			{
				ECalClientView* _tmp6_;
				_tmp6_ = view;
				e_cal_client_view_stop (_tmp6_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
			}
			goto __finally0;
			__catch0_g_error:
			{
				GError* e = NULL;
				GError* _tmp7_;
				const gchar* _tmp8_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp7_ = e;
				_tmp8_ = _tmp7_->message;
				g_warning ("TaskModel.vala:108: %s", _tmp8_);
				_g_error_free0 (e);
			}
			__finally0:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (view);
				_g_object_unref0 (_view_it);
				_g_object_unref0 (views);
				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 (view);
		}
		_g_object_unref0 (_view_it);
	}
	{
		GHashTable* _tmp9_;
		_tmp9_ = self->priv->task_list_client_views;
		g_rec_mutex_lock (&self->priv->__lock_task_list_client_views);
		{
			GHashTable* _tmp10_;
			_tmp10_ = self->priv->task_list_client_views;
			g_hash_table_remove (_tmp10_, client);
		}
		__finally1:
		{
			GHashTable* _tmp11_;
			_tmp11_ = self->priv->task_list_client_views;
			g_rec_mutex_unlock (&self->priv->__lock_task_list_client_views);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (views);
			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;
		}
	}
	{
		GHashTable* _tmp12_;
		_tmp12_ = self->priv->task_list_client;
		g_rec_mutex_lock (&self->priv->__lock_task_list_client);
		{
			GHashTable* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			_tmp13_ = self->priv->task_list_client;
			_tmp14_ = e_source_dup_uid (task_list);
			_tmp15_ = _tmp14_;
			g_hash_table_remove (_tmp13_, _tmp15_);
			_g_free0 (_tmp15_);
		}
		__finally2:
		{
			GHashTable* _tmp16_;
			_tmp16_ = self->priv->task_list_client;
			g_rec_mutex_unlock (&self->priv->__lock_task_list_client);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (views);
			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 (views);
}

static GeeCollection*
tasks_task_model_get_views (TasksTaskModel* self,
                            ECalClient* client)
{
	GeeCollection* views = NULL;
	GeeCollection* _tmp5_;
	GeeCollection* _tmp8_;
	GeeCollection* _tmp9_;
	GeeCollection* _tmp10_;
	GError* _inner_error0_ = NULL;
	GeeCollection* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (client != NULL, NULL);
	{
		GHashTable* _tmp0_;
		_tmp0_ = self->priv->task_list_client_views;
		g_rec_mutex_lock (&self->priv->__lock_task_list_client_views);
		{
			GHashTable* _tmp1_;
			gconstpointer _tmp2_;
			GeeCollection* _tmp3_;
			_tmp1_ = self->priv->task_list_client_views;
			_tmp2_ = g_hash_table_lookup (_tmp1_, client);
			_tmp3_ = _g_object_ref0 ((GeeCollection*) _tmp2_);
			_g_object_unref0 (views);
			views = _tmp3_;
		}
		__finally0:
		{
			GHashTable* _tmp4_;
			_tmp4_ = self->priv->task_list_client_views;
			g_rec_mutex_unlock (&self->priv->__lock_task_list_client_views);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (views);
			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;
		}
	}
	_tmp5_ = views;
	if (_tmp5_ == NULL) {
		GEqualFunc _tmp6_;
		GeeArrayList* _tmp7_;
		_tmp6_ = g_direct_equal;
		_tmp7_ = gee_array_list_new (e_cal_client_view_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeEqualDataFunc) _tmp6_, NULL, NULL);
		_g_object_unref0 (views);
		views = (GeeCollection*) _tmp7_;
	}
	_tmp8_ = views;
	_tmp9_ = gee_collection_get_read_only_view (_tmp8_);
	_tmp10_ = _tmp9_;
	result = _tmp10_;
	_g_object_unref0 (views);
	return result;
}

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

void
tasks_task_model_start (TasksTaskModel* self,
                        GAsyncReadyCallback _callback_,
                        gpointer _user_data_)
{
	TasksTaskModelStartData* _data_;
	TasksTaskModel* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TasksTaskModelStartData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_start_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tasks_task_model_start_co (_data_);
}

void
tasks_task_model_start_finish (TasksTaskModel* self,
                               GAsyncResult* _res_)
{
	TasksTaskModelStartData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
tasks_task_model_start_ready (GObject* source_object,
                              GAsyncResult* _res_,
                              gpointer _user_data_)
{
	TasksTaskModelStartData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_start_co (_data_);
}

static void
_tasks_task_model_network_changed_g_network_monitor_network_changed (GNetworkMonitor* _sender,
                                                                     gboolean network_available,
                                                                     gpointer self)
{
	tasks_task_model_network_changed ((TasksTaskModel*) self, network_available);
}

static gboolean
tasks_task_model_start_co (TasksTaskModelStartData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gee_promise_new (e_source_registry_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	_data_->promise = _data_->_tmp0_;
	_data_->_tmp1_ = gee_promise_get_future (_data_->promise);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _g_object_ref0 (_data_->_tmp2_);
	_g_object_unref0 (_data_->self->priv->registry);
	_data_->self->priv->registry = _data_->_tmp3_;
	_data_->_state_ = 1;
	tasks_task_model_init_registry (_data_->self, _data_->promise, tasks_task_model_start_ready, _data_);
	return FALSE;
	_state_1:
	tasks_task_model_init_registry_finish (_data_->self, _data_->_res_);
	_data_->_tmp4_ = g_network_monitor_get_default ();
	g_signal_connect_object (_data_->_tmp4_, "network-changed", (GCallback) _tasks_task_model_network_changed_g_network_monitor_network_changed, _data_->self, 0);
	_gee_promise_unref0 (_data_->promise);
	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
tasks_task_model_init_registry_data_free (gpointer _data)
{
	TasksTaskModelInitRegistryData* _data_;
	_data_ = _data;
	_gee_promise_unref0 (_data_->promise);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelInitRegistryData, _data_);
}

static gpointer
_gee_promise_ref0 (gpointer self)
{
	return self ? gee_promise_ref (self) : NULL;
}

static void
tasks_task_model_init_registry (TasksTaskModel* self,
                                GeePromise* promise,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	TasksTaskModelInitRegistryData* _data_;
	TasksTaskModel* _tmp0_;
	GeePromise* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (promise != NULL);
	_data_ = g_slice_new0 (TasksTaskModelInitRegistryData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_init_registry_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _gee_promise_ref0 (promise);
	_gee_promise_unref0 (_data_->promise);
	_data_->promise = _tmp1_;
	tasks_task_model_init_registry_co (_data_);
}

static void
tasks_task_model_init_registry_finish (TasksTaskModel* self,
                                       GAsyncResult* _res_)
{
	TasksTaskModelInitRegistryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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_)) {
		TasksTaskModel* self;
		self = _data10_->self;
		_g_object_unref0 (_data10_->registry);
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static void
tasks_task_model_init_registry_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	TasksTaskModelInitRegistryData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_init_registry_co (_data_);
}

static void
___lambda4_ (Block10Data* _data10_,
             ESource* task_list)
{
	TasksTaskModel* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GError* _inner_error0_ = NULL;
	self = _data10_->self;
	g_return_if_fail (task_list != NULL);
	_tmp0_ = e_source_dup_display_name (task_list);
	_tmp1_ = _tmp0_;
	g_debug ("TaskModel.vala:149: Configuring task list '%s'…", _tmp1_);
	_g_free0 (_tmp1_);
	{
		tasks_task_model_configure_task_list (self, task_list, _data10_->registry, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		gchar* _tmp2_;
		gchar* _tmp3_;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e_source_dup_display_name (task_list);
		_tmp3_ = _tmp2_;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_warning ("TaskModel.vala:154: There was an error configuring the task list '%s':" \
" %s", _tmp3_, _tmp5_);
		_g_free0 (_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;
	}
	_tmp6_ = e_source_dup_display_name (task_list);
	_tmp7_ = _tmp6_;
	g_debug ("TaskModel.vala:157: Adding task list '%s'…", _tmp7_);
	_g_free0 (_tmp7_);
	tasks_task_model_create_task_list_client (self, task_list);
	g_signal_emit (self, tasks_task_model_signals[TASKS_TASK_MODEL_TASK_LIST_ADDED_SIGNAL], 0, task_list);
}

static void
____lambda4__e_source_registry_source_added (ESourceRegistry* _sender,
                                             ESource* source,
                                             gpointer self)
{
	___lambda4_ (self, source);
}

static void
___lambda5_ (TasksTaskModel* self,
             ESource* task_list)
{
	g_return_if_fail (task_list != NULL);
	g_signal_emit (self, tasks_task_model_signals[TASKS_TASK_MODEL_TASK_LIST_MODIFIED_SIGNAL], 0, task_list);
}

static void
____lambda5__e_source_registry_source_changed (ESourceRegistry* _sender,
                                               ESource* source,
                                               gpointer self)
{
	___lambda5_ ((TasksTaskModel*) self, source);
}

static void
___lambda6_ (TasksTaskModel* self,
             ESource* task_list)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	ECalClient* client = NULL;
	ECalClient* _tmp7_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (task_list != NULL);
	_tmp0_ = e_source_dup_display_name (task_list);
	_tmp1_ = _tmp0_;
	g_debug ("TaskModel.vala:168: Removing task list '%s'…", _tmp1_);
	_g_free0 (_tmp1_);
	{
		ECalClient* _tmp2_ = NULL;
		ECalClient* _tmp3_;
		ECalClient* _tmp4_;
		_tmp3_ = tasks_task_model_get_client (self, task_list, &_inner_error0_);
		_tmp2_ = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = _tmp2_;
		_tmp2_ = NULL;
		_g_object_unref0 (client);
		client = _tmp4_;
		_g_object_unref0 (_tmp2_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		g_warning ("TaskModel.vala:175: %s", _tmp6_);
		_g_error_free0 (e);
		_g_object_unref0 (client);
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (client);
		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;
	}
	_tmp7_ = client;
	tasks_task_model_destroy_task_list_client (self, task_list, _tmp7_);
	g_signal_emit (self, tasks_task_model_signals[TASKS_TASK_MODEL_TASK_LIST_REMOVED_SIGNAL], 0, task_list);
	_g_object_unref0 (client);
}

static void
____lambda6__e_source_registry_source_removed (ESourceRegistry* _sender,
                                               ESource* source,
                                               gpointer self)
{
	___lambda6_ ((TasksTaskModel*) self, source);
}

static void
___lambda7_ (Block10Data* _data10_,
             ESource* task_list)
{
	TasksTaskModel* self;
	ESourceTaskList* task_list_extension = NULL;
	ESourceExtension* _tmp0_;
	ESourceTaskList* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	ESourceTaskList* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	self = _data10_->self;
	g_return_if_fail (task_list != NULL);
	_tmp0_ = e_source_get_extension (task_list, E_SOURCE_EXTENSION_TASK_LIST);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, e_source_task_list_get_type (), ESourceTaskList));
	task_list_extension = _tmp1_;
	_tmp4_ = task_list_extension;
	_tmp5_ = e_source_selectable_get_selected ((ESourceSelectable*) _tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == TRUE) {
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp7_ = e_source_get_enabled (task_list);
		_tmp8_ = _tmp7_;
		_tmp3_ = _tmp8_ == TRUE;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = !e_source_has_extension (task_list, E_SOURCE_EXTENSION_COLLECTION);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		g_signal_emit_by_name (_data10_->registry, "source-added", task_list);
	}
	_g_object_unref0 (task_list_extension);
}

static void
____lambda7__gfunc (gconstpointer data,
                    gpointer self)
{
	___lambda7_ (self, (ESource*) data);
}

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

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

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static gboolean
tasks_task_model_init_registry_co (TasksTaskModelInitRegistryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_data10_ = g_slice_new0 (Block10Data);
		_data_->_data10_->_ref_count_ = 1;
		_data_->_data10_->self = g_object_ref (_data_->self);
		_data_->_state_ = 1;
		e_source_registry_new (NULL, tasks_task_model_init_registry_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp0_ = e_source_registry_new_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->_data10_->registry = _data_->_tmp0_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			block10_data_unref (_data_->_data10_);
			_data_->_data10_ = NULL;
			goto __catch0_g_error;
		}
		g_signal_connect_data (_data_->_data10_->registry, "source-added", (GCallback) ____lambda4__e_source_registry_source_added, block10_data_ref (_data_->_data10_), (GClosureNotify) block10_data_unref, 0);
		g_signal_connect_object (_data_->_data10_->registry, "source-changed", (GCallback) ____lambda5__e_source_registry_source_changed, _data_->self, 0);
		g_signal_connect_object (_data_->_data10_->registry, "source-removed", (GCallback) ____lambda6__e_source_registry_source_removed, _data_->self, 0);
		_data_->_tmp1_ = e_source_registry_list_sources (_data_->_data10_->registry, E_SOURCE_EXTENSION_TASK_LIST);
		_data_->_tmp2_ = _data_->_tmp1_;
		g_list_foreach (_data_->_tmp2_, ____lambda7__gfunc, _data_->_data10_);
		(_data_->_tmp2_ == NULL) ? NULL : (_data_->_tmp2_ = (_g_list_free__g_object_unref0_ (_data_->_tmp2_), NULL));
		_data_->_tmp3_ = _g_object_ref0 (_data_->_data10_->registry);
		gee_promise_set_value (_data_->promise, _data_->_tmp3_);
		block10_data_unref (_data_->_data10_);
		_data_->_data10_ = NULL;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		g_critical ("TaskModel.vala:193: %s", _data_->_tmp5_);
		_data_->_tmp6_ = _data_->e;
		_data_->_tmp7_ = _g_error_copy0 (_data_->_tmp6_);
		gee_promise_set_exception (_data_->promise, _data_->_tmp7_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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 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_)) {
		TasksTaskModel* self;
		self = _data11_->self;
		_g_object_unref0 (self);
		g_slice_free (Block11Data, _data11_);
	}
}

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

static 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_)) {
		TasksTaskModel* self;
		self = _data12_->self;
		_g_object_unref0 (_data12_->task_list);
		_g_object_unref0 (self);
		g_slice_free (Block12Data, _data12_);
	}
}

static void
__lambda10_ (Block12Data* _data12_,
             GObject* obj,
             GAsyncResult* res)
{
	TasksTaskModel* self;
	GError* _inner_error0_ = NULL;
	self = _data12_->self;
	g_return_if_fail (res != NULL);
	{
		tasks_task_model_refresh_task_list_finish (self, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		gchar* _tmp0_;
		gchar* _tmp1_;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e_source_dup_display_name (_data12_->task_list);
		_tmp1_ = _tmp0_;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_warning ("TaskModel.vala:218: Error syncing task list '%s': %s", _tmp1_, _tmp3_);
		_g_free0 (_tmp1_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

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

static void
___lambda9_ (TasksTaskModel* self,
             ESource* task_list)
{
	Block12Data* _data12_;
	ESource* _tmp0_;
	g_return_if_fail (task_list != NULL);
	_data12_ = g_slice_new0 (Block12Data);
	_data12_->_ref_count_ = 1;
	_data12_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data12_->task_list);
	_data12_->task_list = _tmp0_;
	tasks_task_model_refresh_task_list (self, _data12_->task_list, NULL, ___lambda10__gasync_ready_callback, block12_data_ref (_data12_));
	block12_data_unref (_data12_);
	_data12_ = NULL;
}

static void
____lambda9__gfunc (gconstpointer data,
                    gpointer self)
{
	___lambda9_ ((TasksTaskModel*) self, (ESource*) data);
}

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_)) {
		TasksTaskModel* self;
		self = _data13_->self;
		_g_object_unref0 (_data13_->collection_source);
		_g_object_unref0 (self);
		g_slice_free (Block13Data, _data13_);
	}
}

static void
__lambda12_ (Block13Data* _data13_,
             GObject* obj,
             GAsyncResult* res)
{
	TasksTaskModel* self;
	GError* _inner_error0_ = NULL;
	self = _data13_->self;
	g_return_if_fail (res != NULL);
	{
		tasks_task_model_refresh_collection_finish (self, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		gchar* _tmp0_;
		gchar* _tmp1_;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e_source_dup_display_name (_data13_->collection_source);
		_tmp1_ = _tmp0_;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_warning ("TaskModel.vala:229: Error syncing collection '%s': %s", _tmp1_, _tmp3_);
		_g_free0 (_tmp1_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda12__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda12_ (self, source_object, res);
	block13_data_unref (self);
}

static void
___lambda11_ (TasksTaskModel* self,
              ESource* collection_source)
{
	Block13Data* _data13_;
	ESource* _tmp0_;
	g_return_if_fail (collection_source != NULL);
	_data13_ = g_slice_new0 (Block13Data);
	_data13_->_ref_count_ = 1;
	_data13_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (collection_source);
	_g_object_unref0 (_data13_->collection_source);
	_data13_->collection_source = _tmp0_;
	tasks_task_model_refresh_collection (self, _data13_->collection_source, NULL, ___lambda12__gasync_ready_callback, block13_data_ref (_data13_));
	block13_data_unref (_data13_);
	_data13_ = NULL;
}

static void
____lambda11__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda11_ ((TasksTaskModel*) self, (ESource*) data);
}

static gboolean
__lambda8_ (Block11Data* _data11_)
{
	TasksTaskModel* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	self = _data11_->self;
	self->priv->network_changed_debounce_timeout_id = (guint) 0;
	_tmp0_ = bool_to_string (_data11_->network_available);
	_tmp1_ = _tmp0_;
	g_debug ("TaskModel.vala:209: Network is available: '%s'", _tmp1_);
	_g_free0 (_tmp1_);
	if (_data11_->network_available) {
		GeeFuture* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp3_ = self->priv->registry;
		_tmp4_ = gee_future_get_ready (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp2_ = _tmp5_;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		GeeFuture* _tmp6_;
		gconstpointer _tmp7_;
		gconstpointer _tmp8_;
		GList* _tmp9_;
		GList* _tmp10_;
		GeeFuture* _tmp11_;
		gconstpointer _tmp12_;
		gconstpointer _tmp13_;
		GList* _tmp14_;
		GList* _tmp15_;
		_tmp6_ = self->priv->registry;
		_tmp7_ = gee_future_get_value (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = e_source_registry_list_sources ((ESourceRegistry*) _tmp8_, E_SOURCE_EXTENSION_TASK_LIST);
		_tmp10_ = _tmp9_;
		g_list_foreach (_tmp10_, ____lambda9__gfunc, self);
		(_tmp10_ == NULL) ? NULL : (_tmp10_ = (_g_list_free__g_object_unref0_ (_tmp10_), NULL));
		_tmp11_ = self->priv->registry;
		_tmp12_ = gee_future_get_value (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = e_source_registry_list_sources ((ESourceRegistry*) _tmp13_, E_SOURCE_EXTENSION_COLLECTION);
		_tmp15_ = _tmp14_;
		g_list_foreach (_tmp15_, ____lambda11__gfunc, self);
		(_tmp15_ == NULL) ? NULL : (_tmp15_ = (_g_list_free__g_object_unref0_ (_tmp15_), NULL));
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda8__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda8_ (self);
	return result;
}

static void
tasks_task_model_network_changed (TasksTaskModel* self,
                                  gboolean network_available)
{
	Block11Data* _data11_;
	g_return_if_fail (self != NULL);
	_data11_ = g_slice_new0 (Block11Data);
	_data11_->_ref_count_ = 1;
	_data11_->self = g_object_ref (self);
	_data11_->network_available = network_available;
	if (self->priv->network_changed_debounce_timeout_id > ((guint) 0)) {
		g_source_remove (self->priv->network_changed_debounce_timeout_id);
		self->priv->network_changed_debounce_timeout_id = (guint) 0;
	}
	self->priv->network_changed_debounce_timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 2, ___lambda8__gsource_func, block11_data_ref (_data11_), block11_data_unref);
	block11_data_unref (_data11_);
	_data11_ = NULL;
}

static void
tasks_task_model_refresh_collection_data_free (gpointer _data)
{
	TasksTaskModelRefreshCollectionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->collection_source);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelRefreshCollectionData, _data_);
}

static void
tasks_task_model_refresh_collection (TasksTaskModel* self,
                                     ESource* collection_source,
                                     GCancellable* cancellable,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	TasksTaskModelRefreshCollectionData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (collection_source != NULL);
	_data_ = g_slice_new0 (TasksTaskModelRefreshCollectionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_refresh_collection_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (collection_source);
	_g_object_unref0 (_data_->collection_source);
	_data_->collection_source = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	tasks_task_model_refresh_collection_co (_data_);
}

static gboolean
tasks_task_model_refresh_collection_finish (TasksTaskModel* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	gboolean result;
	TasksTaskModelRefreshCollectionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static void
tasks_task_model_refresh_collection_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	TasksTaskModelRefreshCollectionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_refresh_collection_co (_data_);
}

static gboolean
tasks_task_model_refresh_collection_co (TasksTaskModelRefreshCollectionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = g_network_monitor_get_default ();
	_data_->_tmp2_ = g_network_monitor_get_network_available (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (_data_->_tmp3_) {
		_data_->_tmp4_ = _data_->self->priv->registry;
		_data_->_tmp5_ = gee_future_get_ready (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp0_ = _data_->_tmp6_;
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		_data_->_tmp7_ = e_source_dup_display_name (_data_->collection_source);
		_data_->_tmp8_ = _data_->_tmp7_;
		g_debug ("TaskModel.vala:241: Scheduling collection refresh '%s'…", _data_->_tmp8_);
		_g_free0 (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->self->priv->registry;
		_data_->_tmp11_ = gee_future_get_value (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = e_source_dup_uid (_data_->collection_source);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_state_ = 1;
		e_source_registry_refresh_backend ((ESourceRegistry*) _data_->_tmp12_, _data_->_tmp14_, _data_->cancellable, tasks_task_model_refresh_collection_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp15_ = e_source_registry_refresh_backend_finish ((ESourceRegistry*) _data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
		_g_free0 (_data_->_tmp14_);
		_data_->_tmp9_ = _data_->_tmp15_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->result = _data_->_tmp9_;
		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;
	}
	_data_->result = FALSE;
	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
tasks_task_model_refresh_task_list_data_free (gpointer _data)
{
	TasksTaskModelRefreshTaskListData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->task_list);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelRefreshTaskListData, _data_);
}

void
tasks_task_model_refresh_task_list (TasksTaskModel* self,
                                    ESource* task_list,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	TasksTaskModelRefreshTaskListData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	_data_ = g_slice_new0 (TasksTaskModelRefreshTaskListData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_refresh_task_list_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data_->task_list);
	_data_->task_list = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	tasks_task_model_refresh_task_list_co (_data_);
}

gboolean
tasks_task_model_refresh_task_list_finish (TasksTaskModel* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	gboolean result;
	TasksTaskModelRefreshTaskListData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static void
tasks_task_model_refresh_task_list_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	TasksTaskModelRefreshTaskListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_refresh_task_list_co (_data_);
}

static gboolean
tasks_task_model_refresh_task_list_co (TasksTaskModelRefreshTaskListData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = g_network_monitor_get_default ();
	_data_->_tmp2_ = g_network_monitor_get_network_available (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (_data_->_tmp3_) {
		_data_->_tmp4_ = _data_->self->priv->task_list_client;
		_data_->_tmp5_ = e_source_dup_uid (_data_->task_list);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp0_ = g_hash_table_contains (_data_->_tmp4_, _data_->_tmp6_);
		_g_free0 (_data_->_tmp6_);
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		_data_->_tmp7_ = _data_->self->priv->task_list_client;
		_data_->_tmp8_ = e_source_dup_uid (_data_->task_list);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = g_hash_table_lookup (_data_->_tmp7_, _data_->_tmp9_);
		_data_->_tmp11_ = _g_object_ref0 ((ECalClient*) _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_g_free0 (_data_->_tmp9_);
		_data_->client = _data_->_tmp12_;
		_data_->_tmp13_ = _data_->client;
		if (e_client_check_refresh_supported ((EClient*) _data_->_tmp13_)) {
			_data_->_tmp14_ = e_source_dup_display_name (_data_->task_list);
			_data_->_tmp15_ = _data_->_tmp14_;
			g_debug ("TaskModel.vala:253: Scheduling task list refresh '%s'…", _data_->_tmp15_);
			_g_free0 (_data_->_tmp15_);
			_data_->_tmp17_ = _data_->client;
			_data_->_state_ = 1;
			e_client_refresh ((EClient*) _data_->_tmp17_, _data_->cancellable, tasks_task_model_refresh_task_list_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp16_ = e_client_refresh_finish ((EClient*) _data_->_tmp17_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->client);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->result = _data_->_tmp16_;
			_g_object_unref0 (_data_->client);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_object_unref0 (_data_->client);
	}
	_data_->result = FALSE;
	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
tasks_task_model_add_task_list_data_free (gpointer _data)
{
	TasksTaskModelAddTaskListData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->task_list);
	_g_object_unref0 (_data_->collection_or_sibling);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelAddTaskListData, _data_);
}

void
tasks_task_model_add_task_list (TasksTaskModel* self,
                                ESource* task_list,
                                ESource* collection_or_sibling,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	TasksTaskModelAddTaskListData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	ESource* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (collection_or_sibling != NULL);
	_data_ = g_slice_new0 (TasksTaskModelAddTaskListData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_add_task_list_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data_->task_list);
	_data_->task_list = _tmp1_;
	_tmp2_ = _g_object_ref0 (collection_or_sibling);
	_g_object_unref0 (_data_->collection_or_sibling);
	_data_->collection_or_sibling = _tmp2_;
	tasks_task_model_add_task_list_co (_data_);
}

void
tasks_task_model_add_task_list_finish (TasksTaskModel* self,
                                       GAsyncResult* _res_,
                                       GError** error)
{
	TasksTaskModelAddTaskListData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
_vala_ENamedParameters_free (ENamedParameters* self)
{
	g_boxed_free (e_named_parameters_get_type (), self);
}

static void
tasks_task_model_add_task_list_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	TasksTaskModelAddTaskListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_add_task_list_co (_data_);
}

static gboolean
tasks_task_model_add_task_list_co (TasksTaskModelAddTaskListData* _data_)
{
	static GQuark _tmp7_label0 = 0;
	static GQuark _tmp7_label1 = 0;
	static GQuark _tmp7_label2 = 0;
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = tasks_task_model_get_registry_sync (_data_->self, &_data_->_inner_error0_);
	_data_->registry = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_TASK_LIST);
	_data_->task_list_extension = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, e_source_task_list_get_type (), ESourceTaskList);
	_data_->_tmp2_ = _data_->registry;
	_data_->_tmp3_ = tasks_task_model_get_collection_backend_name (_data_->self, _data_->collection_or_sibling, _data_->_tmp2_);
	_data_->backend_name = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->backend_name;
	_data_->_tmp5_ = g_utf8_strdown (_data_->_tmp4_, (gssize) -1);
	_data_->_tmp8_ = 0U;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp8_ = (NULL == _data_->_tmp6_) ? 0 : g_quark_from_string (_data_->_tmp6_);
	g_free (_data_->_tmp6_);
	if (_data_->_tmp8_ == ((0 != _tmp7_label0) ? _tmp7_label0 : (_tmp7_label0 = g_quark_from_static_string ("webdav")))) {
		switch (0) {
			default:
			{
				_data_->_tmp9_ = _data_->registry;
				_data_->_tmp10_ = e_source_registry_find_extension (_data_->_tmp9_, _data_->collection_or_sibling, E_SOURCE_EXTENSION_COLLECTION);
				_data_->collection_source = _data_->_tmp10_;
				_data_->_tmp11_ = _data_->collection_source;
				_data_->_tmp12_ = e_webdav_session_new (_data_->_tmp11_);
				_data_->collection_source_webdav_session = _data_->_tmp12_;
				_data_->_tmp13_ = _data_->registry;
				_data_->_tmp14_ = e_source_credentials_provider_new (_data_->_tmp13_);
				_data_->credentials_provider = _data_->_tmp14_;
				_data_->_tmp15_ = _data_->credentials_provider;
				_data_->_tmp16_ = _data_->collection_source;
				_data_->_tmp17_ = NULL;
				e_source_credentials_provider_lookup_sync (_data_->_tmp15_, _data_->_tmp16_, NULL, &_data_->_tmp17_, &_data_->_inner_error0_);
				__vala_ENamedParameters_free0 (_data_->credentials);
				_data_->credentials = _data_->_tmp17_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp18_ = _data_->collection_source_webdav_session;
				_data_->_tmp19_ = _data_->credentials;
				g_object_set ((ESoupSession*) _data_->_tmp18_, "credentials", _data_->_tmp19_, NULL);
				_data_->_tmp20_ = _data_->credentials;
				_data_->_tmp21_ = _data_->collection_source;
				_data_->_state_ = 1;
				tasks_task_model_discover_webdav_server_uri (_data_->self, _data_->_tmp20_, _data_->_tmp21_, tasks_task_model_add_task_list_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp22_ = tasks_task_model_discover_webdav_server_uri_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
				_data_->webdav_task_list_uri = _data_->_tmp22_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				{
					_data_->_tmp24_ = _data_->webdav_task_list_uri;
					_data_->_tmp25_ = g_uuid_string_random ();
					_data_->_tmp26_ = _data_->_tmp25_;
					_data_->_tmp27_ = g_utf8_strup (_data_->_tmp26_, (gssize) -1);
					_data_->_tmp28_ = _data_->_tmp27_;
					_data_->_tmp29_ = g_uri_parse_relative (_data_->_tmp24_, _data_->_tmp28_, G_URI_FLAGS_NONE, &_data_->_inner_error0_);
					_data_->_tmp30_ = _data_->_tmp29_;
					_g_free0 (_data_->_tmp28_);
					_g_free0 (_data_->_tmp26_);
					_data_->_tmp23_ = _data_->_tmp30_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					_data_->_tmp31_ = _data_->_tmp23_;
					_data_->_tmp23_ = NULL;
					_g_uri_unref0 (_data_->webdav_task_list_uri);
					_data_->webdav_task_list_uri = _data_->_tmp31_;
					_g_uri_unref0 (_data_->_tmp23_);
				}
				goto __finally0;
				__catch0_g_error:
				{
					_data_->e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp32_ = _data_->e;
					_data_->_tmp33_ = _data_->_tmp32_->message;
					g_critical ("TaskModel.vala:280: Error parsing relative uri: %s", _data_->_tmp33_);
					_g_error_free0 (_data_->e);
				}
				__finally0:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_uri_unref0 (_data_->webdav_task_list_uri);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp34_ = _data_->collection_source_webdav_session;
				_data_->_tmp35_ = _data_->webdav_task_list_uri;
				_data_->_tmp36_ = g_uri_to_string (_data_->_tmp35_);
				_data_->_tmp37_ = _data_->_tmp36_;
				_data_->_tmp38_ = e_source_get_display_name (_data_->task_list);
				_data_->_tmp39_ = _data_->_tmp38_;
				_data_->_tmp40_ = _data_->task_list_extension;
				_data_->_tmp41_ = e_source_selectable_get_color ((ESourceSelectable*) _data_->_tmp40_);
				_data_->_tmp42_ = _data_->_tmp41_;
				e_webdav_session_mkcalendar_sync (_data_->_tmp34_, _data_->_tmp37_, _data_->_tmp39_, NULL, _data_->_tmp42_, (guint32) E_WEBDAV_RESOURCE_SUPPORTS_TASKS, NULL, &_data_->_inner_error0_);
				_g_free0 (_data_->_tmp37_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_uri_unref0 (_data_->webdav_task_list_uri);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp43_ = _data_->registry;
				_data_->_tmp44_ = _data_->collection_source;
				_data_->_tmp45_ = e_source_get_uid (_data_->_tmp44_);
				_data_->_tmp46_ = _data_->_tmp45_;
				e_source_registry_refresh_backend_sync (_data_->_tmp43_, _data_->_tmp46_, NULL, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_uri_unref0 (_data_->webdav_task_list_uri);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_g_uri_unref0 (_data_->webdav_task_list_uri);
				__vala_ENamedParameters_free0 (_data_->credentials);
				_g_object_unref0 (_data_->credentials_provider);
				_g_object_unref0 (_data_->collection_source_webdav_session);
				_g_object_unref0 (_data_->collection_source);
				break;
			}
		}
	} else if (_data_->_tmp8_ == ((0 != _tmp7_label1) ? _tmp7_label1 : (_tmp7_label1 = g_quark_from_static_string ("google")))) {
		switch (0) {
			default:
			{
				_data_->_tmp47_ = _data_->registry;
				_data_->_tmp48_ = e_source_registry_find_extension (_data_->_tmp47_, _data_->collection_or_sibling, E_SOURCE_EXTENSION_COLLECTION);
				_data_->_vala1_collection_source = _data_->_tmp48_;
				_data_->_tmp49_ = e_gdata_session_new (_data_->collection_or_sibling);
				_data_->session = _data_->_tmp49_;
				{
					_data_->_tmp50_ = _data_->session;
					_data_->_tmp51_ = e_source_get_display_name (_data_->task_list);
					_data_->_tmp52_ = _data_->_tmp51_;
					_data_->_tmp53_ = NULL;
					e_gdata_session_tasklists_insert_sync (_data_->_tmp50_, _data_->_tmp52_, &_data_->_tmp53_, NULL, &_data_->_inner_error0_);
					_json_object_unref0 (_data_->inserted_tasklist);
					_data_->inserted_tasklist = _data_->_tmp53_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_json_object_unref0 (_data_->inserted_tasklist);
						goto __catch1_g_error;
					}
					_json_object_unref0 (_data_->inserted_tasklist);
				}
				goto __finally1;
				__catch1_g_error:
				{
					_data_->_vala1_e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp54_ = _data_->_vala1_e;
					_data_->_tmp55_ = _data_->_tmp54_->message;
					g_critical ("TaskModel.vala:319: Error creating task list: %s", _data_->_tmp55_);
					_g_error_free0 (_data_->_vala1_e);
				}
				__finally1:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->session);
					_g_object_unref0 (_data_->_vala1_collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp56_ = _data_->registry;
				_data_->_tmp57_ = _data_->_vala1_collection_source;
				_data_->_tmp58_ = e_source_get_uid (_data_->_tmp57_);
				_data_->_tmp59_ = _data_->_tmp58_;
				_data_->_state_ = 2;
				e_source_registry_refresh_backend (_data_->_tmp56_, _data_->_tmp59_, NULL, tasks_task_model_add_task_list_ready, _data_);
				return FALSE;
				_state_2:
				e_source_registry_refresh_backend_finish (_data_->_tmp56_, _data_->_res_, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->session);
					_g_object_unref0 (_data_->_vala1_collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_g_object_unref0 (_data_->session);
				_g_object_unref0 (_data_->_vala1_collection_source);
				break;
			}
		}
	} else if (_data_->_tmp8_ == ((0 != _tmp7_label2) ? _tmp7_label2 : (_tmp7_label2 = g_quark_from_static_string ("local")))) {
		switch (0) {
			default:
			{
				e_source_set_parent (_data_->task_list, "local-stub");
				_data_->_tmp60_ = _data_->task_list_extension;
				e_source_backend_set_backend_name ((ESourceBackend*) _data_->_tmp60_, "local");
				_data_->_tmp61_ = _data_->registry;
				e_source_registry_commit_source_sync (_data_->_tmp61_, _data_->task_list, NULL, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				_data_->_tmp62_ = _data_->backend_name;
				_data_->_tmp63_ = g_strdup_printf ("Task list management for '%s' is not supported yet.", _data_->_tmp62_);
				_data_->_tmp64_ = _data_->_tmp63_;
				_data_->_tmp65_ = g_error_new_literal (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_BACKEND_ERROR, _data_->_tmp64_);
				_data_->_tmp66_ = _data_->_tmp65_;
				_g_free0 (_data_->_tmp64_);
				_data_->_inner_error0_ = _data_->_tmp66_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_free0 (_data_->backend_name);
				_g_object_unref0 (_data_->registry);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	_g_free0 (_data_->backend_name);
	_g_object_unref0 (_data_->registry);
	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
tasks_task_model_remove_task_list_data_free (gpointer _data)
{
	TasksTaskModelRemoveTaskListData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->task_list);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelRemoveTaskListData, _data_);
}

void
tasks_task_model_remove_task_list (TasksTaskModel* self,
                                   ESource* task_list,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	TasksTaskModelRemoveTaskListData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	_data_ = g_slice_new0 (TasksTaskModelRemoveTaskListData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_remove_task_list_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data_->task_list);
	_data_->task_list = _tmp1_;
	tasks_task_model_remove_task_list_co (_data_);
}

void
tasks_task_model_remove_task_list_finish (TasksTaskModel* self,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	TasksTaskModelRemoveTaskListData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
tasks_task_model_remove_task_list_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	TasksTaskModelRemoveTaskListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_remove_task_list_co (_data_);
}

static gboolean
tasks_task_model_remove_task_list_co (TasksTaskModelRemoveTaskListData* _data_)
{
	static GQuark _tmp6_label0 = 0;
	static GQuark _tmp6_label1 = 0;
	static GQuark _tmp6_label2 = 0;
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = tasks_task_model_get_registry_sync (_data_->self, &_data_->_inner_error0_);
	_data_->registry = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = _data_->registry;
	_data_->_tmp2_ = tasks_task_model_get_collection_backend_name (_data_->self, _data_->task_list, _data_->_tmp1_);
	_data_->backend_name = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->backend_name;
	_data_->_tmp4_ = g_utf8_strdown (_data_->_tmp3_, (gssize) -1);
	_data_->_tmp7_ = 0U;
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp7_ = (NULL == _data_->_tmp5_) ? 0 : g_quark_from_string (_data_->_tmp5_);
	g_free (_data_->_tmp5_);
	if (_data_->_tmp7_ == ((0 != _tmp6_label0) ? _tmp6_label0 : (_tmp6_label0 = g_quark_from_static_string ("webdav")))) {
		switch (0) {
			default:
			{
				_data_->_tmp8_ = _data_->registry;
				_data_->_tmp9_ = e_source_registry_find_extension (_data_->_tmp8_, _data_->task_list, E_SOURCE_EXTENSION_COLLECTION);
				_data_->collection_source = _data_->_tmp9_;
				_data_->_tmp10_ = _data_->collection_source;
				_data_->_tmp11_ = e_webdav_session_new (_data_->_tmp10_);
				_data_->collection_source_webdav_session = _data_->_tmp11_;
				_data_->_tmp12_ = _data_->registry;
				_data_->_tmp13_ = e_source_credentials_provider_new (_data_->_tmp12_);
				_data_->credentials_provider = _data_->_tmp13_;
				_data_->_tmp14_ = _data_->credentials_provider;
				_data_->_tmp15_ = _data_->collection_source;
				_data_->_tmp16_ = NULL;
				e_source_credentials_provider_lookup_sync (_data_->_tmp14_, _data_->_tmp15_, NULL, &_data_->_tmp16_, &_data_->_inner_error0_);
				__vala_ENamedParameters_free0 (_data_->credentials);
				_data_->credentials = _data_->_tmp16_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp17_ = _data_->collection_source_webdav_session;
				_data_->_tmp18_ = _data_->credentials;
				g_object_set ((ESoupSession*) _data_->_tmp17_, "credentials", _data_->_tmp18_, NULL);
				_data_->_tmp19_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
				_data_->_tmp20_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp19_, e_source_webdav_get_type (), ESourceWebdav));
				_data_->task_list_webdav_extension = _data_->_tmp20_;
				_data_->_tmp21_ = _data_->collection_source_webdav_session;
				_data_->_tmp22_ = _data_->task_list_webdav_extension;
				g_object_get (_data_->_tmp22_, "uri", &_data_->_tmp23_, NULL);
				_data_->_tmp24_ = _data_->_tmp23_;
				_data_->_tmp25_ = _data_->_tmp24_;
				_data_->_tmp26_ = g_uri_to_string (_data_->_tmp25_);
				_data_->_tmp27_ = _data_->_tmp26_;
				e_webdav_session_delete_sync (_data_->_tmp21_, _data_->_tmp27_, E_WEBDAV_DEPTH_THIS_AND_CHILDREN, NULL, NULL, &_data_->_inner_error0_);
				_g_free0 (_data_->_tmp27_);
				_g_uri_unref0 (_data_->_tmp25_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->task_list_webdav_extension);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp28_ = _data_->registry;
				_data_->_tmp29_ = _data_->collection_source;
				_data_->_tmp30_ = e_source_get_uid (_data_->_tmp29_);
				_data_->_tmp31_ = _data_->_tmp30_;
				e_source_registry_refresh_backend_sync (_data_->_tmp28_, _data_->_tmp31_, NULL, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->task_list_webdav_extension);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					_g_object_unref0 (_data_->collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_g_object_unref0 (_data_->task_list_webdav_extension);
				__vala_ENamedParameters_free0 (_data_->credentials);
				_g_object_unref0 (_data_->credentials_provider);
				_g_object_unref0 (_data_->collection_source_webdav_session);
				_g_object_unref0 (_data_->collection_source);
				break;
			}
		}
	} else if (_data_->_tmp7_ == ((0 != _tmp6_label1) ? _tmp6_label1 : (_tmp6_label1 = g_quark_from_static_string ("google")))) {
		switch (0) {
			default:
			{
				_data_->_tmp32_ = _data_->registry;
				_data_->_tmp33_ = e_source_registry_find_extension (_data_->_tmp32_, _data_->task_list, E_SOURCE_EXTENSION_COLLECTION);
				_data_->_vala1_collection_source = _data_->_tmp33_;
				_data_->_tmp34_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_RESOURCE);
				_data_->_tmp35_ = e_source_resource_get_identity (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp34_, e_source_resource_get_type (), ESourceResource));
				_data_->_tmp36_ = _data_->_tmp35_;
				_data_->_tmp37_ = string_replace (_data_->_tmp36_, "gtasks::", "");
				_data_->id = _data_->_tmp37_;
				_data_->_tmp38_ = e_gdata_session_new (_data_->task_list);
				_data_->session = _data_->_tmp38_;
				{
					_data_->_tmp39_ = _data_->session;
					_data_->_tmp40_ = _data_->id;
					e_gdata_session_tasklists_delete_sync (_data_->_tmp39_, _data_->_tmp40_, NULL, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
				}
				goto __finally0;
				__catch0_g_error:
				{
					_data_->e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp41_ = _data_->e;
					_data_->_tmp42_ = _data_->_tmp41_->message;
					g_critical ("TaskModel.vala:390: Error deleting task list: %s", _data_->_tmp42_);
					_g_error_free0 (_data_->e);
				}
				__finally0:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->session);
					_g_free0 (_data_->id);
					_g_object_unref0 (_data_->_vala1_collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp43_ = _data_->registry;
				_data_->_tmp44_ = _data_->_vala1_collection_source;
				_data_->_tmp45_ = e_source_get_uid (_data_->_tmp44_);
				_data_->_tmp46_ = _data_->_tmp45_;
				_data_->_state_ = 1;
				e_source_registry_refresh_backend (_data_->_tmp43_, _data_->_tmp46_, NULL, tasks_task_model_remove_task_list_ready, _data_);
				return FALSE;
				_state_1:
				e_source_registry_refresh_backend_finish (_data_->_tmp43_, _data_->_res_, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->session);
					_g_free0 (_data_->id);
					_g_object_unref0 (_data_->_vala1_collection_source);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_g_object_unref0 (_data_->session);
				_g_free0 (_data_->id);
				_g_object_unref0 (_data_->_vala1_collection_source);
				break;
			}
		}
	} else if (_data_->_tmp7_ == ((0 != _tmp6_label2) ? _tmp6_label2 : (_tmp6_label2 = g_quark_from_static_string ("local")))) {
		switch (0) {
			default:
			{
				e_source_remove_sync (_data_->task_list, NULL, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->backend_name);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				_data_->_tmp47_ = _data_->backend_name;
				_data_->_tmp48_ = g_strdup_printf ("Task list management for '%s' is not supported yet.", _data_->_tmp47_);
				_data_->_tmp49_ = _data_->_tmp48_;
				_data_->_tmp50_ = g_error_new_literal (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_BACKEND_ERROR, _data_->_tmp49_);
				_data_->_tmp51_ = _data_->_tmp50_;
				_g_free0 (_data_->_tmp49_);
				_data_->_inner_error0_ = _data_->_tmp51_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_free0 (_data_->backend_name);
				_g_object_unref0 (_data_->registry);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	_g_free0 (_data_->backend_name);
	_g_object_unref0 (_data_->registry);
	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;
}

gboolean
tasks_task_model_is_add_task_list_supported (TasksTaskModel* self,
                                             ESource* source)
{
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (source != NULL, FALSE);
	{
		ESourceRegistry* registry = NULL;
		ESourceRegistry* _tmp0_;
		gchar* backend_name = NULL;
		ESourceRegistry* _tmp1_;
		gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GQuark _tmp7_ = 0U;
		static GQuark _tmp6_label0 = 0;
		static GQuark _tmp6_label1 = 0;
		static GQuark _tmp6_label2 = 0;
		_tmp0_ = tasks_task_model_get_registry_sync (self, &_inner_error0_);
		registry = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = registry;
		_tmp2_ = tasks_task_model_get_collection_backend_name (self, source, _tmp1_);
		backend_name = _tmp2_;
		_tmp3_ = backend_name;
		_tmp4_ = g_utf8_strdown (_tmp3_, (gssize) -1);
		_tmp5_ = _tmp4_;
		_tmp7_ = (NULL == _tmp5_) ? 0 : g_quark_from_string (_tmp5_);
		g_free (_tmp5_);
		if (_tmp7_ == ((0 != _tmp6_label0) ? _tmp6_label0 : (_tmp6_label0 = g_quark_from_static_string ("webdav")))) {
			switch (0) {
				default:
				{
					result = TRUE;
					_g_free0 (backend_name);
					_g_object_unref0 (registry);
					return result;
				}
			}
		} else if (_tmp7_ == ((0 != _tmp6_label1) ? _tmp6_label1 : (_tmp6_label1 = g_quark_from_static_string ("google")))) {
			switch (0) {
				default:
				{
					result = TRUE;
					_g_free0 (backend_name);
					_g_object_unref0 (registry);
					return result;
				}
			}
		} else if (_tmp7_ == ((0 != _tmp6_label2) ? _tmp6_label2 : (_tmp6_label2 = g_quark_from_static_string ("local")))) {
			switch (0) {
				default:
				{
					result = TRUE;
					_g_free0 (backend_name);
					_g_object_unref0 (registry);
					return result;
				}
			}
		}
		_g_free0 (backend_name);
		_g_object_unref0 (registry);
	}
	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_warning ("TaskModel.vala:417: %s", _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp10_ = FALSE;
		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 _tmp10_;
	}
	result = FALSE;
	return result;
}

gboolean
tasks_task_model_is_remove_task_list_supported (TasksTaskModel* self,
                                                ESource* source)
{
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (source != NULL, FALSE);
	{
		ESourceRegistry* registry = NULL;
		ESourceRegistry* _tmp0_;
		gchar* backend_name = NULL;
		ESourceRegistry* _tmp1_;
		gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GQuark _tmp7_ = 0U;
		static GQuark _tmp6_label0 = 0;
		static GQuark _tmp6_label1 = 0;
		static GQuark _tmp6_label2 = 0;
		_tmp0_ = tasks_task_model_get_registry_sync (self, &_inner_error0_);
		registry = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = registry;
		_tmp2_ = tasks_task_model_get_collection_backend_name (self, source, _tmp1_);
		backend_name = _tmp2_;
		_tmp3_ = backend_name;
		_tmp4_ = g_utf8_strdown (_tmp3_, (gssize) -1);
		_tmp5_ = _tmp4_;
		_tmp7_ = (NULL == _tmp5_) ? 0 : g_quark_from_string (_tmp5_);
		g_free (_tmp5_);
		if (_tmp7_ == ((0 != _tmp6_label0) ? _tmp6_label0 : (_tmp6_label0 = g_quark_from_static_string ("webdav")))) {
			switch (0) {
				default:
				{
					result = TRUE;
					_g_free0 (backend_name);
					_g_object_unref0 (registry);
					return result;
				}
			}
		} else if (_tmp7_ == ((0 != _tmp6_label1) ? _tmp6_label1 : (_tmp6_label1 = g_quark_from_static_string ("google")))) {
			switch (0) {
				default:
				{
					gboolean _tmp8_ = FALSE;
					ESourceRegistry* _tmp9_;
					_tmp9_ = registry;
					_tmp8_ = tasks_task_model_is_gtasks_default_task_list (self, source, _tmp9_, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_g_free0 (backend_name);
						_g_object_unref0 (registry);
						goto __catch0_g_error;
					}
					result = !_tmp8_;
					_g_free0 (backend_name);
					_g_object_unref0 (registry);
					return result;
				}
			}
		} else if (_tmp7_ == ((0 != _tmp6_label2) ? _tmp6_label2 : (_tmp6_label2 = g_quark_from_static_string ("local")))) {
			switch (0) {
				default:
				{
					gboolean _tmp10_;
					gboolean _tmp11_;
					_tmp10_ = e_source_get_removable (source);
					_tmp11_ = _tmp10_;
					result = _tmp11_;
					_g_free0 (backend_name);
					_g_object_unref0 (registry);
					return result;
				}
			}
		}
		_g_free0 (backend_name);
		_g_object_unref0 (registry);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		g_warning ("TaskModel.vala:434: %s", _tmp13_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp14_ = FALSE;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp14_;
	}
	result = FALSE;
	return result;
}

static gboolean
tasks_task_model_is_gtasks_default_task_list (TasksTaskModel* self,
                                              ESource* task_list,
                                              ESourceRegistry* registry,
                                              GError** error)
{
	ESource* collection_source = NULL;
	ESource* _tmp0_;
	gchar* id = NULL;
	ESourceExtension* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	EGDataSession* session = NULL;
	EGDataSession* _tmp5_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (task_list != NULL, FALSE);
	g_return_val_if_fail (registry != NULL, FALSE);
	_tmp0_ = e_source_registry_find_extension (registry, task_list, E_SOURCE_EXTENSION_COLLECTION);
	collection_source = _tmp0_;
	_tmp1_ = e_source_get_extension (task_list, E_SOURCE_EXTENSION_RESOURCE);
	_tmp2_ = e_source_resource_get_identity (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, e_source_resource_get_type (), ESourceResource));
	_tmp3_ = _tmp2_;
	_tmp4_ = string_replace (_tmp3_, "gtasks::", "");
	id = _tmp4_;
	_tmp5_ = e_gdata_session_new (collection_source);
	session = _tmp5_;
	{
		JsonObject* tasklist = NULL;
		JsonObject* _tmp6_ = NULL;
		const gchar* _tmp7_;
		e_gdata_session_tasklists_get_sync (session, "@default", &_tmp6_, NULL, &_inner_error0_);
		_json_object_unref0 (tasklist);
		tasklist = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_json_object_unref0 (tasklist);
			goto __catch0_g_error;
		}
		_tmp7_ = e_gdata_tasklist_get_id (tasklist);
		result = g_strcmp0 (_tmp7_, id) == 0;
		_json_object_unref0 (tasklist);
		_g_object_unref0 (session);
		_g_free0 (id);
		_g_object_unref0 (collection_source);
		return result;
	}
	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_critical ("TaskModel.vala:466: Error deleting task list: %s", _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp10_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (session);
		_g_free0 (id);
		_g_object_unref0 (collection_source);
		return _tmp10_;
	}
	result = FALSE;
	_g_object_unref0 (session);
	_g_free0 (id);
	_g_object_unref0 (collection_source);
	return result;
}

gchar*
tasks_task_model_get_collection_backend_name (TasksTaskModel* self,
                                              ESource* source,
                                              ESourceRegistry* registry)
{
	gchar* backend_name = NULL;
	ESource* collection_source = NULL;
	ESource* _tmp0_;
	ESource* _tmp1_;
	gboolean _tmp9_ = FALSE;
	const gchar* _tmp10_;
	const gchar* _tmp17_ = NULL;
	const gchar* _tmp18_;
	gchar* _tmp20_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (source != NULL, NULL);
	g_return_val_if_fail (registry != NULL, NULL);
	backend_name = NULL;
	_tmp0_ = e_source_registry_find_extension (registry, source, E_SOURCE_EXTENSION_COLLECTION);
	collection_source = _tmp0_;
	_tmp1_ = collection_source;
	if (_tmp1_ != NULL) {
		ESourceCollection* collection_source_extension = NULL;
		ESource* _tmp2_;
		ESourceExtension* _tmp3_;
		ESourceCollection* _tmp4_;
		ESourceCollection* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp2_ = collection_source;
		_tmp3_ = e_source_get_extension (_tmp2_, E_SOURCE_EXTENSION_COLLECTION);
		_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, e_source_collection_get_type (), ESourceCollection));
		collection_source_extension = _tmp4_;
		_tmp5_ = collection_source_extension;
		_tmp6_ = e_source_backend_get_backend_name ((ESourceBackend*) _tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (backend_name);
		backend_name = _tmp8_;
		_g_object_unref0 (collection_source_extension);
	}
	_tmp10_ = backend_name;
	if (_tmp10_ == NULL) {
		_tmp9_ = e_source_has_extension (source, E_SOURCE_EXTENSION_TASK_LIST);
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		ESourceTaskList* source_extension = NULL;
		ESourceExtension* _tmp11_;
		ESourceTaskList* _tmp12_;
		ESourceTaskList* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp11_ = e_source_get_extension (source, E_SOURCE_EXTENSION_TASK_LIST);
		_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, e_source_task_list_get_type (), ESourceTaskList));
		source_extension = _tmp12_;
		_tmp13_ = source_extension;
		_tmp14_ = e_source_backend_get_backend_name ((ESourceBackend*) _tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_strdup (_tmp15_);
		_g_free0 (backend_name);
		backend_name = _tmp16_;
		_g_object_unref0 (source_extension);
	}
	_tmp18_ = backend_name;
	if (_tmp18_ == NULL) {
		_tmp17_ = "";
	} else {
		const gchar* _tmp19_;
		_tmp19_ = backend_name;
		_tmp17_ = _tmp19_;
	}
	_tmp20_ = g_strdup (_tmp17_);
	result = _tmp20_;
	_g_object_unref0 (collection_source);
	_g_free0 (backend_name);
	return result;
}

static void
tasks_task_model_discover_webdav_server_uri_data_free (gpointer _data)
{
	TasksTaskModelDiscoverWebdavServerUriData* _data_;
	_data_ = _data;
	__vala_ENamedParameters_free0 (_data_->credentials);
	_g_uri_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelDiscoverWebdavServerUriData, _data_);
}

static ENamedParameters*
_vala_ENamedParameters_copy (ENamedParameters* self)
{
	return g_boxed_copy (e_named_parameters_get_type (), self);
}

static gpointer
__vala_ENamedParameters_copy0 (gpointer self)
{
	return self ? _vala_ENamedParameters_copy (self) : NULL;
}

static void
tasks_task_model_discover_webdav_server_uri (TasksTaskModel* self,
                                             ENamedParameters* credentials,
                                             ESource* collection_source,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	TasksTaskModelDiscoverWebdavServerUriData* _data_;
	TasksTaskModel* _tmp0_;
	ENamedParameters* _tmp1_;
	ESource* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (credentials != NULL);
	g_return_if_fail (collection_source != NULL);
	_data_ = g_slice_new0 (TasksTaskModelDiscoverWebdavServerUriData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_discover_webdav_server_uri_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = __vala_ENamedParameters_copy0 (credentials);
	__vala_ENamedParameters_free0 (_data_->credentials);
	_data_->credentials = _tmp1_;
	_tmp2_ = _g_object_ref0 (collection_source);
	_g_object_unref0 (_data_->collection_source);
	_data_->collection_source = _tmp2_;
	tasks_task_model_discover_webdav_server_uri_co (_data_);
}

static GUri*
tasks_task_model_discover_webdav_server_uri_finish (TasksTaskModel* self,
                                                    GAsyncResult* _res_,
                                                    GError** error)
{
	GUri* result;
	TasksTaskModelDiscoverWebdavServerUriData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		TasksTaskModel* self;
		self = _data14_->self;
		_g_error_free0 (_data14_->webdav_error);
		_g_uri_unref0 (_data14_->webdav_server_uri);
		_g_object_unref0 (_data14_->collection_source);
		_g_object_unref0 (self);
		g_slice_free (Block14Data, _data14_);
	}
}

static GTlsCertificateFlags*
_g_tls_certificate_flags_dup (GTlsCertificateFlags* self)
{
	GTlsCertificateFlags* dup;
	dup = g_new0 (GTlsCertificateFlags, 1);
	memcpy (dup, self, sizeof (GTlsCertificateFlags));
	return dup;
}

static gpointer
__g_tls_certificate_flags_dup0 (gpointer self)
{
	return self ? _g_tls_certificate_flags_dup (self) : NULL;
}

static void
_vala_EWebDAVDiscoveredSource_free (EWebDAVDiscoveredSource* self)
{
	g_boxed_free (e_webdav_discovered_source_get_type (), self);
}

static void
__vala_EWebDAVDiscoveredSource_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_EWebDAVDiscoveredSource_free (var), NULL));
}

static inline void
_g_slist_free___vala_EWebDAVDiscoveredSource_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) __vala_EWebDAVDiscoveredSource_free0_);
}

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

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

static EWebDAVDiscoveredSource*
_vala_EWebDAVDiscoveredSource_copy (EWebDAVDiscoveredSource* self)
{
	return g_boxed_copy (e_webdav_discovered_source_get_type (), self);
}

static gpointer
__vala_EWebDAVDiscoveredSource_copy0 (gpointer self)
{
	return self ? _vala_EWebDAVDiscoveredSource_copy (self) : NULL;
}

static void
__lambda13_ (Block14Data* _data14_,
             GObject* obj,
             GAsyncResult* res)
{
	TasksTaskModel* self;
	gchar* webdav_certificate_pem = NULL;
	GTlsCertificateFlags* webdav_certificate_errors = NULL;
	GSList* webdav_discovered_sources = NULL;
	GSList* webdav_calendar_user_addresses = NULL;
	GError* _inner_error0_ = NULL;
	self = _data14_->self;
	g_return_if_fail (res != NULL);
	{
		gchar* _tmp0_ = NULL;
		GTlsCertificateFlags _tmp1_ = 0U;
		GSList* _tmp2_ = NULL;
		GSList* _tmp3_ = NULL;
		GTlsCertificateFlags _tmp4_;
		GTlsCertificateFlags* _tmp5_;
		GSList* _tmp6_;
		GUri* _tmp25_;
		e_webdav_discover_sources_finish (_data14_->collection_source, res, &_tmp0_, &_tmp1_, &_tmp2_, &_tmp3_, &_inner_error0_);
		_g_free0 (webdav_certificate_pem);
		webdav_certificate_pem = _tmp0_;
		_g_free0 (webdav_certificate_errors);
		_tmp4_ = _tmp1_;
		_tmp5_ = __g_tls_certificate_flags_dup0 (&_tmp4_);
		webdav_certificate_errors = _tmp5_;
		(webdav_discovered_sources == NULL) ? NULL : (webdav_discovered_sources = (_g_slist_free___vala_EWebDAVDiscoveredSource_free0_ (webdav_discovered_sources), NULL));
		webdav_discovered_sources = _tmp2_;
		(webdav_calendar_user_addresses == NULL) ? NULL : (webdav_calendar_user_addresses = (_g_slist_free__g_free0_ (webdav_calendar_user_addresses), NULL));
		webdav_calendar_user_addresses = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp6_ = webdav_discovered_sources;
		if (g_slist_length (_tmp6_) > ((guint) 0)) {
			EWebDAVDiscoveredSource* webdav_discovered_source = NULL;
			GSList* _tmp7_;
			gconstpointer _tmp8_;
			EWebDAVDiscoveredSource* _tmp9_;
			_tmp7_ = webdav_discovered_sources;
			_tmp8_ = g_slist_nth_data (_tmp7_, (guint) 0);
			_tmp9_ = __vala_EWebDAVDiscoveredSource_copy0 ((EWebDAVDiscoveredSource*) _tmp8_);
			webdav_discovered_source = _tmp9_;
			{
				GUri* _tmp10_ = NULL;
				EWebDAVDiscoveredSource* _tmp11_;
				const gchar* _tmp12_;
				GUri* _tmp13_;
				GUri* _tmp14_;
				_tmp11_ = webdav_discovered_source;
				_tmp12_ = _tmp11_->href;
				_tmp13_ = g_uri_parse (_tmp12_, G_URI_FLAGS_NONE, &_inner_error0_);
				_tmp10_ = _tmp13_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
				_tmp14_ = _tmp10_;
				_tmp10_ = NULL;
				_g_uri_unref0 (_data14_->webdav_server_uri);
				_data14_->webdav_server_uri = _tmp14_;
				_g_uri_unref0 (_tmp10_);
			}
			goto __finally1;
			__catch1_g_error:
			{
				GError* e = NULL;
				EWebDAVDiscoveredSource* _tmp15_;
				const gchar* _tmp16_;
				GError* _tmp17_;
				const gchar* _tmp18_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp15_ = webdav_discovered_source;
				_tmp16_ = _tmp15_->href;
				_tmp17_ = e;
				_tmp18_ = _tmp17_->message;
				g_critical ("TaskModel.vala:541: Error parsing %s: %s", _tmp16_, _tmp18_);
				_g_error_free0 (e);
			}
			__finally1:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				__vala_EWebDAVDiscoveredSource_free0 (webdav_discovered_source);
				goto __catch0_g_error;
			}
			{
				GUri* _tmp19_ = NULL;
				GUri* _tmp20_;
				GUri* _tmp21_;
				GUri* _tmp22_;
				_tmp20_ = _data14_->webdav_server_uri;
				_tmp21_ = g_uri_parse_relative (_tmp20_, "..", G_URI_FLAGS_NONE, &_inner_error0_);
				_tmp19_ = _tmp21_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch2_g_error;
				}
				_tmp22_ = _tmp19_;
				_tmp19_ = NULL;
				_g_uri_unref0 (_data14_->webdav_server_uri);
				_data14_->webdav_server_uri = _tmp22_;
				_g_uri_unref0 (_tmp19_);
			}
			goto __finally2;
			__catch2_g_error:
			{
				GError* e = NULL;
				GError* _tmp23_;
				const gchar* _tmp24_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp23_ = e;
				_tmp24_ = _tmp23_->message;
				g_critical ("TaskModel.vala:547: Error parsing relative uri: %s", _tmp24_);
				_g_error_free0 (e);
			}
			__finally2:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				__vala_EWebDAVDiscoveredSource_free0 (webdav_discovered_source);
				goto __catch0_g_error;
			}
			__vala_EWebDAVDiscoveredSource_free0 (webdav_discovered_source);
		}
		_tmp25_ = _data14_->webdav_server_uri;
		if (_tmp25_ == NULL) {
			GError* _tmp26_;
			_tmp26_ = g_error_new_literal (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_BACKEND_ERROR, "Unable to resolve the WebDAV uri from backend.");
			_inner_error0_ = _tmp26_;
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp27_;
		GError* _tmp28_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp27_ = e;
		_tmp28_ = _g_error_copy0 (_tmp27_);
		_g_error_free0 (_data14_->webdav_error);
		_data14_->webdav_error = _tmp28_;
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		(webdav_calendar_user_addresses == NULL) ? NULL : (webdav_calendar_user_addresses = (_g_slist_free__g_free0_ (webdav_calendar_user_addresses), NULL));
		(webdav_discovered_sources == NULL) ? NULL : (webdav_discovered_sources = (_g_slist_free___vala_EWebDAVDiscoveredSource_free0_ (webdav_discovered_sources), NULL));
		_g_free0 (webdav_certificate_errors);
		_g_free0 (webdav_certificate_pem);
		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;
	}
	tasks_task_model_discover_webdav_server_uri_co (_data14_->_async_data_);
	(webdav_calendar_user_addresses == NULL) ? NULL : (webdav_calendar_user_addresses = (_g_slist_free__g_free0_ (webdav_calendar_user_addresses), NULL));
	(webdav_discovered_sources == NULL) ? NULL : (webdav_discovered_sources = (_g_slist_free___vala_EWebDAVDiscoveredSource_free0_ (webdav_discovered_sources), NULL));
	_g_free0 (webdav_certificate_errors);
	_g_free0 (webdav_certificate_pem);
}

static void
___lambda13__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda13_ (self, source_object, res);
	block14_data_unref (self);
}

static gpointer
_g_uri_ref0 (gpointer self)
{
	return self ? g_uri_ref (self) : NULL;
}

static gboolean
tasks_task_model_discover_webdav_server_uri_co (TasksTaskModelDiscoverWebdavServerUriData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data14_ = g_slice_new0 (Block14Data);
	_data_->_data14_->_ref_count_ = 1;
	_data_->_data14_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data14_->collection_source);
	_data_->_data14_->collection_source = _data_->collection_source;
	_data_->_data14_->_async_data_ = _data_;
	_data_->_tmp0_ = e_source_get_extension (_data_->_data14_->collection_source, E_SOURCE_EXTENSION_COLLECTION);
	_data_->_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp0_, e_source_collection_get_type (), ESourceCollection));
	_data_->collection_source_extension = _data_->_tmp1_;
	_data_->_data14_->webdav_server_uri = NULL;
	_data_->_data14_->webdav_error = NULL;
	_data_->_tmp2_ = _data_->collection_source_extension;
	_data_->_tmp3_ = e_source_collection_get_calendar_url (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	e_webdav_discover_sources (_data_->_data14_->collection_source, _data_->_tmp4_, (guint32) E_WEBDAV_DISCOVER_SUPPORTS_TASKS, _data_->credentials, NULL, ___lambda13__gasync_ready_callback, block14_data_ref (_data_->_data14_));
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp5_ = _data_->_data14_->webdav_error;
	if (_data_->_tmp5_ != NULL) {
		_data_->_tmp6_ = _data_->_data14_->webdav_error;
		_data_->_tmp7_ = _g_error_copy0 (_data_->_tmp6_);
		_data_->_inner_error0_ = _data_->_tmp7_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->collection_source_extension);
		block14_data_unref (_data_->_data14_);
		_data_->_data14_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = _data_->_data14_->webdav_server_uri;
	_data_->_tmp9_ = _g_uri_ref0 (_data_->_tmp8_);
	_data_->result = _data_->_tmp9_;
	_g_object_unref0 (_data_->collection_source_extension);
	block14_data_unref (_data_->_data14_);
	_data_->_data14_ = 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;
}

static void
tasks_task_model_update_task_list_display_name_data_free (gpointer _data)
{
	TasksTaskModelUpdateTaskListDisplayNameData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->task_list);
	_g_free0 (_data_->display_name);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelUpdateTaskListDisplayNameData, _data_);
}

void
tasks_task_model_update_task_list_display_name (TasksTaskModel* self,
                                                ESource* task_list,
                                                const gchar* display_name,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	TasksTaskModelUpdateTaskListDisplayNameData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (display_name != NULL);
	_data_ = g_slice_new0 (TasksTaskModelUpdateTaskListDisplayNameData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_update_task_list_display_name_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data_->task_list);
	_data_->task_list = _tmp1_;
	_tmp2_ = g_strdup (display_name);
	_g_free0 (_data_->display_name);
	_data_->display_name = _tmp2_;
	tasks_task_model_update_task_list_display_name_co (_data_);
}

void
tasks_task_model_update_task_list_display_name_finish (TasksTaskModel* self,
                                                       GAsyncResult* _res_,
                                                       GError** error)
{
	TasksTaskModelUpdateTaskListDisplayNameData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
_vala_EWebDAVPropertyChange_free (EWebDAVPropertyChange* self)
{
	g_boxed_free (e_webdav_property_change_get_type (), self);
}

static void
__vala_EWebDAVPropertyChange_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_EWebDAVPropertyChange_free (var), NULL));
}

static inline void
_g_slist_free___vala_EWebDAVPropertyChange_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) __vala_EWebDAVPropertyChange_free0_);
}

static void
tasks_task_model_update_task_list_display_name_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_)
{
	TasksTaskModelUpdateTaskListDisplayNameData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_update_task_list_display_name_co (_data_);
}

static gboolean
tasks_task_model_update_task_list_display_name_co (TasksTaskModelUpdateTaskListDisplayNameData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = tasks_task_model_get_registry_sync (_data_->self, &_data_->_inner_error0_);
	_data_->registry = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = _data_->registry;
	_data_->_tmp2_ = e_source_registry_find_extension (_data_->_tmp1_, _data_->task_list, E_SOURCE_EXTENSION_COLLECTION);
	_data_->collection_source = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->collection_source;
	if (_data_->_tmp4_ != NULL) {
		_data_->_tmp3_ = e_source_has_extension (_data_->task_list, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
	} else {
		_data_->_tmp3_ = FALSE;
	}
	if (_data_->_tmp3_) {
		_data_->_tmp5_ = e_source_get_uid (_data_->task_list);
		g_debug ("TaskModel.vala:591: WebDAV Rename '%s'", _data_->_tmp5_);
		_data_->_tmp6_ = _data_->collection_source;
		_data_->_tmp7_ = e_webdav_session_new (_data_->_tmp6_);
		_data_->collection_source_webdav_session = _data_->_tmp7_;
		_data_->_tmp8_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
		_data_->source_webdav_extension = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp8_, e_source_webdav_get_type (), ESourceWebdav);
		_data_->_tmp9_ = _data_->registry;
		_data_->_tmp10_ = e_source_credentials_provider_new (_data_->_tmp9_);
		_data_->credentials_provider = _data_->_tmp10_;
		_data_->_tmp11_ = _data_->credentials_provider;
		_data_->_tmp12_ = _data_->collection_source;
		_data_->_tmp13_ = NULL;
		e_source_credentials_provider_lookup_sync (_data_->_tmp11_, _data_->_tmp12_, NULL, &_data_->_tmp13_, &_data_->_inner_error0_);
		__vala_ENamedParameters_free0 (_data_->credentials);
		_data_->credentials = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			__vala_ENamedParameters_free0 (_data_->credentials);
			_g_object_unref0 (_data_->credentials_provider);
			_g_object_unref0 (_data_->collection_source_webdav_session);
			_g_object_unref0 (_data_->collection_source);
			_g_object_unref0 (_data_->registry);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp14_ = _data_->collection_source_webdav_session;
		_data_->_tmp15_ = _data_->credentials;
		g_object_set ((ESoupSession*) _data_->_tmp14_, "credentials", _data_->_tmp15_, NULL);
		_data_->changes = NULL;
		_data_->_tmp16_ = e_webdav_property_change_new_set (E_WEBDAV_NS_DAV, "displayname", _data_->display_name);
		_data_->changes = g_slist_append (_data_->changes, _data_->_tmp16_);
		_data_->_tmp17_ = _data_->collection_source_webdav_session;
		_data_->_tmp18_ = _data_->source_webdav_extension;
		g_object_get (_data_->_tmp18_, "uri", &_data_->_tmp19_, NULL);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = g_uri_to_string (_data_->_tmp21_);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp24_ = _data_->changes;
		e_webdav_session_update_properties_sync (_data_->_tmp17_, _data_->_tmp23_, _data_->_tmp24_, NULL, &_data_->_inner_error0_);
		_g_free0 (_data_->_tmp23_);
		_g_uri_unref0 (_data_->_tmp21_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			(_data_->changes == NULL) ? NULL : (_data_->changes = (_g_slist_free___vala_EWebDAVPropertyChange_free0_ (_data_->changes), NULL));
			__vala_ENamedParameters_free0 (_data_->credentials);
			_g_object_unref0 (_data_->credentials_provider);
			_g_object_unref0 (_data_->collection_source_webdav_session);
			_g_object_unref0 (_data_->collection_source);
			_g_object_unref0 (_data_->registry);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp25_ = _data_->registry;
		_data_->_tmp26_ = _data_->collection_source;
		_data_->_tmp27_ = e_source_get_uid (_data_->_tmp26_);
		_data_->_tmp28_ = _data_->_tmp27_;
		e_source_registry_refresh_backend_sync (_data_->_tmp25_, _data_->_tmp28_, NULL, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			(_data_->changes == NULL) ? NULL : (_data_->changes = (_g_slist_free___vala_EWebDAVPropertyChange_free0_ (_data_->changes), NULL));
			__vala_ENamedParameters_free0 (_data_->credentials);
			_g_object_unref0 (_data_->credentials_provider);
			_g_object_unref0 (_data_->collection_source_webdav_session);
			_g_object_unref0 (_data_->collection_source);
			_g_object_unref0 (_data_->registry);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		(_data_->changes == NULL) ? NULL : (_data_->changes = (_g_slist_free___vala_EWebDAVPropertyChange_free0_ (_data_->changes), NULL));
		__vala_ENamedParameters_free0 (_data_->credentials);
		_g_object_unref0 (_data_->credentials_provider);
		_g_object_unref0 (_data_->collection_source_webdav_session);
	} else {
		_data_->_tmp30_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_TASK_LIST);
		_data_->_tmp31_ = e_source_backend_get_backend_name ((ESourceBackend*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp30_, e_source_task_list_get_type (), ESourceTaskList));
		_data_->_tmp32_ = _data_->_tmp31_;
		if (g_strcmp0 ("gtasks", _data_->_tmp32_) == 0) {
			_data_->_tmp29_ = e_oauth2_services_is_supported ();
		} else {
			_data_->_tmp29_ = FALSE;
		}
		if (_data_->_tmp29_) {
			_data_->_tmp33_ = e_source_get_uid (_data_->task_list);
			g_debug ("TaskModel.vala:626: GTasks Rename '%s'", _data_->_tmp33_);
			_data_->_tmp34_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_RESOURCE);
			_data_->_tmp35_ = e_source_resource_get_identity (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp34_, e_source_resource_get_type (), ESourceResource));
			_data_->_tmp36_ = _data_->_tmp35_;
			_data_->_tmp37_ = string_replace (_data_->_tmp36_, "gtasks::", "");
			_data_->task_list_id = _data_->_tmp37_;
			_data_->_tmp38_ = e_gdata_session_new (_data_->task_list);
			_data_->session = _data_->_tmp38_;
			{
				_data_->_tmp39_ = json_builder_new ();
				_data_->properties = _data_->_tmp39_;
				_data_->_tmp40_ = _data_->properties;
				json_builder_begin_object (_data_->_tmp40_);
				_data_->_tmp41_ = _data_->properties;
				json_builder_set_member_name (_data_->_tmp41_, "title");
				_data_->_tmp42_ = _data_->properties;
				json_builder_add_string_value (_data_->_tmp42_, _data_->display_name);
				_data_->_tmp43_ = _data_->properties;
				json_builder_end_object (_data_->_tmp43_);
				_data_->_tmp44_ = _data_->session;
				_data_->_tmp45_ = _data_->task_list_id;
				_data_->_tmp46_ = _data_->properties;
				_data_->_tmp47_ = NULL;
				e_gdata_session_tasklists_patch_sync (_data_->_tmp44_, _data_->_tmp45_, _data_->_tmp46_, &_data_->_tmp47_, NULL, &_data_->_inner_error0_);
				_json_object_unref0 (_data_->tasklist);
				_data_->tasklist = _data_->_tmp47_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->properties);
					_json_object_unref0 (_data_->tasklist);
					goto __catch0_g_error;
				}
				_g_object_unref0 (_data_->properties);
				_json_object_unref0 (_data_->tasklist);
			}
			goto __finally0;
			__catch0_g_error:
			{
				_data_->e = _data_->_inner_error0_;
				_data_->_inner_error0_ = NULL;
				_data_->_tmp48_ = _data_->e;
				_data_->_tmp49_ = _data_->_tmp48_->message;
				g_critical ("TaskModel.vala:657: Error renaming task list: %s", _data_->_tmp49_);
				_g_error_free0 (_data_->e);
			}
			__finally0:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->session);
				_g_free0 (_data_->task_list_id);
				_g_object_unref0 (_data_->collection_source);
				_g_object_unref0 (_data_->registry);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp50_ = _data_->registry;
			_data_->_tmp51_ = _data_->collection_source;
			_data_->_tmp52_ = e_source_get_uid (_data_->_tmp51_);
			_data_->_tmp53_ = _data_->_tmp52_;
			_data_->_state_ = 1;
			e_source_registry_refresh_backend (_data_->_tmp50_, _data_->_tmp53_, NULL, tasks_task_model_update_task_list_display_name_ready, _data_);
			return FALSE;
			_state_1:
			e_source_registry_refresh_backend_finish (_data_->_tmp50_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->session);
				_g_free0 (_data_->task_list_id);
				_g_object_unref0 (_data_->collection_source);
				_g_object_unref0 (_data_->registry);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_g_object_unref0 (_data_->session);
			_g_free0 (_data_->task_list_id);
		} else {
			_data_->_tmp54_ = e_source_get_parent (_data_->task_list);
			_data_->_tmp55_ = _data_->_tmp54_;
			if (g_strcmp0 (_data_->_tmp55_, "local-stub") == 0) {
				_data_->_tmp56_ = e_source_get_uid (_data_->task_list);
				g_debug ("TaskModel.vala:664: Local Rename '%s'", _data_->_tmp56_);
				e_source_set_display_name (_data_->task_list, _data_->display_name);
				_data_->_tmp57_ = _data_->registry;
				e_source_registry_commit_source_sync (_data_->_tmp57_, _data_->task_list, NULL, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->collection_source);
					_g_object_unref0 (_data_->registry);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			} else {
				_data_->_tmp58_ = g_error_new_literal (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_BACKEND_ERROR, "Renaming tasks list is not supported yet for this type of backend.");
				_data_->_inner_error0_ = _data_->_tmp58_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->collection_source);
				_g_object_unref0 (_data_->registry);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	_g_object_unref0 (_data_->collection_source);
	_g_object_unref0 (_data_->registry);
	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
tasks_task_model_update_task_list_color_data_free (gpointer _data)
{
	TasksTaskModelUpdateTaskListColorData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->task_list);
	_g_free0 (_data_->color);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelUpdateTaskListColorData, _data_);
}

void
tasks_task_model_update_task_list_color (TasksTaskModel* self,
                                         ESource* task_list,
                                         const gchar* color,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	TasksTaskModelUpdateTaskListColorData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (color != NULL);
	_data_ = g_slice_new0 (TasksTaskModelUpdateTaskListColorData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_update_task_list_color_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data_->task_list);
	_data_->task_list = _tmp1_;
	_tmp2_ = g_strdup (color);
	_g_free0 (_data_->color);
	_data_->color = _tmp2_;
	tasks_task_model_update_task_list_color_co (_data_);
}

void
tasks_task_model_update_task_list_color_finish (TasksTaskModel* self,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	TasksTaskModelUpdateTaskListColorData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
tasks_task_model_update_task_list_color_co (TasksTaskModelUpdateTaskListColorData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!e_source_has_extension (_data_->task_list, E_SOURCE_EXTENSION_TASK_LIST)) {
		_data_->_tmp0_ = g_error_new_literal (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_INVALID_ARGUMENT, "Changing the color is not supported by this source.");
		_data_->_inner_error0_ = _data_->_tmp0_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_TASK_LIST);
	_data_->task_list_extension = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, e_source_task_list_get_type (), ESourceTaskList);
	_data_->_tmp2_ = _data_->task_list_extension;
	_data_->_tmp3_ = e_source_selectable_dup_color ((ESourceSelectable*) _data_->_tmp2_);
	_data_->previous_color = _data_->_tmp3_;
	_data_->_tmp4_ = tasks_task_model_get_registry_sync (_data_->self, &_data_->_inner_error0_);
	_data_->registry = _data_->_tmp4_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->previous_color);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = _data_->registry;
	_data_->_tmp6_ = e_source_registry_find_extension (_data_->_tmp5_, _data_->task_list, E_SOURCE_EXTENSION_COLLECTION);
	_data_->collection_source = _data_->_tmp6_;
	_data_->_tmp7_ = g_strdup ("local");
	_data_->backend_name = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->collection_source;
	if (_data_->_tmp8_ != NULL) {
		_data_->_tmp9_ = _data_->collection_source;
		_data_->_tmp10_ = _data_->registry;
		_data_->_tmp11_ = tasks_task_model_get_collection_backend_name (_data_->self, _data_->_tmp9_, _data_->_tmp10_);
		_g_free0 (_data_->backend_name);
		_data_->backend_name = _data_->_tmp11_;
	}
	_data_->_tmp12_ = e_source_get_uid (_data_->task_list);
	g_debug ("TaskModel.vala:689: Update local color for '%s'", _data_->_tmp12_);
	_data_->_tmp13_ = _data_->task_list_extension;
	e_source_selectable_set_color ((ESourceSelectable*) _data_->_tmp13_, _data_->color);
	_data_->_tmp14_ = _data_->registry;
	e_source_registry_commit_source_sync (_data_->_tmp14_, _data_->task_list, NULL, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->backend_name);
		_g_object_unref0 (_data_->collection_source);
		_g_object_unref0 (_data_->registry);
		_g_free0 (_data_->previous_color);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		static GQuark _tmp18_label0 = 0;
		static GQuark _tmp18_label1 = 0;
		_data_->_tmp15_ = _data_->backend_name;
		_data_->_tmp16_ = g_utf8_strdown (_data_->_tmp15_, (gssize) -1);
		_data_->_tmp19_ = 0U;
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp19_ = (NULL == _data_->_tmp17_) ? 0 : g_quark_from_string (_data_->_tmp17_);
		g_free (_data_->_tmp17_);
		if (_data_->_tmp19_ == ((0 != _tmp18_label0) ? _tmp18_label0 : (_tmp18_label0 = g_quark_from_static_string ("webdav")))) {
			switch (0) {
				default:
				{
					_data_->_tmp21_ = _data_->collection_source;
					if (_data_->_tmp21_ == NULL) {
						_data_->_tmp20_ = TRUE;
					} else {
						_data_->_tmp20_ = !e_source_has_extension (_data_->task_list, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
					}
					if (_data_->_tmp20_) {
						_data_->_tmp22_ = g_error_new_literal (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_INVALID_ARGUMENT, "Required information is missing to update the color of this source.");
						_data_->_inner_error0_ = _data_->_tmp22_;
						goto __catch0_g_error;
					}
					_data_->_tmp23_ = _data_->backend_name;
					_data_->_tmp24_ = e_source_get_uid (_data_->task_list);
					g_debug ("TaskModel.vala:699: Update %s color for '%s'", _data_->_tmp23_, _data_->_tmp24_);
					_data_->_tmp25_ = _data_->collection_source;
					_data_->_tmp26_ = e_webdav_session_new (_data_->_tmp25_);
					_data_->collection_source_webdav_session = _data_->_tmp26_;
					_data_->_tmp27_ = e_source_get_extension (_data_->task_list, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
					_data_->source_webdav_extension = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp27_, e_source_webdav_get_type (), ESourceWebdav);
					_data_->_tmp28_ = _data_->registry;
					_data_->_tmp29_ = e_source_credentials_provider_new (_data_->_tmp28_);
					_data_->credentials_provider = _data_->_tmp29_;
					_data_->_tmp30_ = _data_->credentials_provider;
					_data_->_tmp31_ = _data_->collection_source;
					_data_->_tmp32_ = NULL;
					e_source_credentials_provider_lookup_sync (_data_->_tmp30_, _data_->_tmp31_, NULL, &_data_->_tmp32_, &_data_->_inner_error0_);
					__vala_ENamedParameters_free0 (_data_->credentials);
					_data_->credentials = _data_->_tmp32_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						__vala_ENamedParameters_free0 (_data_->credentials);
						_g_object_unref0 (_data_->credentials_provider);
						_g_object_unref0 (_data_->collection_source_webdav_session);
						goto __catch0_g_error;
					}
					_data_->_tmp33_ = _data_->collection_source_webdav_session;
					_data_->_tmp34_ = _data_->credentials;
					g_object_set ((ESoupSession*) _data_->_tmp33_, "credentials", _data_->_tmp34_, NULL);
					_data_->changes = NULL;
					_data_->_tmp35_ = e_webdav_property_change_new_set (E_WEBDAV_NS_ICAL, "calendar-color", _data_->color);
					_data_->changes = g_slist_append (_data_->changes, _data_->_tmp35_);
					_data_->_tmp36_ = _data_->collection_source_webdav_session;
					_data_->_tmp37_ = _data_->source_webdav_extension;
					g_object_get (_data_->_tmp37_, "uri", &_data_->_tmp38_, NULL);
					_data_->_tmp39_ = _data_->_tmp38_;
					_data_->_tmp40_ = _data_->_tmp39_;
					_data_->_tmp41_ = g_uri_to_string (_data_->_tmp40_);
					_data_->_tmp42_ = _data_->_tmp41_;
					_data_->_tmp43_ = _data_->changes;
					e_webdav_session_update_properties_sync (_data_->_tmp36_, _data_->_tmp42_, _data_->_tmp43_, NULL, &_data_->_inner_error0_);
					_g_free0 (_data_->_tmp42_);
					_g_uri_unref0 (_data_->_tmp40_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						(_data_->changes == NULL) ? NULL : (_data_->changes = (_g_slist_free___vala_EWebDAVPropertyChange_free0_ (_data_->changes), NULL));
						__vala_ENamedParameters_free0 (_data_->credentials);
						_g_object_unref0 (_data_->credentials_provider);
						_g_object_unref0 (_data_->collection_source_webdav_session);
						goto __catch0_g_error;
					}
					_data_->_tmp44_ = _data_->registry;
					_data_->_tmp45_ = _data_->collection_source;
					_data_->_tmp46_ = e_source_get_uid (_data_->_tmp45_);
					_data_->_tmp47_ = _data_->_tmp46_;
					e_source_registry_refresh_backend_sync (_data_->_tmp44_, _data_->_tmp47_, NULL, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						(_data_->changes == NULL) ? NULL : (_data_->changes = (_g_slist_free___vala_EWebDAVPropertyChange_free0_ (_data_->changes), NULL));
						__vala_ENamedParameters_free0 (_data_->credentials);
						_g_object_unref0 (_data_->credentials_provider);
						_g_object_unref0 (_data_->collection_source_webdav_session);
						goto __catch0_g_error;
					}
					(_data_->changes == NULL) ? NULL : (_data_->changes = (_g_slist_free___vala_EWebDAVPropertyChange_free0_ (_data_->changes), NULL));
					__vala_ENamedParameters_free0 (_data_->credentials);
					_g_object_unref0 (_data_->credentials_provider);
					_g_object_unref0 (_data_->collection_source_webdav_session);
					break;
				}
			}
		} else if (_data_->_tmp19_ == ((0 != _tmp18_label1) ? _tmp18_label1 : (_tmp18_label1 = g_quark_from_static_string ("local")))) {
			switch (0) {
				default:
				{
					break;
				}
			}
		} else {
			switch (0) {
				default:
				{
					_data_->_tmp48_ = _data_->backend_name;
					_data_->_tmp49_ = g_error_new (TASKS_TASK_MODEL_ERROR, TASKS_TASK_MODEL_ERROR_BACKEND_ERROR, "Updating the list color is not supported for '%s' backends.", _data_->_tmp48_);
					_data_->_inner_error0_ = _data_->_tmp49_;
					goto __catch0_g_error;
				}
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp50_ = e_source_get_uid (_data_->task_list);
		g_debug ("TaskModel.vala:743: Reset local color for '%s'", _data_->_tmp50_);
		_data_->_tmp51_ = _data_->task_list_extension;
		_data_->_tmp52_ = _data_->previous_color;
		e_source_selectable_set_color ((ESourceSelectable*) _data_->_tmp51_, _data_->_tmp52_);
		_data_->_tmp53_ = _data_->registry;
		e_source_registry_commit_source_sync (_data_->_tmp53_, _data_->task_list, NULL, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_error_free0 (_data_->e);
			goto __finally0;
		}
		_data_->_tmp54_ = _data_->e;
		_data_->_tmp55_ = _g_error_copy0 (_data_->_tmp54_);
		_data_->_inner_error0_ = _data_->_tmp55_;
		_g_error_free0 (_data_->e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->backend_name);
		_g_object_unref0 (_data_->collection_source);
		_g_object_unref0 (_data_->registry);
		_g_free0 (_data_->previous_color);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_free0 (_data_->backend_name);
	_g_object_unref0 (_data_->collection_source);
	_g_object_unref0 (_data_->registry);
	_g_free0 (_data_->previous_color);
	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
tasks_task_model_add_task_data_free (gpointer _data)
{
	TasksTaskModelAddTaskData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->list);
	_g_object_unref0 (_data_->task);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelAddTaskData, _data_);
}

void
tasks_task_model_add_task (TasksTaskModel* self,
                           ESource* list,
                           ECalComponent* task,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	TasksTaskModelAddTaskData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	ECalComponent* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (list != NULL);
	g_return_if_fail (task != NULL);
	_data_ = g_slice_new0 (TasksTaskModelAddTaskData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_add_task_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (list);
	_g_object_unref0 (_data_->list);
	_data_->list = _tmp1_;
	_tmp2_ = _g_object_ref0 (task);
	_g_object_unref0 (_data_->task);
	_data_->task = _tmp2_;
	tasks_task_model_add_task_co (_data_);
}

void
tasks_task_model_add_task_finish (TasksTaskModel* self,
                                  GAsyncResult* _res_,
                                  GError** error)
{
	TasksTaskModelAddTaskData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static void
tasks_task_model_add_task_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_)
{
	TasksTaskModelAddTaskData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_add_task_co (_data_);
}

static gboolean
tasks_task_model_add_task_co (TasksTaskModelAddTaskData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = tasks_task_model_get_client (_data_->self, _data_->list, &_data_->_inner_error0_);
	_data_->client = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = e_cal_component_get_icalcomponent (_data_->task);
	_data_->comp = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->comp;
	_data_->_tmp3_ = i_cal_component_get_uid (_data_->_tmp2_);
	_data_->_tmp4_ = string_to_string (_data_->_tmp3_);
	_data_->_tmp5_ = g_strconcat ("Adding task '", _data_->_tmp4_, "'", NULL);
	_data_->_tmp6_ = _data_->_tmp5_;
	g_debug ("TaskModel.vala:754: %s", _data_->_tmp6_);
	_g_free0 (_data_->_tmp6_);
	_data_->_tmp7_ = _data_->client;
	_data_->_tmp8_ = _data_->comp;
	_data_->_tmp9_ = NULL;
	_data_->_state_ = 1;
	e_cal_client_create_object (_data_->_tmp7_, _data_->_tmp8_, E_CAL_OPERATION_FLAG_NONE, NULL, tasks_task_model_add_task_ready, _data_);
	return FALSE;
	_state_1:
	e_cal_client_create_object_finish (_data_->_tmp7_, _data_->_res_, &_data_->_tmp9_, &_data_->_inner_error0_);
	_g_free0 (_data_->uid);
	_data_->uid = _data_->_tmp9_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->uid);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp10_ = _data_->uid;
	if (_data_->_tmp10_ != NULL) {
		_data_->_tmp11_ = _data_->comp;
		_data_->_tmp12_ = _data_->uid;
		i_cal_component_set_uid (_data_->_tmp11_, _data_->_tmp12_);
	}
	_g_free0 (_data_->uid);
	_g_object_unref0 (_data_->client);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tasks_task_model_complete_task_data_free (gpointer _data)
{
	TasksTaskModelCompleteTaskData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->list);
	_g_object_unref0 (_data_->task);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelCompleteTaskData, _data_);
}

void
tasks_task_model_complete_task (TasksTaskModel* self,
                                ESource* list,
                                ECalComponent* task,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	TasksTaskModelCompleteTaskData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	ECalComponent* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (list != NULL);
	g_return_if_fail (task != NULL);
	_data_ = g_slice_new0 (TasksTaskModelCompleteTaskData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_complete_task_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (list);
	_g_object_unref0 (_data_->list);
	_data_->list = _tmp1_;
	_tmp2_ = _g_object_ref0 (task);
	_g_object_unref0 (_data_->task);
	_data_->task = _tmp2_;
	tasks_task_model_complete_task_co (_data_);
}

void
tasks_task_model_complete_task_finish (TasksTaskModel* self,
                                       GAsyncResult* _res_,
                                       GError** error)
{
	TasksTaskModelCompleteTaskData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static Block15Data*
block15_data_ref (Block15Data* _data15_)
{
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}

static void
block15_data_unref (void * _userdata_)
{
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		TasksTaskModel* self;
		self = _data15_->self;
		_g_object_unref0 (_data15_->client);
		_g_object_unref0 (self);
		g_slice_free (Block15Data, _data15_);
	}
}

static void
tasks_task_model_complete_task_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	TasksTaskModelCompleteTaskData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_complete_task_co (_data_);
}

static Block16Data*
block16_data_ref (Block16Data* _data16_)
{
	g_atomic_int_inc (&_data16_->_ref_count_);
	return _data16_;
}

static void
block16_data_unref (void * _userdata_)
{
	Block16Data* _data16_;
	_data16_ = (Block16Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
		TasksTaskModel* self;
		self = _data16_->_data15_->self;
		_g_object_unref0 (_data16_->instance);
		block15_data_unref (_data16_->_data15_);
		_data16_->_data15_ = NULL;
		g_slice_free (Block16Data, _data16_);
	}
}

static void
_vala_ECalComponentAlarmTrigger_free (ECalComponentAlarmTrigger* self)
{
	g_boxed_free (e_cal_component_alarm_trigger_get_type (), self);
}

static void
_vala_ECalComponentAlarm_free (ECalComponentAlarm* self)
{
	g_boxed_free (e_cal_component_alarm_get_type (), self);
}

static void
___lambda15_ (Block16Data* _data16_,
              const gchar* alarm_uid)
{
	Block15Data* _data15_;
	TasksTaskModel* self;
	ECalComponentAlarmTrigger* trigger = NULL;
	ICalDuration* _tmp0_;
	ICalDuration* _tmp1_;
	ECalComponentAlarmTrigger* _tmp2_;
	ECalComponent* _tmp3_;
	ECalComponentAlarm* _tmp4_;
	ECalComponentAlarm* _tmp5_;
	_data15_ = _data16_->_data15_;
	self = _data15_->self;
	g_return_if_fail (alarm_uid != NULL);
	_tmp0_ = i_cal_duration_new_null_duration ();
	_tmp1_ = _tmp0_;
	_tmp2_ = e_cal_component_alarm_trigger_new_relative (E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, _tmp1_);
	__vala_ECalComponentAlarmTrigger_free0 (trigger);
	trigger = _tmp2_;
	_g_object_unref0 (_tmp1_);
	_tmp3_ = _data16_->instance;
	_tmp4_ = e_cal_component_get_alarm (_tmp3_, alarm_uid);
	_tmp5_ = _tmp4_;
	e_cal_component_alarm_set_trigger (_tmp5_, trigger);
	__vala_ECalComponentAlarm_free0 (_tmp5_);
	__vala_ECalComponentAlarmTrigger_free0 (trigger);
}

static void
____lambda15__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda15_ (self, (const gchar*) data);
}

static gboolean
___lambda14_ (Block15Data* _data15_,
              ICalComponent* instance_comp,
              ICalTime* instance_start_timet,
              ICalTime* instance_end_timet,
              GCancellable* cancellable,
              GError** error)
{
	TasksTaskModel* self;
	Block16Data* _data16_;
	ECalComponent* _tmp0_;
	ECalComponent* _tmp1_;
	ICalComponent* _tmp2_;
	ICalTime* _tmp3_;
	ICalTime* _tmp4_;
	gboolean _tmp5_;
	ECalComponent* _tmp8_;
	ECalComponent* _tmp9_;
	ICalTime* _tmp10_;
	ICalTime* _tmp11_;
	ECalComponent* _tmp12_;
	ECalClient* _tmp16_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = _data15_->self;
	g_return_val_if_fail (instance_comp != NULL, FALSE);
	g_return_val_if_fail (instance_start_timet != NULL, FALSE);
	g_return_val_if_fail (instance_end_timet != NULL, FALSE);
	_data16_ = g_slice_new0 (Block16Data);
	_data16_->_ref_count_ = 1;
	_data16_->_data15_ = block15_data_ref (_data15_);
	_tmp0_ = e_cal_component_new ();
	_data16_->instance = _tmp0_;
	_tmp1_ = _data16_->instance;
	_tmp2_ = _g_object_ref0 (instance_comp);
	e_cal_component_set_icalcomponent (_tmp1_, _tmp2_);
	_tmp3_ = i_cal_component_get_due (instance_comp);
	_tmp4_ = _tmp3_;
	_tmp5_ = !i_cal_time_is_null_time (_tmp4_);
	_g_object_unref0 (_tmp4_);
	if (_tmp5_) {
		ICalTime* _tmp6_;
		ICalTime* _tmp7_;
		_tmp6_ = i_cal_component_get_dtstart (instance_comp);
		_tmp7_ = _tmp6_;
		i_cal_component_set_due (instance_comp, _tmp7_);
		_g_object_unref0 (_tmp7_);
	}
	i_cal_component_set_status (instance_comp, I_CAL_STATUS_NONE);
	_tmp8_ = _data16_->instance;
	e_cal_component_set_percent_complete (_tmp8_, 0);
	_tmp9_ = _data16_->instance;
	_tmp10_ = i_cal_time_new_null_time ();
	_tmp11_ = _tmp10_;
	e_cal_component_set_completed (_tmp9_, _tmp11_);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = _data16_->instance;
	if (e_cal_component_has_alarms (_tmp12_)) {
		ECalComponent* _tmp13_;
		GSList* _tmp14_;
		GSList* _tmp15_;
		_tmp13_ = _data16_->instance;
		_tmp14_ = e_cal_component_get_alarm_uids (_tmp13_);
		_tmp15_ = _tmp14_;
		g_slist_foreach (_tmp15_, ____lambda15__gfunc, _data16_);
		(_tmp15_ == NULL) ? NULL : (_tmp15_ = (_g_slist_free__g_free0_ (_tmp15_), NULL));
	}
	_tmp16_ = _data15_->client;
	e_cal_client_modify_object_sync (_tmp16_, instance_comp, E_CAL_OBJ_MOD_THIS_AND_FUTURE, E_CAL_OPERATION_FLAG_NONE, NULL, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp17_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		block16_data_unref (_data16_);
		_data16_ = NULL;
		return _tmp17_;
	}
	result = FALSE;
	block16_data_unref (_data16_);
	_data16_ = NULL;
	return result;
}

static gboolean
____lambda14__ecal_recur_instance_cb (ICalComponent* icomp,
                                      ICalTime* instance_start,
                                      ICalTime* instance_end,
                                      gpointer self,
                                      GCancellable* cancellable,
                                      GError** error)
{
	gboolean result;
	result = ___lambda14_ (self, icomp, instance_start, instance_end, cancellable, error);
	return result;
}

static gboolean
tasks_task_model_complete_task_co (TasksTaskModelCompleteTaskData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data15_ = g_slice_new0 (Block15Data);
	_data_->_data15_->_ref_count_ = 1;
	_data_->_data15_->self = g_object_ref (_data_->self);
	_data_->_data15_->_async_data_ = _data_;
	_data_->_tmp0_ = tasks_task_model_get_client (_data_->self, _data_->list, &_data_->_inner_error0_);
	_data_->_data15_->client = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block15_data_unref (_data_->_data15_);
		_data_->_data15_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = e_cal_component_get_icalcomponent (_data_->task);
	_data_->comp = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->comp;
	_data_->was_completed = i_cal_component_get_status (_data_->_tmp2_) == I_CAL_STATUS_COMPLETED;
	if (_data_->was_completed) {
		if (e_cal_component_is_instance (_data_->task)) {
			_data_->_tmp3_ = "instance";
		} else {
			_data_->_tmp3_ = "task";
		}
		_data_->_tmp4_ = string_to_string (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->comp;
		_data_->_tmp6_ = i_cal_component_get_uid (_data_->_tmp5_);
		_data_->_tmp7_ = string_to_string (_data_->_tmp6_);
		_data_->_tmp8_ = g_strconcat ("Reopen ", _data_->_tmp4_, " '", _data_->_tmp7_, "'", NULL);
		_data_->_tmp9_ = _data_->_tmp8_;
		g_debug ("TaskModel.vala:770: %s", _data_->_tmp9_);
		_g_free0 (_data_->_tmp9_);
		_data_->_tmp10_ = _data_->comp;
		i_cal_component_set_status (_data_->_tmp10_, I_CAL_STATUS_NONE);
		e_cal_component_set_percent_complete (_data_->task, 0);
		_data_->_tmp11_ = i_cal_time_new_null_time ();
		_data_->_tmp12_ = _data_->_tmp11_;
		e_cal_component_set_completed (_data_->task, _data_->_tmp12_);
		_g_object_unref0 (_data_->_tmp12_);
		_data_->_tmp13_ = _data_->_data15_->client;
		_data_->_tmp14_ = _data_->comp;
		_data_->_state_ = 1;
		e_cal_client_modify_object (_data_->_tmp13_, _data_->_tmp14_, E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE, NULL, tasks_task_model_complete_task_ready, _data_);
		return FALSE;
		_state_1:
		e_cal_client_modify_object_finish (_data_->_tmp13_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block15_data_unref (_data_->_data15_);
			_data_->_data15_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	} else {
		if (e_cal_component_is_instance (_data_->task)) {
			_data_->_tmp15_ = "instance";
		} else {
			_data_->_tmp15_ = "task";
		}
		_data_->_tmp16_ = string_to_string (_data_->_tmp15_);
		_data_->_tmp17_ = _data_->comp;
		_data_->_tmp18_ = i_cal_component_get_uid (_data_->_tmp17_);
		_data_->_tmp19_ = string_to_string (_data_->_tmp18_);
		_data_->_tmp20_ = g_strconcat ("Completing ", _data_->_tmp16_, " '", _data_->_tmp19_, "'", NULL);
		_data_->_tmp21_ = _data_->_tmp20_;
		g_debug ("TaskModel.vala:780: %s", _data_->_tmp21_);
		_g_free0 (_data_->_tmp21_);
		_data_->_tmp22_ = _data_->comp;
		i_cal_component_set_status (_data_->_tmp22_, I_CAL_STATUS_COMPLETED);
		e_cal_component_set_percent_complete (_data_->task, 100);
		_data_->_tmp23_ = i_cal_time_new_today ();
		_data_->_tmp24_ = _data_->_tmp23_;
		e_cal_component_set_completed (_data_->task, _data_->_tmp24_);
		_g_object_unref0 (_data_->_tmp24_);
		_data_->_tmp25_ = _data_->_data15_->client;
		_data_->_tmp26_ = _data_->comp;
		_data_->_state_ = 2;
		e_cal_client_modify_object (_data_->_tmp25_, _data_->_tmp26_, E_CAL_OBJ_MOD_THIS_AND_PRIOR, E_CAL_OPERATION_FLAG_NONE, NULL, tasks_task_model_complete_task_ready, _data_);
		return FALSE;
		_state_2:
		e_cal_client_modify_object_finish (_data_->_tmp25_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block15_data_unref (_data_->_data15_);
			_data_->_data15_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	if (e_cal_component_has_recurrences (_data_->task)) {
		_data_->_tmp27_ = !_data_->was_completed;
	} else {
		_data_->_tmp27_ = FALSE;
	}
	if (_data_->_tmp27_) {
		_data_->_tmp28_ = i_cal_duration_new_null_duration ();
		_data_->duration = _data_->_tmp28_;
		_data_->_tmp29_ = _data_->duration;
		i_cal_duration_set_weeks (_data_->_tmp29_, (guint) 520);
		_data_->_tmp30_ = i_cal_time_new_today ();
		_data_->today = _data_->_tmp30_;
		_data_->_tmp31_ = _data_->comp;
		_data_->_tmp32_ = i_cal_component_get_dtstart (_data_->_tmp31_);
		_data_->start = _data_->_tmp32_;
		_data_->_tmp33_ = _data_->today;
		_data_->_tmp34_ = _data_->start;
		if (i_cal_time_compare (_data_->_tmp33_, _data_->_tmp34_) > 0) {
			_data_->_tmp35_ = _data_->today;
			_data_->_tmp36_ = _g_object_ref0 (_data_->_tmp35_);
			_g_object_unref0 (_data_->start);
			_data_->start = _data_->_tmp36_;
		}
		_data_->_tmp37_ = _data_->start;
		_data_->_tmp38_ = _data_->duration;
		_data_->_tmp39_ = i_cal_time_add (_data_->_tmp37_, _data_->_tmp38_);
		_data_->end = _data_->_tmp39_;
		_data_->recur_instance_callback = ____lambda14__ecal_recur_instance_cb;
		_data_->recur_instance_callback_target = block15_data_ref (_data_->_data15_);
		_data_->recur_instance_callback_target_destroy_notify = block15_data_unref;
		_data_->_tmp40_ = _data_->_data15_->client;
		_data_->_tmp41_ = _data_->comp;
		_data_->_tmp42_ = _data_->start;
		_data_->_tmp43_ = _data_->end;
		_data_->_tmp44_ = _data_->recur_instance_callback;
		_data_->_tmp44__target = _data_->recur_instance_callback_target;
		e_cal_client_generate_instances_for_object_sync (_data_->_tmp40_, _data_->_tmp41_, i_cal_time_as_timet (_data_->_tmp42_), i_cal_time_as_timet (_data_->_tmp43_), NULL, _data_->_tmp44_, _data_->_tmp44__target);
		(_data_->recur_instance_callback_target_destroy_notify == NULL) ? NULL : (_data_->recur_instance_callback_target_destroy_notify (_data_->recur_instance_callback_target), NULL);
		_data_->recur_instance_callback = NULL;
		_data_->recur_instance_callback_target = NULL;
		_data_->recur_instance_callback_target_destroy_notify = NULL;
		_g_object_unref0 (_data_->end);
		_g_object_unref0 (_data_->start);
		_g_object_unref0 (_data_->today);
		_g_object_unref0 (_data_->duration);
	}
	block15_data_unref (_data_->_data15_);
	_data_->_data15_ = 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;
}

static void
tasks_task_model_update_task_data_free (gpointer _data)
{
	TasksTaskModelUpdateTaskData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->list);
	_g_object_unref0 (_data_->task);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelUpdateTaskData, _data_);
}

void
tasks_task_model_update_task (TasksTaskModel* self,
                              ESource* list,
                              ECalComponent* task,
                              ECalObjModType mod_type,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	TasksTaskModelUpdateTaskData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	ECalComponent* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (list != NULL);
	g_return_if_fail (task != NULL);
	_data_ = g_slice_new0 (TasksTaskModelUpdateTaskData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_update_task_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (list);
	_g_object_unref0 (_data_->list);
	_data_->list = _tmp1_;
	_tmp2_ = _g_object_ref0 (task);
	_g_object_unref0 (_data_->task);
	_data_->task = _tmp2_;
	_data_->mod_type = mod_type;
	tasks_task_model_update_task_co (_data_);
}

void
tasks_task_model_update_task_finish (TasksTaskModel* self,
                                     GAsyncResult* _res_,
                                     GError** error)
{
	TasksTaskModelUpdateTaskData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tasks_task_model_update_task_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	TasksTaskModelUpdateTaskData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_update_task_co (_data_);
}

static gboolean
tasks_task_model_update_task_co (TasksTaskModelUpdateTaskData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = tasks_task_model_get_client (_data_->self, _data_->list, &_data_->_inner_error0_);
	_data_->client = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = e_cal_component_get_icalcomponent (_data_->task);
	_data_->comp = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->comp;
	_data_->_tmp3_ = i_cal_component_get_uid (_data_->_tmp2_);
	_data_->_tmp4_ = string_to_string (_data_->_tmp3_);
	_data_->_tmp5_ = g_flags_to_string (e_cal_obj_mod_type_get_type (), _data_->mod_type);
	_data_->_tmp6_ = g_strconcat ("Updating task '", _data_->_tmp4_, "' [mod_type=", _data_->_tmp5_, "]", NULL);
	_data_->_tmp7_ = _data_->_tmp6_;
	g_debug ("TaskModel.vala:835: %s", _data_->_tmp7_);
	_g_free0 (_data_->_tmp7_);
	_g_free0 (_data_->_tmp5_);
	_data_->_tmp8_ = _data_->client;
	_data_->_tmp9_ = _data_->comp;
	_data_->_state_ = 1;
	e_cal_client_modify_object (_data_->_tmp8_, _data_->_tmp9_, _data_->mod_type, E_CAL_OPERATION_FLAG_NONE, NULL, tasks_task_model_update_task_ready, _data_);
	return FALSE;
	_state_1:
	e_cal_client_modify_object_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->client);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tasks_task_model_remove_task_data_free (gpointer _data)
{
	TasksTaskModelRemoveTaskData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->list);
	_g_object_unref0 (_data_->task);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelRemoveTaskData, _data_);
}

void
tasks_task_model_remove_task (TasksTaskModel* self,
                              ESource* list,
                              ECalComponent* task,
                              ECalObjModType mod_type,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	TasksTaskModelRemoveTaskData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	ECalComponent* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (list != NULL);
	g_return_if_fail (task != NULL);
	_data_ = g_slice_new0 (TasksTaskModelRemoveTaskData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_remove_task_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (list);
	_g_object_unref0 (_data_->list);
	_data_->list = _tmp1_;
	_tmp2_ = _g_object_ref0 (task);
	_g_object_unref0 (_data_->task);
	_data_->task = _tmp2_;
	_data_->mod_type = mod_type;
	tasks_task_model_remove_task_co (_data_);
}

void
tasks_task_model_remove_task_finish (TasksTaskModel* self,
                                     GAsyncResult* _res_,
                                     GError** error)
{
	TasksTaskModelRemoveTaskData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tasks_task_model_remove_task_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	TasksTaskModelRemoveTaskData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_remove_task_co (_data_);
}

static gboolean
tasks_task_model_remove_task_co (TasksTaskModelRemoveTaskData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = tasks_task_model_get_client (_data_->self, _data_->list, &_data_->_inner_error0_);
	_data_->client = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = e_cal_component_get_icalcomponent (_data_->task);
	_data_->comp = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->comp;
	_data_->_tmp3_ = i_cal_component_get_uid (_data_->_tmp2_);
	_data_->_tmp4_ = g_strdup (_data_->_tmp3_);
	_data_->uid = _data_->_tmp4_;
	if (e_cal_component_has_recurrences (_data_->task)) {
		_g_free0 (_data_->_tmp5_);
		_data_->_tmp5_ = NULL;
	} else {
		_data_->_tmp6_ = e_cal_component_get_recurid_as_string (_data_->task);
		_g_free0 (_data_->_tmp5_);
		_data_->_tmp5_ = _data_->_tmp6_;
	}
	_data_->_tmp7_ = g_strdup (_data_->_tmp5_);
	_data_->rid = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->uid;
	_data_->_tmp9_ = string_to_string (_data_->_tmp8_);
	_data_->_tmp10_ = g_strconcat ("Removing task '", _data_->_tmp9_, "'", NULL);
	_data_->_tmp11_ = _data_->_tmp10_;
	g_debug ("TaskModel.vala:846: %s", _data_->_tmp11_);
	_g_free0 (_data_->_tmp11_);
	_data_->_tmp12_ = _data_->client;
	_data_->_tmp13_ = _data_->uid;
	_data_->_tmp14_ = _data_->rid;
	_data_->_state_ = 1;
	e_cal_client_remove_object (_data_->_tmp12_, _data_->_tmp13_, _data_->_tmp14_, _data_->mod_type, E_CAL_OPERATION_FLAG_NONE, NULL, tasks_task_model_remove_task_ready, _data_);
	return FALSE;
	_state_1:
	e_cal_client_remove_object_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->rid);
		_g_free0 (_data_->_tmp5_);
		_g_free0 (_data_->uid);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_free0 (_data_->rid);
	_g_free0 (_data_->_tmp5_);
	_g_free0 (_data_->uid);
	_g_object_unref0 (_data_->client);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tasks_task_model_move_task_data_free (gpointer _data)
{
	TasksTaskModelMoveTaskData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->source_list);
	_g_object_unref0 (_data_->destination_list);
	_g_free0 (_data_->task_uid);
	_g_object_unref0 (_data_->self);
	g_slice_free (TasksTaskModelMoveTaskData, _data_);
}

void
tasks_task_model_move_task (TasksTaskModel* self,
                            ESource* source_list,
                            ESource* destination_list,
                            const gchar* task_uid,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	TasksTaskModelMoveTaskData* _data_;
	TasksTaskModel* _tmp0_;
	ESource* _tmp1_;
	ESource* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source_list != NULL);
	g_return_if_fail (destination_list != NULL);
	g_return_if_fail (task_uid != NULL);
	_data_ = g_slice_new0 (TasksTaskModelMoveTaskData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tasks_task_model_move_task_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source_list);
	_g_object_unref0 (_data_->source_list);
	_data_->source_list = _tmp1_;
	_tmp2_ = _g_object_ref0 (destination_list);
	_g_object_unref0 (_data_->destination_list);
	_data_->destination_list = _tmp2_;
	_tmp3_ = g_strdup (task_uid);
	_g_free0 (_data_->task_uid);
	_data_->task_uid = _tmp3_;
	tasks_task_model_move_task_co (_data_);
}

gboolean
tasks_task_model_move_task_finish (TasksTaskModel* self,
                                   GAsyncResult* _res_,
                                   GError** error)
{
	gboolean result;
	TasksTaskModelMoveTaskData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static void
tasks_task_model_move_task_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_)
{
	TasksTaskModelMoveTaskData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tasks_task_model_move_task_co (_data_);
}

static inline void
_g_slist_free__g_object_unref0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
_vala_ECalComponentId_free (ECalComponentId* self)
{
	g_boxed_free (e_cal_component_id_get_type (), self);
}

static void
__vala_ECalComponentId_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_ECalComponentId_free (var), NULL));
}

static inline void
_g_slist_free___vala_ECalComponentId_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) __vala_ECalComponentId_free0_);
}

static gboolean
tasks_task_model_move_task_co (TasksTaskModelMoveTaskData* _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_ = tasks_task_model_get_client (_data_->self, _data_->source_list, &_data_->_inner_error0_);
	_data_->source_client = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->source_remove_success = FALSE;
	_data_->_tmp1_ = tasks_task_model_get_client (_data_->self, _data_->destination_list, &_data_->_inner_error0_);
	_data_->destination_client = _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->source_client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->destination_create_success = FALSE;
	_data_->_tmp3_ = _data_->source_client;
	_data_->_tmp4_ = NULL;
	_data_->_state_ = 1;
	e_cal_client_get_objects_for_uid (_data_->_tmp3_, _data_->task_uid, NULL, tasks_task_model_move_task_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp5_ = e_cal_client_get_objects_for_uid_finish (_data_->_tmp3_, _data_->_res_, &_data_->_tmp4_, &_data_->_inner_error0_);
	(_data_->ecal_components == NULL) ? NULL : (_data_->ecal_components = (_g_slist_free__g_object_unref0_ (_data_->ecal_components), NULL));
	_data_->ecal_components = _data_->_tmp4_;
	_data_->_tmp2_ = _data_->_tmp5_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		(_data_->ecal_components == NULL) ? NULL : (_data_->ecal_components = (_g_slist_free__g_object_unref0_ (_data_->ecal_components), NULL));
		_g_object_unref0 (_data_->destination_client);
		_g_object_unref0 (_data_->source_client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (_data_->_tmp2_) {
		_data_->ical_components = NULL;
		_data_->_tmp6_ = _data_->ecal_components;
		{
			_data_->ecal_component_collection = _data_->_tmp6_;
			for (_data_->ecal_component_it = _data_->ecal_component_collection; _data_->ecal_component_it != NULL; _data_->ecal_component_it = _data_->ecal_component_it->next) {
				_data_->_tmp7_ = _g_object_ref0 ((ECalComponent*) _data_->ecal_component_it->data);
				_data_->ecal_component = _data_->_tmp7_;
				{
					_data_->_tmp8_ = _data_->ecal_component;
					_data_->_tmp9_ = e_cal_component_get_icalcomponent (_data_->_tmp8_);
					_data_->ical_component = _data_->_tmp9_;
					_data_->_tmp10_ = _data_->ical_component;
					if (_data_->_tmp10_ != NULL) {
						_data_->_tmp11_ = _data_->ical_component;
						_data_->_tmp12_ = i_cal_component_clone (_data_->_tmp11_);
						_data_->ical_components = g_slist_append (_data_->ical_components, _data_->_tmp12_);
					}
					_g_object_unref0 (_data_->ecal_component);
				}
			}
		}
		_data_->_tmp13_ = _data_->ical_components;
		if (g_slist_length (_data_->_tmp13_) > ((guint) 0)) {
			_data_->_tmp15_ = _data_->destination_client;
			_data_->_tmp16_ = _data_->ical_components;
			_data_->_state_ = 2;
			e_cal_client_create_objects (_data_->_tmp15_, _data_->_tmp16_, E_CAL_OPERATION_FLAG_NONE, NULL, tasks_task_model_move_task_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp14_ = e_cal_client_create_objects_finish (_data_->_tmp15_, _data_->_res_, NULL, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				(_data_->ical_components == NULL) ? NULL : (_data_->ical_components = (_g_slist_free__g_object_unref0_ (_data_->ical_components), NULL));
				(_data_->ecal_components == NULL) ? NULL : (_data_->ecal_components = (_g_slist_free__g_object_unref0_ (_data_->ecal_components), NULL));
				_g_object_unref0 (_data_->destination_client);
				_g_object_unref0 (_data_->source_client);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->destination_create_success = _data_->_tmp14_;
		}
		if (_data_->destination_create_success) {
			_data_->ecal_component_ids = NULL;
			_data_->_tmp17_ = e_cal_component_id_new (_data_->task_uid, NULL);
			_data_->ecal_component_ids = g_slist_append (_data_->ecal_component_ids, _data_->_tmp17_);
			_data_->_tmp19_ = _data_->source_client;
			_data_->_tmp20_ = _data_->ecal_component_ids;
			_data_->_state_ = 3;
			e_cal_client_remove_objects (_data_->_tmp19_, _data_->_tmp20_, E_CAL_OBJ_MOD_ALL, E_CAL_OPERATION_FLAG_NONE, NULL, tasks_task_model_move_task_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp18_ = e_cal_client_remove_objects_finish (_data_->_tmp19_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				(_data_->ecal_component_ids == NULL) ? NULL : (_data_->ecal_component_ids = (_g_slist_free___vala_ECalComponentId_free0_ (_data_->ecal_component_ids), NULL));
				(_data_->ical_components == NULL) ? NULL : (_data_->ical_components = (_g_slist_free__g_object_unref0_ (_data_->ical_components), NULL));
				(_data_->ecal_components == NULL) ? NULL : (_data_->ecal_components = (_g_slist_free__g_object_unref0_ (_data_->ecal_components), NULL));
				_g_object_unref0 (_data_->destination_client);
				_g_object_unref0 (_data_->source_client);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->source_remove_success = _data_->_tmp18_;
			(_data_->ecal_component_ids == NULL) ? NULL : (_data_->ecal_component_ids = (_g_slist_free___vala_ECalComponentId_free0_ (_data_->ecal_component_ids), NULL));
		}
		(_data_->ical_components == NULL) ? NULL : (_data_->ical_components = (_g_slist_free__g_object_unref0_ (_data_->ical_components), NULL));
	}
	if (_data_->destination_create_success) {
		_data_->_tmp21_ = _data_->source_remove_success;
	} else {
		_data_->_tmp21_ = FALSE;
	}
	_data_->result = _data_->_tmp21_;
	(_data_->ecal_components == NULL) ? NULL : (_data_->ecal_components = (_g_slist_free__g_object_unref0_ (_data_->ecal_components), NULL));
	_g_object_unref0 (_data_->destination_client);
	_g_object_unref0 (_data_->source_client);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tasks_task_model_debug_task (TasksTaskModel* self,
                             ESource* task_list,
                             ECalComponent* task)
{
	ICalComponent* comp = NULL;
	ICalComponent* _tmp0_;
	gchar* task_summary = NULL;
	ICalComponent* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* task_uid = NULL;
	ICalComponent* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* task_list_display_name = NULL;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp10_;
	const gchar* _tmp12_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (task != NULL);
	_tmp0_ = e_cal_component_get_icalcomponent (task);
	comp = _tmp0_;
	_tmp1_ = comp;
	_tmp2_ = i_cal_component_get_summary (_tmp1_);
	_tmp3_ = g_strdup (_tmp2_);
	task_summary = _tmp3_;
	_tmp4_ = comp;
	_tmp5_ = i_cal_component_get_uid (_tmp4_);
	_tmp6_ = g_strdup (_tmp5_);
	task_uid = _tmp6_;
	_tmp7_ = e_source_dup_display_name (task_list);
	task_list_display_name = _tmp7_;
	_tmp8_ = task_summary;
	if (_tmp8_ == NULL) {
		gchar* _tmp9_;
		_tmp9_ = g_strdup ("");
		_g_free0 (task_summary);
		task_summary = _tmp9_;
	}
	_tmp10_ = task_uid;
	if (_tmp10_ == NULL) {
		gchar* _tmp11_;
		_tmp11_ = g_strdup ("");
		_g_free0 (task_uid);
		task_uid = _tmp11_;
	}
	_tmp12_ = task_list_display_name;
	if (_tmp12_ == NULL) {
		gchar* _tmp13_;
		_tmp13_ = g_strdup ("");
		_g_free0 (task_list_display_name);
		task_list_display_name = _tmp13_;
	}
	_tmp14_ = task_summary;
	_tmp15_ = string_to_string (_tmp14_);
	_tmp16_ = task_list_display_name;
	_tmp17_ = string_to_string (_tmp16_);
	_tmp18_ = task_uid;
	_tmp19_ = string_to_string (_tmp18_);
	_tmp20_ = g_strconcat ("Task ['", _tmp15_, "', ", _tmp17_, ", ", _tmp19_, "))]", NULL);
	_tmp21_ = _tmp20_;
	g_debug ("TaskModel.vala:897: %s", _tmp21_);
	_g_free0 (_tmp21_);
	_g_free0 (task_list_display_name);
	_g_free0 (task_uid);
	_g_free0 (task_summary);
}

static Block17Data*
block17_data_ref (Block17Data* _data17_)
{
	g_atomic_int_inc (&_data17_->_ref_count_);
	return _data17_;
}

static void
block17_data_unref (void * _userdata_)
{
	Block17Data* _data17_;
	_data17_ = (Block17Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
		TasksTaskModel* self;
		self = _data17_->self;
		_g_object_unref0 (_data17_->client);
		_g_object_unref0 (_data17_->task_list);
		_g_object_unref0 (self);
		g_slice_free (Block17Data, _data17_);
	}
}

static void
__lambda16_ (Block17Data* _data17_,
             GSList* objects)
{
	TasksTaskModel* self;
	ECalClient* _tmp0_;
	self = _data17_->self;
	_tmp0_ = _data17_->client;
	tasks_task_model_on_objects_added (self, _data17_->task_list, _tmp0_, objects, _data17_->on_tasks_added, _data17_->on_tasks_added_target);
}

static void
___lambda16__e_cal_client_view_objects_added (ECalClientView* _sender,
                                              GSList* objects,
                                              gpointer self)
{
	__lambda16_ (self, objects);
}

static void
__lambda19_ (Block17Data* _data17_,
             GSList* objects)
{
	TasksTaskModel* self;
	ECalClient* _tmp0_;
	self = _data17_->self;
	_tmp0_ = _data17_->client;
	tasks_task_model_on_objects_removed (self, _data17_->task_list, _tmp0_, objects, _data17_->on_tasks_removed, _data17_->on_tasks_removed_target);
}

static void
___lambda19__e_cal_client_view_objects_removed (ECalClientView* _sender,
                                                GSList* uids,
                                                gpointer self)
{
	__lambda19_ (self, uids);
}

static void
__lambda20_ (Block17Data* _data17_,
             GSList* objects)
{
	TasksTaskModel* self;
	ECalClient* _tmp0_;
	self = _data17_->self;
	_tmp0_ = _data17_->client;
	tasks_task_model_on_objects_modified (self, _data17_->task_list, _tmp0_, objects, _data17_->on_tasks_modified, _data17_->on_tasks_modified_target);
}

static void
___lambda20__e_cal_client_view_objects_modified (ECalClientView* _sender,
                                                 GSList* objects,
                                                 gpointer self)
{
	__lambda20_ (self, objects);
}

ECalClientView*
tasks_task_model_create_task_list_view (TasksTaskModel* self,
                                        ESource* task_list,
                                        const gchar* query,
                                        TasksTaskModelTasksAddedFunc on_tasks_added,
                                        gpointer on_tasks_added_target,
                                        TasksTaskModelTasksModifiedFunc on_tasks_modified,
                                        gpointer on_tasks_modified_target,
                                        TasksTaskModelTasksRemovedFunc on_tasks_removed,
                                        gpointer on_tasks_removed_target,
                                        GError** error)
{
	Block17Data* _data17_;
	ESource* _tmp0_;
	ECalClient* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	ECalClientView* view = NULL;
	ECalClient* _tmp4_;
	ECalClientView* _tmp5_ = NULL;
	ECalClientView* _tmp6_;
	ECalClientView* _tmp7_;
	ECalClientView* _tmp8_;
	ECalClientView* _tmp9_;
	GError* _inner_error0_ = NULL;
	ECalClientView* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (task_list != NULL, NULL);
	g_return_val_if_fail (query != NULL, NULL);
	_data17_ = g_slice_new0 (Block17Data);
	_data17_->_ref_count_ = 1;
	_data17_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data17_->task_list);
	_data17_->task_list = _tmp0_;
	_data17_->on_tasks_added = on_tasks_added;
	_data17_->on_tasks_added_target = on_tasks_added_target;
	_data17_->on_tasks_modified = on_tasks_modified;
	_data17_->on_tasks_modified_target = on_tasks_modified_target;
	_data17_->on_tasks_removed = on_tasks_removed;
	_data17_->on_tasks_removed_target = on_tasks_removed_target;
	_tmp1_ = tasks_task_model_get_client (self, _data17_->task_list, &_inner_error0_);
	_data17_->client = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		block17_data_unref (_data17_);
		_data17_ = NULL;
		return NULL;
	}
	_tmp2_ = e_source_dup_display_name (_data17_->task_list);
	_tmp3_ = _tmp2_;
	g_debug ("TaskModel.vala:902: Getting view for task list '%s'", _tmp3_);
	_g_free0 (_tmp3_);
	_tmp4_ = _data17_->client;
	e_cal_client_get_view_sync (_tmp4_, query, &_tmp5_, NULL, &_inner_error0_);
	_g_object_unref0 (view);
	view = _tmp5_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (view);
		block17_data_unref (_data17_);
		_data17_ = NULL;
		return NULL;
	}
	_tmp6_ = view;
	g_signal_connect_data (_tmp6_, "objects-added", (GCallback) ___lambda16__e_cal_client_view_objects_added, block17_data_ref (_data17_), (GClosureNotify) block17_data_unref, 0);
	_tmp7_ = view;
	g_signal_connect_data (_tmp7_, "objects-removed", (GCallback) ___lambda19__e_cal_client_view_objects_removed, block17_data_ref (_data17_), (GClosureNotify) block17_data_unref, 0);
	_tmp8_ = view;
	g_signal_connect_data (_tmp8_, "objects-modified", (GCallback) ___lambda20__e_cal_client_view_objects_modified, block17_data_ref (_data17_), (GClosureNotify) block17_data_unref, 0);
	_tmp9_ = view;
	e_cal_client_view_start (_tmp9_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (view);
		block17_data_unref (_data17_);
		_data17_ = NULL;
		return NULL;
	}
	{
		GHashTable* _tmp10_;
		_tmp10_ = self->priv->task_list_client_views;
		g_rec_mutex_lock (&self->priv->__lock_task_list_client_views);
		{
			GeeCollection* views = NULL;
			GHashTable* _tmp11_;
			ECalClient* _tmp12_;
			gconstpointer _tmp13_;
			GeeCollection* _tmp14_;
			GeeCollection* _tmp15_;
			GeeCollection* _tmp18_;
			ECalClientView* _tmp19_;
			GHashTable* _tmp20_;
			ECalClient* _tmp21_;
			ECalClient* _tmp22_;
			GeeCollection* _tmp23_;
			GeeCollection* _tmp24_;
			_tmp11_ = self->priv->task_list_client_views;
			_tmp12_ = _data17_->client;
			_tmp13_ = g_hash_table_lookup (_tmp11_, _tmp12_);
			_tmp14_ = _g_object_ref0 ((GeeCollection*) _tmp13_);
			views = _tmp14_;
			_tmp15_ = views;
			if (_tmp15_ == NULL) {
				GEqualFunc _tmp16_;
				GeeArrayList* _tmp17_;
				_tmp16_ = g_direct_equal;
				_tmp17_ = gee_array_list_new (e_cal_client_view_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeEqualDataFunc) _tmp16_, NULL, NULL);
				_g_object_unref0 (views);
				views = (GeeCollection*) _tmp17_;
			}
			_tmp18_ = views;
			_tmp19_ = view;
			gee_collection_add (_tmp18_, _tmp19_);
			_tmp20_ = self->priv->task_list_client_views;
			_tmp21_ = _data17_->client;
			_tmp22_ = _g_object_ref0 (_tmp21_);
			_tmp23_ = views;
			_tmp24_ = _g_object_ref0 (_tmp23_);
			g_hash_table_insert (_tmp20_, _tmp22_, _tmp24_);
			_g_object_unref0 (views);
		}
		__finally0:
		{
			GHashTable* _tmp25_;
			_tmp25_ = self->priv->task_list_client_views;
			g_rec_mutex_unlock (&self->priv->__lock_task_list_client_views);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (view);
			block17_data_unref (_data17_);
			_data17_ = NULL;
			return NULL;
		}
	}
	result = view;
	block17_data_unref (_data17_);
	_data17_ = NULL;
	return result;
}

void
tasks_task_model_destroy_task_list_view (TasksTaskModel* self,
                                         ECalClientView* view)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (view != NULL);
	{
		e_cal_client_view_stop (view, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning ("TaskModel.vala:930: %s", _tmp1_);
		_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;
	}
	{
		GHashTable* _tmp2_;
		_tmp2_ = self->priv->task_list_client_views;
		g_rec_mutex_lock (&self->priv->__lock_task_list_client_views);
		{
			GeeCollection* views = NULL;
			GHashTable* _tmp3_;
			ECalClient* _tmp4_;
			ECalClient* _tmp5_;
			ECalClient* _tmp6_;
			gconstpointer _tmp7_;
			GeeCollection* _tmp8_;
			GeeCollection* _tmp9_;
			_tmp3_ = self->priv->task_list_client_views;
			g_object_get (view, "client", &_tmp4_, NULL);
			_tmp5_ = _tmp4_;
			_tmp6_ = _tmp5_;
			_tmp7_ = g_hash_table_lookup (_tmp3_, _tmp6_);
			_tmp8_ = (GeeCollection*) _tmp7_;
			_g_object_unref0 (_tmp6_);
			views = _tmp8_;
			_tmp9_ = views;
			if (_tmp9_ != NULL) {
				GeeCollection* _tmp10_;
				_tmp10_ = views;
				gee_collection_remove (_tmp10_, view);
			}
		}
		__finally1:
		{
			GHashTable* _tmp11_;
			_tmp11_ = self->priv->task_list_client_views;
			g_rec_mutex_unlock (&self->priv->__lock_task_list_client_views);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
}

static Block18Data*
block18_data_ref (Block18Data* _data18_)
{
	g_atomic_int_inc (&_data18_->_ref_count_);
	return _data18_;
}

static void
block18_data_unref (void * _userdata_)
{
	Block18Data* _data18_;
	_data18_ = (Block18Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data18_->_ref_count_)) {
		TasksTaskModel* self;
		self = _data18_->self;
		_g_object_unref0 (_data18_->added_tasks);
		_g_object_unref0 (_data18_->task_list);
		_g_object_unref0 (_data18_->client);
		_g_object_unref0 (self);
		g_slice_free (Block18Data, _data18_);
	}
}

static void
___lambda18_ (Block18Data* _data18_,
              ECalComponent* task)
{
	TasksTaskModel* self;
	self = _data18_->self;
	g_return_if_fail (task != NULL);
	tasks_task_model_debug_task (self, _data18_->task_list, task);
	if (!gee_abstract_collection_contains ((GeeAbstractCollection*) _data18_->added_tasks, task)) {
		gee_abstract_collection_add ((GeeAbstractCollection*) _data18_->added_tasks, task);
	}
}

static void
____lambda18__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda18_ (self, (ECalComponent*) data);
}

static void
__lambda17_ (Block18Data* _data18_,
             ICalComponent* ical_comp)
{
	TasksTaskModel* self;
	GError* _inner_error0_ = NULL;
	self = _data18_->self;
	g_return_if_fail (ical_comp != NULL);
	{
		GSList* ecal_tasks = NULL;
		const gchar* _tmp0_;
		GSList* _tmp1_ = NULL;
		_tmp0_ = i_cal_component_get_uid (ical_comp);
		e_cal_client_get_objects_for_uid_sync (_data18_->client, _tmp0_, &_tmp1_, NULL, &_inner_error0_);
		(ecal_tasks == NULL) ? NULL : (ecal_tasks = (_g_slist_free__g_object_unref0_ (ecal_tasks), NULL));
		ecal_tasks = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			(ecal_tasks == NULL) ? NULL : (ecal_tasks = (_g_slist_free__g_object_unref0_ (ecal_tasks), NULL));
			goto __catch0_g_error;
		}
		g_slist_foreach (ecal_tasks, ____lambda18__gfunc, _data18_);
		(ecal_tasks == NULL) ? NULL : (ecal_tasks = (_g_slist_free__g_object_unref0_ (ecal_tasks), NULL));
	}
	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_warning ("TaskModel.vala:959: %s", _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;
	}
}

static void
___lambda17__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda17_ (self, (ICalComponent*) data);
}

static void
tasks_task_model_on_objects_added (TasksTaskModel* self,
                                   ESource* task_list,
                                   ECalClient* client,
                                   GSList* objects,
                                   TasksTaskModelTasksAddedFunc on_tasks_added,
                                   gpointer on_tasks_added_target)
{
	Block18Data* _data18_;
	ESource* _tmp0_;
	ECalClient* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeBidirList* _tmp9_;
	GeeBidirList* _tmp10_;
	GeeBidirList* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (client != NULL);
	_data18_ = g_slice_new0 (Block18Data);
	_data18_->_ref_count_ = 1;
	_data18_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data18_->task_list);
	_data18_->task_list = _tmp0_;
	_tmp1_ = _g_object_ref0 (client);
	_g_object_unref0 (_data18_->client);
	_data18_->client = _tmp1_;
	_tmp2_ = g_strdup_printf ("%u", g_slist_length (objects));
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat ("Received ", _tmp3_, " added task(s) for task list '%s'", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = e_source_dup_display_name (_data18_->task_list);
	_tmp7_ = _tmp6_;
	g_debug (_tmp5_, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_tmp8_ = gee_array_list_new (e_cal_component_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeEqualDataFunc) tasks_util_calcomponent_equal_func, NULL, NULL);
	_data18_->added_tasks = _tmp8_;
	g_slist_foreach (objects, ___lambda17__gfunc, _data18_);
	_tmp9_ = gee_abstract_bidir_list_get_read_only_view ((GeeAbstractBidirList*) _data18_->added_tasks);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	on_tasks_added ((GeeCollection*) _tmp11_, _data18_->task_list, on_tasks_added_target);
	_g_object_unref0 (_tmp11_);
	block18_data_unref (_data18_);
	_data18_ = NULL;
}

static Block19Data*
block19_data_ref (Block19Data* _data19_)
{
	g_atomic_int_inc (&_data19_->_ref_count_);
	return _data19_;
}

static void
block19_data_unref (void * _userdata_)
{
	Block19Data* _data19_;
	_data19_ = (Block19Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data19_->_ref_count_)) {
		TasksTaskModel* self;
		self = _data19_->self;
		_g_object_unref0 (_data19_->updated_tasks);
		_g_object_unref0 (_data19_->task_list);
		_g_object_unref0 (_data19_->client);
		_g_object_unref0 (self);
		g_slice_free (Block19Data, _data19_);
	}
}

static void
___lambda22_ (Block19Data* _data19_,
              ECalComponent* task)
{
	TasksTaskModel* self;
	self = _data19_->self;
	g_return_if_fail (task != NULL);
	tasks_task_model_debug_task (self, _data19_->task_list, task);
	if (!gee_abstract_collection_contains ((GeeAbstractCollection*) _data19_->updated_tasks, task)) {
		gee_abstract_collection_add ((GeeAbstractCollection*) _data19_->updated_tasks, task);
	}
}

static void
____lambda22__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda22_ (self, (ECalComponent*) data);
}

static void
__lambda21_ (Block19Data* _data19_,
             ICalComponent* comp)
{
	TasksTaskModel* self;
	GError* _inner_error0_ = NULL;
	self = _data19_->self;
	g_return_if_fail (comp != NULL);
	{
		GSList* ecal_tasks = NULL;
		const gchar* _tmp0_;
		GSList* _tmp1_ = NULL;
		_tmp0_ = i_cal_component_get_uid (comp);
		e_cal_client_get_objects_for_uid_sync (_data19_->client, _tmp0_, &_tmp1_, NULL, &_inner_error0_);
		(ecal_tasks == NULL) ? NULL : (ecal_tasks = (_g_slist_free__g_object_unref0_ (ecal_tasks), NULL));
		ecal_tasks = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			(ecal_tasks == NULL) ? NULL : (ecal_tasks = (_g_slist_free__g_object_unref0_ (ecal_tasks), NULL));
			goto __catch0_g_error;
		}
		g_slist_foreach (ecal_tasks, ____lambda22__gfunc, _data19_);
		(ecal_tasks == NULL) ? NULL : (ecal_tasks = (_g_slist_free__g_object_unref0_ (ecal_tasks), NULL));
	}
	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_warning ("TaskModel.vala:982: %s", _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;
	}
}

static void
___lambda21__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda21_ (self, (ICalComponent*) data);
}

static void
tasks_task_model_on_objects_modified (TasksTaskModel* self,
                                      ESource* task_list,
                                      ECalClient* client,
                                      GSList* objects,
                                      TasksTaskModelTasksModifiedFunc on_tasks_modified,
                                      gpointer on_tasks_modified_target)
{
	Block19Data* _data19_;
	ESource* _tmp0_;
	ECalClient* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeBidirList* _tmp9_;
	GeeBidirList* _tmp10_;
	GeeBidirList* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (client != NULL);
	_data19_ = g_slice_new0 (Block19Data);
	_data19_->_ref_count_ = 1;
	_data19_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (task_list);
	_g_object_unref0 (_data19_->task_list);
	_data19_->task_list = _tmp0_;
	_tmp1_ = _g_object_ref0 (client);
	_g_object_unref0 (_data19_->client);
	_data19_->client = _tmp1_;
	_tmp2_ = g_strdup_printf ("%u", g_slist_length (objects));
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat ("Received ", _tmp3_, " modified task(s) for task list '%s'", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = e_source_dup_display_name (_data19_->task_list);
	_tmp7_ = _tmp6_;
	g_debug (_tmp5_, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_tmp8_ = gee_array_list_new (e_cal_component_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeEqualDataFunc) tasks_util_calcomponent_equal_func, NULL, NULL);
	_data19_->updated_tasks = _tmp8_;
	g_slist_foreach (objects, ___lambda21__gfunc, _data19_);
	_tmp9_ = gee_abstract_bidir_list_get_read_only_view ((GeeAbstractBidirList*) _data19_->updated_tasks);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	on_tasks_modified ((GeeCollection*) _tmp11_, on_tasks_modified_target);
	_g_object_unref0 (_tmp11_);
	block19_data_unref (_data19_);
	_data19_ = NULL;
}

static void
tasks_task_model_on_objects_removed (TasksTaskModel* self,
                                     ESource* task_list,
                                     ECalClient* client,
                                     GSList* cids,
                                     TasksTaskModelTasksRemovedFunc on_tasks_removed,
                                     gpointer on_tasks_removed_target)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (task_list != NULL);
	g_return_if_fail (client != NULL);
	_tmp0_ = g_strdup_printf ("%u", g_slist_length (cids));
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("Received ", _tmp1_, " removed task(s) for task list '%s'", NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = e_source_dup_display_name (task_list);
	_tmp5_ = _tmp4_;
	g_debug (_tmp3_, _tmp5_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	on_tasks_removed (cids, on_tasks_removed_target);
}

TasksTaskModel*
tasks_task_model_construct (GType object_type)
{
	TasksTaskModel * self = NULL;
	self = (TasksTaskModel*) g_object_new (object_type, NULL);
	return self;
}

TasksTaskModel*
tasks_task_model_new (void)
{
	return tasks_task_model_construct (TASKS_TYPE_TASK_MODEL);
}

static GObject *
tasks_task_model_constructor (GType type,
                              guint n_construct_properties,
                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TasksTaskModel * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashFunc _tmp3_;
	GEqualFunc _tmp4_;
	GHashTable* _tmp5_;
	parent_class = G_OBJECT_CLASS (tasks_task_model_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TASKS_TYPE_TASK_MODEL, TasksTaskModel);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->task_list_client);
	self->priv->task_list_client = _tmp2_;
	_tmp3_ = g_direct_hash;
	_tmp4_ = g_direct_equal;
	_tmp5_ = g_hash_table_new_full (_tmp3_, _tmp4_, _g_object_unref0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->task_list_client_views);
	self->priv->task_list_client_views = _tmp5_;
	return obj;
}

static void
tasks_task_model_class_init (TasksTaskModelClass * klass,
                             gpointer klass_data)
{
	tasks_task_model_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TasksTaskModel_private_offset);
	G_OBJECT_CLASS (klass)->constructor = tasks_task_model_constructor;
	G_OBJECT_CLASS (klass)->finalize = tasks_task_model_finalize;
	tasks_task_model_signals[TASKS_TASK_MODEL_TASK_LIST_ADDED_SIGNAL] = g_signal_new ("task-list-added", TASKS_TYPE_TASK_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, e_source_get_type ());
	tasks_task_model_signals[TASKS_TASK_MODEL_TASK_LIST_MODIFIED_SIGNAL] = g_signal_new ("task-list-modified", TASKS_TYPE_TASK_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, e_source_get_type ());
	tasks_task_model_signals[TASKS_TASK_MODEL_TASK_LIST_REMOVED_SIGNAL] = g_signal_new ("task-list-removed", TASKS_TYPE_TASK_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, e_source_get_type ());
}

static void
tasks_task_model_instance_init (TasksTaskModel * self,
                                gpointer klass)
{
	self->priv = tasks_task_model_get_instance_private (self);
	g_rec_mutex_init (&self->priv->__lock_task_list_client);
	g_rec_mutex_init (&self->priv->__lock_task_list_client_views);
	self->priv->network_changed_debounce_timeout_id = (guint) 0;
}

static void
tasks_task_model_finalize (GObject * obj)
{
	TasksTaskModel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TASKS_TYPE_TASK_MODEL, TasksTaskModel);
	_g_object_unref0 (self->priv->registry);
	g_rec_mutex_clear (&self->priv->__lock_task_list_client);
	_g_hash_table_unref0 (self->priv->task_list_client);
	g_rec_mutex_clear (&self->priv->__lock_task_list_client_views);
	_g_hash_table_unref0 (self->priv->task_list_client_views);
	G_OBJECT_CLASS (tasks_task_model_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tasks_task_model_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TasksTaskModelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tasks_task_model_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TasksTaskModel), 0, (GInstanceInitFunc) tasks_task_model_instance_init, NULL };
	GType tasks_task_model_type_id;
	tasks_task_model_type_id = g_type_register_static (G_TYPE_OBJECT, "TasksTaskModel", &g_define_type_info, 0);
	TasksTaskModel_private_offset = g_type_add_instance_private (tasks_task_model_type_id, sizeof (TasksTaskModelPrivate));
	return tasks_task_model_type_id;
}

GType
tasks_task_model_get_type (void)
{
	static gsize tasks_task_model_type_id__once = 0;
	if (g_once_init_enter (&tasks_task_model_type_id__once)) {
		GType tasks_task_model_type_id;
		tasks_task_model_type_id = tasks_task_model_get_type_once ();
		g_once_init_leave (&tasks_task_model_type_id__once, tasks_task_model_type_id);
	}
	return tasks_task_model_type_id__once;
}

