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

/*
 * Copyright (c) 2011-2019 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, see <http://www.gnu.org/licenses/>.
 */

#include "planify.h"
#include <glib.h>
#include <libedataserver/libedataserver.h>
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <libecal/libecal.h>
#include <gio/gio.h>
#include <float.h>
#include <math.h>
#include <time.h>
#include <libical-glib/libical-glib.h>
#include <langinfo.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	SERVICES_CALENDAR_EVENTS_0_PROPERTY,
	SERVICES_CALENDAR_EVENTS_DATA_RANGE_PROPERTY,
	SERVICES_CALENDAR_EVENTS_MONTH_START_PROPERTY,
	SERVICES_CALENDAR_EVENTS_NUM_WEEKS_PROPERTY,
	SERVICES_CALENDAR_EVENTS_WEEK_STARTS_ON_PROPERTY,
	SERVICES_CALENDAR_EVENTS_SOURCE_COMPONENTS_PROPERTY,
	SERVICES_CALENDAR_EVENTS_REGISTRY_PROPERTY,
	SERVICES_CALENDAR_EVENTS_NUM_PROPERTIES
};
static GParamSpec* services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ServicesCalendarEventsOpenData ServicesCalendarEventsOpenData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block63Data Block63Data;
typedef struct _Block64Data Block64Data;
typedef struct _ServicesCalendarEventsAddSourceAsyncData ServicesCalendarEventsAddSourceAsyncData;
typedef struct _Block65Data Block65Data;
typedef struct _Block66Data Block66Data;
typedef struct _Block67Data Block67Data;
typedef struct _Block68Data Block68Data;
typedef struct _Block69Data Block69Data;
typedef struct _Block70Data Block70Data;
typedef struct _ServicesCalendarEventsGetClientData ServicesCalendarEventsGetClientData;
typedef struct _Block71Data Block71Data;
typedef struct _Block72Data Block72Data;
typedef struct _ServicesCalendarEventsCreateEventData ServicesCalendarEventsCreateEventData;
typedef struct _ServicesCalendarEventsDeleteEventData ServicesCalendarEventsDeleteEventData;
typedef struct _ServicesCalendarEventsUpdateEventData ServicesCalendarEventsUpdateEventData;
enum  {
	SERVICES_CALENDAR_EVENTS_COMPONENTS_ADDED_SIGNAL,
	SERVICES_CALENDAR_EVENTS_COMPONENTS_UPDATED_SIGNAL,
	SERVICES_CALENDAR_EVENTS_COMPONENTS_REMOVED_SIGNAL,
	SERVICES_CALENDAR_EVENTS_NUM_SIGNALS
};
static guint services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _ServicesCalendarEventsPrivate {
	CalendarEventsUtilDateRange* _data_range;
	GDateTime* _month_start;
	gint _num_weeks;
	GDateWeekday _week_starts_on;
	GHashTable* _source_components;
	ESourceRegistry* _registry;
	GHashTable* source_client;
	GRecMutex __lock_source_client;
	GHashTable* source_view;
};

struct _ServicesCalendarEventsOpenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalendarEvents* self;
	ESourceRegistry* _tmp0_;
	ESourceRegistry* _tmp1_;
	ESourceRegistry* _tmp2_;
	ESourceRegistry* _tmp3_;
	ESourceRegistry* _tmp4_;
	GList* _tmp5_;
	GList* _tmp6_;
	GError* _error_;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError* _inner_error0_;
};

struct _Block63Data {
	int _ref_count_;
	ServicesCalendarEvents* self;
	ECalClient* client;
	ESource* source;
};

struct _Block64Data {
	int _ref_count_;
	ServicesCalendarEvents* self;
	ESource* source;
	gpointer _async_data_;
};

struct _ServicesCalendarEventsAddSourceAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalendarEvents* self;
	ESource* source;
	Block64Data* _data64_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	EClient* _tmp2_;
	EClient* _tmp3_;
	ECalClient* client;
	ECalClient* _tmp4_;
	GHashTable* _tmp5_;
	gchar* _tmp6_;
	ECalClient* _tmp7_;
	ECalClient* _tmp8_;
	GError* e;
	GError* _tmp9_;
	const gchar* _tmp10_;
	GError* _inner_error0_;
};

struct _Block65Data {
	int _ref_count_;
	ServicesCalendarEvents* self;
	GeeTreeMultiMap* components;
	GeeArrayList* added_components;
	ESource* source;
	ECalClient* client;
};

struct _Block66Data {
	int _ref_count_;
	Block65Data * _data65_;
	const gchar* uid;
};

struct _Block67Data {
	int _ref_count_;
	ServicesCalendarEvents* self;
	GeeTreeMultiMap* components;
	GeeArrayList* updated_components;
	ESource* source;
	ECalClient* client;
};

struct _Block68Data {
	int _ref_count_;
	Block67Data * _data67_;
	const gchar* uid;
};

struct _Block69Data {
	int _ref_count_;
	ServicesCalendarEvents* self;
	GeeTreeMultiMap* components;
	GeeArrayList* removed_components;
	ESource* source;
};

struct _Block70Data {
	int _ref_count_;
	ServicesCalendarEvents* self;
	GeeArrayList* sources;
};

struct _ServicesCalendarEventsGetClientData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalendarEvents* self;
	gchar* source_uid;
	ECalClient* result;
	ESourceRegistry* _tmp0_;
	ESourceRegistry* _tmp1_;
	ECalClient* client;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	gconstpointer _tmp4_;
	ECalClient* _tmp5_;
	GHashTable* _tmp6_;
	ECalClient* _tmp7_;
	ESource* source;
	ESourceRegistry* _tmp8_;
	ESource* _tmp9_;
	ESource* _tmp10_;
	ESource* _tmp11_;
	GHashTable* _tmp12_;
	GHashTable* _tmp13_;
	gconstpointer _tmp14_;
	ECalClient* _tmp15_;
	GHashTable* _tmp16_;
	ECalClient* _tmp17_;
	GError* _inner_error0_;
};

struct _Block71Data {
	int _ref_count_;
	ServicesCalendarEvents* self;
	ECalClient* client;
	gpointer _async_data_;
};

struct _Block72Data {
	int _ref_count_;
	Block71Data * _data71_;
	gchar* uid;
};

struct _ServicesCalendarEventsCreateEventData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalendarEvents* self;
	gchar* source_uid;
	ObjectsItem* item;
	gchar* result;
	Block71Data* _data71_;
	ECalClient* _tmp0_;
	ECalClient* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	ICalComponent* event;
	ICalComponent* _tmp4_;
	gchar* generated_uid;
	Util* _tmp5_;
	Util* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ICalComponent* _tmp9_;
	const gchar* _tmp10_;
	ICalComponent* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	ICalComponent* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gboolean has_time;
	ObjectsDueDate* _tmp19_;
	ObjectsDueDate* _tmp20_;
	GDateTime* _tmp21_;
	GDateTime* _tmp22_;
	ICalTime* dt_start;
	ICalTime* _tmp23_;
	ICalTime* _tmp24_;
	ObjectsDueDate* _tmp25_;
	ObjectsDueDate* _tmp26_;
	GDateTime* _tmp27_;
	GDateTime* _tmp28_;
	ObjectsDueDate* _tmp29_;
	ObjectsDueDate* _tmp30_;
	GDateTime* _tmp31_;
	GDateTime* _tmp32_;
	ObjectsDueDate* _tmp33_;
	ObjectsDueDate* _tmp34_;
	GDateTime* _tmp35_;
	GDateTime* _tmp36_;
	ICalTime* _tmp37_;
	ObjectsDueDate* _tmp38_;
	ObjectsDueDate* _tmp39_;
	GDateTime* _tmp40_;
	GDateTime* _tmp41_;
	ObjectsDueDate* _tmp42_;
	ObjectsDueDate* _tmp43_;
	GDateTime* _tmp44_;
	GDateTime* _tmp45_;
	ObjectsDueDate* _tmp46_;
	ObjectsDueDate* _tmp47_;
	GDateTime* _tmp48_;
	GDateTime* _tmp49_;
	ICalTime* _tmp50_;
	ICalTime* _tmp51_;
	ICalComponent* _tmp52_;
	ICalTime* _tmp53_;
	ICalComponent* _tmp54_;
	ICalTime* _tmp55_;
	Block72Data* _data72_;
	ECalClient* _tmp56_;
	ICalComponent* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	const gchar* _tmp60_;
	gchar* _tmp61_;
	GError* e;
	GError* _tmp62_;
	const gchar* _tmp63_;
	GError* _inner_error0_;
};

struct _ServicesCalendarEventsDeleteEventData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalendarEvents* self;
	gchar* source_uid;
	gchar* event_uid;
	gboolean result;
	ECalClient* client;
	ECalClient* _tmp0_;
	ECalClient* _tmp1_;
	ECalClient* _tmp2_;
	GError* e;
	GError* _tmp3_;
	const gchar* _tmp4_;
	GError* _inner_error0_;
};

struct _ServicesCalendarEventsUpdateEventData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ServicesCalendarEvents* self;
	gchar* source_uid;
	gchar* event_uid;
	ObjectsItem* item;
	gboolean result;
	ECalClient* client;
	ECalClient* _tmp0_;
	ECalClient* _tmp1_;
	ICalComponent* ical_event;
	ECalClient* _tmp2_;
	ICalComponent* _tmp3_;
	ICalComponent* _tmp4_;
	ICalComponent* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	ICalComponent* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gboolean has_time;
	ObjectsDueDate* _tmp11_;
	ObjectsDueDate* _tmp12_;
	GDateTime* _tmp13_;
	GDateTime* _tmp14_;
	ICalTime* dt_start;
	ICalTime* _tmp15_;
	ICalTime* _tmp16_;
	ObjectsDueDate* _tmp17_;
	ObjectsDueDate* _tmp18_;
	GDateTime* _tmp19_;
	GDateTime* _tmp20_;
	ObjectsDueDate* _tmp21_;
	ObjectsDueDate* _tmp22_;
	GDateTime* _tmp23_;
	GDateTime* _tmp24_;
	ObjectsDueDate* _tmp25_;
	ObjectsDueDate* _tmp26_;
	GDateTime* _tmp27_;
	GDateTime* _tmp28_;
	ICalTime* _tmp29_;
	ObjectsDueDate* _tmp30_;
	ObjectsDueDate* _tmp31_;
	GDateTime* _tmp32_;
	GDateTime* _tmp33_;
	ObjectsDueDate* _tmp34_;
	ObjectsDueDate* _tmp35_;
	GDateTime* _tmp36_;
	GDateTime* _tmp37_;
	ObjectsDueDate* _tmp38_;
	ObjectsDueDate* _tmp39_;
	GDateTime* _tmp40_;
	GDateTime* _tmp41_;
	ICalTime* _tmp42_;
	ICalTime* _tmp43_;
	ICalComponent* _tmp44_;
	ICalTime* _tmp45_;
	ICalComponent* _tmp46_;
	ICalTime* _tmp47_;
	ECalClient* _tmp48_;
	ICalComponent* _tmp49_;
	GError* e;
	GError* _tmp50_;
	const gchar* _tmp51_;
	GError* _inner_error0_;
};

static gint ServicesCalendarEvents_private_offset;
static gpointer services_calendar_events_parent_class = NULL;
static ServicesCalendarEvents* services_calendar_events__instance;
static ServicesCalendarEvents* services_calendar_events__instance = NULL;

static void services_calendar_events_open_data_free (gpointer _data);
static void services_calendar_events_open (ServicesCalendarEvents* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void services_calendar_events_open_finish (ServicesCalendarEvents* self,
                                           GAsyncResult* _res_);
static gboolean services_calendar_events_open_co (ServicesCalendarEventsOpenData* _data_);
static void services_calendar_events_open_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void services_calendar_events_set_registry (ServicesCalendarEvents* self,
                                            ESourceRegistry* value);
static void services_calendar_events_remove_source (ServicesCalendarEvents* self,
                                             ESource* source);
static void _services_calendar_events_remove_source_e_source_registry_source_removed (ESourceRegistry* _sender,
                                                                               ESource* source,
                                                                               gpointer self);
static void ___lambda11_ (ServicesCalendarEvents* self,
                   ESource* source);
static void services_calendar_events_add_source_async (ServicesCalendarEvents* self,
                                                ESource* source,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void services_calendar_events_add_source_finish (ServicesCalendarEvents* self,
                                                 GAsyncResult* _res_);
static void ____lambda11__e_source_registry_source_added (ESourceRegistry* _sender,
                                                   ESource* source,
                                                   gpointer self);
static void ___lambda22_ (ServicesCalendarEvents* self,
                   ESource* source);
static void ____lambda22__gfunc (gconstpointer data,
                          gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void services_calendar_events_load_all_sources (ServicesCalendarEvents* self);
static void services_calendar_events_load_source (ServicesCalendarEvents* self,
                                           ESource* source);
static void services_calendar_events_compute_ranges (ServicesCalendarEvents* self);
static void services_calendar_events_set_data_range (ServicesCalendarEvents* self,
                                              CalendarEventsUtilDateRange* value);
static void services_calendar_events_set_num_weeks (ServicesCalendarEvents* self,
                                             gint value);
static Block63Data* block63_data_ref (Block63Data* _data63_);
static void block63_data_unref (void * _userdata_);
static void __lambda13_ (Block63Data* _data63_,
                  GObject* obj,
                  GAsyncResult* results);
static ECalClientView* services_calendar_events_on_client_view_received (ServicesCalendarEvents* self,
                                                                  GAsyncResult* results,
                                                                  ESource* source,
                                                                  ECalClient* client);
static void __lambda14_ (Block63Data* _data63_,
                  GSList* objects);
static void services_calendar_events_on_objects_added (ServicesCalendarEvents* self,
                                                ESource* source,
                                                ECalClient* client,
                                                GSList* objects);
static void ___lambda14__e_cal_client_view_objects_added (ECalClientView* _sender,
                                                   GSList* objects,
                                                   gpointer self);
static void __lambda17_ (Block63Data* _data63_,
                  GSList* objects);
static void services_calendar_events_on_objects_removed (ServicesCalendarEvents* self,
                                                  ESource* source,
                                                  ECalClient* client,
                                                  GSList* cids);
static void ___lambda17__e_cal_client_view_objects_removed (ECalClientView* _sender,
                                                     GSList* uids,
                                                     gpointer self);
static void __lambda19_ (Block63Data* _data63_,
                  GSList* objects);
static void services_calendar_events_on_objects_modified (ServicesCalendarEvents* self,
                                                   ESource* source,
                                                   ECalClient* client,
                                                   GSList* objects);
static void ___lambda19__e_cal_client_view_objects_modified (ECalClientView* _sender,
                                                      GSList* objects,
                                                      gpointer self);
static void ___lambda13__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void services_calendar_events_add_source_async_data_free (gpointer _data);
static gboolean services_calendar_events_add_source_async_co (ServicesCalendarEventsAddSourceAsyncData* _data_);
static Block64Data* block64_data_ref (Block64Data* _data64_);
static void block64_data_unref (void * _userdata_);
static gboolean __lambda12_ (Block64Data* _data64_);
static gboolean ___lambda12__gsource_func (gpointer self);
static void services_calendar_events_debug_component (ServicesCalendarEvents* self,
                                               ESource* source,
                                               ECalComponent* component);
static Block65Data* block65_data_ref (Block65Data* _data65_);
static void block65_data_unref (void * _userdata_);
static void __lambda15_ (Block65Data* _data65_,
                  ICalComponent* comp);
static Block66Data* block66_data_ref (Block66Data* _data66_);
static void block66_data_unref (void * _userdata_);
static gboolean __lambda16_ (Block66Data* _data66_,
                      ICalComponent* comp,
                      ICalTime* start,
                      ICalTime* end,
                      GError** error);
static gboolean ___lambda16__ecal_recur_instance_cb (ICalComponent* icomp,
                                              ICalTime* instance_start,
                                              ICalTime* instance_end,
                                              gpointer self,
                                              GCancellable* cancellable,
                                              GError** error);
static void ___lambda15__gfunc (gconstpointer data,
                         gpointer self);
static Block67Data* block67_data_ref (Block67Data* _data67_);
static void block67_data_unref (void * _userdata_);
static void __lambda20_ (Block67Data* _data67_,
                  ICalComponent* comp);
static Block68Data* block68_data_ref (Block68Data* _data68_);
static void block68_data_unref (void * _userdata_);
static gboolean __lambda21_ (Block68Data* _data68_,
                      ICalComponent* comp,
                      ICalTime* start,
                      ICalTime* end,
                      GError** error);
static gboolean ___lambda21__ecal_recur_instance_cb (ICalComponent* icomp,
                                              ICalTime* instance_start,
                                              ICalTime* instance_end,
                                              gpointer self,
                                              GCancellable* cancellable,
                                              GError** error);
static void ___lambda20__gfunc (gconstpointer data,
                         gpointer self);
static Block69Data* block69_data_ref (Block69Data* _data69_);
static void block69_data_unref (void * _userdata_);
static void __lambda18_ (Block69Data* _data69_,
                  ECalComponentId* cid);
static void ___lambda18__gfunc (gconstpointer data,
                         gpointer self);
static Block70Data* block70_data_ref (Block70Data* _data70_);
static void block70_data_unref (void * _userdata_);
static void __lambda23_ (Block70Data* _data70_,
                  ESource* source);
static void ___lambda23__gfunc (gconstpointer data,
                         gpointer self);
static void services_calendar_events_get_client_data_free (gpointer _data);
static void services_calendar_events_get_client (ServicesCalendarEvents* self,
                                          const gchar* source_uid,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static ECalClient* services_calendar_events_get_client_finish (ServicesCalendarEvents* self,
                                                        GAsyncResult* _res_);
static gboolean services_calendar_events_get_client_co (ServicesCalendarEventsGetClientData* _data_);
static void services_calendar_events_get_client_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void services_calendar_events_create_event_data_free (gpointer _data);
static gboolean services_calendar_events_create_event_co (ServicesCalendarEventsCreateEventData* _data_);
static Block71Data* block71_data_ref (Block71Data* _data71_);
static void block71_data_unref (void * _userdata_);
static void services_calendar_events_create_event_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static Block72Data* block72_data_ref (Block72Data* _data72_);
static void block72_data_unref (void * _userdata_);
static void ___lambda25_ (Block72Data* _data72_,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda25__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void services_calendar_events_delete_event_data_free (gpointer _data);
static gboolean services_calendar_events_delete_event_co (ServicesCalendarEventsDeleteEventData* _data_);
static void services_calendar_events_delete_event_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static void services_calendar_events_update_event_data_free (gpointer _data);
static gboolean services_calendar_events_update_event_co (ServicesCalendarEventsUpdateEventData* _data_);
static void services_calendar_events_update_event_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static void services_calendar_events_set_source_components (ServicesCalendarEvents* self,
                                                     GHashTable* value);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static GObject * services_calendar_events_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _g_free0_ (gpointer var);
static guint _calendar_events_util_source_hash_func_ghash_func (gconstpointer key);
static gboolean _calendar_events_util_source_equal_func_gequal_func (gconstpointer a,
                                                              gconstpointer b);
static void services_calendar_events_finalize (GObject * obj);
static GType services_calendar_events_get_type_once (void);
static void _vala_services_calendar_events_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_services_calendar_events_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
services_calendar_events_get_instance_private (ServicesCalendarEvents* self)
{
	return G_STRUCT_MEMBER_P (self, ServicesCalendarEvents_private_offset);
}

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

ServicesCalendarEvents*
services_calendar_events_get_default (void)
{
	ServicesCalendarEvents* _tmp0_;
	ServicesCalendarEvents* _tmp4_;
	ServicesCalendarEvents* _tmp5_;
	ServicesCalendarEvents* result;
	_tmp0_ = services_calendar_events__instance;
	if (_tmp0_ == NULL) {
		GDateTime* _tmp1_;
		GDateTime* _tmp2_;
		ServicesCalendarEvents* _tmp3_;
		_tmp1_ = g_date_time_new_now_local ();
		_tmp2_ = _tmp1_;
		_tmp3_ = services_calendar_events_new (_tmp2_);
		_g_object_unref0 (services_calendar_events__instance);
		services_calendar_events__instance = _tmp3_;
		_g_date_time_unref0 (_tmp2_);
	}
	_tmp4_ = services_calendar_events__instance;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	result = _tmp5_;
	return result;
}

ServicesCalendarEvents*
services_calendar_events_construct (GType object_type,
                                    GDateTime* month_start)
{
	ServicesCalendarEvents * self = NULL;
	g_return_val_if_fail (month_start != NULL, NULL);
	self = (ServicesCalendarEvents*) g_object_new (object_type, "month-start", month_start, NULL);
	return self;
}

ServicesCalendarEvents*
services_calendar_events_new (GDateTime* month_start)
{
	return services_calendar_events_construct (SERVICES_TYPE_CALENDAR_EVENTS, month_start);
}

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

static void
services_calendar_events_open (ServicesCalendarEvents* self,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	ServicesCalendarEventsOpenData* _data_;
	ServicesCalendarEvents* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ServicesCalendarEventsOpenData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_calendar_events_open_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	services_calendar_events_open_co (_data_);
}

static void
services_calendar_events_open_finish (ServicesCalendarEvents* self,
                                      GAsyncResult* _res_)
{
	ServicesCalendarEventsOpenData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
services_calendar_events_open_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	ServicesCalendarEventsOpenData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_calendar_events_open_co (_data_);
}

static void
_services_calendar_events_remove_source_e_source_registry_source_removed (ESourceRegistry* _sender,
                                                                          ESource* source,
                                                                          gpointer self)
{
	services_calendar_events_remove_source ((ServicesCalendarEvents*) self, source);
}

static void
___lambda11_ (ServicesCalendarEvents* self,
              ESource* source)
{
	g_return_if_fail (source != NULL);
	services_calendar_events_add_source_async (self, source, NULL, NULL);
}

static void
____lambda11__e_source_registry_source_added (ESourceRegistry* _sender,
                                              ESource* source,
                                              gpointer self)
{
	___lambda11_ ((ServicesCalendarEvents*) self, source);
}

static void
___lambda22_ (ServicesCalendarEvents* self,
              ESource* source)
{
	ESourceCalendar* cal = NULL;
	ESourceExtension* _tmp0_;
	ESourceCalendar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	ESourceCalendar* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	g_return_if_fail (source != NULL);
	_tmp0_ = e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, e_source_calendar_get_type (), ESourceCalendar));
	cal = _tmp1_;
	_tmp3_ = cal;
	_tmp4_ = e_source_selectable_get_selected ((ESourceSelectable*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == TRUE) {
		gboolean _tmp6_;
		gboolean _tmp7_;
		_tmp6_ = e_source_get_enabled (source);
		_tmp7_ = _tmp6_;
		_tmp2_ = _tmp7_ == TRUE;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		services_calendar_events_add_source_async (self, source, NULL, NULL);
	}
	_g_object_unref0 (cal);
}

static void
____lambda22__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda22_ ((ServicesCalendarEvents*) 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 gboolean
services_calendar_events_open_co (ServicesCalendarEventsOpenData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_state_ = 1;
		e_source_registry_new (NULL, services_calendar_events_open_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = e_source_registry_new_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp0_ = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		services_calendar_events_set_registry (_data_->self, _data_->_tmp0_);
		_data_->_tmp2_ = _data_->self->priv->_registry;
		g_signal_connect_object (_data_->_tmp2_, "source-removed", (GCallback) _services_calendar_events_remove_source_e_source_registry_source_removed, _data_->self, 0);
		_data_->_tmp3_ = _data_->self->priv->_registry;
		g_signal_connect_object (_data_->_tmp3_, "source-added", (GCallback) ____lambda11__e_source_registry_source_added, _data_->self, 0);
		_data_->_tmp4_ = _data_->self->priv->_registry;
		_data_->_tmp5_ = e_source_registry_list_sources (_data_->_tmp4_, E_SOURCE_EXTENSION_CALENDAR);
		_data_->_tmp6_ = _data_->_tmp5_;
		g_list_foreach (_data_->_tmp6_, ____lambda22__gfunc, _data_->self);
		(_data_->_tmp6_ == NULL) ? NULL : (_data_->_tmp6_ = (_g_list_free__g_object_unref0_ (_data_->_tmp6_), NULL));
		services_calendar_events_load_all_sources (_data_->self);
		_g_object_unref0 (_data_->_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->_error_;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_critical ("CalendarEvents.vala:96: %s", _data_->_tmp8_);
		_g_error_free0 (_data_->_error_);
	}
	__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 void
services_calendar_events_load_all_sources (ServicesCalendarEvents* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GHashTable* _tmp0_;
		_tmp0_ = self->priv->source_client;
		g_rec_mutex_lock (&self->priv->__lock_source_client);
		{
			GHashTable* _tmp1_;
			GList* _tmp2_;
			_tmp1_ = self->priv->source_client;
			_tmp2_ = g_hash_table_get_keys (_tmp1_);
			{
				GList* id_collection = NULL;
				GList* id_it = NULL;
				id_collection = _tmp2_;
				for (id_it = id_collection; id_it != NULL; id_it = id_it->next) {
					const gchar* id = NULL;
					id = (const gchar*) id_it->data;
					{
						ESource* source = NULL;
						ESourceRegistry* _tmp3_;
						const gchar* _tmp4_;
						ESource* _tmp5_;
						ESourceTaskList* list = NULL;
						ESource* _tmp6_;
						ESourceExtension* _tmp7_;
						ESourceTaskList* _tmp8_;
						gboolean _tmp9_ = FALSE;
						ESourceTaskList* _tmp10_;
						gboolean _tmp11_;
						gboolean _tmp12_;
						_tmp3_ = self->priv->_registry;
						_tmp4_ = id;
						_tmp5_ = e_source_registry_ref_source (_tmp3_, _tmp4_);
						source = _tmp5_;
						_tmp6_ = source;
						_tmp7_ = e_source_get_extension (_tmp6_, E_SOURCE_EXTENSION_TASK_LIST);
						_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, e_source_task_list_get_type (), ESourceTaskList));
						list = _tmp8_;
						_tmp10_ = list;
						_tmp11_ = e_source_selectable_get_selected ((ESourceSelectable*) _tmp10_);
						_tmp12_ = _tmp11_;
						if (_tmp12_ == TRUE) {
							ESource* _tmp13_;
							gboolean _tmp14_;
							gboolean _tmp15_;
							_tmp13_ = source;
							_tmp14_ = e_source_get_enabled (_tmp13_);
							_tmp15_ = _tmp14_;
							_tmp9_ = _tmp15_ == TRUE;
						} else {
							_tmp9_ = FALSE;
						}
						if (_tmp9_) {
							ESource* _tmp16_;
							_tmp16_ = source;
							services_calendar_events_load_source (self, _tmp16_);
						}
						_g_object_unref0 (list);
						_g_object_unref0 (source);
					}
				}
				(id_collection == NULL) ? NULL : (id_collection = (g_list_free (id_collection), NULL));
			}
		}
		__finally0:
		{
			GHashTable* _tmp17_;
			_tmp17_ = self->priv->source_client;
			g_rec_mutex_unlock (&self->priv->__lock_source_client);
		}
		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
services_calendar_events_remove_source (ServicesCalendarEvents* self,
                                        ESource* source)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* uid = NULL;
	const gchar* _tmp2_;
	GHashTable* _tmp3_;
	const gchar* _tmp4_;
	ECalClientView* current_view = NULL;
	GHashTable* _tmp5_;
	const gchar* _tmp6_;
	gconstpointer _tmp7_;
	ECalClientView* _tmp8_;
	GHashTable* _tmp12_;
	const gchar* _tmp13_;
	GeeCollection* components = NULL;
	GHashTable* _tmp18_;
	gconstpointer _tmp19_;
	GeeCollection* _tmp20_;
	GeeCollection* _tmp21_;
	GeeCollection* _tmp22_;
	GeeCollection* _tmp23_;
	GeeCollection* _tmp24_;
	GeeCollection* _tmp25_;
	GHashTable* _tmp26_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_tmp0_ = e_source_dup_display_name (source);
	_tmp1_ = _tmp0_;
	g_debug ("CalendarEvents.vala:115: Removing source '%s'", _tmp1_);
	_g_free0 (_tmp1_);
	_tmp2_ = e_source_get_uid (source);
	uid = _tmp2_;
	_tmp3_ = self->priv->source_view;
	_tmp4_ = uid;
	if (!g_hash_table_contains (_tmp3_, _tmp4_)) {
		return;
	}
	_tmp5_ = self->priv->source_view;
	_tmp6_ = uid;
	_tmp7_ = g_hash_table_lookup (_tmp5_, _tmp6_);
	_tmp8_ = _g_object_ref0 ((ECalClientView*) _tmp7_);
	current_view = _tmp8_;
	{
		ECalClientView* _tmp9_;
		_tmp9_ = current_view;
		e_cal_client_view_stop (_tmp9_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp10_;
		const gchar* _tmp11_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp10_ = e;
		_tmp11_ = _tmp10_->message;
		g_warning ("CalendarEvents.vala:127: %s", _tmp11_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (current_view);
		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;
	}
	_tmp12_ = self->priv->source_view;
	_tmp13_ = uid;
	g_hash_table_remove (_tmp12_, _tmp13_);
	{
		GHashTable* _tmp14_;
		_tmp14_ = self->priv->source_client;
		g_rec_mutex_lock (&self->priv->__lock_source_client);
		{
			GHashTable* _tmp15_;
			const gchar* _tmp16_;
			_tmp15_ = self->priv->source_client;
			_tmp16_ = uid;
			g_hash_table_remove (_tmp15_, _tmp16_);
		}
		__finally1:
		{
			GHashTable* _tmp17_;
			_tmp17_ = self->priv->source_client;
			g_rec_mutex_unlock (&self->priv->__lock_source_client);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (current_view);
			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;
		}
	}
	_tmp18_ = self->priv->_source_components;
	_tmp19_ = g_hash_table_lookup (_tmp18_, source);
	_tmp20_ = gee_multi_map_get_values ((GeeMultiMap*) ((GeeTreeMultiMap*) _tmp19_));
	_tmp21_ = _tmp20_;
	_tmp22_ = gee_collection_get_read_only_view (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = _tmp23_;
	_g_object_unref0 (_tmp21_);
	components = _tmp24_;
	_tmp25_ = components;
	g_signal_emit (self, services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_COMPONENTS_REMOVED_SIGNAL], 0, source, _tmp25_);
	_tmp26_ = self->priv->_source_components;
	g_hash_table_remove (_tmp26_, source);
	_g_object_unref0 (components);
	_g_object_unref0 (current_view);
}

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

static void
services_calendar_events_compute_ranges (ServicesCalendarEvents* self)
{
	GDateTime* month_end = NULL;
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	gint dow = 0;
	GDateTime* _tmp2_;
	gint wso = 0;
	GDateWeekday _tmp3_;
	gint offset = 0;
	GDateTime* data_range_first = NULL;
	GDateTime* _tmp4_;
	GDateTime* _tmp5_;
	GDateTime* _tmp6_;
	GDateWeekday _tmp7_;
	GDateTime* data_range_last = NULL;
	GDateTime* _tmp8_;
	GDateTime* _tmp9_;
	GDateTime* _tmp10_;
	CalendarEventsUtilDateRange* _tmp11_;
	CalendarEventsUtilDateRange* _tmp12_;
	CalendarEventsUtilDateRange* _tmp13_;
	GeeList* _tmp14_;
	GeeList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	GDateTime* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	GDateTime* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	GDateTime* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_month_start;
	_tmp1_ = g_date_time_add_full (_tmp0_, 0, 1, -1, 0, 0, (gdouble) 0);
	month_end = _tmp1_;
	_tmp2_ = self->priv->_month_start;
	dow = g_date_time_get_day_of_week (_tmp2_);
	_tmp3_ = self->priv->_week_starts_on;
	wso = (gint) _tmp3_;
	offset = 0;
	if (wso < dow) {
		offset = dow - wso;
	} else {
		if (wso > dow) {
			offset = (7 + dow) - wso;
		}
	}
	_tmp4_ = self->priv->_month_start;
	_tmp5_ = g_date_time_add_days (_tmp4_, -offset);
	data_range_first = _tmp5_;
	_tmp6_ = month_end;
	dow = g_date_time_get_day_of_week (_tmp6_);
	_tmp7_ = self->priv->_week_starts_on;
	wso = (gint) (_tmp7_ + 6);
	if (wso > 7) {
		wso = wso - 7;
	}
	offset = 0;
	if (wso < dow) {
		offset = (7 + wso) - dow;
	} else {
		if (wso > dow) {
			offset = wso - dow;
		}
	}
	_tmp8_ = month_end;
	_tmp9_ = g_date_time_add_days (_tmp8_, offset);
	data_range_last = _tmp9_;
	_tmp10_ = data_range_first;
	_tmp11_ = calendar_events_util_date_range_new (_tmp10_, data_range_last);
	_tmp12_ = _tmp11_;
	services_calendar_events_set_data_range (self, _tmp12_);
	_g_object_unref0 (_tmp12_);
	_tmp13_ = self->priv->_data_range;
	_tmp14_ = calendar_events_util_date_range_to_list (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = gee_collection_get_size ((GeeCollection*) _tmp15_);
	_tmp17_ = _tmp16_;
	services_calendar_events_set_num_weeks (self, _tmp17_ / 7);
	_g_object_unref0 (_tmp15_);
	_tmp18_ = data_range_first;
	_tmp19_ = g_date_time_to_string (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->_month_start;
	_tmp22_ = g_date_time_to_string (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = month_end;
	_tmp25_ = g_date_time_to_string (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = g_date_time_to_string (data_range_last);
	_tmp28_ = _tmp27_;
	_tmp29_ = g_strconcat ("Date ranges: (", _tmp20_, " <= ", _tmp23_, " < ", _tmp26_, " <= ", _tmp28_, ")", NULL);
	_tmp30_ = _tmp29_;
	g_debug ("CalendarEvents.vala:178: %s", _tmp30_);
	_g_free0 (_tmp30_);
	_g_free0 (_tmp28_);
	_g_free0 (_tmp26_);
	_g_free0 (_tmp23_);
	_g_free0 (_tmp20_);
	_g_date_time_unref0 (data_range_last);
	_g_date_time_unref0 (data_range_first);
	_g_date_time_unref0 (month_end);
}

static Block63Data*
block63_data_ref (Block63Data* _data63_)
{
	g_atomic_int_inc (&_data63_->_ref_count_);
	return _data63_;
}

static void
block63_data_unref (void * _userdata_)
{
	Block63Data* _data63_;
	_data63_ = (Block63Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data63_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data63_->self;
		_g_object_unref0 (_data63_->client);
		_g_object_unref0 (_data63_->source);
		_g_object_unref0 (self);
		g_slice_free (Block63Data, _data63_);
	}
}

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
__lambda14_ (Block63Data* _data63_,
             GSList* objects)
{
	ServicesCalendarEvents* self;
	self = _data63_->self;
	services_calendar_events_on_objects_added (self, _data63_->source, _data63_->client, objects);
}

static void
___lambda14__e_cal_client_view_objects_added (ECalClientView* _sender,
                                              GSList* objects,
                                              gpointer self)
{
	__lambda14_ (self, objects);
}

static void
__lambda17_ (Block63Data* _data63_,
             GSList* objects)
{
	ServicesCalendarEvents* self;
	self = _data63_->self;
	services_calendar_events_on_objects_removed (self, _data63_->source, _data63_->client, objects);
}

static void
___lambda17__e_cal_client_view_objects_removed (ECalClientView* _sender,
                                                GSList* uids,
                                                gpointer self)
{
	__lambda17_ (self, uids);
}

static void
__lambda19_ (Block63Data* _data63_,
             GSList* objects)
{
	ServicesCalendarEvents* self;
	self = _data63_->self;
	services_calendar_events_on_objects_modified (self, _data63_->source, _data63_->client, objects);
}

static void
___lambda19__e_cal_client_view_objects_modified (ECalClientView* _sender,
                                                 GSList* objects,
                                                 gpointer self)
{
	__lambda19_ (self, objects);
}

static void
__lambda13_ (Block63Data* _data63_,
             GObject* obj,
             GAsyncResult* results)
{
	ServicesCalendarEvents* self;
	ECalClientView* view = NULL;
	ECalClientView* _tmp0_;
	GHashTable* _tmp3_;
	gchar* _tmp4_;
	ECalClientView* _tmp5_;
	GError* _inner_error0_ = NULL;
	self = _data63_->self;
	g_return_if_fail (results != NULL);
	_tmp0_ = services_calendar_events_on_client_view_received (self, results, _data63_->source, _data63_->client);
	view = _tmp0_;
	g_signal_connect_data (view, "objects-added", (GCallback) ___lambda14__e_cal_client_view_objects_added, block63_data_ref (_data63_), (GClosureNotify) block63_data_unref, 0);
	g_signal_connect_data (view, "objects-removed", (GCallback) ___lambda17__e_cal_client_view_objects_removed, block63_data_ref (_data63_), (GClosureNotify) block63_data_unref, 0);
	g_signal_connect_data (view, "objects-modified", (GCallback) ___lambda19__e_cal_client_view_objects_modified, block63_data_ref (_data63_), (GClosureNotify) block63_data_unref, 0);
	{
		e_cal_client_view_start (view, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		g_critical ("CalendarEvents.vala:220: %s", _tmp2_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (view);
		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;
	}
	_tmp3_ = self->priv->source_view;
	_tmp4_ = e_source_dup_uid (_data63_->source);
	_tmp5_ = _g_object_ref0 (view);
	g_hash_table_insert (_tmp3_, _tmp4_, _tmp5_);
	_g_object_unref0 (view);
}

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

static void
services_calendar_events_load_source (ServicesCalendarEvents* self,
                                      ESource* source)
{
	Block63Data* _data63_;
	ESource* _tmp0_;
	GeeTreeMultiMap* components = NULL;
	GCompareFunc _tmp1_;
	GeeTreeMultiMap* _tmp2_;
	GHashTable* _tmp3_;
	ESource* _tmp4_;
	GeeTreeMultiMap* _tmp5_;
	gchar* iso_first = NULL;
	CalendarEventsUtilDateRange* _tmp6_;
	GDateTime* _tmp7_;
	GDateTime* _tmp8_;
	CalendarEventsUtilDateRange* _tmp9_;
	GDateTime* _tmp10_;
	GDateTime* _tmp11_;
	CalendarEventsUtilDateRange* _tmp12_;
	GDateTime* _tmp13_;
	GDateTime* _tmp14_;
	GDateTime* _tmp15_;
	GDateTime* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* iso_last = NULL;
	CalendarEventsUtilDateRange* _tmp19_;
	GDateTime* _tmp20_;
	GDateTime* _tmp21_;
	CalendarEventsUtilDateRange* _tmp22_;
	GDateTime* _tmp23_;
	GDateTime* _tmp24_;
	CalendarEventsUtilDateRange* _tmp25_;
	GDateTime* _tmp26_;
	GDateTime* _tmp27_;
	GDateTime* _tmp28_;
	GDateTime* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* query = NULL;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_data63_ = g_slice_new0 (Block63Data);
	_data63_->_ref_count_ = 1;
	_data63_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (source);
	_g_object_unref0 (_data63_->source);
	_data63_->source = _tmp0_;
	_tmp1_ = ((GCompareFunc) g_strcmp0);
	_tmp2_ = gee_tree_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, e_cal_component_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GCompareDataFunc) _tmp1_, NULL, NULL, (GCompareDataFunc) calendar_events_util_calcomponent_compare_func, NULL, NULL);
	components = _tmp2_;
	_tmp3_ = self->priv->_source_components;
	_tmp4_ = _g_object_ref0 (_data63_->source);
	_tmp5_ = _g_object_ref0 (components);
	g_hash_table_insert (_tmp3_, _tmp4_, _tmp5_);
	_tmp6_ = self->priv->_data_range;
	_tmp7_ = calendar_events_util_date_range_get_first_dt (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->_data_range;
	_tmp10_ = calendar_events_util_date_range_get_first_dt (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = self->priv->_data_range;
	_tmp13_ = calendar_events_util_date_range_get_first_dt (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_date_time_new_local (g_date_time_get_year (_tmp8_), g_date_time_get_month (_tmp11_), g_date_time_get_day_of_month (_tmp14_), 0, 0, (gdouble) 0);
	_tmp16_ = _tmp15_;
	_tmp17_ = isodate_from_time_t ((time_t) g_date_time_to_unix (_tmp16_));
	_tmp18_ = _tmp17_;
	_g_date_time_unref0 (_tmp16_);
	iso_first = _tmp18_;
	_tmp19_ = self->priv->_data_range;
	_tmp20_ = calendar_events_util_date_range_get_last_dt (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = self->priv->_data_range;
	_tmp23_ = calendar_events_util_date_range_get_last_dt (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = self->priv->_data_range;
	_tmp26_ = calendar_events_util_date_range_get_last_dt (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = g_date_time_new_local (g_date_time_get_year (_tmp21_), g_date_time_get_month (_tmp24_), g_date_time_get_day_of_month (_tmp27_), 23, 59, (gdouble) 59);
	_tmp29_ = _tmp28_;
	_tmp30_ = isodate_from_time_t ((time_t) g_date_time_to_unix (_tmp29_));
	_tmp31_ = _tmp30_;
	_g_date_time_unref0 (_tmp29_);
	iso_last = _tmp31_;
	_tmp32_ = string_to_string (iso_first);
	_tmp33_ = string_to_string (iso_last);
	_tmp34_ = g_strconcat ("(occur-in-time-range? (make-time \"", _tmp32_, "\") (make-time \"", _tmp33_, "\"))", NULL);
	query = _tmp34_;
	{
		GHashTable* _tmp35_;
		_tmp35_ = self->priv->source_client;
		g_rec_mutex_lock (&self->priv->__lock_source_client);
		{
			GHashTable* _tmp36_;
			gchar* _tmp37_;
			gchar* _tmp38_;
			gconstpointer _tmp39_;
			ECalClient* _tmp40_;
			_tmp36_ = self->priv->source_client;
			_tmp37_ = e_source_dup_uid (_data63_->source);
			_tmp38_ = _tmp37_;
			_tmp39_ = g_hash_table_lookup (_tmp36_, _tmp38_);
			_tmp40_ = _g_object_ref0 ((ECalClient*) _tmp39_);
			_g_object_unref0 (_data63_->client);
			_data63_->client = _tmp40_;
			_g_free0 (_tmp38_);
		}
		__finally0:
		{
			GHashTable* _tmp41_;
			_tmp41_ = self->priv->source_client;
			g_rec_mutex_unlock (&self->priv->__lock_source_client);
		}
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (query);
			_g_free0 (iso_last);
			_g_free0 (iso_first);
			_g_object_unref0 (components);
			block63_data_unref (_data63_);
			_data63_ = 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;
		}
	}
	if (_data63_->client == NULL) {
		_g_free0 (query);
		_g_free0 (iso_last);
		_g_free0 (iso_first);
		_g_object_unref0 (components);
		block63_data_unref (_data63_);
		_data63_ = NULL;
		return;
	}
	_tmp42_ = e_source_dup_display_name (_data63_->source);
	_tmp43_ = _tmp42_;
	g_debug ("CalendarEvents.vala:211: Getting client-view for source '%s'", _tmp43_);
	_g_free0 (_tmp43_);
	e_cal_client_get_view (_data63_->client, query, NULL, ___lambda13__gasync_ready_callback, block63_data_ref (_data63_));
	_g_free0 (query);
	_g_free0 (iso_last);
	_g_free0 (iso_first);
	_g_object_unref0 (components);
	block63_data_unref (_data63_);
	_data63_ = NULL;
}

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

static void
services_calendar_events_add_source_async (ServicesCalendarEvents* self,
                                           ESource* source,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	ServicesCalendarEventsAddSourceAsyncData* _data_;
	ServicesCalendarEvents* _tmp0_;
	ESource* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_data_ = g_slice_new0 (ServicesCalendarEventsAddSourceAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_calendar_events_add_source_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (source);
	_g_object_unref0 (_data_->source);
	_data_->source = _tmp1_;
	services_calendar_events_add_source_async_co (_data_);
}

static void
services_calendar_events_add_source_finish (ServicesCalendarEvents* self,
                                            GAsyncResult* _res_)
{
	ServicesCalendarEventsAddSourceAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block64Data*
block64_data_ref (Block64Data* _data64_)
{
	g_atomic_int_inc (&_data64_->_ref_count_);
	return _data64_;
}

static void
block64_data_unref (void * _userdata_)
{
	Block64Data* _data64_;
	_data64_ = (Block64Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data64_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data64_->self;
		_g_object_unref0 (_data64_->source);
		_g_object_unref0 (self);
		g_slice_free (Block64Data, _data64_);
	}
}

static gboolean
__lambda12_ (Block64Data* _data64_)
{
	ServicesCalendarEvents* self;
	gboolean result;
	self = _data64_->self;
	services_calendar_events_load_source (self, _data64_->source);
	result = FALSE;
	return result;
}

static gboolean
___lambda12__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda12_ (self);
	return result;
}

static gboolean
services_calendar_events_add_source_async_co (ServicesCalendarEventsAddSourceAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data64_ = g_slice_new0 (Block64Data);
	_data_->_data64_->_ref_count_ = 1;
	_data_->_data64_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data64_->source);
	_data_->_data64_->source = _data_->source;
	_data_->_data64_->_async_data_ = _data_;
	if (!e_source_has_extension (_data_->_data64_->source, E_SOURCE_EXTENSION_CALENDAR)) {
		block64_data_unref (_data_->_data64_);
		_data_->_data64_ = 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;
	}
	_data_->_tmp0_ = e_source_dup_display_name (_data_->_data64_->source);
	_data_->_tmp1_ = _data_->_tmp0_;
	g_debug ("CalendarEvents.vala:232: Adding source '%s'", _data_->_tmp1_);
	_g_free0 (_data_->_tmp1_);
	{
		_data_->_tmp3_ = e_cal_client_connect_sync (_data_->_data64_->source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, (guint32) -1, NULL, &_data_->_inner_error0_);
		_data_->_tmp2_ = _data_->_tmp3_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, e_cal_client_get_type (), ECalClient));
		_data_->client = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->self->priv->source_client;
		_data_->_tmp6_ = e_source_dup_uid (_data_->_data64_->source);
		_data_->_tmp7_ = _data_->client;
		_data_->_tmp8_ = _g_object_ref0 (_data_->_tmp7_);
		g_hash_table_insert (_data_->_tmp5_, _data_->_tmp6_, _data_->_tmp8_);
		_g_object_unref0 (_data_->client);
		_g_object_unref0 (_data_->_tmp2_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp9_ = _data_->e;
		_data_->_tmp10_ = _data_->_tmp9_->message;
		g_critical ("CalendarEvents.vala:238: %s", _data_->_tmp10_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		block64_data_unref (_data_->_data64_);
		_data_->_data64_ = 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_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda12__gsource_func, block64_data_ref (_data_->_data64_), block64_data_unref);
	block64_data_unref (_data_->_data64_);
	_data_->_data64_ = 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
services_calendar_events_debug_component (ServicesCalendarEvents* self,
                                          ESource* source,
                                          ECalComponent* component)
{
	ICalComponent* comp = NULL;
	ICalComponent* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (component != NULL);
	_tmp0_ = e_cal_component_get_icalcomponent (component);
	comp = _tmp0_;
	_tmp1_ = i_cal_component_get_summary (comp);
	_tmp2_ = string_to_string (_tmp1_);
	_tmp3_ = e_source_dup_display_name (source);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_to_string (_tmp4_);
	_tmp6_ = i_cal_component_get_uid (comp);
	_tmp7_ = string_to_string (_tmp6_);
	_tmp8_ = g_strconcat ("Component ['", _tmp2_, "', ", _tmp5_, ", ", _tmp7_, ")]", NULL);
	_tmp9_ = _tmp8_;
	g_debug ("CalendarEvents.vala:250: %s", _tmp9_);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp4_);
}

static ECalClientView*
services_calendar_events_on_client_view_received (ServicesCalendarEvents* self,
                                                  GAsyncResult* results,
                                                  ESource* source,
                                                  ECalClient* client)
{
	ECalClientView* view = NULL;
	GError* _inner_error0_ = NULL;
	ECalClientView* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (results != NULL, NULL);
	g_return_val_if_fail (source != NULL, NULL);
	g_return_val_if_fail (client != NULL, NULL);
	{
		gchar* _tmp0_;
		gchar* _tmp1_;
		gboolean status = FALSE;
		ECalClientView* _tmp2_ = NULL;
		gboolean _tmp3_;
		_tmp0_ = e_source_dup_display_name (source);
		_tmp1_ = _tmp0_;
		g_debug ("CalendarEvents.vala:256: Received client-view for source '%s'", _tmp1_);
		_g_free0 (_tmp1_);
		_tmp3_ = e_cal_client_get_view_finish (client, results, &_tmp2_, &_inner_error0_);
		_g_object_unref0 (view);
		view = _tmp2_;
		status = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_vala_assert (status == TRUE, "status == true");
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = e_source_dup_display_name (source);
		_tmp5_ = _tmp4_;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		g_critical ("CalendarEvents.vala:260: Error loading client-view from source '%s': %" \
"s", _tmp5_, _tmp7_);
		_g_free0 (_tmp5_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (view);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = view;
	return result;
}

static Block65Data*
block65_data_ref (Block65Data* _data65_)
{
	g_atomic_int_inc (&_data65_->_ref_count_);
	return _data65_;
}

static void
block65_data_unref (void * _userdata_)
{
	Block65Data* _data65_;
	_data65_ = (Block65Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data65_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data65_->self;
		_g_object_unref0 (_data65_->added_components);
		_g_object_unref0 (_data65_->components);
		_g_object_unref0 (_data65_->source);
		_g_object_unref0 (_data65_->client);
		_g_object_unref0 (self);
		g_slice_free (Block65Data, _data65_);
	}
}

static Block66Data*
block66_data_ref (Block66Data* _data66_)
{
	g_atomic_int_inc (&_data66_->_ref_count_);
	return _data66_;
}

static void
block66_data_unref (void * _userdata_)
{
	Block66Data* _data66_;
	_data66_ = (Block66Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data66_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data66_->_data65_->self;
		block65_data_unref (_data66_->_data65_);
		_data66_->_data65_ = NULL;
		g_slice_free (Block66Data, _data66_);
	}
}

static gboolean
__lambda16_ (Block66Data* _data66_,
             ICalComponent* comp,
             ICalTime* start,
             ICalTime* end,
             GError** error)
{
	Block65Data* _data65_;
	ServicesCalendarEvents* self;
	ECalComponent* component = NULL;
	ICalComponent* _tmp0_;
	ECalComponent* _tmp1_;
	gboolean result;
	_data65_ = _data66_->_data65_;
	self = _data65_->self;
	g_return_val_if_fail (comp != NULL, FALSE);
	g_return_val_if_fail (start != NULL, FALSE);
	g_return_val_if_fail (end != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (comp);
	_tmp1_ = e_cal_component_new_from_icalcomponent (_tmp0_);
	component = _tmp1_;
	services_calendar_events_debug_component (self, _data65_->source, component);
	gee_multi_map_set ((GeeMultiMap*) _data65_->components, _data66_->uid, component);
	gee_abstract_collection_add ((GeeAbstractCollection*) _data65_->added_components, component);
	result = TRUE;
	_g_object_unref0 (component);
	return result;
}

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

static void
__lambda15_ (Block65Data* _data65_,
             ICalComponent* comp)
{
	ServicesCalendarEvents* self;
	Block66Data* _data66_;
	const gchar* _tmp0_;
	CalendarEventsUtilDateRange* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	CalendarEventsUtilDateRange* _tmp4_;
	GDateTime* _tmp5_;
	GDateTime* _tmp6_;
	self = _data65_->self;
	g_return_if_fail (comp != NULL);
	_data66_ = g_slice_new0 (Block66Data);
	_data66_->_ref_count_ = 1;
	_data66_->_data65_ = block65_data_ref (_data65_);
	_tmp0_ = i_cal_component_get_uid (comp);
	_data66_->uid = _tmp0_;
	_tmp1_ = self->priv->_data_range;
	_tmp2_ = calendar_events_util_date_range_get_first_dt (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->_data_range;
	_tmp5_ = calendar_events_util_date_range_get_last_dt (_tmp4_);
	_tmp6_ = _tmp5_;
	e_cal_client_generate_instances_for_object_sync (_data65_->client, comp, (time_t) g_date_time_to_unix (_tmp3_), (time_t) g_date_time_to_unix (_tmp6_), NULL, ___lambda16__ecal_recur_instance_cb, _data66_);
	block66_data_unref (_data66_);
	_data66_ = NULL;
}

static void
___lambda15__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda15_ (self, (ICalComponent*) data);
}

static void
services_calendar_events_on_objects_added (ServicesCalendarEvents* self,
                                           ESource* source,
                                           ECalClient* client,
                                           GSList* objects)
{
	Block65Data* _data65_;
	ESource* _tmp0_;
	ECalClient* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GHashTable* _tmp8_;
	gconstpointer _tmp9_;
	GeeTreeMultiMap* _tmp10_;
	GeeArrayList* _tmp11_;
	GeeBidirList* _tmp12_;
	GeeBidirList* _tmp13_;
	GeeBidirList* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (client != NULL);
	_data65_ = g_slice_new0 (Block65Data);
	_data65_->_ref_count_ = 1;
	_data65_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (source);
	_g_object_unref0 (_data65_->source);
	_data65_->source = _tmp0_;
	_tmp1_ = _g_object_ref0 (client);
	_g_object_unref0 (_data65_->client);
	_data65_->client = _tmp1_;
	_tmp2_ = g_strdup_printf ("%u", g_slist_length (objects));
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat ("Received ", _tmp3_, " added component(s) for source '%s'", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = e_source_dup_display_name (_data65_->source);
	_tmp7_ = _tmp6_;
	g_debug (_tmp5_, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_tmp8_ = self->priv->_source_components;
	_tmp9_ = g_hash_table_lookup (_tmp8_, _data65_->source);
	_tmp10_ = _g_object_ref0 ((GeeTreeMultiMap*) _tmp9_);
	_data65_->components = _tmp10_;
	_tmp11_ = gee_array_list_new (e_cal_component_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeEqualDataFunc) calendar_events_util_calcomponent_equal_func, NULL, NULL);
	_data65_->added_components = _tmp11_;
	g_slist_foreach (objects, ___lambda15__gfunc, _data65_);
	_tmp12_ = gee_abstract_bidir_list_get_read_only_view ((GeeAbstractBidirList*) _data65_->added_components);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_;
	g_signal_emit (self, services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_COMPONENTS_ADDED_SIGNAL], 0, _data65_->source, (GeeCollection*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	block65_data_unref (_data65_);
	_data65_ = NULL;
}

static Block67Data*
block67_data_ref (Block67Data* _data67_)
{
	g_atomic_int_inc (&_data67_->_ref_count_);
	return _data67_;
}

static void
block67_data_unref (void * _userdata_)
{
	Block67Data* _data67_;
	_data67_ = (Block67Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data67_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data67_->self;
		_g_object_unref0 (_data67_->updated_components);
		_g_object_unref0 (_data67_->components);
		_g_object_unref0 (_data67_->source);
		_g_object_unref0 (_data67_->client);
		_g_object_unref0 (self);
		g_slice_free (Block67Data, _data67_);
	}
}

static Block68Data*
block68_data_ref (Block68Data* _data68_)
{
	g_atomic_int_inc (&_data68_->_ref_count_);
	return _data68_;
}

static void
block68_data_unref (void * _userdata_)
{
	Block68Data* _data68_;
	_data68_ = (Block68Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data68_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data68_->_data67_->self;
		block67_data_unref (_data68_->_data67_);
		_data68_->_data67_ = NULL;
		g_slice_free (Block68Data, _data68_);
	}
}

static gboolean
__lambda21_ (Block68Data* _data68_,
             ICalComponent* comp,
             ICalTime* start,
             ICalTime* end,
             GError** error)
{
	Block67Data* _data67_;
	ServicesCalendarEvents* self;
	ECalComponent* component = NULL;
	ICalComponent* _tmp0_;
	ECalComponent* _tmp1_;
	gboolean result;
	_data67_ = _data68_->_data67_;
	self = _data67_->self;
	g_return_val_if_fail (comp != NULL, FALSE);
	g_return_val_if_fail (start != NULL, FALSE);
	g_return_val_if_fail (end != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (comp);
	_tmp1_ = e_cal_component_new_from_icalcomponent (_tmp0_);
	component = _tmp1_;
	services_calendar_events_debug_component (self, _data67_->source, component);
	gee_multi_map_set ((GeeMultiMap*) _data67_->components, _data68_->uid, component);
	gee_abstract_collection_add ((GeeAbstractCollection*) _data67_->updated_components, component);
	result = TRUE;
	_g_object_unref0 (component);
	return result;
}

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

static void
__lambda20_ (Block67Data* _data67_,
             ICalComponent* comp)
{
	ServicesCalendarEvents* self;
	Block68Data* _data68_;
	const gchar* _tmp0_;
	CalendarEventsUtilDateRange* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	CalendarEventsUtilDateRange* _tmp4_;
	GDateTime* _tmp5_;
	GDateTime* _tmp6_;
	self = _data67_->self;
	g_return_if_fail (comp != NULL);
	_data68_ = g_slice_new0 (Block68Data);
	_data68_->_ref_count_ = 1;
	_data68_->_data67_ = block67_data_ref (_data67_);
	_tmp0_ = i_cal_component_get_uid (comp);
	_data68_->uid = _tmp0_;
	gee_multi_map_remove_all ((GeeMultiMap*) _data67_->components, _data68_->uid);
	_tmp1_ = self->priv->_data_range;
	_tmp2_ = calendar_events_util_date_range_get_first_dt (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->_data_range;
	_tmp5_ = calendar_events_util_date_range_get_last_dt (_tmp4_);
	_tmp6_ = _tmp5_;
	e_cal_client_generate_instances_for_object_sync (_data67_->client, comp, (time_t) g_date_time_to_unix (_tmp3_), (time_t) g_date_time_to_unix (_tmp6_), NULL, ___lambda21__ecal_recur_instance_cb, _data68_);
	block68_data_unref (_data68_);
	_data68_ = NULL;
}

static void
___lambda20__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda20_ (self, (ICalComponent*) data);
}

static void
services_calendar_events_on_objects_modified (ServicesCalendarEvents* self,
                                              ESource* source,
                                              ECalClient* client,
                                              GSList* objects)
{
	Block67Data* _data67_;
	ESource* _tmp0_;
	ECalClient* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GHashTable* _tmp8_;
	gconstpointer _tmp9_;
	GeeTreeMultiMap* _tmp10_;
	GeeArrayList* _tmp11_;
	GeeBidirList* _tmp12_;
	GeeBidirList* _tmp13_;
	GeeBidirList* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (client != NULL);
	_data67_ = g_slice_new0 (Block67Data);
	_data67_->_ref_count_ = 1;
	_data67_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (source);
	_g_object_unref0 (_data67_->source);
	_data67_->source = _tmp0_;
	_tmp1_ = _g_object_ref0 (client);
	_g_object_unref0 (_data67_->client);
	_data67_->client = _tmp1_;
	_tmp2_ = g_strdup_printf ("%u", g_slist_length (objects));
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat ("Received ", _tmp3_, " modified component(s) for source '%s'", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = e_source_dup_display_name (_data67_->source);
	_tmp7_ = _tmp6_;
	g_debug (_tmp5_, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_tmp8_ = self->priv->_source_components;
	_tmp9_ = g_hash_table_lookup (_tmp8_, _data67_->source);
	_tmp10_ = _g_object_ref0 ((GeeTreeMultiMap*) _tmp9_);
	_data67_->components = _tmp10_;
	_tmp11_ = gee_array_list_new (e_cal_component_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeEqualDataFunc) calendar_events_util_calcomponent_equal_func, NULL, NULL);
	_data67_->updated_components = _tmp11_;
	g_slist_foreach (objects, ___lambda20__gfunc, _data67_);
	_tmp12_ = gee_abstract_bidir_list_get_read_only_view ((GeeAbstractBidirList*) _data67_->updated_components);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_;
	g_signal_emit (self, services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_COMPONENTS_UPDATED_SIGNAL], 0, _data67_->source, (GeeCollection*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	block67_data_unref (_data67_);
	_data67_ = NULL;
}

static Block69Data*
block69_data_ref (Block69Data* _data69_)
{
	g_atomic_int_inc (&_data69_->_ref_count_);
	return _data69_;
}

static void
block69_data_unref (void * _userdata_)
{
	Block69Data* _data69_;
	_data69_ = (Block69Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data69_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data69_->self;
		_g_object_unref0 (_data69_->removed_components);
		_g_object_unref0 (_data69_->components);
		_g_object_unref0 (_data69_->source);
		_g_object_unref0 (self);
		g_slice_free (Block69Data, _data69_);
	}
}

static void
__lambda18_ (Block69Data* _data69_,
             ECalComponentId* cid)
{
	ServicesCalendarEvents* self;
	GeeCollection* comps = NULL;
	const gchar* _tmp0_;
	GeeCollection* _tmp1_;
	self = _data69_->self;
	if (cid == NULL) {
		return;
	}
	_tmp0_ = e_cal_component_id_get_uid (cid);
	_tmp1_ = gee_multi_map_get ((GeeMultiMap*) _data69_->components, _tmp0_);
	comps = _tmp1_;
	{
		GeeIterator* _component_it = NULL;
		GeeCollection* _tmp2_;
		GeeIterator* _tmp3_;
		_tmp2_ = comps;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_component_it = _tmp3_;
		while (TRUE) {
			GeeIterator* _tmp4_;
			ECalComponent* component = NULL;
			GeeIterator* _tmp5_;
			gpointer _tmp6_;
			ECalComponent* _tmp7_;
			ECalComponent* _tmp8_;
			_tmp4_ = _component_it;
			if (!gee_iterator_next (_tmp4_)) {
				break;
			}
			_tmp5_ = _component_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			component = (ECalComponent*) _tmp6_;
			_tmp7_ = component;
			gee_abstract_collection_add ((GeeAbstractCollection*) _data69_->removed_components, _tmp7_);
			_tmp8_ = component;
			services_calendar_events_debug_component (self, _data69_->source, _tmp8_);
			_g_object_unref0 (component);
		}
		_g_object_unref0 (_component_it);
	}
	_g_object_unref0 (comps);
}

static void
___lambda18__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda18_ (self, (ECalComponentId*) data);
}

static void
services_calendar_events_on_objects_removed (ServicesCalendarEvents* self,
                                             ESource* source,
                                             ECalClient* client,
                                             GSList* cids)
{
	Block69Data* _data69_;
	ESource* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GHashTable* _tmp7_;
	gconstpointer _tmp8_;
	GeeTreeMultiMap* _tmp9_;
	GeeArrayList* _tmp10_;
	GeeBidirList* _tmp11_;
	GeeBidirList* _tmp12_;
	GeeBidirList* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (client != NULL);
	_data69_ = g_slice_new0 (Block69Data);
	_data69_->_ref_count_ = 1;
	_data69_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (source);
	_g_object_unref0 (_data69_->source);
	_data69_->source = _tmp0_;
	_tmp1_ = g_strdup_printf ("%u", g_slist_length (cids));
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat ("Received ", _tmp2_, " removed component(s) for source '%s'", NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = e_source_dup_display_name (_data69_->source);
	_tmp6_ = _tmp5_;
	g_debug (_tmp4_, _tmp6_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	_tmp7_ = self->priv->_source_components;
	_tmp8_ = g_hash_table_lookup (_tmp7_, _data69_->source);
	_tmp9_ = _g_object_ref0 ((GeeTreeMultiMap*) _tmp8_);
	_data69_->components = _tmp9_;
	_tmp10_ = gee_array_list_new (e_cal_component_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeEqualDataFunc) calendar_events_util_calcomponent_equal_func, NULL, NULL);
	_data69_->removed_components = _tmp10_;
	g_slist_foreach (cids, ___lambda18__gfunc, _data69_);
	_tmp11_ = gee_abstract_bidir_list_get_read_only_view ((GeeAbstractBidirList*) _data69_->removed_components);
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_;
	g_signal_emit (self, services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_COMPONENTS_REMOVED_SIGNAL], 0, _data69_->source, (GeeCollection*) _tmp13_);
	_g_object_unref0 (_tmp13_);
	block69_data_unref (_data69_);
	_data69_ = NULL;
}

static Block70Data*
block70_data_ref (Block70Data* _data70_)
{
	g_atomic_int_inc (&_data70_->_ref_count_);
	return _data70_;
}

static void
block70_data_unref (void * _userdata_)
{
	Block70Data* _data70_;
	_data70_ = (Block70Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data70_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data70_->self;
		_g_object_unref0 (_data70_->sources);
		_g_object_unref0 (self);
		g_slice_free (Block70Data, _data70_);
	}
}

static void
__lambda23_ (Block70Data* _data70_,
             ESource* source)
{
	ServicesCalendarEvents* self;
	self = _data70_->self;
	g_return_if_fail (source != NULL);
	gee_abstract_collection_add ((GeeAbstractCollection*) _data70_->sources, source);
}

static void
___lambda23__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda23_ (self, (ESource*) data);
}

GeeArrayList*
services_calendar_events_get_all_sources (ServicesCalendarEvents* self)
{
	Block70Data* _data70_;
	GeeArrayList* _tmp0_;
	ESourceRegistry* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	GeeArrayList* _tmp4_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data70_ = g_slice_new0 (Block70Data);
	_data70_->_ref_count_ = 1;
	_data70_->self = g_object_ref (self);
	_tmp0_ = gee_array_list_new (e_source_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data70_->sources = _tmp0_;
	_tmp1_ = self->priv->_registry;
	_tmp2_ = e_source_registry_list_sources (_tmp1_, E_SOURCE_EXTENSION_CALENDAR);
	_tmp3_ = _tmp2_;
	g_list_foreach (_tmp3_, ___lambda23__gfunc, _data70_);
	(_tmp3_ == NULL) ? NULL : (_tmp3_ = (_g_list_free__g_object_unref0_ (_tmp3_), NULL));
	_tmp4_ = _g_object_ref0 (_data70_->sources);
	result = _tmp4_;
	block70_data_unref (_data70_);
	_data70_ = NULL;
	return result;
}

static void
services_calendar_events_get_client_data_free (gpointer _data)
{
	ServicesCalendarEventsGetClientData* _data_;
	_data_ = _data;
	_g_free0 (_data_->source_uid);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalendarEventsGetClientData, _data_);
}

static void
services_calendar_events_get_client (ServicesCalendarEvents* self,
                                     const gchar* source_uid,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	ServicesCalendarEventsGetClientData* _data_;
	ServicesCalendarEvents* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source_uid != NULL);
	_data_ = g_slice_new0 (ServicesCalendarEventsGetClientData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_calendar_events_get_client_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (source_uid);
	_g_free0 (_data_->source_uid);
	_data_->source_uid = _tmp1_;
	services_calendar_events_get_client_co (_data_);
}

static ECalClient*
services_calendar_events_get_client_finish (ServicesCalendarEvents* self,
                                            GAsyncResult* _res_)
{
	ECalClient* result;
	ServicesCalendarEventsGetClientData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
services_calendar_events_get_client_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	ServicesCalendarEventsGetClientData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_calendar_events_get_client_co (_data_);
}

static gboolean
services_calendar_events_get_client_co (ServicesCalendarEventsGetClientData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_registry;
	if (_data_->_tmp0_ == NULL) {
		while (TRUE) {
			_data_->_tmp1_ = _data_->self->priv->_registry;
			if (!(_data_->_tmp1_ == NULL)) {
				break;
			}
			_data_->_state_ = 1;
			util_nap ((guint) 100, G_PRIORITY_DEFAULT, services_calendar_events_get_client_ready, _data_);
			return FALSE;
			_state_1:
			util_nap_finish (_data_->_res_);
		}
	}
	{
		_data_->_tmp2_ = _data_->self->priv->source_client;
		g_rec_mutex_lock (&_data_->self->priv->__lock_source_client);
		{
			_data_->_tmp3_ = _data_->self->priv->source_client;
			_data_->_tmp4_ = g_hash_table_lookup (_data_->_tmp3_, _data_->source_uid);
			_data_->_tmp5_ = _g_object_ref0 ((ECalClient*) _data_->_tmp4_);
			_g_object_unref0 (_data_->client);
			_data_->client = _data_->_tmp5_;
		}
		__finally0:
		{
			_data_->_tmp6_ = _data_->self->priv->source_client;
			g_rec_mutex_unlock (&_data_->self->priv->__lock_source_client);
		}
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->client);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp7_ = _data_->client;
	if (_data_->_tmp7_ == NULL) {
		_data_->_tmp8_ = _data_->self->priv->_registry;
		_data_->_tmp9_ = e_source_registry_ref_source (_data_->_tmp8_, _data_->source_uid);
		_data_->source = _data_->_tmp9_;
		_data_->_tmp10_ = _data_->source;
		if (_data_->_tmp10_ != NULL) {
			_data_->_tmp11_ = _data_->source;
			_data_->_state_ = 2;
			services_calendar_events_add_source_async (_data_->self, _data_->_tmp11_, services_calendar_events_get_client_ready, _data_);
			return FALSE;
			_state_2:
			services_calendar_events_add_source_finish (_data_->self, _data_->_res_);
			{
				_data_->_tmp12_ = _data_->self->priv->source_client;
				g_rec_mutex_lock (&_data_->self->priv->__lock_source_client);
				{
					_data_->_tmp13_ = _data_->self->priv->source_client;
					_data_->_tmp14_ = g_hash_table_lookup (_data_->_tmp13_, _data_->source_uid);
					_data_->_tmp15_ = _g_object_ref0 ((ECalClient*) _data_->_tmp14_);
					_g_object_unref0 (_data_->client);
					_data_->client = _data_->_tmp15_;
				}
				__finally1:
				{
					_data_->_tmp16_ = _data_->self->priv->source_client;
					g_rec_mutex_unlock (&_data_->self->priv->__lock_source_client);
				}
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->source);
					_g_object_unref0 (_data_->client);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
		}
		_data_->_tmp17_ = _data_->client;
		if (_data_->_tmp17_ == NULL) {
			g_critical ("CalendarEvents.vala:357: Calendar client not found for UID: %s", _data_->source_uid);
			_data_->result = NULL;
			_g_object_unref0 (_data_->source);
			_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_->source);
	}
	_data_->result = _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
services_calendar_events_create_event_data_free (gpointer _data)
{
	ServicesCalendarEventsCreateEventData* _data_;
	_data_ = _data;
	_g_free0 (_data_->source_uid);
	_g_object_unref0 (_data_->item);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalendarEventsCreateEventData, _data_);
}

void
services_calendar_events_create_event (ServicesCalendarEvents* self,
                                       const gchar* source_uid,
                                       ObjectsItem* item,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	ServicesCalendarEventsCreateEventData* _data_;
	ServicesCalendarEvents* _tmp0_;
	gchar* _tmp1_;
	ObjectsItem* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source_uid != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesCalendarEventsCreateEventData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_calendar_events_create_event_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (source_uid);
	_g_free0 (_data_->source_uid);
	_data_->source_uid = _tmp1_;
	_tmp2_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp2_;
	services_calendar_events_create_event_co (_data_);
}

gchar*
services_calendar_events_create_event_finish (ServicesCalendarEvents* self,
                                              GAsyncResult* _res_)
{
	gchar* result;
	ServicesCalendarEventsCreateEventData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block71Data*
block71_data_ref (Block71Data* _data71_)
{
	g_atomic_int_inc (&_data71_->_ref_count_);
	return _data71_;
}

static void
block71_data_unref (void * _userdata_)
{
	Block71Data* _data71_;
	_data71_ = (Block71Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data71_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data71_->self;
		_g_object_unref0 (_data71_->client);
		_g_object_unref0 (self);
		g_slice_free (Block71Data, _data71_);
	}
}

static void
services_calendar_events_create_event_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	ServicesCalendarEventsCreateEventData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_calendar_events_create_event_co (_data_);
}

static Block72Data*
block72_data_ref (Block72Data* _data72_)
{
	g_atomic_int_inc (&_data72_->_ref_count_);
	return _data72_;
}

static void
block72_data_unref (void * _userdata_)
{
	Block72Data* _data72_;
	_data72_ = (Block72Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data72_->_ref_count_)) {
		ServicesCalendarEvents* self;
		self = _data72_->_data71_->self;
		_g_free0 (_data72_->uid);
		block71_data_unref (_data72_->_data71_);
		_data72_->_data71_ = NULL;
		g_slice_free (Block72Data, _data72_);
	}
}

static void
___lambda25_ (Block72Data* _data72_,
              GObject* obj,
              GAsyncResult* res)
{
	Block71Data* _data71_;
	ServicesCalendarEvents* self;
	GError* _inner_error0_ = NULL;
	_data71_ = _data72_->_data71_;
	self = _data71_->self;
	g_return_if_fail (res != NULL);
	{
		ECalClient* _tmp0_;
		gchar* _tmp1_ = NULL;
		_tmp0_ = _data71_->client;
		e_cal_client_create_object_finish (_tmp0_, res, &_tmp1_, &_inner_error0_);
		_g_free0 (_data72_->uid);
		_data72_->uid = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		services_calendar_events_create_event_co (_data71_->_async_data_);
	}
	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_critical ("CalendarEvents.vala:407: Error creating event: %s", _tmp3_);
		services_calendar_events_create_event_co (_data71_->_async_data_);
		_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
____lambda25__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda25_ (self, source_object, res);
	block72_data_unref (self);
}

static gboolean
services_calendar_events_create_event_co (ServicesCalendarEventsCreateEventData* _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_->_data71_ = g_slice_new0 (Block71Data);
	_data_->_data71_->_ref_count_ = 1;
	_data_->_data71_->self = g_object_ref (_data_->self);
	_data_->_data71_->_async_data_ = _data_;
	_data_->_state_ = 1;
	services_calendar_events_get_client (_data_->self, _data_->source_uid, services_calendar_events_create_event_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = services_calendar_events_get_client_finish (_data_->self, _data_->_res_);
	_data_->_data71_->client = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->_data71_->client;
	if (_data_->_tmp1_ == NULL) {
		_data_->result = NULL;
		block71_data_unref (_data_->_data71_);
		_data_->_data71_ = 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;
	}
	_data_->_tmp2_ = objects_item_get_has_due (_data_->item);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (!_data_->_tmp3_) {
		_data_->result = NULL;
		block71_data_unref (_data_->_data71_);
		_data_->_data71_ = 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;
	}
	_data_->_tmp4_ = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
	_data_->event = _data_->_tmp4_;
	_data_->_tmp5_ = util_get_default ();
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = util_generate_id (_data_->_tmp6_, NULL);
	_data_->_tmp8_ = _data_->_tmp7_;
	_g_object_unref0 (_data_->_tmp6_);
	_data_->generated_uid = _data_->_tmp8_;
	_data_->_tmp9_ = _data_->event;
	_data_->_tmp10_ = _data_->generated_uid;
	i_cal_component_set_uid (_data_->_tmp9_, _data_->_tmp10_);
	_data_->_tmp11_ = _data_->event;
	_data_->_tmp12_ = objects_item_get_content (_data_->item);
	_data_->_tmp13_ = _data_->_tmp12_;
	i_cal_component_set_summary (_data_->_tmp11_, _data_->_tmp13_);
	_data_->_tmp14_ = objects_item_get_description (_data_->item);
	_data_->_tmp15_ = _data_->_tmp14_;
	if (g_strcmp0 (_data_->_tmp15_, "") != 0) {
		_data_->_tmp16_ = _data_->event;
		_data_->_tmp17_ = objects_item_get_description (_data_->item);
		_data_->_tmp18_ = _data_->_tmp17_;
		i_cal_component_set_description (_data_->_tmp16_, _data_->_tmp18_);
	}
	_data_->_tmp19_ = objects_item_get_due (_data_->item);
	_data_->_tmp20_ = _data_->_tmp19_;
	_data_->_tmp21_ = objects_due_date_get_datetime (_data_->_tmp20_);
	_data_->_tmp22_ = _data_->_tmp21_;
	_data_->has_time = utils_datetime_has_time (_data_->_tmp22_);
	_data_->_tmp23_ = i_cal_time_new ();
	_data_->dt_start = _data_->_tmp23_;
	_data_->_tmp24_ = _data_->dt_start;
	_data_->_tmp25_ = objects_item_get_due (_data_->item);
	_data_->_tmp26_ = _data_->_tmp25_;
	_data_->_tmp27_ = objects_due_date_get_datetime (_data_->_tmp26_);
	_data_->_tmp28_ = _data_->_tmp27_;
	_data_->_tmp29_ = objects_item_get_due (_data_->item);
	_data_->_tmp30_ = _data_->_tmp29_;
	_data_->_tmp31_ = objects_due_date_get_datetime (_data_->_tmp30_);
	_data_->_tmp32_ = _data_->_tmp31_;
	_data_->_tmp33_ = objects_item_get_due (_data_->item);
	_data_->_tmp34_ = _data_->_tmp33_;
	_data_->_tmp35_ = objects_due_date_get_datetime (_data_->_tmp34_);
	_data_->_tmp36_ = _data_->_tmp35_;
	i_cal_time_set_date (_data_->_tmp24_, g_date_time_get_year (_data_->_tmp28_), g_date_time_get_month (_data_->_tmp32_), g_date_time_get_day_of_month (_data_->_tmp36_));
	if (_data_->has_time) {
		_data_->_tmp37_ = _data_->dt_start;
		_data_->_tmp38_ = objects_item_get_due (_data_->item);
		_data_->_tmp39_ = _data_->_tmp38_;
		_data_->_tmp40_ = objects_due_date_get_datetime (_data_->_tmp39_);
		_data_->_tmp41_ = _data_->_tmp40_;
		_data_->_tmp42_ = objects_item_get_due (_data_->item);
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_tmp44_ = objects_due_date_get_datetime (_data_->_tmp43_);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_tmp46_ = objects_item_get_due (_data_->item);
		_data_->_tmp47_ = _data_->_tmp46_;
		_data_->_tmp48_ = objects_due_date_get_datetime (_data_->_tmp47_);
		_data_->_tmp49_ = _data_->_tmp48_;
		i_cal_time_set_time (_data_->_tmp37_, g_date_time_get_hour (_data_->_tmp41_), g_date_time_get_minute (_data_->_tmp45_), g_date_time_get_second (_data_->_tmp49_));
		_data_->_tmp50_ = _data_->dt_start;
		i_cal_time_set_is_date (_data_->_tmp50_, FALSE);
	} else {
		_data_->_tmp51_ = _data_->dt_start;
		i_cal_time_set_is_date (_data_->_tmp51_, TRUE);
	}
	_data_->_tmp52_ = _data_->event;
	_data_->_tmp53_ = _data_->dt_start;
	i_cal_component_set_dtstart (_data_->_tmp52_, _data_->_tmp53_);
	_data_->_tmp54_ = _data_->event;
	_data_->_tmp55_ = _data_->dt_start;
	i_cal_component_set_dtend (_data_->_tmp54_, _data_->_tmp55_);
	{
		_data_->_data72_ = g_slice_new0 (Block72Data);
		_data_->_data72_->_ref_count_ = 1;
		_data_->_data72_->_data71_ = block71_data_ref (_data_->_data71_);
		_data_->_data72_->uid = NULL;
		_data_->_tmp56_ = _data_->_data71_->client;
		_data_->_tmp57_ = _data_->event;
		e_cal_client_create_object (_data_->_tmp56_, _data_->_tmp57_, E_CAL_OPERATION_FLAG_NONE, NULL, ____lambda25__gasync_ready_callback, block72_data_ref (_data_->_data72_));
		_data_->_state_ = 2;
		return FALSE;
		_state_2:
		;
		_data_->_tmp59_ = _data_->_data72_->uid;
		_data_->_tmp58_ = _data_->_tmp59_;
		if (_data_->_tmp58_ == NULL) {
			_data_->_tmp60_ = _data_->generated_uid;
			_data_->_tmp58_ = _data_->_tmp60_;
		}
		_data_->_tmp61_ = g_strdup (_data_->_tmp58_);
		_data_->result = _data_->_tmp61_;
		block72_data_unref (_data_->_data72_);
		_data_->_data72_ = NULL;
		_g_object_unref0 (_data_->dt_start);
		_g_free0 (_data_->generated_uid);
		_g_object_unref0 (_data_->event);
		block71_data_unref (_data_->_data71_);
		_data_->_data71_ = 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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp62_ = _data_->e;
		_data_->_tmp63_ = _data_->_tmp62_->message;
		g_critical ("CalendarEvents.vala:414: Error creating event: %s", _data_->_tmp63_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->dt_start);
		_g_free0 (_data_->generated_uid);
		_g_object_unref0 (_data_->event);
		block71_data_unref (_data_->_data71_);
		_data_->_data71_ = 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;
	}
	__finally0:
	_g_object_unref0 (_data_->dt_start);
	_g_free0 (_data_->generated_uid);
	_g_object_unref0 (_data_->event);
	block71_data_unref (_data_->_data71_);
	_data_->_data71_ = 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;
}

static void
services_calendar_events_delete_event_data_free (gpointer _data)
{
	ServicesCalendarEventsDeleteEventData* _data_;
	_data_ = _data;
	_g_free0 (_data_->source_uid);
	_g_free0 (_data_->event_uid);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalendarEventsDeleteEventData, _data_);
}

void
services_calendar_events_delete_event (ServicesCalendarEvents* self,
                                       const gchar* source_uid,
                                       const gchar* event_uid,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	ServicesCalendarEventsDeleteEventData* _data_;
	ServicesCalendarEvents* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source_uid != NULL);
	g_return_if_fail (event_uid != NULL);
	_data_ = g_slice_new0 (ServicesCalendarEventsDeleteEventData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_calendar_events_delete_event_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (source_uid);
	_g_free0 (_data_->source_uid);
	_data_->source_uid = _tmp1_;
	_tmp2_ = g_strdup (event_uid);
	_g_free0 (_data_->event_uid);
	_data_->event_uid = _tmp2_;
	services_calendar_events_delete_event_co (_data_);
}

gboolean
services_calendar_events_delete_event_finish (ServicesCalendarEvents* self,
                                              GAsyncResult* _res_)
{
	gboolean result;
	ServicesCalendarEventsDeleteEventData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
services_calendar_events_delete_event_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	ServicesCalendarEventsDeleteEventData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_calendar_events_delete_event_co (_data_);
}

static gboolean
services_calendar_events_delete_event_co (ServicesCalendarEventsDeleteEventData* _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_->_state_ = 1;
	services_calendar_events_get_client (_data_->self, _data_->source_uid, services_calendar_events_delete_event_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = services_calendar_events_get_client_finish (_data_->self, _data_->_res_);
	_data_->client = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->client;
	if (_data_->_tmp1_ == NULL) {
		_data_->result = 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;
	}
	{
		_data_->_tmp2_ = _data_->client;
		_data_->_state_ = 2;
		e_cal_client_remove_object (_data_->_tmp2_, _data_->event_uid, NULL, E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE, NULL, services_calendar_events_delete_event_ready, _data_);
		return FALSE;
		_state_2:
		e_cal_client_remove_object_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->result = TRUE;
		_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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp3_ = _data_->e;
		_data_->_tmp4_ = _data_->_tmp3_->message;
		g_critical ("CalendarEvents.vala:429: Error deleting event: %s", _data_->_tmp4_);
		_data_->result = FALSE;
		_g_error_free0 (_data_->e);
		_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;
	}
	__finally0:
	_g_object_unref0 (_data_->client);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
services_calendar_events_update_event_data_free (gpointer _data)
{
	ServicesCalendarEventsUpdateEventData* _data_;
	_data_ = _data;
	_g_free0 (_data_->source_uid);
	_g_free0 (_data_->event_uid);
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->self);
	g_slice_free (ServicesCalendarEventsUpdateEventData, _data_);
}

void
services_calendar_events_update_event (ServicesCalendarEvents* self,
                                       const gchar* source_uid,
                                       const gchar* event_uid,
                                       ObjectsItem* item,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	ServicesCalendarEventsUpdateEventData* _data_;
	ServicesCalendarEvents* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	ObjectsItem* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source_uid != NULL);
	g_return_if_fail (event_uid != NULL);
	g_return_if_fail (item != NULL);
	_data_ = g_slice_new0 (ServicesCalendarEventsUpdateEventData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, services_calendar_events_update_event_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (source_uid);
	_g_free0 (_data_->source_uid);
	_data_->source_uid = _tmp1_;
	_tmp2_ = g_strdup (event_uid);
	_g_free0 (_data_->event_uid);
	_data_->event_uid = _tmp2_;
	_tmp3_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp3_;
	services_calendar_events_update_event_co (_data_);
}

gboolean
services_calendar_events_update_event_finish (ServicesCalendarEvents* self,
                                              GAsyncResult* _res_)
{
	gboolean result;
	ServicesCalendarEventsUpdateEventData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
services_calendar_events_update_event_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	ServicesCalendarEventsUpdateEventData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	services_calendar_events_update_event_co (_data_);
}

static gboolean
services_calendar_events_update_event_co (ServicesCalendarEventsUpdateEventData* _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_->_state_ = 1;
	services_calendar_events_get_client (_data_->self, _data_->source_uid, services_calendar_events_update_event_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = services_calendar_events_get_client_finish (_data_->self, _data_->_res_);
	_data_->client = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->client;
	if (_data_->_tmp1_ == NULL) {
		_data_->result = 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;
	}
	{
		_data_->ical_event = NULL;
		_data_->_tmp2_ = _data_->client;
		_data_->_tmp3_ = NULL;
		_data_->_state_ = 2;
		e_cal_client_get_object (_data_->_tmp2_, _data_->event_uid, NULL, NULL, services_calendar_events_update_event_ready, _data_);
		return FALSE;
		_state_2:
		e_cal_client_get_object_finish (_data_->_tmp2_, _data_->_res_, &_data_->_tmp3_, &_data_->_inner_error0_);
		_g_object_unref0 (_data_->ical_event);
		_data_->ical_event = _data_->_tmp3_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->ical_event);
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _data_->ical_event;
		if (_data_->_tmp4_ == NULL) {
			_data_->result = FALSE;
			_g_object_unref0 (_data_->ical_event);
			_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;
		}
		_data_->_tmp5_ = _data_->ical_event;
		_data_->_tmp6_ = objects_item_get_content (_data_->item);
		_data_->_tmp7_ = _data_->_tmp6_;
		i_cal_component_set_summary (_data_->_tmp5_, _data_->_tmp7_);
		_data_->_tmp8_ = _data_->ical_event;
		_data_->_tmp9_ = objects_item_get_description (_data_->item);
		_data_->_tmp10_ = _data_->_tmp9_;
		i_cal_component_set_description (_data_->_tmp8_, _data_->_tmp10_);
		_data_->_tmp11_ = objects_item_get_due (_data_->item);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = objects_due_date_get_datetime (_data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->has_time = utils_datetime_has_time (_data_->_tmp14_);
		_data_->_tmp15_ = i_cal_time_new ();
		_data_->dt_start = _data_->_tmp15_;
		_data_->_tmp16_ = _data_->dt_start;
		_data_->_tmp17_ = objects_item_get_due (_data_->item);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp19_ = objects_due_date_get_datetime (_data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = objects_item_get_due (_data_->item);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = objects_due_date_get_datetime (_data_->_tmp22_);
		_data_->_tmp24_ = _data_->_tmp23_;
		_data_->_tmp25_ = objects_item_get_due (_data_->item);
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_tmp27_ = objects_due_date_get_datetime (_data_->_tmp26_);
		_data_->_tmp28_ = _data_->_tmp27_;
		i_cal_time_set_date (_data_->_tmp16_, g_date_time_get_year (_data_->_tmp20_), g_date_time_get_month (_data_->_tmp24_), g_date_time_get_day_of_month (_data_->_tmp28_));
		if (_data_->has_time) {
			_data_->_tmp29_ = _data_->dt_start;
			_data_->_tmp30_ = objects_item_get_due (_data_->item);
			_data_->_tmp31_ = _data_->_tmp30_;
			_data_->_tmp32_ = objects_due_date_get_datetime (_data_->_tmp31_);
			_data_->_tmp33_ = _data_->_tmp32_;
			_data_->_tmp34_ = objects_item_get_due (_data_->item);
			_data_->_tmp35_ = _data_->_tmp34_;
			_data_->_tmp36_ = objects_due_date_get_datetime (_data_->_tmp35_);
			_data_->_tmp37_ = _data_->_tmp36_;
			_data_->_tmp38_ = objects_item_get_due (_data_->item);
			_data_->_tmp39_ = _data_->_tmp38_;
			_data_->_tmp40_ = objects_due_date_get_datetime (_data_->_tmp39_);
			_data_->_tmp41_ = _data_->_tmp40_;
			i_cal_time_set_time (_data_->_tmp29_, g_date_time_get_hour (_data_->_tmp33_), g_date_time_get_minute (_data_->_tmp37_), g_date_time_get_second (_data_->_tmp41_));
			_data_->_tmp42_ = _data_->dt_start;
			i_cal_time_set_is_date (_data_->_tmp42_, FALSE);
		} else {
			_data_->_tmp43_ = _data_->dt_start;
			i_cal_time_set_is_date (_data_->_tmp43_, TRUE);
		}
		_data_->_tmp44_ = _data_->ical_event;
		_data_->_tmp45_ = _data_->dt_start;
		i_cal_component_set_dtstart (_data_->_tmp44_, _data_->_tmp45_);
		_data_->_tmp46_ = _data_->ical_event;
		_data_->_tmp47_ = _data_->dt_start;
		i_cal_component_set_dtend (_data_->_tmp46_, _data_->_tmp47_);
		_data_->_tmp48_ = _data_->client;
		_data_->_tmp49_ = _data_->ical_event;
		_data_->_state_ = 3;
		e_cal_client_modify_object (_data_->_tmp48_, _data_->_tmp49_, E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE, NULL, services_calendar_events_update_event_ready, _data_);
		return FALSE;
		_state_3:
		e_cal_client_modify_object_finish (_data_->_tmp48_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->dt_start);
			_g_object_unref0 (_data_->ical_event);
			goto __catch0_g_error;
		}
		_data_->result = TRUE;
		_g_object_unref0 (_data_->dt_start);
		_g_object_unref0 (_data_->ical_event);
		_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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp50_ = _data_->e;
		_data_->_tmp51_ = _data_->_tmp50_->message;
		g_critical ("CalendarEvents.vala:469: Error updating event: %s", _data_->_tmp51_);
		_data_->result = FALSE;
		_g_error_free0 (_data_->e);
		_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;
	}
	__finally0:
	_g_object_unref0 (_data_->client);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

CalendarEventsUtilDateRange*
services_calendar_events_get_data_range (ServicesCalendarEvents* self)
{
	CalendarEventsUtilDateRange* result;
	CalendarEventsUtilDateRange* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_data_range;
	result = _tmp0_;
	return result;
}

static void
services_calendar_events_set_data_range (ServicesCalendarEvents* self,
                                         CalendarEventsUtilDateRange* value)
{
	CalendarEventsUtilDateRange* old_value;
	g_return_if_fail (self != NULL);
	old_value = services_calendar_events_get_data_range (self);
	if (old_value != value) {
		CalendarEventsUtilDateRange* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_data_range);
		self->priv->_data_range = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_DATA_RANGE_PROPERTY]);
	}
}

GDateTime*
services_calendar_events_get_month_start (ServicesCalendarEvents* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_month_start;
	result = _tmp0_;
	return result;
}

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

static void
services_calendar_events_set_month_start (ServicesCalendarEvents* self,
                                          GDateTime* value)
{
	GDateTime* old_value;
	g_return_if_fail (self != NULL);
	old_value = services_calendar_events_get_month_start (self);
	if (old_value != value) {
		GDateTime* _tmp0_;
		_tmp0_ = _g_date_time_ref0 (value);
		_g_date_time_unref0 (self->priv->_month_start);
		self->priv->_month_start = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_MONTH_START_PROPERTY]);
	}
}

gint
services_calendar_events_get_num_weeks (ServicesCalendarEvents* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_num_weeks;
	return result;
}

static void
services_calendar_events_set_num_weeks (ServicesCalendarEvents* self,
                                        gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = services_calendar_events_get_num_weeks (self);
	if (old_value != value) {
		self->priv->_num_weeks = value;
		g_object_notify_by_pspec ((GObject *) self, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_NUM_WEEKS_PROPERTY]);
	}
}

GDateWeekday
services_calendar_events_get_week_starts_on (ServicesCalendarEvents* self)
{
	GDateWeekday result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_week_starts_on;
	return result;
}

void
services_calendar_events_set_week_starts_on (ServicesCalendarEvents* self,
                                             GDateWeekday value)
{
	GDateWeekday old_value;
	g_return_if_fail (self != NULL);
	old_value = services_calendar_events_get_week_starts_on (self);
	if (old_value != value) {
		self->priv->_week_starts_on = value;
		g_object_notify_by_pspec ((GObject *) self, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_WEEK_STARTS_ON_PROPERTY]);
	}
}

GHashTable*
services_calendar_events_get_source_components (ServicesCalendarEvents* self)
{
	GHashTable* result;
	GHashTable* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_source_components;
	result = _tmp0_;
	return result;
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

static void
services_calendar_events_set_source_components (ServicesCalendarEvents* self,
                                                GHashTable* value)
{
	GHashTable* old_value;
	g_return_if_fail (self != NULL);
	old_value = services_calendar_events_get_source_components (self);
	if (old_value != value) {
		GHashTable* _tmp0_;
		_tmp0_ = _g_hash_table_ref0 (value);
		_g_hash_table_unref0 (self->priv->_source_components);
		self->priv->_source_components = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_SOURCE_COMPONENTS_PROPERTY]);
	}
}

ESourceRegistry*
services_calendar_events_get_registry (ServicesCalendarEvents* self)
{
	ESourceRegistry* result;
	ESourceRegistry* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_registry;
	result = _tmp0_;
	return result;
}

static void
services_calendar_events_set_registry (ServicesCalendarEvents* self,
                                       ESourceRegistry* value)
{
	ESourceRegistry* old_value;
	g_return_if_fail (self != NULL);
	old_value = services_calendar_events_get_registry (self);
	if (old_value != value) {
		ESourceRegistry* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_registry);
		self->priv->_registry = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_REGISTRY_PROPERTY]);
	}
}

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

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

static guint
_calendar_events_util_source_hash_func_ghash_func (gconstpointer key)
{
	guint result;
	result = calendar_events_util_source_hash_func ((ESource*) key);
	return result;
}

static gboolean
_calendar_events_util_source_equal_func_gequal_func (gconstpointer a,
                                                     gconstpointer b)
{
	gboolean result;
	result = calendar_events_util_source_equal_func ((ESource*) a, (ESource*) b);
	return result;
}

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

static GObject *
services_calendar_events_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ServicesCalendarEvents * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	GHashTable* _tmp4_;
	GHashFunc _tmp5_;
	GEqualFunc _tmp6_;
	GHashTable* _tmp7_;
	gint week_start = 0;
	const gchar* _tmp8_;
	guint8* _tmp9_;
	gint _tmp9__length1;
	gint _tmp10_ = 0;
	guint8* _tmp11_;
	gint _tmp11__length1;
	guint8 _tmp12_;
	gboolean _tmp13_ = FALSE;
	parent_class = G_OBJECT_CLASS (services_calendar_events_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_TYPE_CALENDAR_EVENTS, ServicesCalendarEvents);
	_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->source_client);
	self->priv->source_client = _tmp2_;
	_tmp3_ = g_hash_table_new_full (_calendar_events_util_source_hash_func_ghash_func, _calendar_events_util_source_equal_func_gequal_func, _g_object_unref0_, _g_object_unref0_);
	_tmp4_ = _tmp3_;
	services_calendar_events_set_source_components (self, _tmp4_);
	_g_hash_table_unref0 (_tmp4_);
	_tmp5_ = g_str_hash;
	_tmp6_ = g_str_equal;
	_tmp7_ = g_hash_table_new_full (_tmp5_, _tmp6_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->source_view);
	self->priv->source_view = _tmp7_;
	_tmp8_ = nl_langinfo (_NL_TIME_FIRST_WEEKDAY);
	_tmp9_ = string_get_data (_tmp8_, &_tmp10_);
	_tmp9__length1 = _tmp10_;
	_tmp11_ = _tmp9_;
	_tmp11__length1 = _tmp9__length1;
	_tmp12_ = _tmp11_[0];
	week_start = (gint) _tmp12_;
	if (week_start >= 1) {
		_tmp13_ = week_start <= 7;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		services_calendar_events_set_week_starts_on (self, (GDateWeekday) (week_start - 1));
	}
	services_calendar_events_compute_ranges (self);
	services_calendar_events_open (self, NULL, NULL);
	return obj;
}

static void
services_calendar_events_class_init (ServicesCalendarEventsClass * klass,
                                     gpointer klass_data)
{
	services_calendar_events_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ServicesCalendarEvents_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_services_calendar_events_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_services_calendar_events_set_property;
	G_OBJECT_CLASS (klass)->constructor = services_calendar_events_constructor;
	G_OBJECT_CLASS (klass)->finalize = services_calendar_events_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CALENDAR_EVENTS_DATA_RANGE_PROPERTY, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_DATA_RANGE_PROPERTY] = g_param_spec_object ("data-range", "data-range", "data-range", CALENDAR_EVENTS_UTIL_TYPE_DATE_RANGE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CALENDAR_EVENTS_MONTH_START_PROPERTY, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_MONTH_START_PROPERTY] = g_param_spec_boxed ("month-start", "month-start", "month-start", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CALENDAR_EVENTS_NUM_WEEKS_PROPERTY, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_NUM_WEEKS_PROPERTY] = g_param_spec_int ("num-weeks", "num-weeks", "num-weeks", G_MININT, G_MAXINT, 6, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CALENDAR_EVENTS_WEEK_STARTS_ON_PROPERTY, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_WEEK_STARTS_ON_PROPERTY] = g_param_spec_int ("week-starts-on", "week-starts-on", "week-starts-on", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CALENDAR_EVENTS_SOURCE_COMPONENTS_PROPERTY, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_SOURCE_COMPONENTS_PROPERTY] = g_param_spec_boxed ("source-components", "source-components", "source-components", G_TYPE_HASH_TABLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SERVICES_CALENDAR_EVENTS_REGISTRY_PROPERTY, services_calendar_events_properties[SERVICES_CALENDAR_EVENTS_REGISTRY_PROPERTY] = g_param_spec_object ("registry", "registry", "registry", e_source_registry_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_COMPONENTS_ADDED_SIGNAL] = g_signal_new ("components-added", SERVICES_TYPE_CALENDAR_EVENTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, e_source_get_type (), GEE_TYPE_COLLECTION);
	services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_COMPONENTS_UPDATED_SIGNAL] = g_signal_new ("components-updated", SERVICES_TYPE_CALENDAR_EVENTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, e_source_get_type (), GEE_TYPE_COLLECTION);
	services_calendar_events_signals[SERVICES_CALENDAR_EVENTS_COMPONENTS_REMOVED_SIGNAL] = g_signal_new ("components-removed", SERVICES_TYPE_CALENDAR_EVENTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, e_source_get_type (), GEE_TYPE_COLLECTION);
}

static void
services_calendar_events_instance_init (ServicesCalendarEvents * self,
                                        gpointer klass)
{
	self->priv = services_calendar_events_get_instance_private (self);
	self->priv->_num_weeks = 6;
	g_rec_mutex_init (&self->priv->__lock_source_client);
}

static void
services_calendar_events_finalize (GObject * obj)
{
	ServicesCalendarEvents * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SERVICES_TYPE_CALENDAR_EVENTS, ServicesCalendarEvents);
	_g_object_unref0 (self->priv->_data_range);
	_g_date_time_unref0 (self->priv->_month_start);
	_g_hash_table_unref0 (self->priv->_source_components);
	_g_object_unref0 (self->priv->_registry);
	g_rec_mutex_clear (&self->priv->__lock_source_client);
	_g_hash_table_unref0 (self->priv->source_client);
	_g_hash_table_unref0 (self->priv->source_view);
	G_OBJECT_CLASS (services_calendar_events_parent_class)->finalize (obj);
}

static GType
services_calendar_events_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ServicesCalendarEventsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) services_calendar_events_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ServicesCalendarEvents), 0, (GInstanceInitFunc) services_calendar_events_instance_init, NULL };
	GType services_calendar_events_type_id;
	services_calendar_events_type_id = g_type_register_static (G_TYPE_OBJECT, "ServicesCalendarEvents", &g_define_type_info, 0);
	ServicesCalendarEvents_private_offset = g_type_add_instance_private (services_calendar_events_type_id, sizeof (ServicesCalendarEventsPrivate));
	return services_calendar_events_type_id;
}

GType
services_calendar_events_get_type (void)
{
	static volatile gsize services_calendar_events_type_id__once = 0;
	if (g_once_init_enter (&services_calendar_events_type_id__once)) {
		GType services_calendar_events_type_id;
		services_calendar_events_type_id = services_calendar_events_get_type_once ();
		g_once_init_leave (&services_calendar_events_type_id__once, services_calendar_events_type_id);
	}
	return services_calendar_events_type_id__once;
}

static void
_vala_services_calendar_events_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	ServicesCalendarEvents * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_TYPE_CALENDAR_EVENTS, ServicesCalendarEvents);
	switch (property_id) {
		case SERVICES_CALENDAR_EVENTS_DATA_RANGE_PROPERTY:
		g_value_set_object (value, services_calendar_events_get_data_range (self));
		break;
		case SERVICES_CALENDAR_EVENTS_MONTH_START_PROPERTY:
		g_value_set_boxed (value, services_calendar_events_get_month_start (self));
		break;
		case SERVICES_CALENDAR_EVENTS_NUM_WEEKS_PROPERTY:
		g_value_set_int (value, services_calendar_events_get_num_weeks (self));
		break;
		case SERVICES_CALENDAR_EVENTS_WEEK_STARTS_ON_PROPERTY:
		g_value_set_int (value, services_calendar_events_get_week_starts_on (self));
		break;
		case SERVICES_CALENDAR_EVENTS_SOURCE_COMPONENTS_PROPERTY:
		g_value_set_boxed (value, services_calendar_events_get_source_components (self));
		break;
		case SERVICES_CALENDAR_EVENTS_REGISTRY_PROPERTY:
		g_value_set_object (value, services_calendar_events_get_registry (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_services_calendar_events_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	ServicesCalendarEvents * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SERVICES_TYPE_CALENDAR_EVENTS, ServicesCalendarEvents);
	switch (property_id) {
		case SERVICES_CALENDAR_EVENTS_DATA_RANGE_PROPERTY:
		services_calendar_events_set_data_range (self, g_value_get_object (value));
		break;
		case SERVICES_CALENDAR_EVENTS_MONTH_START_PROPERTY:
		services_calendar_events_set_month_start (self, g_value_get_boxed (value));
		break;
		case SERVICES_CALENDAR_EVENTS_NUM_WEEKS_PROPERTY:
		services_calendar_events_set_num_weeks (self, g_value_get_int (value));
		break;
		case SERVICES_CALENDAR_EVENTS_WEEK_STARTS_ON_PROPERTY:
		services_calendar_events_set_week_starts_on (self, g_value_get_int (value));
		break;
		case SERVICES_CALENDAR_EVENTS_SOURCE_COMPONENTS_PROPERTY:
		services_calendar_events_set_source_components (self, g_value_get_boxed (value));
		break;
		case SERVICES_CALENDAR_EVENTS_REGISTRY_PROPERTY:
		services_calendar_events_set_registry (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

