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

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

#include <adwaita.h>
#include <glib-object.h>
#include "planify.h"
#include <libedataserver/libedataserver.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define DIALOGS_TYPE_CALENDAR_SYNC (dialogs_calendar_sync_get_type ())
#define DIALOGS_CALENDAR_SYNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_CALENDAR_SYNC, DialogsCalendarSync))
#define DIALOGS_CALENDAR_SYNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_CALENDAR_SYNC, DialogsCalendarSyncClass))
#define DIALOGS_IS_CALENDAR_SYNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_CALENDAR_SYNC))
#define DIALOGS_IS_CALENDAR_SYNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_CALENDAR_SYNC))
#define DIALOGS_CALENDAR_SYNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_CALENDAR_SYNC, DialogsCalendarSyncClass))

typedef struct _DialogsCalendarSync DialogsCalendarSync;
typedef struct _DialogsCalendarSyncClass DialogsCalendarSyncClass;
typedef struct _DialogsCalendarSyncPrivate DialogsCalendarSyncPrivate;
enum  {
	DIALOGS_CALENDAR_SYNC_0_PROPERTY,
	DIALOGS_CALENDAR_SYNC_PROJECT_PROPERTY,
	DIALOGS_CALENDAR_SYNC_NUM_PROPERTIES
};
static GParamSpec* dialogs_calendar_sync_properties[DIALOGS_CALENDAR_SYNC_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _DialogsCalendarSyncUnsyncTasksData DialogsCalendarSyncUnsyncTasksData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _DialogsCalendarSyncSyncTasksData DialogsCalendarSyncSyncTasksData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DialogsCalendarSyncLoadActiveCalendarInfoData DialogsCalendarSyncLoadActiveCalendarInfoData;
typedef struct _Block119Data Block119Data;

#define DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW (dialogs_calendar_sync_calendar_source_row_get_type ())
#define DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRow))
#define DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRowClass))
#define DIALOGS_CALENDAR_SYNC_IS_CALENDAR_SOURCE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW))
#define DIALOGS_CALENDAR_SYNC_IS_CALENDAR_SOURCE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW))
#define DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRowClass))

typedef struct _DialogsCalendarSyncCalendarSourceRow DialogsCalendarSyncCalendarSourceRow;
typedef struct _DialogsCalendarSyncCalendarSourceRowClass DialogsCalendarSyncCalendarSourceRowClass;
typedef struct _Block120Data Block120Data;
typedef struct _Block121Data Block121Data;
typedef struct _DialogsCalendarSyncLoadCalendarSourcesData DialogsCalendarSyncLoadCalendarSourcesData;
typedef struct _DialogsCalendarSyncCalendarSourceRowPrivate DialogsCalendarSyncCalendarSourceRowPrivate;
enum  {
	DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_0_PROPERTY,
	DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_SOURCE_PROPERTY,
	DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CHECK_ICON_PROPERTY,
	DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CALENDAR_NAME_PROPERTY,
	DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_NUM_PROPERTIES
};
static GParamSpec* dialogs_calendar_sync_calendar_source_row_properties[DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_NUM_PROPERTIES];

struct _DialogsCalendarSync {
	AdwDialog parent_instance;
	DialogsCalendarSyncPrivate * priv;
};

struct _DialogsCalendarSyncClass {
	AdwDialogClass parent_class;
};

struct _DialogsCalendarSyncPrivate {
	ObjectsProject* _project;
	WidgetsLoadingButton* enable_button;
	WidgetsLoadingButton* disable_button;
	ESource* selected_source;
	GtkStack* stack;
};

struct _DialogsCalendarSyncUnsyncTasksData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DialogsCalendarSync* self;
	WidgetsLoadingButton* _tmp0_;
	WidgetsLoadingButton* _tmp1_;
	gint deleted_count;
	GeeArrayList* _item_list;
	ObjectsProject* _tmp2_;
	GeeArrayList* _tmp3_;
	GeeArrayList* _tmp4_;
	gint _item_size;
	GeeArrayList* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gint _item_index;
	gint _tmp8_;
	gint _tmp9_;
	ObjectsItem* item;
	GeeArrayList* _tmp10_;
	gpointer _tmp11_;
	ObjectsItem* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gboolean success;
	ServicesCalendarEvents* _tmp15_;
	ServicesCalendarEvents* _tmp16_;
	ObjectsProject* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	ObjectsItem* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gboolean _tmp23_;
	ObjectsItem* _tmp24_;
	ObjectsItem* _tmp25_;
	gint _tmp26_;
	ObjectsProject* _tmp27_;
	ObjectsProject* _tmp28_;
	WidgetsLoadingButton* _tmp29_;
	ServicesEventBus* _tmp30_;
	ServicesEventBus* _tmp31_;
	Util* _tmp32_;
	Util* _tmp33_;
	AdwToast* _tmp34_;
	AdwToast* _tmp35_;
};

struct _DialogsCalendarSyncSyncTasksData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DialogsCalendarSync* self;
	WidgetsLoadingButton* _tmp0_;
	WidgetsLoadingButton* _tmp1_;
	ObjectsProject* _tmp2_;
	ESource* _tmp3_;
	const gchar* _tmp4_;
	ObjectsProject* _tmp5_;
	gint synced_count;
	GeeArrayList* _item_list;
	ObjectsProject* _tmp6_;
	GeeArrayList* _tmp7_;
	GeeArrayList* _tmp8_;
	gint _item_size;
	GeeArrayList* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gint _item_index;
	gint _tmp12_;
	gint _tmp13_;
	ObjectsItem* item;
	GeeArrayList* _tmp14_;
	gpointer _tmp15_;
	ObjectsItem* _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	gchar* event_uid;
	ServicesCalendarEvents* _tmp19_;
	ServicesCalendarEvents* _tmp20_;
	ESource* _tmp21_;
	const gchar* _tmp22_;
	ObjectsItem* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	const gchar* _tmp26_;
	ObjectsItem* _tmp27_;
	const gchar* _tmp28_;
	ObjectsItem* _tmp29_;
	gint _tmp30_;
	WidgetsLoadingButton* _tmp31_;
	GtkStack* _tmp32_;
};

struct _DialogsCalendarSyncLoadActiveCalendarInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DialogsCalendarSync* self;
	GtkLabel* label;
	ESourceRegistry* registry;
	ESourceRegistry* _tmp0_;
	ESource* source;
	ObjectsProject* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ESource* _tmp4_;
	ESource* _tmp5_;
	ESource* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GError* e;
	GError* _tmp11_;
	const gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _Block119Data {
	int _ref_count_;
	DialogsCalendarSync* self;
	GtkListBox* list_box;
	GtkPopover* popover;
	GtkLabel* name_label;
	GtkLabel* location_label;
	GtkGrid* color_widget;
};

struct _Block120Data {
	int _ref_count_;
	DialogsCalendarSync* self;
	GtkListBox* list_box;
	gpointer _async_data_;
};

struct _Block121Data {
	int _ref_count_;
	Block120Data * _data120_;
	GeeArrayList* used_calendars;
};

struct _DialogsCalendarSyncLoadCalendarSourcesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DialogsCalendarSync* self;
	GtkListBox* list_box;
	Block120Data* _data120_;
	Block121Data* _data121_;
	ESourceRegistry* registry;
	ESourceRegistry* _tmp0_;
	GList* sources;
	GList* _tmp1_;
	ServicesStore* _tmp2_;
	GeeArrayList* _tmp3_;
	GList* _tmp4_;
	GError* _error_;
	GError* _tmp5_;
	const gchar* _tmp6_;
	GError* _inner_error0_;
};

struct _DialogsCalendarSyncCalendarSourceRow {
	GtkListBoxRow parent_instance;
	DialogsCalendarSyncCalendarSourceRowPrivate * priv;
};

struct _DialogsCalendarSyncCalendarSourceRowClass {
	GtkListBoxRowClass parent_class;
};

struct _DialogsCalendarSyncCalendarSourceRowPrivate {
	ESource* _source;
	GtkImage* _check_icon;
	gchar* _calendar_name;
};

static gint DialogsCalendarSync_private_offset;
static gpointer dialogs_calendar_sync_parent_class = NULL;
static gint DialogsCalendarSyncCalendarSourceRow_private_offset;
static gpointer dialogs_calendar_sync_calendar_source_row_parent_class = NULL;

VALA_EXTERN GType dialogs_calendar_sync_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsCalendarSync, g_object_unref)
VALA_EXTERN DialogsCalendarSync* dialogs_calendar_sync_new (ObjectsProject* project);
VALA_EXTERN DialogsCalendarSync* dialogs_calendar_sync_construct (GType object_type,
                                                      ObjectsProject* project);
static void dialogs_calendar_sync_unsync_tasks_data_free (gpointer _data);
static void dialogs_calendar_sync_unsync_tasks (DialogsCalendarSync* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dialogs_calendar_sync_unsync_tasks_finish (DialogsCalendarSync* self,
                                                GAsyncResult* _res_);
static gboolean dialogs_calendar_sync_unsync_tasks_co (DialogsCalendarSyncUnsyncTasksData* _data_);
VALA_EXTERN ObjectsProject* dialogs_calendar_sync_get_project (DialogsCalendarSync* self);
static void dialogs_calendar_sync_unsync_tasks_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void dialogs_calendar_sync_sync_tasks_data_free (gpointer _data);
static void dialogs_calendar_sync_sync_tasks (DialogsCalendarSync* self,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
static void dialogs_calendar_sync_sync_tasks_finish (DialogsCalendarSync* self,
                                              GAsyncResult* _res_);
static gboolean dialogs_calendar_sync_sync_tasks_co (DialogsCalendarSyncSyncTasksData* _data_);
static void dialogs_calendar_sync_sync_tasks_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static GtkWidget* dialogs_calendar_sync_create_active_page (DialogsCalendarSync* self);
static void dialogs_calendar_sync_load_active_calendar_info (DialogsCalendarSync* self,
                                                      GtkLabel* label,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static void dialogs_calendar_sync_load_active_calendar_info_finish (DialogsCalendarSync* self,
                                                             GAsyncResult* _res_);
static void __lambda754_ (DialogsCalendarSync* self);
static void ___lambda754__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dialogs_calendar_sync_load_active_calendar_info_data_free (gpointer _data);
static gboolean dialogs_calendar_sync_load_active_calendar_info_co (DialogsCalendarSyncLoadActiveCalendarInfoData* _data_);
static void dialogs_calendar_sync_load_active_calendar_info_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static GtkWidget* dialogs_calendar_sync_create_success_page (DialogsCalendarSync* self);
static void __lambda755_ (DialogsCalendarSync* self);
static void ___lambda755__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static GtkWidget* dialogs_calendar_sync_create_benefit_card (DialogsCalendarSync* self,
                                                      const gchar* description);
static GtkPopover* dialogs_calendar_sync_create_calendar_popover (DialogsCalendarSync* self,
                                                           GtkMenuButton* button,
                                                           GtkLabel* name_label,
                                                           GtkLabel* location_label,
                                                           GtkGrid* color_widget);
static Block119Data* block119_data_ref (Block119Data* _data119_);
static void block119_data_unref (void * _userdata_);
static void __lambda756_ (Block119Data* _data119_,
                   GtkListBoxRow* row);
VALA_EXTERN GType dialogs_calendar_sync_calendar_source_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsCalendarSyncCalendarSourceRow, g_object_unref)
VALA_EXTERN const gchar* dialogs_calendar_sync_calendar_source_row_get_calendar_name (DialogsCalendarSyncCalendarSourceRow* self);
VALA_EXTERN ESource* dialogs_calendar_sync_calendar_source_row_get_source (DialogsCalendarSyncCalendarSourceRow* self);
VALA_EXTERN GtkImage* dialogs_calendar_sync_calendar_source_row_get_check_icon (DialogsCalendarSyncCalendarSourceRow* self);
static void ___lambda756__gtk_list_box_row_activated (GtkListBox* _sender,
                                               GtkListBoxRow* row,
                                               gpointer self);
static void dialogs_calendar_sync_load_calendar_sources (DialogsCalendarSync* self,
                                                  GtkListBox* list_box,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
static void dialogs_calendar_sync_load_calendar_sources_finish (DialogsCalendarSync* self,
                                                         GAsyncResult* _res_);
static void dialogs_calendar_sync_load_calendar_sources_data_free (gpointer _data);
static gboolean dialogs_calendar_sync_load_calendar_sources_co (DialogsCalendarSyncLoadCalendarSourcesData* _data_);
static Block120Data* block120_data_ref (Block120Data* _data120_);
static void block120_data_unref (void * _userdata_);
static Block121Data* block121_data_ref (Block121Data* _data121_);
static void block121_data_unref (void * _userdata_);
static void dialogs_calendar_sync_load_calendar_sources_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void ___lambda757_ (Block121Data* _data121_,
                    ESource* source);
VALA_EXTERN DialogsCalendarSyncCalendarSourceRow* dialogs_calendar_sync_calendar_source_row_new (ESource* source);
VALA_EXTERN DialogsCalendarSyncCalendarSourceRow* dialogs_calendar_sync_calendar_source_row_construct (GType object_type,
                                                                                           ESource* source);
static void ____lambda757__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 dialogs_calendar_sync_set_project (DialogsCalendarSync* self,
                                        ObjectsProject* value);
static void dialogs_calendar_sync_calendar_source_row_set_source (DialogsCalendarSyncCalendarSourceRow* self,
                                                           ESource* value);
static void dialogs_calendar_sync_calendar_source_row_set_check_icon (DialogsCalendarSyncCalendarSourceRow* self,
                                                               GtkImage* value);
static void dialogs_calendar_sync_calendar_source_row_set_calendar_name (DialogsCalendarSyncCalendarSourceRow* self,
                                                                  const gchar* value);
static GObject * dialogs_calendar_sync_calendar_source_row_constructor (GType type,
                                                                 guint n_construct_properties,
                                                                 GObjectConstructParam * construct_properties);
static void dialogs_calendar_sync_calendar_source_row_finalize (GObject * obj);
static GType dialogs_calendar_sync_calendar_source_row_get_type_once (void);
static void _vala_dialogs_calendar_sync_calendar_source_row_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static void _vala_dialogs_calendar_sync_calendar_source_row_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec);
static GObject * dialogs_calendar_sync_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _dialogs_calendar_sync___lambda758_ (DialogsCalendarSync* self);
static void __dialogs_calendar_sync___lambda758__gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self);
static void dialogs_calendar_sync_finalize (GObject * obj);
static GType dialogs_calendar_sync_get_type_once (void);
static void _vala_dialogs_calendar_sync_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_dialogs_calendar_sync_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
dialogs_calendar_sync_get_instance_private (DialogsCalendarSync* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsCalendarSync_private_offset);
}

DialogsCalendarSync*
dialogs_calendar_sync_construct (GType object_type,
                                 ObjectsProject* project)
{
	DialogsCalendarSync * self = NULL;
	g_return_val_if_fail (project != NULL, NULL);
	self = (DialogsCalendarSync*) g_object_new (object_type, "project", project, "title", _ ("Calendar Sync"), "content-width", 450, NULL);
	return self;
}

DialogsCalendarSync*
dialogs_calendar_sync_new (ObjectsProject* project)
{
	return dialogs_calendar_sync_construct (DIALOGS_TYPE_CALENDAR_SYNC, project);
}

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

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

static void
dialogs_calendar_sync_unsync_tasks (DialogsCalendarSync* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DialogsCalendarSyncUnsyncTasksData* _data_;
	DialogsCalendarSync* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DialogsCalendarSyncUnsyncTasksData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dialogs_calendar_sync_unsync_tasks_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dialogs_calendar_sync_unsync_tasks_co (_data_);
}

static void
dialogs_calendar_sync_unsync_tasks_finish (DialogsCalendarSync* self,
                                           GAsyncResult* _res_)
{
	DialogsCalendarSyncUnsyncTasksData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dialogs_calendar_sync_unsync_tasks_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DialogsCalendarSyncUnsyncTasksData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dialogs_calendar_sync_unsync_tasks_co (_data_);
}

static gboolean
dialogs_calendar_sync_unsync_tasks_co (DialogsCalendarSyncUnsyncTasksData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->disable_button;
	widgets_loading_button_set_is_loading (_data_->_tmp0_, TRUE);
	_data_->_tmp1_ = _data_->self->priv->disable_button;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp1_, FALSE);
	_data_->deleted_count = 0;
	{
		_data_->_tmp2_ = _data_->self->priv->_project;
		_data_->_tmp3_ = objects_project_get_all_items (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_item_list = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->_item_list;
		_data_->_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_item_size = _data_->_tmp7_;
		_data_->_item_index = -1;
		while (TRUE) {
			_data_->_item_index = _data_->_item_index + 1;
			_data_->_tmp8_ = _data_->_item_index;
			_data_->_tmp9_ = _data_->_item_size;
			if (!(_data_->_tmp8_ < _data_->_tmp9_)) {
				break;
			}
			_data_->_tmp10_ = _data_->_item_list;
			_data_->_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp10_, _data_->_item_index);
			_data_->item = (ObjectsItem*) _data_->_tmp11_;
			_data_->_tmp12_ = _data_->item;
			_data_->_tmp13_ = objects_item_get_calendar_event_uid (_data_->_tmp12_);
			_data_->_tmp14_ = _data_->_tmp13_;
			if (g_strcmp0 (_data_->_tmp14_, "") != 0) {
				_data_->_tmp15_ = services_calendar_events_get_default ();
				_data_->_tmp16_ = _data_->_tmp15_;
				_data_->_tmp17_ = _data_->self->priv->_project;
				_data_->_tmp18_ = objects_project_get_calendar_source_uid (_data_->_tmp17_);
				_data_->_tmp19_ = _data_->_tmp18_;
				_data_->_tmp20_ = _data_->item;
				_data_->_tmp21_ = objects_item_get_calendar_event_uid (_data_->_tmp20_);
				_data_->_tmp22_ = _data_->_tmp21_;
				_data_->_state_ = 1;
				services_calendar_events_delete_event (_data_->_tmp16_, _data_->_tmp19_, _data_->_tmp22_, dialogs_calendar_sync_unsync_tasks_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp23_ = services_calendar_events_delete_event_finish (_data_->_tmp16_, _data_->_res_);
				_g_object_unref0 (_data_->_tmp16_);
				_data_->success = _data_->_tmp23_;
				if (_data_->success) {
					_data_->_tmp24_ = _data_->item;
					objects_item_set_calendar_event_uid (_data_->_tmp24_, "");
					_data_->_tmp25_ = _data_->item;
					objects_item_update_local (_data_->_tmp25_);
					_data_->_tmp26_ = _data_->deleted_count;
					_data_->deleted_count = _data_->_tmp26_ + 1;
				}
			}
			_g_object_unref0 (_data_->item);
		}
	}
	_data_->_tmp27_ = _data_->self->priv->_project;
	objects_project_set_calendar_source_uid (_data_->_tmp27_, "");
	_data_->_tmp28_ = _data_->self->priv->_project;
	objects_project_update_local (_data_->_tmp28_);
	_data_->_tmp29_ = _data_->self->priv->disable_button;
	widgets_loading_button_set_is_loading (_data_->_tmp29_, FALSE);
	_data_->_tmp30_ = services_event_bus_get_default ();
	_data_->_tmp31_ = _data_->_tmp30_;
	_data_->_tmp32_ = util_get_default ();
	_data_->_tmp33_ = _data_->_tmp32_;
	_data_->_tmp34_ = util_create_toast (_data_->_tmp33_, _ ("Calendar sync disabled successfully"), (guint) 2, ADW_TOAST_PRIORITY_NORMAL);
	_data_->_tmp35_ = _data_->_tmp34_;
	g_signal_emit_by_name (_data_->_tmp31_, "send-toast", _data_->_tmp35_);
	_g_object_unref0 (_data_->_tmp35_);
	_g_object_unref0 (_data_->_tmp33_);
	_g_object_unref0 (_data_->_tmp31_);
	adw_dialog_close ((AdwDialog*) _data_->self);
	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
dialogs_calendar_sync_sync_tasks_data_free (gpointer _data)
{
	DialogsCalendarSyncSyncTasksData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DialogsCalendarSyncSyncTasksData, _data_);
}

static void
dialogs_calendar_sync_sync_tasks (DialogsCalendarSync* self,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	DialogsCalendarSyncSyncTasksData* _data_;
	DialogsCalendarSync* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DialogsCalendarSyncSyncTasksData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dialogs_calendar_sync_sync_tasks_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dialogs_calendar_sync_sync_tasks_co (_data_);
}

static void
dialogs_calendar_sync_sync_tasks_finish (DialogsCalendarSync* self,
                                         GAsyncResult* _res_)
{
	DialogsCalendarSyncSyncTasksData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dialogs_calendar_sync_sync_tasks_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	DialogsCalendarSyncSyncTasksData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dialogs_calendar_sync_sync_tasks_co (_data_);
}

static gboolean
dialogs_calendar_sync_sync_tasks_co (DialogsCalendarSyncSyncTasksData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->enable_button;
	widgets_loading_button_set_is_loading (_data_->_tmp0_, TRUE);
	_data_->_tmp1_ = _data_->self->priv->enable_button;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp1_, FALSE);
	_data_->_tmp2_ = _data_->self->priv->_project;
	_data_->_tmp3_ = _data_->self->priv->selected_source;
	_data_->_tmp4_ = e_source_get_uid (_data_->_tmp3_);
	objects_project_set_calendar_source_uid (_data_->_tmp2_, _data_->_tmp4_);
	_data_->_tmp5_ = _data_->self->priv->_project;
	objects_project_update_local (_data_->_tmp5_);
	_data_->synced_count = 0;
	{
		_data_->_tmp6_ = _data_->self->priv->_project;
		_data_->_tmp7_ = objects_project_get_all_items (_data_->_tmp6_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_item_list = _data_->_tmp8_;
		_data_->_tmp9_ = _data_->_item_list;
		_data_->_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp9_);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_item_size = _data_->_tmp11_;
		_data_->_item_index = -1;
		while (TRUE) {
			_data_->_item_index = _data_->_item_index + 1;
			_data_->_tmp12_ = _data_->_item_index;
			_data_->_tmp13_ = _data_->_item_size;
			if (!(_data_->_tmp12_ < _data_->_tmp13_)) {
				break;
			}
			_data_->_tmp14_ = _data_->_item_list;
			_data_->_tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp14_, _data_->_item_index);
			_data_->item = (ObjectsItem*) _data_->_tmp15_;
			_data_->_tmp16_ = _data_->item;
			_data_->_tmp17_ = objects_item_get_has_due (_data_->_tmp16_);
			_data_->_tmp18_ = _data_->_tmp17_;
			if (_data_->_tmp18_) {
				_data_->_tmp19_ = services_calendar_events_get_default ();
				_data_->_tmp20_ = _data_->_tmp19_;
				_data_->_tmp21_ = _data_->self->priv->selected_source;
				_data_->_tmp22_ = e_source_get_uid (_data_->_tmp21_);
				_data_->_tmp23_ = _data_->item;
				_data_->_state_ = 1;
				services_calendar_events_create_event (_data_->_tmp20_, _data_->_tmp22_, _data_->_tmp23_, dialogs_calendar_sync_sync_tasks_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp24_ = services_calendar_events_create_event_finish (_data_->_tmp20_, _data_->_res_);
				_data_->_tmp25_ = _data_->_tmp24_;
				_g_object_unref0 (_data_->_tmp20_);
				_data_->event_uid = _data_->_tmp25_;
				_data_->_tmp26_ = _data_->event_uid;
				if (_data_->_tmp26_ != NULL) {
					_data_->_tmp27_ = _data_->item;
					_data_->_tmp28_ = _data_->event_uid;
					objects_item_set_calendar_event_uid (_data_->_tmp27_, _data_->_tmp28_);
					_data_->_tmp29_ = _data_->item;
					objects_item_update_local (_data_->_tmp29_);
					_data_->_tmp30_ = _data_->synced_count;
					_data_->synced_count = _data_->_tmp30_ + 1;
				}
				_g_free0 (_data_->event_uid);
			}
			_g_object_unref0 (_data_->item);
		}
	}
	_data_->_tmp31_ = _data_->self->priv->enable_button;
	widgets_loading_button_set_is_loading (_data_->_tmp31_, FALSE);
	_data_->_tmp32_ = _data_->self->priv->stack;
	gtk_stack_set_visible_child_name (_data_->_tmp32_, "success");
	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
__lambda754_ (DialogsCalendarSync* self)
{
	dialogs_calendar_sync_unsync_tasks (self, NULL, NULL);
}

static void
___lambda754__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda754_ ((DialogsCalendarSync*) self);
}

static GtkWidget*
dialogs_calendar_sync_create_active_page (DialogsCalendarSync* self)
{
	GtkImage* icon = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkImage* _tmp2_ = NULL;
	GtkLabel* title = NULL;
	gchar* _tmp3_;
	gchar** _tmp4_;
	GtkLabel* _tmp5_ = NULL;
	GtkLabel* description = NULL;
	GtkLabel* _tmp6_ = NULL;
	GtkLabel* calendar_info = NULL;
	gchar* _tmp7_;
	gchar** _tmp8_;
	GtkLabel* _tmp9_ = NULL;
	WidgetsLoadingButton* _tmp10_ = NULL;
	WidgetsLoadingButton* _tmp11_;
	WidgetsLoadingButton* _tmp12_;
	WidgetsLoadingButton* _tmp13_;
	GtkBox* box = NULL;
	GtkBox* _tmp14_ = NULL;
	WidgetsLoadingButton* _tmp15_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("success");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("check-round-outline-symbolic");
	gtk_image_set_pixel_size (_tmp2_, 64);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp2_);
	icon = _tmp2_;
	_tmp3_ = g_strdup ("title-1");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp5_ = (GtkLabel*) gtk_label_new (_ ("Calendar Sync Active"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp5_, _tmp4_);
	_tmp4_ = (_vala_array_free (_tmp4_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp5_, 24);
	g_object_ref_sink (_tmp5_);
	title = _tmp5_;
	_tmp6_ = (GtkLabel*) gtk_label_new (_ ("Your tasks are currently synced with your calendar. Any task with a da" \
"te automatically appears as a calendar event."));
	gtk_label_set_wrap (_tmp6_, TRUE);
	gtk_label_set_justify (_tmp6_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp6_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp6_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp6_, 12);
	g_object_ref_sink (_tmp6_);
	description = _tmp6_;
	_tmp7_ = g_strdup ("dim-label");
	_tmp8_ = g_new0 (gchar*, 1 + 1);
	_tmp8_[0] = _tmp7_;
	_tmp9_ = (GtkLabel*) gtk_label_new ("");
	gtk_label_set_wrap (_tmp9_, TRUE);
	gtk_label_set_justify (_tmp9_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp9_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp9_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp9_, 24);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp9_, _tmp8_);
	_tmp8_ = (_vala_array_free (_tmp8_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp9_);
	calendar_info = _tmp9_;
	dialogs_calendar_sync_load_active_calendar_info (self, calendar_info, NULL, NULL);
	_tmp10_ = widgets_loading_button_new_with_label (_ ("Disable Sync"));
	gtk_widget_set_margin_start ((GtkWidget*) _tmp10_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp10_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp10_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp10_, 24);
	gtk_widget_set_halign ((GtkWidget*) _tmp10_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->disable_button);
	self->priv->disable_button = _tmp10_;
	_tmp11_ = self->priv->disable_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp11_, "destructive-action");
	_tmp12_ = self->priv->disable_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp12_, "pill");
	_tmp13_ = self->priv->disable_button;
	g_signal_connect_object ((GtkButton*) _tmp13_, "clicked", (GCallback) ___lambda754__gtk_button_clicked, self, 0);
	_tmp14_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp14_, TRUE);
	g_object_ref_sink (_tmp14_);
	box = _tmp14_;
	gtk_box_append (box, (GtkWidget*) icon);
	gtk_box_append (box, (GtkWidget*) title);
	gtk_box_append (box, (GtkWidget*) description);
	gtk_box_append (box, (GtkWidget*) calendar_info);
	_tmp15_ = self->priv->disable_button;
	gtk_box_append (box, (GtkWidget*) _tmp15_);
	result = (GtkWidget*) box;
	_g_object_unref0 (calendar_info);
	_g_object_unref0 (description);
	_g_object_unref0 (title);
	_g_object_unref0 (icon);
	return result;
}

static void
dialogs_calendar_sync_load_active_calendar_info_data_free (gpointer _data)
{
	DialogsCalendarSyncLoadActiveCalendarInfoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->label);
	_g_object_unref0 (_data_->self);
	g_slice_free (DialogsCalendarSyncLoadActiveCalendarInfoData, _data_);
}

static void
dialogs_calendar_sync_load_active_calendar_info (DialogsCalendarSync* self,
                                                 GtkLabel* label,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	DialogsCalendarSyncLoadActiveCalendarInfoData* _data_;
	DialogsCalendarSync* _tmp0_;
	GtkLabel* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_data_ = g_slice_new0 (DialogsCalendarSyncLoadActiveCalendarInfoData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dialogs_calendar_sync_load_active_calendar_info_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (label);
	_g_object_unref0 (_data_->label);
	_data_->label = _tmp1_;
	dialogs_calendar_sync_load_active_calendar_info_co (_data_);
}

static void
dialogs_calendar_sync_load_active_calendar_info_finish (DialogsCalendarSync* self,
                                                        GAsyncResult* _res_)
{
	DialogsCalendarSyncLoadActiveCalendarInfoData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dialogs_calendar_sync_load_active_calendar_info_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	DialogsCalendarSyncLoadActiveCalendarInfoData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dialogs_calendar_sync_load_active_calendar_info_co (_data_);
}

static gboolean
dialogs_calendar_sync_load_active_calendar_info_co (DialogsCalendarSyncLoadActiveCalendarInfoData* _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, dialogs_calendar_sync_load_active_calendar_info_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp0_ = e_source_registry_new_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->registry = _data_->_tmp0_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp1_ = _data_->self->priv->_project;
		_data_->_tmp2_ = objects_project_get_calendar_source_uid (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = e_source_registry_ref_source (_data_->registry, _data_->_tmp3_);
		_data_->source = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->source;
		if (_data_->_tmp5_ != NULL) {
			_data_->_tmp6_ = _data_->source;
			_data_->_tmp7_ = e_source_dup_display_name (_data_->_tmp6_);
			_data_->_tmp8_ = _data_->_tmp7_;
			_data_->_tmp9_ = g_strdup_printf (_ ("Synced with: %s"), _data_->_tmp8_);
			_data_->_tmp10_ = _data_->_tmp9_;
			gtk_label_set_label (_data_->label, _data_->_tmp10_);
			_g_free0 (_data_->_tmp10_);
			_g_free0 (_data_->_tmp8_);
		}
		_g_object_unref0 (_data_->source);
		_g_object_unref0 (_data_->registry);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp11_ = _data_->e;
		_data_->_tmp12_ = _data_->_tmp11_->message;
		g_critical ("CalendarSync.vala:282: Error loading calendar info: %s", _data_->_tmp12_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda755_ (DialogsCalendarSync* self)
{
	adw_dialog_close ((AdwDialog*) self);
}

static void
___lambda755__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda755_ ((DialogsCalendarSync*) self);
}

static GtkWidget*
dialogs_calendar_sync_create_success_page (DialogsCalendarSync* self)
{
	GtkImage* icon = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkImage* _tmp2_ = NULL;
	GtkLabel* title = NULL;
	gchar* _tmp3_;
	gchar** _tmp4_;
	GtkLabel* _tmp5_ = NULL;
	GtkLabel* description = NULL;
	GtkLabel* _tmp6_ = NULL;
	GtkButton* ok_button = NULL;
	GtkButton* _tmp7_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp8_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("success");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("check-round-outline-symbolic");
	gtk_image_set_pixel_size (_tmp2_, 64);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp2_);
	icon = _tmp2_;
	_tmp3_ = g_strdup ("title-1");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp5_ = (GtkLabel*) gtk_label_new (_ ("Sync Enabled!"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp5_, _tmp4_);
	_tmp4_ = (_vala_array_free (_tmp4_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp5_, 24);
	g_object_ref_sink (_tmp5_);
	title = _tmp5_;
	_tmp6_ = (GtkLabel*) gtk_label_new (_ ("Your tasks are now synced with your calendar. Any task with a date wil" \
"l automatically appear as a calendar event."));
	gtk_label_set_wrap (_tmp6_, TRUE);
	gtk_label_set_justify (_tmp6_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp6_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp6_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp6_, 12);
	g_object_ref_sink (_tmp6_);
	description = _tmp6_;
	_tmp7_ = (GtkButton*) gtk_button_new_with_label (_ ("OK"));
	gtk_widget_set_margin_start ((GtkWidget*) _tmp7_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp7_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp7_, 32);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp7_, 24);
	gtk_widget_set_halign ((GtkWidget*) _tmp7_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp7_);
	ok_button = _tmp7_;
	gtk_widget_add_css_class ((GtkWidget*) ok_button, "suggested-action");
	gtk_widget_add_css_class ((GtkWidget*) ok_button, "pill");
	g_signal_connect_object (ok_button, "clicked", (GCallback) ___lambda755__gtk_button_clicked, self, 0);
	_tmp8_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_valign ((GtkWidget*) _tmp8_, GTK_ALIGN_CENTER);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp8_, TRUE);
	g_object_ref_sink (_tmp8_);
	box = _tmp8_;
	gtk_box_append (box, (GtkWidget*) icon);
	gtk_box_append (box, (GtkWidget*) title);
	gtk_box_append (box, (GtkWidget*) description);
	gtk_box_append (box, (GtkWidget*) ok_button);
	result = (GtkWidget*) box;
	_g_object_unref0 (ok_button);
	_g_object_unref0 (description);
	_g_object_unref0 (title);
	_g_object_unref0 (icon);
	return result;
}

static GtkWidget*
dialogs_calendar_sync_create_benefit_card (DialogsCalendarSync* self,
                                           const gchar* description)
{
	GtkLabel* label = NULL;
	GtkLabel* _tmp0_ = NULL;
	AdwBin* card = NULL;
	gchar* _tmp1_;
	gchar** _tmp2_;
	GtkWidget* _tmp3_;
	AdwBin* _tmp4_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (description != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (description);
	gtk_label_set_wrap (_tmp0_, TRUE);
	gtk_label_set_justify (_tmp0_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_valign ((GtkWidget*) _tmp0_, GTK_ALIGN_CENTER);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp0_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp0_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp0_, 12);
	g_object_ref_sink (_tmp0_);
	label = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) label, "caption");
	_tmp1_ = g_strdup ("card");
	_tmp2_ = g_new0 (gchar*, 1 + 1);
	_tmp2_[0] = _tmp1_;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) label);
	_tmp4_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp4_, _tmp2_);
	_tmp2_ = (_vala_array_free (_tmp2_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp4_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	card = _tmp4_;
	result = (GtkWidget*) card;
	_g_object_unref0 (label);
	return result;
}

static Block119Data*
block119_data_ref (Block119Data* _data119_)
{
	g_atomic_int_inc (&_data119_->_ref_count_);
	return _data119_;
}

static void
block119_data_unref (void * _userdata_)
{
	Block119Data* _data119_;
	_data119_ = (Block119Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data119_->_ref_count_)) {
		DialogsCalendarSync* self;
		self = _data119_->self;
		_g_object_unref0 (_data119_->popover);
		_g_object_unref0 (_data119_->list_box);
		_g_object_unref0 (_data119_->name_label);
		_g_object_unref0 (_data119_->location_label);
		_g_object_unref0 (_data119_->color_widget);
		_g_object_unref0 (self);
		g_slice_free (Block119Data, _data119_);
	}
}

static void
__lambda756_ (Block119Data* _data119_,
              GtkListBoxRow* row)
{
	DialogsCalendarSync* self;
	DialogsCalendarSyncCalendarSourceRow* calendar_row = NULL;
	DialogsCalendarSyncCalendarSourceRow* _tmp0_;
	DialogsCalendarSyncCalendarSourceRow* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	DialogsCalendarSyncCalendarSourceRow* _tmp4_;
	ESource* _tmp5_;
	ESource* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ESourceCalendar* cal = NULL;
	DialogsCalendarSyncCalendarSourceRow* _tmp9_;
	ESource* _tmp10_;
	ESource* _tmp11_;
	ESourceExtension* _tmp12_;
	ESourceCalendar* _tmp13_;
	Util* _tmp14_;
	Util* _tmp15_;
	ESourceCalendar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	DialogsCalendarSyncCalendarSourceRow* _tmp19_;
	ESource* _tmp20_;
	ESource* _tmp21_;
	ESource* _tmp22_;
	WidgetsLoadingButton* _tmp23_;
	GtkWidget* child = NULL;
	GtkWidget* _tmp24_;
	GtkWidget* _tmp25_;
	DialogsCalendarSyncCalendarSourceRow* _tmp34_;
	GtkImage* _tmp35_;
	GtkImage* _tmp36_;
	self = _data119_->self;
	g_return_if_fail (row != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (row, DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRow));
	calendar_row = _tmp0_;
	_tmp1_ = calendar_row;
	_tmp2_ = dialogs_calendar_sync_calendar_source_row_get_calendar_name (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_label_set_label (_data119_->name_label, _tmp3_);
	_tmp4_ = calendar_row;
	_tmp5_ = dialogs_calendar_sync_calendar_source_row_get_source (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = calendar_events_util_get_source_location (_tmp6_);
	_tmp8_ = _tmp7_;
	gtk_label_set_label (_data119_->location_label, _tmp8_);
	_g_free0 (_tmp8_);
	gtk_widget_set_visible ((GtkWidget*) _data119_->location_label, TRUE);
	_tmp9_ = calendar_row;
	_tmp10_ = dialogs_calendar_sync_calendar_source_row_get_source (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = e_source_get_extension (_tmp11_, E_SOURCE_EXTENSION_CALENDAR);
	_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, e_source_calendar_get_type (), ESourceCalendar));
	cal = _tmp13_;
	_tmp14_ = util_get_default ();
	_tmp15_ = _tmp14_;
	_tmp16_ = cal;
	_tmp17_ = e_source_selectable_dup_color ((ESourceSelectable*) _tmp16_);
	_tmp18_ = _tmp17_;
	util_set_widget_color (_tmp15_, _tmp18_, (GtkWidget*) _data119_->color_widget);
	_g_free0 (_tmp18_);
	_g_object_unref0 (_tmp15_);
	gtk_widget_set_visible ((GtkWidget*) _data119_->color_widget, TRUE);
	_tmp19_ = calendar_row;
	_tmp20_ = dialogs_calendar_sync_calendar_source_row_get_source (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _g_object_ref0 (_tmp21_);
	_g_object_unref0 (self->priv->selected_source);
	self->priv->selected_source = _tmp22_;
	_tmp23_ = self->priv->enable_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp23_, TRUE);
	_tmp24_ = gtk_widget_get_first_child ((GtkWidget*) _data119_->list_box);
	_tmp25_ = _g_object_ref0 (_tmp24_);
	child = _tmp25_;
	while (TRUE) {
		GtkWidget* _tmp26_;
		GtkWidget* _tmp27_;
		GtkWidget* _tmp31_;
		GtkWidget* _tmp32_;
		GtkWidget* _tmp33_;
		_tmp26_ = child;
		if (!(_tmp26_ != NULL)) {
			break;
		}
		_tmp27_ = child;
		if (DIALOGS_CALENDAR_SYNC_IS_CALENDAR_SOURCE_ROW (_tmp27_)) {
			GtkWidget* _tmp28_;
			GtkImage* _tmp29_;
			GtkImage* _tmp30_;
			_tmp28_ = child;
			_tmp29_ = dialogs_calendar_sync_calendar_source_row_get_check_icon (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRow));
			_tmp30_ = _tmp29_;
			gtk_widget_set_visible ((GtkWidget*) _tmp30_, FALSE);
		}
		_tmp31_ = child;
		_tmp32_ = gtk_widget_get_next_sibling (_tmp31_);
		_tmp33_ = _g_object_ref0 (_tmp32_);
		_g_object_unref0 (child);
		child = _tmp33_;
	}
	_tmp34_ = calendar_row;
	_tmp35_ = dialogs_calendar_sync_calendar_source_row_get_check_icon (_tmp34_);
	_tmp36_ = _tmp35_;
	gtk_widget_set_visible ((GtkWidget*) _tmp36_, TRUE);
	gtk_popover_popdown (_data119_->popover);
	_g_object_unref0 (child);
	_g_object_unref0 (cal);
	_g_object_unref0 (calendar_row);
}

static void
___lambda756__gtk_list_box_row_activated (GtkListBox* _sender,
                                          GtkListBoxRow* row,
                                          gpointer self)
{
	__lambda756_ (self, row);
}

static GtkPopover*
dialogs_calendar_sync_create_calendar_popover (DialogsCalendarSync* self,
                                               GtkMenuButton* button,
                                               GtkLabel* name_label,
                                               GtkLabel* location_label,
                                               GtkGrid* color_widget)
{
	Block119Data* _data119_;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkGrid* _tmp2_;
	gchar* _tmp3_;
	gchar** _tmp4_;
	GtkListBox* _tmp5_ = NULL;
	GtkScrolledWindow* scrolled_window = NULL;
	GtkWidget* _tmp6_;
	GtkScrolledWindow* _tmp7_ = NULL;
	GtkWidget* _tmp8_;
	GtkPopover* _tmp9_ = NULL;
	GtkPopover* _tmp10_;
	GtkPopover* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (button != NULL, NULL);
	g_return_val_if_fail (name_label != NULL, NULL);
	g_return_val_if_fail (location_label != NULL, NULL);
	g_return_val_if_fail (color_widget != NULL, NULL);
	_data119_ = g_slice_new0 (Block119Data);
	_data119_->_ref_count_ = 1;
	_data119_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (name_label);
	_g_object_unref0 (_data119_->name_label);
	_data119_->name_label = _tmp0_;
	_tmp1_ = _g_object_ref0 (location_label);
	_g_object_unref0 (_data119_->location_label);
	_data119_->location_label = _tmp1_;
	_tmp2_ = _g_object_ref0 (color_widget);
	_g_object_unref0 (_data119_->color_widget);
	_data119_->color_widget = _tmp2_;
	_tmp3_ = g_strdup ("listbox-background");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp5_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp5_, _tmp4_);
	_tmp4_ = (_vala_array_free (_tmp4_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp5_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp5_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp5_, 6);
	g_object_ref_sink (_tmp5_);
	_data119_->list_box = _tmp5_;
	_tmp6_ = _g_object_ref0 ((GtkWidget*) _data119_->list_box);
	_tmp7_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp7_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set (_tmp7_, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	gtk_scrolled_window_set_child (_tmp7_, _tmp6_);
	_g_object_unref0 (_tmp6_);
	g_object_ref_sink (_tmp7_);
	scrolled_window = _tmp7_;
	_tmp8_ = _g_object_ref0 ((GtkWidget*) scrolled_window);
	_tmp9_ = (GtkPopover*) gtk_popover_new ();
	gtk_popover_set_child (_tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_object_set ((GtkWidget*) _tmp9_, "width-request", 300, NULL);
	g_object_set ((GtkWidget*) _tmp9_, "height-request", 300, NULL);
	g_object_ref_sink (_tmp9_);
	_data119_->popover = _tmp9_;
	gtk_widget_add_css_class ((GtkWidget*) _data119_->popover, "popover-contents");
	g_signal_connect_data (_data119_->list_box, "row-activated", (GCallback) ___lambda756__gtk_list_box_row_activated, block119_data_ref (_data119_), (GClosureNotify) block119_data_unref, 0);
	dialogs_calendar_sync_load_calendar_sources (self, _data119_->list_box, NULL, NULL);
	_tmp10_ = _g_object_ref0 (_data119_->popover);
	result = _tmp10_;
	_g_object_unref0 (scrolled_window);
	block119_data_unref (_data119_);
	_data119_ = NULL;
	return result;
}

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

static void
dialogs_calendar_sync_load_calendar_sources (DialogsCalendarSync* self,
                                             GtkListBox* list_box,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	DialogsCalendarSyncLoadCalendarSourcesData* _data_;
	DialogsCalendarSync* _tmp0_;
	GtkListBox* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (list_box != NULL);
	_data_ = g_slice_new0 (DialogsCalendarSyncLoadCalendarSourcesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dialogs_calendar_sync_load_calendar_sources_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (list_box);
	_g_object_unref0 (_data_->list_box);
	_data_->list_box = _tmp1_;
	dialogs_calendar_sync_load_calendar_sources_co (_data_);
}

static void
dialogs_calendar_sync_load_calendar_sources_finish (DialogsCalendarSync* self,
                                                    GAsyncResult* _res_)
{
	DialogsCalendarSyncLoadCalendarSourcesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block120Data*
block120_data_ref (Block120Data* _data120_)
{
	g_atomic_int_inc (&_data120_->_ref_count_);
	return _data120_;
}

static void
block120_data_unref (void * _userdata_)
{
	Block120Data* _data120_;
	_data120_ = (Block120Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data120_->_ref_count_)) {
		DialogsCalendarSync* self;
		self = _data120_->self;
		_g_object_unref0 (_data120_->list_box);
		_g_object_unref0 (self);
		g_slice_free (Block120Data, _data120_);
	}
}

static Block121Data*
block121_data_ref (Block121Data* _data121_)
{
	g_atomic_int_inc (&_data121_->_ref_count_);
	return _data121_;
}

static void
block121_data_unref (void * _userdata_)
{
	Block121Data* _data121_;
	_data121_ = (Block121Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data121_->_ref_count_)) {
		DialogsCalendarSync* self;
		self = _data121_->_data120_->self;
		_g_object_unref0 (_data121_->used_calendars);
		block120_data_unref (_data121_->_data120_);
		_data121_->_data120_ = NULL;
		g_slice_free (Block121Data, _data121_);
	}
}

static void
dialogs_calendar_sync_load_calendar_sources_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	DialogsCalendarSyncLoadCalendarSourcesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dialogs_calendar_sync_load_calendar_sources_co (_data_);
}

static void
___lambda757_ (Block121Data* _data121_,
               ESource* source)
{
	Block120Data* _data120_;
	DialogsCalendarSync* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GeeArrayList* _tmp2_;
	const gchar* _tmp3_;
	DialogsCalendarSyncCalendarSourceRow* _tmp4_;
	DialogsCalendarSyncCalendarSourceRow* _tmp5_;
	_data120_ = _data121_->_data120_;
	self = _data120_->self;
	g_return_if_fail (source != NULL);
	_tmp0_ = e_source_get_enabled (source);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = _data121_->used_calendars;
	_tmp3_ = e_source_get_uid (source);
	if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp2_, _tmp3_)) {
		return;
	}
	_tmp4_ = dialogs_calendar_sync_calendar_source_row_new (source);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	gtk_list_box_append (_data120_->list_box, (GtkWidget*) _tmp5_);
	_g_object_unref0 (_tmp5_);
}

static void
____lambda757__gfunc (gconstpointer data,
                      gpointer self)
{
	___lambda757_ (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
dialogs_calendar_sync_load_calendar_sources_co (DialogsCalendarSyncLoadCalendarSourcesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data120_ = g_slice_new0 (Block120Data);
	_data_->_data120_->_ref_count_ = 1;
	_data_->_data120_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data120_->list_box);
	_data_->_data120_->list_box = _data_->list_box;
	_data_->_data120_->_async_data_ = _data_;
	{
		_data_->_data121_ = g_slice_new0 (Block121Data);
		_data_->_data121_->_ref_count_ = 1;
		_data_->_data121_->_data120_ = block120_data_ref (_data_->_data120_);
		_data_->_state_ = 1;
		e_source_registry_new (NULL, dialogs_calendar_sync_load_calendar_sources_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp0_ = e_source_registry_new_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->registry = _data_->_tmp0_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			block121_data_unref (_data_->_data121_);
			_data_->_data121_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp1_ = e_source_registry_list_sources (_data_->registry, E_SOURCE_EXTENSION_CALENDAR);
		_data_->sources = _data_->_tmp1_;
		_data_->_tmp2_ = services_store_instance ();
		_data_->_tmp3_ = services_store_get_used_calendar_sources (_data_->_tmp2_);
		_data_->_data121_->used_calendars = _data_->_tmp3_;
		_data_->_tmp4_ = _data_->sources;
		g_list_foreach (_data_->_tmp4_, ____lambda757__gfunc, _data_->_data121_);
		(_data_->sources == NULL) ? NULL : (_data_->sources = (_g_list_free__g_object_unref0_ (_data_->sources), NULL));
		_g_object_unref0 (_data_->registry);
		block121_data_unref (_data_->_data121_);
		_data_->_data121_ = NULL;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = _data_->_error_;
		_data_->_tmp6_ = _data_->_tmp5_->message;
		g_critical ("CalendarSync.vala:422: Error loading calendar sources: %s", _data_->_tmp6_);
		_g_error_free0 (_data_->_error_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		block120_data_unref (_data_->_data120_);
		_data_->_data120_ = 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;
	}
	block120_data_unref (_data_->_data120_);
	_data_->_data120_ = 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;
}

ObjectsProject*
dialogs_calendar_sync_get_project (DialogsCalendarSync* self)
{
	ObjectsProject* result;
	ObjectsProject* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_project;
	result = _tmp0_;
	return result;
}

static void
dialogs_calendar_sync_set_project (DialogsCalendarSync* self,
                                   ObjectsProject* value)
{
	ObjectsProject* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_calendar_sync_get_project (self);
	if (old_value != value) {
		ObjectsProject* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_project);
		self->priv->_project = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_calendar_sync_properties[DIALOGS_CALENDAR_SYNC_PROJECT_PROPERTY]);
	}
}

static inline gpointer
dialogs_calendar_sync_calendar_source_row_get_instance_private (DialogsCalendarSyncCalendarSourceRow* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsCalendarSyncCalendarSourceRow_private_offset);
}

DialogsCalendarSyncCalendarSourceRow*
dialogs_calendar_sync_calendar_source_row_construct (GType object_type,
                                                     ESource* source)
{
	DialogsCalendarSyncCalendarSourceRow * self = NULL;
	g_return_val_if_fail (source != NULL, NULL);
	self = (DialogsCalendarSyncCalendarSourceRow*) g_object_new (object_type, "source", source, NULL);
	return self;
}

DialogsCalendarSyncCalendarSourceRow*
dialogs_calendar_sync_calendar_source_row_new (ESource* source)
{
	return dialogs_calendar_sync_calendar_source_row_construct (DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, source);
}

ESource*
dialogs_calendar_sync_calendar_source_row_get_source (DialogsCalendarSyncCalendarSourceRow* self)
{
	ESource* result;
	ESource* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_source;
	result = _tmp0_;
	return result;
}

static void
dialogs_calendar_sync_calendar_source_row_set_source (DialogsCalendarSyncCalendarSourceRow* self,
                                                      ESource* value)
{
	ESource* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_calendar_sync_calendar_source_row_get_source (self);
	if (old_value != value) {
		ESource* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_source);
		self->priv->_source = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_calendar_sync_calendar_source_row_properties[DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_SOURCE_PROPERTY]);
	}
}

GtkImage*
dialogs_calendar_sync_calendar_source_row_get_check_icon (DialogsCalendarSyncCalendarSourceRow* self)
{
	GtkImage* result;
	GtkImage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_check_icon;
	result = _tmp0_;
	return result;
}

static void
dialogs_calendar_sync_calendar_source_row_set_check_icon (DialogsCalendarSyncCalendarSourceRow* self,
                                                          GtkImage* value)
{
	GtkImage* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_calendar_sync_calendar_source_row_get_check_icon (self);
	if (old_value != value) {
		GtkImage* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_check_icon);
		self->priv->_check_icon = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_calendar_sync_calendar_source_row_properties[DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CHECK_ICON_PROPERTY]);
	}
}

const gchar*
dialogs_calendar_sync_calendar_source_row_get_calendar_name (DialogsCalendarSyncCalendarSourceRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_calendar_name;
	result = _tmp0_;
	return result;
}

static void
dialogs_calendar_sync_calendar_source_row_set_calendar_name (DialogsCalendarSyncCalendarSourceRow* self,
                                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_calendar_sync_calendar_source_row_get_calendar_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_calendar_name);
		self->priv->_calendar_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_calendar_sync_calendar_source_row_properties[DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CALENDAR_NAME_PROPERTY]);
	}
}

static GObject *
dialogs_calendar_sync_calendar_source_row_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DialogsCalendarSyncCalendarSourceRow * self;
	ESource* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkGrid* color_grid = NULL;
	gchar* _tmp3_;
	gchar** _tmp4_;
	GtkGrid* _tmp5_ = NULL;
	GtkLabel* title_label = NULL;
	const gchar* _tmp6_;
	GtkLabel* _tmp7_ = NULL;
	GtkLabel* subtitle_label = NULL;
	ESource* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar** _tmp13_;
	GtkLabel* _tmp14_ = NULL;
	GtkLabel* _tmp15_;
	GtkImage* _tmp16_ = NULL;
	GtkImage* _tmp17_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp18_ = NULL;
	GtkGrid* _tmp19_;
	GtkGrid* _tmp20_;
	GtkGrid* _tmp21_;
	GtkLabel* _tmp22_;
	GtkGrid* _tmp23_;
	GtkLabel* _tmp24_;
	GtkGrid* _tmp25_;
	GtkImage* _tmp26_;
	GtkGrid* _tmp27_;
	ESourceCalendar* cal = NULL;
	ESource* _tmp28_;
	ESourceExtension* _tmp29_;
	ESourceCalendar* _tmp30_;
	Util* _tmp31_;
	Util* _tmp32_;
	ESourceCalendar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	GtkGrid* _tmp36_;
	parent_class = G_OBJECT_CLASS (dialogs_calendar_sync_calendar_source_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRow);
	_tmp0_ = self->priv->_source;
	_tmp1_ = e_source_dup_display_name (_tmp0_);
	_tmp2_ = _tmp1_;
	dialogs_calendar_sync_calendar_source_row_set_calendar_name (self, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = g_strdup ("source-calendar-color");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp5_ = (GtkGrid*) gtk_grid_new ();
	g_object_set ((GtkWidget*) _tmp5_, "width-request", 16, NULL);
	g_object_set ((GtkWidget*) _tmp5_, "height-request", 16, NULL);
	gtk_widget_set_valign ((GtkWidget*) _tmp5_, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) _tmp5_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp5_, _tmp4_);
	_tmp4_ = (_vala_array_free (_tmp4_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp5_);
	color_grid = _tmp5_;
	_tmp6_ = self->priv->_calendar_name;
	_tmp7_ = (GtkLabel*) gtk_label_new (_tmp6_);
	gtk_widget_set_halign ((GtkWidget*) _tmp7_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp7_, TRUE);
	g_object_ref_sink (_tmp7_);
	title_label = _tmp7_;
	_tmp8_ = self->priv->_source;
	_tmp9_ = calendar_events_util_get_source_location (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_strdup ("dim-label");
	_tmp12_ = g_strdup ("caption");
	_tmp13_ = g_new0 (gchar*, 2 + 1);
	_tmp13_[0] = _tmp11_;
	_tmp13_[1] = _tmp12_;
	_tmp14_ = (GtkLabel*) gtk_label_new (_tmp10_);
	gtk_widget_set_halign ((GtkWidget*) _tmp14_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp14_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp14_, _tmp13_);
	_tmp13_ = (_vala_array_free (_tmp13_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp14_);
	_tmp15_ = _tmp14_;
	_g_free0 (_tmp10_);
	subtitle_label = _tmp15_;
	_tmp16_ = (GtkImage*) gtk_image_new_from_icon_name ("object-select-symbolic");
	gtk_widget_set_visible ((GtkWidget*) _tmp16_, FALSE);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp16_, 6);
	g_object_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	dialogs_calendar_sync_calendar_source_row_set_check_icon (self, _tmp17_);
	_g_object_unref0 (_tmp17_);
	_tmp18_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp18_, 9);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp18_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp18_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp18_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp18_, 6);
	g_object_ref_sink (_tmp18_);
	grid = _tmp18_;
	_tmp19_ = grid;
	_tmp20_ = color_grid;
	gtk_grid_attach (_tmp19_, (GtkWidget*) _tmp20_, 0, 0, 1, 2);
	_tmp21_ = grid;
	_tmp22_ = title_label;
	gtk_grid_attach (_tmp21_, (GtkWidget*) _tmp22_, 1, 0, 1, 1);
	_tmp23_ = grid;
	_tmp24_ = subtitle_label;
	gtk_grid_attach (_tmp23_, (GtkWidget*) _tmp24_, 1, 1, 1, 1);
	_tmp25_ = grid;
	_tmp26_ = self->priv->_check_icon;
	gtk_grid_attach (_tmp25_, (GtkWidget*) _tmp26_, 2, 0, 1, 2);
	_tmp27_ = grid;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp27_);
	gtk_widget_add_css_class ((GtkWidget*) self, "border-radius-6");
	_tmp28_ = self->priv->_source;
	_tmp29_ = e_source_get_extension (_tmp28_, E_SOURCE_EXTENSION_CALENDAR);
	_tmp30_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, e_source_calendar_get_type (), ESourceCalendar));
	cal = _tmp30_;
	_tmp31_ = util_get_default ();
	_tmp32_ = _tmp31_;
	_tmp33_ = cal;
	_tmp34_ = e_source_selectable_dup_color ((ESourceSelectable*) _tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = color_grid;
	util_set_widget_color (_tmp32_, _tmp35_, (GtkWidget*) _tmp36_);
	_g_free0 (_tmp35_);
	_g_object_unref0 (_tmp32_);
	_g_object_unref0 (cal);
	_g_object_unref0 (grid);
	_g_object_unref0 (subtitle_label);
	_g_object_unref0 (title_label);
	_g_object_unref0 (color_grid);
	return obj;
}

static void
dialogs_calendar_sync_calendar_source_row_class_init (DialogsCalendarSyncCalendarSourceRowClass * klass,
                                                      gpointer klass_data)
{
	dialogs_calendar_sync_calendar_source_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsCalendarSyncCalendarSourceRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dialogs_calendar_sync_calendar_source_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dialogs_calendar_sync_calendar_source_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = dialogs_calendar_sync_calendar_source_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = dialogs_calendar_sync_calendar_source_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_SOURCE_PROPERTY, dialogs_calendar_sync_calendar_source_row_properties[DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_SOURCE_PROPERTY] = g_param_spec_object ("source", "source", "source", e_source_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CHECK_ICON_PROPERTY, dialogs_calendar_sync_calendar_source_row_properties[DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CHECK_ICON_PROPERTY] = g_param_spec_object ("check-icon", "check-icon", "check-icon", gtk_image_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CALENDAR_NAME_PROPERTY, dialogs_calendar_sync_calendar_source_row_properties[DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CALENDAR_NAME_PROPERTY] = g_param_spec_string ("calendar-name", "calendar-name", "calendar-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dialogs_calendar_sync_calendar_source_row_instance_init (DialogsCalendarSyncCalendarSourceRow * self,
                                                         gpointer klass)
{
	self->priv = dialogs_calendar_sync_calendar_source_row_get_instance_private (self);
}

static void
dialogs_calendar_sync_calendar_source_row_finalize (GObject * obj)
{
	DialogsCalendarSyncCalendarSourceRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRow);
	_g_object_unref0 (self->priv->_source);
	_g_object_unref0 (self->priv->_check_icon);
	_g_free0 (self->priv->_calendar_name);
	G_OBJECT_CLASS (dialogs_calendar_sync_calendar_source_row_parent_class)->finalize (obj);
}

static GType
dialogs_calendar_sync_calendar_source_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsCalendarSyncCalendarSourceRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_calendar_sync_calendar_source_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsCalendarSyncCalendarSourceRow), 0, (GInstanceInitFunc) dialogs_calendar_sync_calendar_source_row_instance_init, NULL };
	GType dialogs_calendar_sync_calendar_source_row_type_id;
	dialogs_calendar_sync_calendar_source_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "DialogsCalendarSyncCalendarSourceRow", &g_define_type_info, 0);
	DialogsCalendarSyncCalendarSourceRow_private_offset = g_type_add_instance_private (dialogs_calendar_sync_calendar_source_row_type_id, sizeof (DialogsCalendarSyncCalendarSourceRowPrivate));
	return dialogs_calendar_sync_calendar_source_row_type_id;
}

GType
dialogs_calendar_sync_calendar_source_row_get_type (void)
{
	static volatile gsize dialogs_calendar_sync_calendar_source_row_type_id__once = 0;
	if (g_once_init_enter (&dialogs_calendar_sync_calendar_source_row_type_id__once)) {
		GType dialogs_calendar_sync_calendar_source_row_type_id;
		dialogs_calendar_sync_calendar_source_row_type_id = dialogs_calendar_sync_calendar_source_row_get_type_once ();
		g_once_init_leave (&dialogs_calendar_sync_calendar_source_row_type_id__once, dialogs_calendar_sync_calendar_source_row_type_id);
	}
	return dialogs_calendar_sync_calendar_source_row_type_id__once;
}

static void
_vala_dialogs_calendar_sync_calendar_source_row_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	DialogsCalendarSyncCalendarSourceRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRow);
	switch (property_id) {
		case DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_SOURCE_PROPERTY:
		g_value_set_object (value, dialogs_calendar_sync_calendar_source_row_get_source (self));
		break;
		case DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CHECK_ICON_PROPERTY:
		g_value_set_object (value, dialogs_calendar_sync_calendar_source_row_get_check_icon (self));
		break;
		case DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CALENDAR_NAME_PROPERTY:
		g_value_set_string (value, dialogs_calendar_sync_calendar_source_row_get_calendar_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dialogs_calendar_sync_calendar_source_row_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec)
{
	DialogsCalendarSyncCalendarSourceRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_CALENDAR_SYNC_TYPE_CALENDAR_SOURCE_ROW, DialogsCalendarSyncCalendarSourceRow);
	switch (property_id) {
		case DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_SOURCE_PROPERTY:
		dialogs_calendar_sync_calendar_source_row_set_source (self, g_value_get_object (value));
		break;
		case DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CHECK_ICON_PROPERTY:
		dialogs_calendar_sync_calendar_source_row_set_check_icon (self, g_value_get_object (value));
		break;
		case DIALOGS_CALENDAR_SYNC_CALENDAR_SOURCE_ROW_CALENDAR_NAME_PROPERTY:
		dialogs_calendar_sync_calendar_source_row_set_calendar_name (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_dialogs_calendar_sync___lambda758_ (DialogsCalendarSync* self)
{
	ESource* _tmp0_;
	_tmp0_ = self->priv->selected_source;
	if (_tmp0_ != NULL) {
		dialogs_calendar_sync_sync_tasks (self, NULL, NULL);
	}
}

static void
__dialogs_calendar_sync___lambda758__gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self)
{
	_dialogs_calendar_sync___lambda758_ ((DialogsCalendarSync*) self);
}

static GObject *
dialogs_calendar_sync_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DialogsCalendarSync * self;
	GtkLabel* title_label = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	GtkLabel* description_label = NULL;
	GtkLabel* _tmp3_ = NULL;
	GtkLabel* note_label = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	GtkLabel* _tmp7_ = NULL;
	GtkWidget* benefit1_card = NULL;
	GtkWidget* _tmp8_;
	GtkWidget* benefit2_card = NULL;
	GtkWidget* _tmp9_;
	GtkBox* benefits_box = NULL;
	GtkBox* _tmp10_ = NULL;
	GtkBox* _tmp11_;
	GtkWidget* _tmp12_;
	GtkBox* _tmp13_;
	GtkWidget* _tmp14_;
	GtkGrid* calendar_color = NULL;
	gchar* _tmp15_;
	gchar** _tmp16_;
	GtkGrid* _tmp17_ = NULL;
	Util* _tmp18_;
	Util* _tmp19_;
	GtkGrid* _tmp20_;
	GtkLabel* calendar_name_label = NULL;
	GtkLabel* _tmp21_ = NULL;
	GtkLabel* calendar_location_label = NULL;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar** _tmp24_;
	GtkLabel* _tmp25_ = NULL;
	GtkGrid* calendar_button_grid = NULL;
	GtkGrid* _tmp26_ = NULL;
	GtkGrid* _tmp27_;
	GtkGrid* _tmp28_;
	GtkGrid* _tmp29_;
	GtkLabel* _tmp30_;
	GtkGrid* _tmp31_;
	GtkLabel* _tmp32_;
	GtkMenuButton* calendar_button = NULL;
	GtkGrid* _tmp33_;
	GtkWidget* _tmp34_;
	GtkMenuButton* _tmp35_ = NULL;
	GtkMenuButton* _tmp36_;
	GtkPopover* calendar_popover = NULL;
	GtkMenuButton* _tmp37_;
	GtkLabel* _tmp38_;
	GtkLabel* _tmp39_;
	GtkGrid* _tmp40_;
	GtkPopover* _tmp41_;
	GtkMenuButton* _tmp42_;
	GtkPopover* _tmp43_;
	WidgetsLoadingButton* _tmp44_ = NULL;
	WidgetsLoadingButton* _tmp45_;
	WidgetsLoadingButton* _tmp46_;
	GtkBox* content_box = NULL;
	GtkBox* _tmp47_;
	GtkBox* _tmp48_;
	GtkLabel* _tmp49_;
	GtkBox* _tmp50_;
	GtkLabel* _tmp51_;
	GtkBox* _tmp52_;
	GtkLabel* _tmp53_;
	GtkBox* _tmp54_;
	GtkBox* _tmp55_;
	GtkBox* _tmp56_;
	GtkMenuButton* _tmp57_;
	GtkBox* _tmp58_;
	WidgetsLoadingButton* _tmp59_;
	GtkWidget* success_page = NULL;
	GtkWidget* _tmp60_;
	GtkWidget* active_page = NULL;
	GtkWidget* _tmp61_;
	GtkStack* _tmp62_ = NULL;
	GtkStack* _tmp63_;
	GtkBox* _tmp64_;
	GtkStack* _tmp65_;
	GtkWidget* _tmp66_;
	GtkStack* _tmp67_;
	GtkWidget* _tmp68_;
	AdwToolbarView* toolbar_view = NULL;
	GtkStack* _tmp69_;
	GtkWidget* _tmp70_;
	AdwToolbarView* _tmp71_ = NULL;
	AdwToolbarView* _tmp72_;
	AdwHeaderBar* _tmp73_;
	AdwHeaderBar* _tmp74_;
	AdwToolbarView* _tmp75_;
	ObjectsProject* _tmp76_;
	const gchar* _tmp77_;
	const gchar* _tmp78_;
	parent_class = G_OBJECT_CLASS (dialogs_calendar_sync_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_CALENDAR_SYNC, DialogsCalendarSync);
	_tmp0_ = g_strdup ("title-1");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkLabel*) gtk_label_new (_ ("Calendar Sync"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp2_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp2_, 12);
	g_object_ref_sink (_tmp2_);
	title_label = _tmp2_;
	_tmp3_ = (GtkLabel*) gtk_label_new (_ ("Turn your tasks into calendar events automatically. Any task with a da" \
"te will appear in your calendar, making it easier to plan your day."));
	gtk_label_set_wrap (_tmp3_, TRUE);
	gtk_label_set_justify (_tmp3_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp3_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp3_, 12);
	g_object_ref_sink (_tmp3_);
	description_label = _tmp3_;
	_tmp4_ = g_strdup ("dim-label");
	_tmp5_ = g_strdup ("caption");
	_tmp6_ = g_new0 (gchar*, 2 + 1);
	_tmp6_[0] = _tmp4_;
	_tmp6_[1] = _tmp5_;
	_tmp7_ = (GtkLabel*) gtk_label_new (_ ("Requirement: You need a calendar account configured in GNOME Calendar " \
"(Google, Nextcloud, etc.)"));
	gtk_label_set_wrap (_tmp7_, TRUE);
	gtk_label_set_justify (_tmp7_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp7_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp7_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp7_, 24);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp7_, _tmp6_);
	_tmp6_ = (_vala_array_free (_tmp6_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp7_);
	note_label = _tmp7_;
	_tmp8_ = dialogs_calendar_sync_create_benefit_card (self, _ ("Get mobile notifications for your tasks through Google Calendar, Outlo" \
"ok, or any calendar app"));
	benefit1_card = _tmp8_;
	_tmp9_ = dialogs_calendar_sync_create_benefit_card (self, _ ("Your tasks sync everywhere: phone, tablet, web browser, and any device" \
" with your calendar"));
	benefit2_card = _tmp9_;
	_tmp10_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	gtk_box_set_homogeneous (_tmp10_, TRUE);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp10_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp10_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp10_, 24);
	g_object_ref_sink (_tmp10_);
	benefits_box = _tmp10_;
	_tmp11_ = benefits_box;
	_tmp12_ = benefit1_card;
	gtk_box_append (_tmp11_, _tmp12_);
	_tmp13_ = benefits_box;
	_tmp14_ = benefit2_card;
	gtk_box_append (_tmp13_, _tmp14_);
	_tmp15_ = g_strdup ("source-calendar-color");
	_tmp16_ = g_new0 (gchar*, 1 + 1);
	_tmp16_[0] = _tmp15_;
	_tmp17_ = (GtkGrid*) gtk_grid_new ();
	g_object_set ((GtkWidget*) _tmp17_, "width-request", 16, NULL);
	g_object_set ((GtkWidget*) _tmp17_, "height-request", 16, NULL);
	gtk_widget_set_valign ((GtkWidget*) _tmp17_, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) _tmp17_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp17_, _tmp16_);
	_tmp16_ = (_vala_array_free (_tmp16_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp17_);
	calendar_color = _tmp17_;
	_tmp18_ = util_get_default ();
	_tmp19_ = _tmp18_;
	_tmp20_ = calendar_color;
	util_set_widget_color (_tmp19_, "#808080", (GtkWidget*) _tmp20_);
	_g_object_unref0 (_tmp19_);
	_tmp21_ = (GtkLabel*) gtk_label_new (_ ("Choose Calendar"));
	gtk_widget_set_halign ((GtkWidget*) _tmp21_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp21_, TRUE);
	g_object_ref_sink (_tmp21_);
	calendar_name_label = _tmp21_;
	_tmp22_ = g_strdup ("dim-label");
	_tmp23_ = g_strdup ("caption");
	_tmp24_ = g_new0 (gchar*, 2 + 1);
	_tmp24_[0] = _tmp22_;
	_tmp24_[1] = _tmp23_;
	_tmp25_ = (GtkLabel*) gtk_label_new (_ ("Select a calendar from the list"));
	gtk_widget_set_halign ((GtkWidget*) _tmp25_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp25_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp25_, _tmp24_);
	_tmp24_ = (_vala_array_free (_tmp24_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp25_);
	calendar_location_label = _tmp25_;
	_tmp26_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp26_, 9);
	g_object_ref_sink (_tmp26_);
	calendar_button_grid = _tmp26_;
	_tmp27_ = calendar_button_grid;
	_tmp28_ = calendar_color;
	gtk_grid_attach (_tmp27_, (GtkWidget*) _tmp28_, 0, 0, 1, 2);
	_tmp29_ = calendar_button_grid;
	_tmp30_ = calendar_name_label;
	gtk_grid_attach (_tmp29_, (GtkWidget*) _tmp30_, 1, 0, 1, 1);
	_tmp31_ = calendar_button_grid;
	_tmp32_ = calendar_location_label;
	gtk_grid_attach (_tmp31_, (GtkWidget*) _tmp32_, 1, 1, 1, 1);
	_tmp33_ = calendar_button_grid;
	_tmp34_ = _g_object_ref0 ((GtkWidget*) _tmp33_);
	_tmp35_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_menu_button_set_child (_tmp35_, _tmp34_);
	_g_object_unref0 (_tmp34_);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp35_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp35_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp35_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp35_, 12);
	g_object_ref_sink (_tmp35_);
	calendar_button = _tmp35_;
	_tmp36_ = calendar_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp36_, "pill");
	_tmp37_ = calendar_button;
	_tmp38_ = calendar_name_label;
	_tmp39_ = calendar_location_label;
	_tmp40_ = calendar_color;
	_tmp41_ = dialogs_calendar_sync_create_calendar_popover (self, _tmp37_, _tmp38_, _tmp39_, _tmp40_);
	calendar_popover = _tmp41_;
	_tmp42_ = calendar_button;
	_tmp43_ = calendar_popover;
	gtk_menu_button_set_popover (_tmp42_, _tmp43_);
	_tmp44_ = widgets_loading_button_new_with_label (_ ("Enable Sync"));
	gtk_widget_set_sensitive ((GtkWidget*) _tmp44_, FALSE);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp44_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp44_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp44_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp44_, 24);
	g_object_ref_sink (_tmp44_);
	_g_object_unref0 (self->priv->enable_button);
	self->priv->enable_button = _tmp44_;
	_tmp45_ = self->priv->enable_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp45_, "suggested-action");
	_tmp46_ = self->priv->enable_button;
	g_signal_connect_object ((GtkButton*) _tmp46_, "clicked", (GCallback) __dialogs_calendar_sync___lambda758__gtk_button_clicked, self, 0);
	_tmp47_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp47_);
	content_box = _tmp47_;
	_tmp48_ = content_box;
	_tmp49_ = title_label;
	gtk_box_append (_tmp48_, (GtkWidget*) _tmp49_);
	_tmp50_ = content_box;
	_tmp51_ = description_label;
	gtk_box_append (_tmp50_, (GtkWidget*) _tmp51_);
	_tmp52_ = content_box;
	_tmp53_ = note_label;
	gtk_box_append (_tmp52_, (GtkWidget*) _tmp53_);
	_tmp54_ = content_box;
	_tmp55_ = benefits_box;
	gtk_box_append (_tmp54_, (GtkWidget*) _tmp55_);
	_tmp56_ = content_box;
	_tmp57_ = calendar_button;
	gtk_box_append (_tmp56_, (GtkWidget*) _tmp57_);
	_tmp58_ = content_box;
	_tmp59_ = self->priv->enable_button;
	gtk_box_append (_tmp58_, (GtkWidget*) _tmp59_);
	_tmp60_ = dialogs_calendar_sync_create_success_page (self);
	success_page = _tmp60_;
	_tmp61_ = dialogs_calendar_sync_create_active_page (self);
	active_page = _tmp61_;
	_tmp62_ = (GtkStack*) gtk_stack_new ();
	gtk_stack_set_transition_type (_tmp62_, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
	g_object_ref_sink (_tmp62_);
	_g_object_unref0 (self->priv->stack);
	self->priv->stack = _tmp62_;
	_tmp63_ = self->priv->stack;
	_tmp64_ = content_box;
	gtk_stack_add_named (_tmp63_, (GtkWidget*) _tmp64_, "setup");
	_tmp65_ = self->priv->stack;
	_tmp66_ = success_page;
	gtk_stack_add_named (_tmp65_, _tmp66_, "success");
	_tmp67_ = self->priv->stack;
	_tmp68_ = active_page;
	gtk_stack_add_named (_tmp67_, _tmp68_, "active");
	_tmp69_ = self->priv->stack;
	_tmp70_ = _g_object_ref0 ((GtkWidget*) _tmp69_);
	_tmp71_ = (AdwToolbarView*) adw_toolbar_view_new ();
	adw_toolbar_view_set_content (_tmp71_, _tmp70_);
	_g_object_unref0 (_tmp70_);
	g_object_ref_sink (_tmp71_);
	toolbar_view = _tmp71_;
	_tmp72_ = toolbar_view;
	_tmp73_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp73_);
	_tmp74_ = _tmp73_;
	adw_toolbar_view_add_top_bar (_tmp72_, (GtkWidget*) _tmp74_);
	_g_object_unref0 (_tmp74_);
	_tmp75_ = toolbar_view;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp75_);
	_tmp76_ = self->priv->_project;
	_tmp77_ = objects_project_get_calendar_source_uid (_tmp76_);
	_tmp78_ = _tmp77_;
	if (g_strcmp0 (_tmp78_, "") != 0) {
		GtkStack* _tmp79_;
		_tmp79_ = self->priv->stack;
		gtk_stack_set_visible_child_name (_tmp79_, "active");
	}
	_g_object_unref0 (toolbar_view);
	_g_object_unref0 (active_page);
	_g_object_unref0 (success_page);
	_g_object_unref0 (content_box);
	_g_object_unref0 (calendar_popover);
	_g_object_unref0 (calendar_button);
	_g_object_unref0 (calendar_button_grid);
	_g_object_unref0 (calendar_location_label);
	_g_object_unref0 (calendar_name_label);
	_g_object_unref0 (calendar_color);
	_g_object_unref0 (benefits_box);
	_g_object_unref0 (benefit2_card);
	_g_object_unref0 (benefit1_card);
	_g_object_unref0 (note_label);
	_g_object_unref0 (description_label);
	_g_object_unref0 (title_label);
	return obj;
}

static void
dialogs_calendar_sync_class_init (DialogsCalendarSyncClass * klass,
                                  gpointer klass_data)
{
	dialogs_calendar_sync_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsCalendarSync_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dialogs_calendar_sync_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dialogs_calendar_sync_set_property;
	G_OBJECT_CLASS (klass)->constructor = dialogs_calendar_sync_constructor;
	G_OBJECT_CLASS (klass)->finalize = dialogs_calendar_sync_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_CALENDAR_SYNC_PROJECT_PROPERTY, dialogs_calendar_sync_properties[DIALOGS_CALENDAR_SYNC_PROJECT_PROPERTY] = g_param_spec_object ("project", "project", "project", OBJECTS_TYPE_PROJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
dialogs_calendar_sync_instance_init (DialogsCalendarSync * self,
                                     gpointer klass)
{
	self->priv = dialogs_calendar_sync_get_instance_private (self);
	self->priv->selected_source = NULL;
}

static void
dialogs_calendar_sync_finalize (GObject * obj)
{
	DialogsCalendarSync * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_TYPE_CALENDAR_SYNC, DialogsCalendarSync);
	_g_object_unref0 (self->priv->_project);
	_g_object_unref0 (self->priv->enable_button);
	_g_object_unref0 (self->priv->disable_button);
	_g_object_unref0 (self->priv->selected_source);
	_g_object_unref0 (self->priv->stack);
	G_OBJECT_CLASS (dialogs_calendar_sync_parent_class)->finalize (obj);
}

static GType
dialogs_calendar_sync_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsCalendarSyncClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_calendar_sync_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsCalendarSync), 0, (GInstanceInitFunc) dialogs_calendar_sync_instance_init, NULL };
	GType dialogs_calendar_sync_type_id;
	dialogs_calendar_sync_type_id = g_type_register_static (adw_dialog_get_type (), "DialogsCalendarSync", &g_define_type_info, 0);
	DialogsCalendarSync_private_offset = g_type_add_instance_private (dialogs_calendar_sync_type_id, sizeof (DialogsCalendarSyncPrivate));
	return dialogs_calendar_sync_type_id;
}

GType
dialogs_calendar_sync_get_type (void)
{
	static volatile gsize dialogs_calendar_sync_type_id__once = 0;
	if (g_once_init_enter (&dialogs_calendar_sync_type_id__once)) {
		GType dialogs_calendar_sync_type_id;
		dialogs_calendar_sync_type_id = dialogs_calendar_sync_get_type_once ();
		g_once_init_leave (&dialogs_calendar_sync_type_id__once, dialogs_calendar_sync_type_id);
	}
	return dialogs_calendar_sync_type_id__once;
}

static void
_vala_dialogs_calendar_sync_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	DialogsCalendarSync * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_CALENDAR_SYNC, DialogsCalendarSync);
	switch (property_id) {
		case DIALOGS_CALENDAR_SYNC_PROJECT_PROPERTY:
		g_value_set_object (value, dialogs_calendar_sync_get_project (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dialogs_calendar_sync_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	DialogsCalendarSync * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_TYPE_CALENDAR_SYNC, DialogsCalendarSync);
	switch (property_id) {
		case DIALOGS_CALENDAR_SYNC_PROJECT_PROPERTY:
		dialogs_calendar_sync_set_project (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

