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

/*
 * Copyright © 2025 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 <gee.h>
#include <glib.h>
#include "planify.h"
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <libsoup/soup.h>
#include <float.h>
#include <math.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_PREFERENCES_PAGES_TYPE_BASE_PAGE (dialogs_preferences_pages_base_page_get_type ())
#define DIALOGS_PREFERENCES_PAGES_BASE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePage))
#define DIALOGS_PREFERENCES_PAGES_BASE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePageClass))
#define DIALOGS_PREFERENCES_PAGES_IS_BASE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE))
#define DIALOGS_PREFERENCES_PAGES_IS_BASE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE))
#define DIALOGS_PREFERENCES_PAGES_BASE_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePageClass))

typedef struct _DialogsPreferencesPagesBasePage DialogsPreferencesPagesBasePage;
typedef struct _DialogsPreferencesPagesBasePageClass DialogsPreferencesPagesBasePageClass;
typedef struct _DialogsPreferencesPagesBasePagePrivate DialogsPreferencesPagesBasePagePrivate;

#define DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP (dialogs_preferences_pages_cal_dav_setup_get_type ())
#define DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, DialogsPreferencesPagesCalDAVSetup))
#define DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, DialogsPreferencesPagesCalDAVSetupClass))
#define DIALOGS_PREFERENCES_PAGES_IS_CAL_DAV_SETUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP))
#define DIALOGS_PREFERENCES_PAGES_IS_CAL_DAV_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP))
#define DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, DialogsPreferencesPagesCalDAVSetupClass))

typedef struct _DialogsPreferencesPagesCalDAVSetup DialogsPreferencesPagesCalDAVSetup;
typedef struct _DialogsPreferencesPagesCalDAVSetupClass DialogsPreferencesPagesCalDAVSetupClass;
typedef struct _DialogsPreferencesPagesCalDAVSetupPrivate DialogsPreferencesPagesCalDAVSetupPrivate;

#define DIALOGS_PREFERENCES_PAGES_TYPE_ACCOUNTS (dialogs_preferences_pages_accounts_get_type ())
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_ACCOUNTS, DialogsPreferencesPagesAccounts))
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_ACCOUNTS, DialogsPreferencesPagesAccountsClass))
#define DIALOGS_PREFERENCES_PAGES_IS_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_ACCOUNTS))
#define DIALOGS_PREFERENCES_PAGES_IS_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_ACCOUNTS))
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_ACCOUNTS, DialogsPreferencesPagesAccountsClass))

typedef struct _DialogsPreferencesPagesAccounts DialogsPreferencesPagesAccounts;
typedef struct _DialogsPreferencesPagesAccountsClass DialogsPreferencesPagesAccountsClass;

#define WIDGETS_TYPE_IGNORE_SSL_SWITCH_ROW (widgets_ignore_ssl_switch_row_get_type ())
#define WIDGETS_IGNORE_SSL_SWITCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_IGNORE_SSL_SWITCH_ROW, WidgetsIgnoreSSLSwitchRow))
#define WIDGETS_IGNORE_SSL_SWITCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_IGNORE_SSL_SWITCH_ROW, WidgetsIgnoreSSLSwitchRowClass))
#define WIDGETS_IS_IGNORE_SSL_SWITCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_IGNORE_SSL_SWITCH_ROW))
#define WIDGETS_IS_IGNORE_SSL_SWITCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_IGNORE_SSL_SWITCH_ROW))
#define WIDGETS_IGNORE_SSL_SWITCH_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_IGNORE_SSL_SWITCH_ROW, WidgetsIgnoreSSLSwitchRowClass))

typedef struct _WidgetsIgnoreSSLSwitchRow WidgetsIgnoreSSLSwitchRow;
typedef struct _WidgetsIgnoreSSLSwitchRowClass WidgetsIgnoreSSLSwitchRowClass;

#define WIDGETS_TYPE_BYPASS_RESOLVE_SWITCH_ROW (widgets_bypass_resolve_switch_row_get_type ())
#define WIDGETS_BYPASS_RESOLVE_SWITCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_BYPASS_RESOLVE_SWITCH_ROW, WidgetsBypassResolveSwitchRow))
#define WIDGETS_BYPASS_RESOLVE_SWITCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_BYPASS_RESOLVE_SWITCH_ROW, WidgetsBypassResolveSwitchRowClass))
#define WIDGETS_IS_BYPASS_RESOLVE_SWITCH_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_BYPASS_RESOLVE_SWITCH_ROW))
#define WIDGETS_IS_BYPASS_RESOLVE_SWITCH_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_BYPASS_RESOLVE_SWITCH_ROW))
#define WIDGETS_BYPASS_RESOLVE_SWITCH_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_BYPASS_RESOLVE_SWITCH_ROW, WidgetsBypassResolveSwitchRowClass))

typedef struct _WidgetsBypassResolveSwitchRow WidgetsBypassResolveSwitchRow;
typedef struct _WidgetsBypassResolveSwitchRowClass WidgetsBypassResolveSwitchRowClass;
enum  {
	DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_0_PROPERTY,
	DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_ACCOUNTS_PAGE_PROPERTY,
	DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_NUM_PROPERTIES
};
static GParamSpec* dialogs_preferences_pages_cal_dav_setup_properties[DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block113Data Block113Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _http_response_unref0(var) ((var == NULL) ? NULL : (var = (http_response_unref (var), NULL)))
typedef struct _DialogsPreferencesPagesCalDavSetupDoLoginData DialogsPreferencesPagesCalDavSetupDoLoginData;

#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_TYPE_LOADING_PAGE (dialogs_preferences_pages_accounts_loading_page_get_type ())
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_LOADING_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PREFERENCES_PAGES_ACCOUNTS_TYPE_LOADING_PAGE, DialogsPreferencesPagesAccountsLoadingPage))
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_LOADING_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PREFERENCES_PAGES_ACCOUNTS_TYPE_LOADING_PAGE, DialogsPreferencesPagesAccountsLoadingPageClass))
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_IS_LOADING_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PREFERENCES_PAGES_ACCOUNTS_TYPE_LOADING_PAGE))
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_IS_LOADING_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PREFERENCES_PAGES_ACCOUNTS_TYPE_LOADING_PAGE))
#define DIALOGS_PREFERENCES_PAGES_ACCOUNTS_LOADING_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PREFERENCES_PAGES_ACCOUNTS_TYPE_LOADING_PAGE, DialogsPreferencesPagesAccountsLoadingPageClass))

typedef struct _DialogsPreferencesPagesAccountsLoadingPage DialogsPreferencesPagesAccountsLoadingPage;
typedef struct _DialogsPreferencesPagesAccountsLoadingPageClass DialogsPreferencesPagesAccountsLoadingPageClass;
typedef struct _Block114Data Block114Data;

struct _DialogsPreferencesPagesBasePage {
	AdwNavigationPage parent_instance;
	DialogsPreferencesPagesBasePagePrivate * priv;
	GeeHashMap* signal_map;
};

struct _DialogsPreferencesPagesBasePageClass {
	AdwNavigationPageClass parent_class;
	void (*clean_up) (DialogsPreferencesPagesBasePage* self);
};

struct _DialogsPreferencesPagesCalDAVSetup {
	DialogsPreferencesPagesBasePage parent_instance;
	DialogsPreferencesPagesCalDAVSetupPrivate * priv;
};

struct _DialogsPreferencesPagesCalDAVSetupClass {
	DialogsPreferencesPagesBasePageClass parent_class;
};

struct _DialogsPreferencesPagesCalDAVSetupPrivate {
	DialogsPreferencesPagesAccounts* _accounts_page;
	AdwEntryRow* server_entry;
	AdwEntryRow* username_entry;
	AdwPasswordEntryRow* password_entry;
	WidgetsLoadingButton* login_button;
	GtkButton* cancel_button;
	GtkStack* main_stack;
	AdwEntryRow* calendar_home_entry;
	WidgetsIgnoreSSLSwitchRow* ignore_ssl_row;
	WidgetsBypassResolveSwitchRow* bypass_resolve_row;
};

struct _Block113Data {
	int _ref_count_;
	DialogsPreferencesPagesCalDAVSetup* self;
	GCancellable* cancellable;
};

struct _DialogsPreferencesPagesCalDavSetupDoLoginData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DialogsPreferencesPagesCalDAVSetup* self;
	GCancellable* cancellable;
	WidgetsLoadingButton* _tmp0_;
	GtkButton* _tmp1_;
	gboolean _tmp2_;
	AdwEntryRow* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	AdwEntryRow* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	ServicesLogService* _tmp9_;
	ServicesLogService* _tmp10_;
	WidgetsLoadingButton* _tmp11_;
	GtkButton* _tmp12_;
	DialogsPreferencesPagesAccounts* _tmp13_;
	ServicesLogService* _tmp14_;
	ServicesLogService* _tmp15_;
	gchar* dav_endpoint;
	gchar* _tmp16_;
	gboolean bypass_resolve;
	WidgetsBypassResolveSwitchRow* _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp19_;
	ServicesLogService* _tmp20_;
	ServicesLogService* _tmp21_;
	AdwEntryRow* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	ServicesLogService* _tmp26_;
	ServicesLogService* _tmp27_;
	gchar* _tmp28_;
	ServicesCalDAVCore* _tmp29_;
	ServicesCalDAVCore* _tmp30_;
	SoupSession* _tmp31_;
	SoupSession* _tmp32_;
	AdwEntryRow* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	WidgetsIgnoreSSLSwitchRow* _tmp36_;
	gboolean _tmp37_;
	gboolean _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	GError* e;
	GError* _tmp42_;
	WidgetsLoadingButton* _tmp43_;
	GtkButton* _tmp44_;
	WidgetsLoadingButton* _tmp45_;
	GtkButton* _tmp46_;
	DialogsPreferencesPagesAccounts* _tmp47_;
	GError* _tmp48_;
	const gchar* _tmp49_;
	gchar* _tmp50_;
	gchar* _tmp51_;
	WidgetsLoadingButton* _tmp52_;
	GtkButton* _tmp53_;
	gchar* calendar_home;
	gchar* _tmp54_;
	gboolean _tmp55_;
	AdwEntryRow* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	AdwEntryRow* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	ServicesLogService* _tmp62_;
	ServicesLogService* _tmp63_;
	AdwEntryRow* _tmp64_;
	const gchar* _tmp65_;
	const gchar* _tmp66_;
	gchar* _tmp67_;
	ServicesLogService* _tmp68_;
	ServicesLogService* _tmp69_;
	gchar* _tmp70_;
	ServicesCalDAVCore* _tmp71_;
	ServicesCalDAVCore* _tmp72_;
	const gchar* _tmp73_;
	AdwEntryRow* _tmp74_;
	const gchar* _tmp75_;
	const gchar* _tmp76_;
	AdwPasswordEntryRow* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	WidgetsIgnoreSSLSwitchRow* _tmp80_;
	gboolean _tmp81_;
	gboolean _tmp82_;
	gchar* _tmp83_;
	gchar* _tmp84_;
	gchar* _tmp85_;
	GError* _vala1_e;
	GError* _tmp86_;
	WidgetsLoadingButton* _tmp87_;
	GtkButton* _tmp88_;
	WidgetsLoadingButton* _tmp89_;
	GtkButton* _tmp90_;
	DialogsPreferencesPagesAccounts* _tmp91_;
	GError* _tmp92_;
	const gchar* _tmp93_;
	gchar* _tmp94_;
	gchar* _tmp95_;
	WidgetsLoadingButton* _tmp96_;
	GtkButton* _tmp97_;
	const gchar* _tmp98_;
	ServicesLogService* _tmp99_;
	ServicesLogService* _tmp100_;
	WidgetsLoadingButton* _tmp101_;
	GtkButton* _tmp102_;
	DialogsPreferencesPagesAccounts* _tmp103_;
	AdwEntryRow* _tmp104_;
	const gchar* _tmp105_;
	ServicesLogService* _tmp106_;
	ServicesLogService* _tmp107_;
	HttpResponse* response;
	ServicesCalDAVCore* _tmp108_;
	ServicesCalDAVCore* _tmp109_;
	const gchar* _tmp110_;
	AdwEntryRow* _tmp111_;
	const gchar* _tmp112_;
	const gchar* _tmp113_;
	AdwPasswordEntryRow* _tmp114_;
	const gchar* _tmp115_;
	const gchar* _tmp116_;
	const gchar* _tmp117_;
	WidgetsIgnoreSSLSwitchRow* _tmp118_;
	gboolean _tmp119_;
	gboolean _tmp120_;
	HttpResponse* _tmp121_;
	HttpResponse* _tmp122_;
	HttpResponse* _tmp123_;
	gboolean _tmp124_;
	gboolean _tmp125_;
	ServicesLogService* _tmp126_;
	ServicesLogService* _tmp127_;
	ObjectsSource* source;
	HttpResponse* _tmp128_;
	GValue _tmp129_;
	GValue _tmp130_;
	GObject* _tmp131_;
	ObjectsSource* _tmp132_;
	GtkStack* _tmp133_;
	ServicesCalDAVCore* _tmp134_;
	ServicesCalDAVCore* _tmp135_;
	ObjectsSource* _tmp136_;
	HttpResponse* _tmp137_;
	HttpResponse* _tmp138_;
	gboolean _tmp139_;
	gboolean _tmp140_;
	ServicesLogService* _tmp141_;
	ServicesLogService* _tmp142_;
	AdwPreferencesDialog* _tmp143_;
	AdwPreferencesDialog* _tmp144_;
	ServicesLogService* _tmp145_;
	ServicesLogService* _tmp146_;
	HttpResponse* _tmp147_;
	const gchar* _tmp148_;
	const gchar* _tmp149_;
	gchar* _tmp150_;
	gchar* _tmp151_;
	GtkStack* _tmp152_;
	WidgetsLoadingButton* _tmp153_;
	GtkButton* _tmp154_;
	DialogsPreferencesPagesAccounts* _tmp155_;
	HttpResponse* _tmp156_;
	gint _tmp157_;
	gint _tmp158_;
	HttpResponse* _tmp159_;
	const gchar* _tmp160_;
	const gchar* _tmp161_;
	gchar* _tmp162_;
	gchar* _tmp163_;
	WidgetsLoadingButton* _tmp164_;
	GtkButton* _tmp165_;
	HttpResponse* _tmp166_;
	gint _tmp167_;
	gint _tmp168_;
	AdwToast* toast;
	HttpResponse* _tmp169_;
	const gchar* _tmp170_;
	const gchar* _tmp171_;
	gchar* _tmp172_;
	gchar* _tmp173_;
	AdwToast* _tmp174_;
	AdwToast* _tmp175_;
	AdwToast* _tmp176_;
	AdwPreferencesDialog* _tmp177_;
	AdwPreferencesDialog* _tmp178_;
	AdwToast* _tmp179_;
	AdwToast* _tmp180_;
	DialogsPreferencesPagesAccounts* _tmp181_;
	HttpResponse* _tmp182_;
	gint _tmp183_;
	gint _tmp184_;
	HttpResponse* _tmp185_;
	const gchar* _tmp186_;
	const gchar* _tmp187_;
	gchar* _tmp188_;
	gchar* _tmp189_;
	GError* _inner_error0_;
};

struct _Block114Data {
	int _ref_count_;
	DialogsPreferencesPagesCalDAVSetup* self;
	GtkRevealer* advanced_revealer;
	GtkImage* advanced_icon;
	GtkLabel* advanced_label;
	DialogsPreferencesPagesAccountsLoadingPage* loading_page;
};

static gint DialogsPreferencesPagesCalDAVSetup_private_offset;
static gpointer dialogs_preferences_pages_cal_dav_setup_parent_class = NULL;

VALA_EXTERN GType dialogs_preferences_pages_base_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsPreferencesPagesBasePage, g_object_unref)
VALA_EXTERN GType dialogs_preferences_pages_cal_dav_setup_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsPreferencesPagesCalDAVSetup, g_object_unref)
VALA_EXTERN GType dialogs_preferences_pages_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsPreferencesPagesAccounts, g_object_unref)
VALA_EXTERN GType widgets_ignore_ssl_switch_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsIgnoreSSLSwitchRow, g_object_unref)
VALA_EXTERN GType widgets_bypass_resolve_switch_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsBypassResolveSwitchRow, g_object_unref)
VALA_EXTERN DialogsPreferencesPagesCalDAVSetup* dialogs_preferences_pages_cal_dav_setup_new (AdwPreferencesDialog* preferences_dialog,
                                                                                 DialogsPreferencesPagesAccounts* accounts_page);
VALA_EXTERN DialogsPreferencesPagesCalDAVSetup* dialogs_preferences_pages_cal_dav_setup_construct (GType object_type,
                                                                                       AdwPreferencesDialog* preferences_dialog,
                                                                                       DialogsPreferencesPagesAccounts* accounts_page);
static void dialogs_preferences_pages_cal_dav_setup_validate_entries (DialogsPreferencesPagesCalDAVSetup* self);
static gboolean dialogs_preferences_pages_cal_dav_setup_is_valid_url (DialogsPreferencesPagesCalDAVSetup* self,
                                                               const gchar* uri);
static void dialogs_preferences_pages_cal_dav_setup_on_login_button_clicked (DialogsPreferencesPagesCalDAVSetup* self);
static Block113Data* block113_data_ref (Block113Data* _data113_);
static void block113_data_unref (void * _userdata_);
static void __lambda323_ (Block113Data* _data113_);
static void ___lambda323__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dialogs_preferences_pages_cal_dav_setup_do_login (DialogsPreferencesPagesCalDAVSetup* self,
                                                       GCancellable* cancellable,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static void dialogs_preferences_pages_cal_dav_setup_do_login_finish (DialogsPreferencesPagesCalDAVSetup* self,
                                                              GAsyncResult* _res_);
static void dialogs_preferences_pages_cal_dav_setup_do_login_data_free (gpointer _data);
static gboolean dialogs_preferences_pages_cal_dav_setup_do_login_co (DialogsPreferencesPagesCalDavSetupDoLoginData* _data_);
VALA_EXTERN DialogsPreferencesPagesAccounts* dialogs_preferences_pages_cal_dav_setup_get_accounts_page (DialogsPreferencesPagesCalDAVSetup* self);
VALA_EXTERN void dialogs_preferences_pages_accounts_show_message_error (DialogsPreferencesPagesAccounts* self,
                                                            gint error_code,
                                                            const gchar* error_message,
                                                            gboolean visible_issue_button);
VALA_EXTERN gboolean widgets_bypass_resolve_switch_row_get_active (WidgetsBypassResolveSwitchRow* self);
VALA_EXTERN gboolean widgets_ignore_ssl_switch_row_get_active (WidgetsIgnoreSSLSwitchRow* self);
static void dialogs_preferences_pages_cal_dav_setup_do_login_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
VALA_EXTERN AdwPreferencesDialog* dialogs_preferences_pages_base_page_get_preferences_dialog (DialogsPreferencesPagesBasePage* self);
static void dialogs_preferences_pages_cal_dav_setup_set_accounts_page (DialogsPreferencesPagesCalDAVSetup* self,
                                                                DialogsPreferencesPagesAccounts* value);
static GObject * dialogs_preferences_pages_cal_dav_setup_constructor (GType type,
                                                               guint n_construct_properties,
                                                               GObjectConstructParam * construct_properties);
VALA_EXTERN GType dialogs_preferences_pages_accounts_loading_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsPreferencesPagesAccountsLoadingPage, g_object_unref)
static Block114Data* block114_data_ref (Block114Data* _data114_);
static void block114_data_unref (void * _userdata_);
VALA_EXTERN WidgetsIgnoreSSLSwitchRow* widgets_ignore_ssl_switch_row_new (void);
VALA_EXTERN WidgetsIgnoreSSLSwitchRow* widgets_ignore_ssl_switch_row_construct (GType object_type);
VALA_EXTERN WidgetsBypassResolveSwitchRow* widgets_bypass_resolve_switch_row_new (void);
VALA_EXTERN WidgetsBypassResolveSwitchRow* widgets_bypass_resolve_switch_row_construct (GType object_type);
static void _dialogs_preferences_pages_cal_dav_setup___lambda324_ (Block114Data* _data114_);
static void __dialogs_preferences_pages_cal_dav_setup___lambda324__gtk_button_clicked (GtkButton* _sender,
                                                                                gpointer self);
VALA_EXTERN DialogsPreferencesPagesAccountsLoadingPage* dialogs_preferences_pages_accounts_loading_page_new (void);
VALA_EXTERN DialogsPreferencesPagesAccountsLoadingPage* dialogs_preferences_pages_accounts_loading_page_construct (GType object_type);
VALA_EXTERN void dialogs_preferences_pages_accounts_loading_page_set_show_progress (DialogsPreferencesPagesAccountsLoadingPage* self,
                                                                        gboolean value);
static void _dialogs_preferences_pages_cal_dav_setup___lambda325_ (DialogsPreferencesPagesCalDAVSetup* self);
static void __dialogs_preferences_pages_cal_dav_setup___lambda325__gtk_editable_changed (GtkEditable* _sender,
                                                                                  gpointer self);
static void _dialogs_preferences_pages_cal_dav_setup___lambda326_ (DialogsPreferencesPagesCalDAVSetup* self);
static void __dialogs_preferences_pages_cal_dav_setup___lambda326__gtk_editable_changed (GtkEditable* _sender,
                                                                                  gpointer self);
static void _dialogs_preferences_pages_cal_dav_setup___lambda327_ (DialogsPreferencesPagesCalDAVSetup* self);
static void __dialogs_preferences_pages_cal_dav_setup___lambda327__gtk_editable_changed (GtkEditable* _sender,
                                                                                  gpointer self);
static void _dialogs_preferences_pages_cal_dav_setup___lambda328_ (DialogsPreferencesPagesCalDAVSetup* self);
static void __dialogs_preferences_pages_cal_dav_setup___lambda328__adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                                                           gpointer self);
static void _dialogs_preferences_pages_cal_dav_setup___lambda329_ (DialogsPreferencesPagesCalDAVSetup* self);
static void __dialogs_preferences_pages_cal_dav_setup___lambda329__gtk_button_clicked (GtkButton* _sender,
                                                                                gpointer self);
static void _dialogs_preferences_pages_cal_dav_setup___lambda330_ (Block114Data* _data114_,
                                                            gint current,
                                                            gint total,
                                                            const gchar* message);
VALA_EXTERN void dialogs_preferences_pages_accounts_loading_page_set_sync_label (DialogsPreferencesPagesAccountsLoadingPage* self,
                                                                     const gchar* value);
VALA_EXTERN void dialogs_preferences_pages_accounts_loading_page_set_progress (DialogsPreferencesPagesAccountsLoadingPage* self,
                                                                   gdouble value);
static void __dialogs_preferences_pages_cal_dav_setup___lambda330__services_cal_dav_core_sync_progress (ServicesCalDAVCore* _sender,
                                                                                                 gint current,
                                                                                                 gint total,
                                                                                                 const gchar* message,
                                                                                                 gpointer self);
static void _dialogs_preferences_pages_cal_dav_setup___lambda331_ (DialogsPreferencesPagesCalDAVSetup* self);
VALA_EXTERN void dialogs_preferences_pages_base_page_clean_up (DialogsPreferencesPagesBasePage* self);
static void __dialogs_preferences_pages_cal_dav_setup___lambda331__gtk_widget_destroy (GtkWidget* _sender,
                                                                                gpointer self);
static void dialogs_preferences_pages_cal_dav_setup_finalize (GObject * obj);
static GType dialogs_preferences_pages_cal_dav_setup_get_type_once (void);
static void _vala_dialogs_preferences_pages_cal_dav_setup_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_dialogs_preferences_pages_cal_dav_setup_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_preferences_pages_cal_dav_setup_get_instance_private (DialogsPreferencesPagesCalDAVSetup* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsPreferencesPagesCalDAVSetup_private_offset);
}

DialogsPreferencesPagesCalDAVSetup*
dialogs_preferences_pages_cal_dav_setup_construct (GType object_type,
                                                   AdwPreferencesDialog* preferences_dialog,
                                                   DialogsPreferencesPagesAccounts* accounts_page)
{
	DialogsPreferencesPagesCalDAVSetup * self = NULL;
	g_return_val_if_fail (preferences_dialog != NULL, NULL);
	g_return_val_if_fail (accounts_page != NULL, NULL);
	self = (DialogsPreferencesPagesCalDAVSetup*) g_object_new (object_type, "preferences-dialog", preferences_dialog, "accounts-page", accounts_page, "title", _ ("CalDAV"), NULL);
	return self;
}

DialogsPreferencesPagesCalDAVSetup*
dialogs_preferences_pages_cal_dav_setup_new (AdwPreferencesDialog* preferences_dialog,
                                             DialogsPreferencesPagesAccounts* accounts_page)
{
	return dialogs_preferences_pages_cal_dav_setup_construct (DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, preferences_dialog, accounts_page);
}

static void
dialogs_preferences_pages_cal_dav_setup_validate_entries (DialogsPreferencesPagesCalDAVSetup* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	AdwEntryRow* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gboolean valid = FALSE;
	AdwEntryRow* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	WidgetsLoadingButton* _tmp32_;
	g_return_if_fail (self != NULL);
	_tmp6_ = self->priv->server_entry;
	_tmp7_ = gtk_editable_get_text ((GtkEditable*) _tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_ != NULL) {
		AdwEntryRow* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp9_ = self->priv->server_entry;
		_tmp10_ = gtk_editable_get_text ((GtkEditable*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp5_ = g_strcmp0 (_tmp11_, "") != 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		AdwEntryRow* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		_tmp12_ = self->priv->username_entry;
		_tmp13_ = gtk_editable_get_text ((GtkEditable*) _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp4_ = _tmp14_ != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		AdwEntryRow* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		_tmp15_ = self->priv->username_entry;
		_tmp16_ = gtk_editable_get_text ((GtkEditable*) _tmp15_);
		_tmp17_ = _tmp16_;
		_tmp3_ = g_strcmp0 (_tmp17_, "") != 0;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		AdwPasswordEntryRow* _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		_tmp18_ = self->priv->password_entry;
		_tmp19_ = gtk_editable_get_text ((GtkEditable*) _tmp18_);
		_tmp20_ = _tmp19_;
		_tmp2_ = _tmp20_ != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		AdwPasswordEntryRow* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		_tmp21_ = self->priv->password_entry;
		_tmp22_ = gtk_editable_get_text ((GtkEditable*) _tmp21_);
		_tmp23_ = _tmp22_;
		_tmp1_ = g_strcmp0 (_tmp23_, "") != 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		AdwEntryRow* _tmp24_;
		const gchar* _tmp25_;
		const gchar* _tmp26_;
		_tmp24_ = self->priv->server_entry;
		_tmp25_ = gtk_editable_get_text ((GtkEditable*) _tmp24_);
		_tmp26_ = _tmp25_;
		_tmp0_ = dialogs_preferences_pages_cal_dav_setup_is_valid_url (self, _tmp26_);
	} else {
		_tmp0_ = FALSE;
	}
	valid = _tmp0_;
	_tmp27_ = self->priv->server_entry;
	_tmp28_ = gtk_editable_get_text ((GtkEditable*) _tmp27_);
	_tmp29_ = _tmp28_;
	if (!dialogs_preferences_pages_cal_dav_setup_is_valid_url (self, _tmp29_)) {
		AdwEntryRow* _tmp30_;
		_tmp30_ = self->priv->server_entry;
		gtk_widget_add_css_class ((GtkWidget*) _tmp30_, "error");
	} else {
		AdwEntryRow* _tmp31_;
		_tmp31_ = self->priv->server_entry;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp31_, "error");
	}
	_tmp32_ = self->priv->login_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp32_, valid);
}

static Block113Data*
block113_data_ref (Block113Data* _data113_)
{
	g_atomic_int_inc (&_data113_->_ref_count_);
	return _data113_;
}

static void
block113_data_unref (void * _userdata_)
{
	Block113Data* _data113_;
	_data113_ = (Block113Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data113_->_ref_count_)) {
		DialogsPreferencesPagesCalDAVSetup* self;
		self = _data113_->self;
		_g_object_unref0 (_data113_->cancellable);
		_g_object_unref0 (self);
		g_slice_free (Block113Data, _data113_);
	}
}

static void
__lambda323_ (Block113Data* _data113_)
{
	DialogsPreferencesPagesCalDAVSetup* self;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	ServicesCalDAVCore* _tmp2_;
	ServicesCalDAVCore* _tmp3_;
	self = _data113_->self;
	_tmp0_ = services_log_service_get_default ();
	_tmp1_ = _tmp0_;
	services_log_service_info (_tmp1_, "CalDAVSetup", "Login cancelled by user");
	_g_object_unref0 (_tmp1_);
	g_cancellable_cancel (_data113_->cancellable);
	_tmp2_ = services_cal_dav_core_get_default ();
	_tmp3_ = _tmp2_;
	services_cal_dav_core_clear (_tmp3_);
	_g_object_unref0 (_tmp3_);
}

static void
___lambda323__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda323_ (self);
}

static void
dialogs_preferences_pages_cal_dav_setup_on_login_button_clicked (DialogsPreferencesPagesCalDAVSetup* self)
{
	Block113Data* _data113_;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	GCancellable* _tmp2_;
	WidgetsLoadingButton* _tmp3_;
	GtkButton* _tmp4_;
	GeeHashMap* _tmp5_;
	GtkButton* _tmp6_;
	gulong _tmp7_;
	GtkButton* _tmp8_;
	g_return_if_fail (self != NULL);
	_data113_ = g_slice_new0 (Block113Data);
	_data113_->_ref_count_ = 1;
	_data113_->self = g_object_ref (self);
	_tmp0_ = services_log_service_get_default ();
	_tmp1_ = _tmp0_;
	services_log_service_info (_tmp1_, "CalDAVSetup", "Login button clicked");
	_g_object_unref0 (_tmp1_);
	_tmp2_ = g_cancellable_new ();
	_data113_->cancellable = _tmp2_;
	_tmp3_ = self->priv->login_button;
	widgets_loading_button_set_is_loading (_tmp3_, TRUE);
	_tmp4_ = self->priv->cancel_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, TRUE);
	_tmp5_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp6_ = self->priv->cancel_button;
	_tmp7_ = g_signal_connect_data (_tmp6_, "clicked", (GCallback) ___lambda323__gtk_button_clicked, block113_data_ref (_data113_), (GClosureNotify) block113_data_unref, 0);
	_tmp8_ = self->priv->cancel_button;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, (gpointer) ((guintptr) _tmp7_), (GObject*) _tmp8_);
	dialogs_preferences_pages_cal_dav_setup_do_login (self, _data113_->cancellable, NULL, NULL);
	block113_data_unref (_data113_);
	_data113_ = NULL;
}

static void
dialogs_preferences_pages_cal_dav_setup_do_login_data_free (gpointer _data)
{
	DialogsPreferencesPagesCalDavSetupDoLoginData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (DialogsPreferencesPagesCalDavSetupDoLoginData, _data_);
}

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

static void
dialogs_preferences_pages_cal_dav_setup_do_login (DialogsPreferencesPagesCalDAVSetup* self,
                                                  GCancellable* cancellable,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	DialogsPreferencesPagesCalDavSetupDoLoginData* _data_;
	DialogsPreferencesPagesCalDAVSetup* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cancellable != NULL);
	_data_ = g_slice_new0 (DialogsPreferencesPagesCalDavSetupDoLoginData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dialogs_preferences_pages_cal_dav_setup_do_login_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	dialogs_preferences_pages_cal_dav_setup_do_login_co (_data_);
}

static void
dialogs_preferences_pages_cal_dav_setup_do_login_finish (DialogsPreferencesPagesCalDAVSetup* self,
                                                         GAsyncResult* _res_)
{
	DialogsPreferencesPagesCalDavSetupDoLoginData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

static void
dialogs_preferences_pages_cal_dav_setup_do_login_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	DialogsPreferencesPagesCalDavSetupDoLoginData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dialogs_preferences_pages_cal_dav_setup_do_login_co (_data_);
}

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

static gboolean
dialogs_preferences_pages_cal_dav_setup_do_login_co (DialogsPreferencesPagesCalDavSetupDoLoginData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (g_cancellable_is_cancelled (_data_->cancellable)) {
		_data_->_tmp0_ = _data_->self->priv->login_button;
		widgets_loading_button_set_is_loading (_data_->_tmp0_, FALSE);
		_data_->_tmp1_ = _data_->self->priv->cancel_button;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp1_, 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;
	}
	_data_->_tmp3_ = _data_->self->priv->server_entry;
	_data_->_tmp4_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	if (_data_->_tmp5_ == NULL) {
		_data_->_tmp2_ = TRUE;
	} else {
		_data_->_tmp6_ = _data_->self->priv->server_entry;
		_data_->_tmp7_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp6_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp2_ = g_strcmp0 (_data_->_tmp8_, "") == 0;
	}
	if (_data_->_tmp2_) {
		_data_->_tmp9_ = services_log_service_get_default ();
		_data_->_tmp10_ = _data_->_tmp9_;
		services_log_service_warn (_data_->_tmp10_, "CalDAVSetup", "Empty server URL");
		_g_object_unref0 (_data_->_tmp10_);
		_data_->_tmp11_ = _data_->self->priv->login_button;
		widgets_loading_button_set_is_loading (_data_->_tmp11_, FALSE);
		_data_->_tmp12_ = _data_->self->priv->cancel_button;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp12_, FALSE);
		_data_->_tmp13_ = _data_->self->priv->_accounts_page;
		dialogs_preferences_pages_accounts_show_message_error (_data_->_tmp13_, 0, "Invalid Server URL", TRUE);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp14_ = services_log_service_get_default ();
	_data_->_tmp15_ = _data_->_tmp14_;
	services_log_service_info (_data_->_tmp15_, "CalDAVSetup", "Starting login flow");
	_g_object_unref0 (_data_->_tmp15_);
	_data_->_tmp16_ = g_strdup ("");
	_data_->dav_endpoint = _data_->_tmp16_;
	_data_->_tmp17_ = _data_->self->priv->bypass_resolve_row;
	_data_->_tmp18_ = widgets_bypass_resolve_switch_row_get_active (_data_->_tmp17_);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->bypass_resolve = _data_->_tmp19_;
	if (_data_->bypass_resolve) {
		_data_->_tmp20_ = services_log_service_get_default ();
		_data_->_tmp21_ = _data_->_tmp20_;
		services_log_service_info (_data_->_tmp21_, "CalDAVSetup", "Bypassing well-known resolve");
		_g_object_unref0 (_data_->_tmp21_);
		_data_->_tmp22_ = _data_->self->priv->server_entry;
		_data_->_tmp23_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp22_);
		_data_->_tmp24_ = _data_->_tmp23_;
		_data_->_tmp25_ = g_strdup (_data_->_tmp24_);
		_g_free0 (_data_->dav_endpoint);
		_data_->dav_endpoint = _data_->_tmp25_;
	} else {
		_data_->_tmp26_ = services_log_service_get_default ();
		_data_->_tmp27_ = _data_->_tmp26_;
		services_log_service_info (_data_->_tmp27_, "CalDAVSetup", "Resolving well-known CalDAV endpoint");
		_g_object_unref0 (_data_->_tmp27_);
		{
			_data_->_tmp29_ = services_cal_dav_core_get_default ();
			_data_->_tmp30_ = _data_->_tmp29_;
			_data_->_tmp31_ = soup_session_new ();
			_data_->_tmp32_ = _data_->_tmp31_;
			_data_->_tmp33_ = _data_->self->priv->server_entry;
			_data_->_tmp34_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp33_);
			_data_->_tmp35_ = _data_->_tmp34_;
			_data_->_tmp36_ = _data_->self->priv->ignore_ssl_row;
			_data_->_tmp37_ = widgets_ignore_ssl_switch_row_get_active (_data_->_tmp36_);
			_data_->_tmp38_ = _data_->_tmp37_;
			_data_->_state_ = 1;
			services_cal_dav_core_resolve_well_known_caldav (_data_->_tmp30_, _data_->_tmp32_, _data_->_tmp35_, _data_->_tmp38_, dialogs_preferences_pages_cal_dav_setup_do_login_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp39_ = services_cal_dav_core_resolve_well_known_caldav_finish (_data_->_tmp30_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp40_ = _data_->_tmp39_;
			_g_object_unref0 (_data_->_tmp32_);
			_g_object_unref0 (_data_->_tmp30_);
			_data_->_tmp28_ = _data_->_tmp40_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp41_ = _data_->_tmp28_;
			_data_->_tmp28_ = NULL;
			_g_free0 (_data_->dav_endpoint);
			_data_->dav_endpoint = _data_->_tmp41_;
			_g_free0 (_data_->_tmp28_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp42_ = _data_->e;
			if (g_error_matches (_data_->_tmp42_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
				_data_->_tmp43_ = _data_->self->priv->login_button;
				widgets_loading_button_set_is_loading (_data_->_tmp43_, FALSE);
				_data_->_tmp44_ = _data_->self->priv->cancel_button;
				gtk_widget_set_visible ((GtkWidget*) _data_->_tmp44_, FALSE);
				_g_error_free0 (_data_->e);
				_g_free0 (_data_->dav_endpoint);
				g_task_return_pointer (_data_->_async_result, _data_, NULL);
				if (_data_->_state_ != 0) {
					while (!g_task_get_completed (_data_->_async_result)) {
						g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
					}
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp45_ = _data_->self->priv->login_button;
			widgets_loading_button_set_is_loading (_data_->_tmp45_, FALSE);
			_data_->_tmp46_ = _data_->self->priv->cancel_button;
			gtk_widget_set_visible ((GtkWidget*) _data_->_tmp46_, FALSE);
			_data_->_tmp47_ = _data_->self->priv->_accounts_page;
			_data_->_tmp48_ = _data_->e;
			_data_->_tmp49_ = _data_->_tmp48_->message;
			_data_->_tmp50_ = g_strdup_printf ("Failed to resolve server: %s", _data_->_tmp49_);
			_data_->_tmp51_ = _data_->_tmp50_;
			dialogs_preferences_pages_accounts_show_message_error (_data_->_tmp47_, 0, _data_->_tmp51_, TRUE);
			_g_free0 (_data_->_tmp51_);
			_g_error_free0 (_data_->e);
			_g_free0 (_data_->dav_endpoint);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->dav_endpoint);
			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;
		}
	}
	if (g_cancellable_is_cancelled (_data_->cancellable)) {
		_data_->_tmp52_ = _data_->self->priv->login_button;
		widgets_loading_button_set_is_loading (_data_->_tmp52_, FALSE);
		_data_->_tmp53_ = _data_->self->priv->cancel_button;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp53_, FALSE);
		_g_free0 (_data_->dav_endpoint);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp54_ = g_strdup ("");
	_data_->calendar_home = _data_->_tmp54_;
	_data_->_tmp56_ = _data_->self->priv->calendar_home_entry;
	_data_->_tmp57_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp56_);
	_data_->_tmp58_ = _data_->_tmp57_;
	if (_data_->_tmp58_ != NULL) {
		_data_->_tmp59_ = _data_->self->priv->calendar_home_entry;
		_data_->_tmp60_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp59_);
		_data_->_tmp61_ = _data_->_tmp60_;
		_data_->_tmp55_ = g_strcmp0 (_data_->_tmp61_, "") != 0;
	} else {
		_data_->_tmp55_ = FALSE;
	}
	if (_data_->_tmp55_) {
		_data_->_tmp62_ = services_log_service_get_default ();
		_data_->_tmp63_ = _data_->_tmp62_;
		services_log_service_info (_data_->_tmp63_, "CalDAVSetup", "Using custom calendar home URL");
		_g_object_unref0 (_data_->_tmp63_);
		_data_->_tmp64_ = _data_->self->priv->calendar_home_entry;
		_data_->_tmp65_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp64_);
		_data_->_tmp66_ = _data_->_tmp65_;
		_data_->_tmp67_ = g_strdup (_data_->_tmp66_);
		_g_free0 (_data_->calendar_home);
		_data_->calendar_home = _data_->_tmp67_;
	} else {
		_data_->_tmp68_ = services_log_service_get_default ();
		_data_->_tmp69_ = _data_->_tmp68_;
		services_log_service_info (_data_->_tmp69_, "CalDAVSetup", "Resolving calendar home");
		_g_object_unref0 (_data_->_tmp69_);
		{
			_data_->_tmp71_ = services_cal_dav_core_get_default ();
			_data_->_tmp72_ = _data_->_tmp71_;
			_data_->_tmp73_ = _data_->dav_endpoint;
			_data_->_tmp74_ = _data_->self->priv->username_entry;
			_data_->_tmp75_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp74_);
			_data_->_tmp76_ = _data_->_tmp75_;
			_data_->_tmp77_ = _data_->self->priv->password_entry;
			_data_->_tmp78_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp77_);
			_data_->_tmp79_ = _data_->_tmp78_;
			_data_->_tmp80_ = _data_->self->priv->ignore_ssl_row;
			_data_->_tmp81_ = widgets_ignore_ssl_switch_row_get_active (_data_->_tmp80_);
			_data_->_tmp82_ = _data_->_tmp81_;
			_data_->_state_ = 2;
			services_cal_dav_core_resolve_calendar_home (_data_->_tmp72_, CAL_DAV_TYPE_GENERIC, _data_->_tmp73_, _data_->_tmp76_, _data_->_tmp79_, _data_->cancellable, _data_->_tmp82_, dialogs_preferences_pages_cal_dav_setup_do_login_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp83_ = services_cal_dav_core_resolve_calendar_home_finish (_data_->_tmp72_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp84_ = _data_->_tmp83_;
			_g_object_unref0 (_data_->_tmp72_);
			_data_->_tmp70_ = _data_->_tmp84_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
			_data_->_tmp85_ = _data_->_tmp70_;
			_data_->_tmp70_ = NULL;
			_g_free0 (_data_->calendar_home);
			_data_->calendar_home = _data_->_tmp85_;
			_g_free0 (_data_->_tmp70_);
		}
		goto __finally1;
		__catch1_g_error:
		{
			_data_->_vala1_e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp86_ = _data_->_vala1_e;
			if (g_error_matches (_data_->_tmp86_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
				_data_->_tmp87_ = _data_->self->priv->login_button;
				widgets_loading_button_set_is_loading (_data_->_tmp87_, FALSE);
				_data_->_tmp88_ = _data_->self->priv->cancel_button;
				gtk_widget_set_visible ((GtkWidget*) _data_->_tmp88_, FALSE);
				_g_error_free0 (_data_->_vala1_e);
				_g_free0 (_data_->calendar_home);
				_g_free0 (_data_->dav_endpoint);
				g_task_return_pointer (_data_->_async_result, _data_, NULL);
				if (_data_->_state_ != 0) {
					while (!g_task_get_completed (_data_->_async_result)) {
						g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
					}
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp89_ = _data_->self->priv->login_button;
			widgets_loading_button_set_is_loading (_data_->_tmp89_, FALSE);
			_data_->_tmp90_ = _data_->self->priv->cancel_button;
			gtk_widget_set_visible ((GtkWidget*) _data_->_tmp90_, FALSE);
			_data_->_tmp91_ = _data_->self->priv->_accounts_page;
			_data_->_tmp92_ = _data_->_vala1_e;
			_data_->_tmp93_ = _data_->_tmp92_->message;
			_data_->_tmp94_ = g_strdup_printf ("Failed to resolve calendar home: %s", _data_->_tmp93_);
			_data_->_tmp95_ = _data_->_tmp94_;
			dialogs_preferences_pages_accounts_show_message_error (_data_->_tmp91_, 0, _data_->_tmp95_, TRUE);
			_g_free0 (_data_->_tmp95_);
			_g_error_free0 (_data_->_vala1_e);
			_g_free0 (_data_->calendar_home);
			_g_free0 (_data_->dav_endpoint);
			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;
		}
		__finally1:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->calendar_home);
			_g_free0 (_data_->dav_endpoint);
			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;
		}
	}
	if (g_cancellable_is_cancelled (_data_->cancellable)) {
		_data_->_tmp96_ = _data_->self->priv->login_button;
		widgets_loading_button_set_is_loading (_data_->_tmp96_, FALSE);
		_data_->_tmp97_ = _data_->self->priv->cancel_button;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp97_, FALSE);
		_g_free0 (_data_->calendar_home);
		_g_free0 (_data_->dav_endpoint);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp98_ = _data_->calendar_home;
	if (_data_->_tmp98_ == NULL) {
		_data_->_tmp99_ = services_log_service_get_default ();
		_data_->_tmp100_ = _data_->_tmp99_;
		services_log_service_error (_data_->_tmp100_, "CalDAVSetup", "Calendar home resolved to null");
		_g_object_unref0 (_data_->_tmp100_);
		_data_->_tmp101_ = _data_->self->priv->login_button;
		widgets_loading_button_set_is_loading (_data_->_tmp101_, FALSE);
		_data_->_tmp102_ = _data_->self->priv->cancel_button;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp102_, FALSE);
		_data_->_tmp103_ = _data_->self->priv->_accounts_page;
		dialogs_preferences_pages_accounts_show_message_error (_data_->_tmp103_, 0, "Failed to resolve calendar home", TRUE);
		_g_free0 (_data_->calendar_home);
		_g_free0 (_data_->dav_endpoint);
		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;
	} else {
		_data_->_tmp104_ = _data_->self->priv->calendar_home_entry;
		_data_->_tmp105_ = _data_->calendar_home;
		gtk_editable_set_text ((GtkEditable*) _data_->_tmp104_, _data_->_tmp105_);
	}
	_data_->_tmp106_ = services_log_service_get_default ();
	_data_->_tmp107_ = _data_->_tmp106_;
	services_log_service_info (_data_->_tmp107_, "CalDAVSetup", "Attempting login");
	_g_object_unref0 (_data_->_tmp107_);
	_data_->_tmp108_ = services_cal_dav_core_get_default ();
	_data_->_tmp109_ = _data_->_tmp108_;
	_data_->_tmp110_ = _data_->dav_endpoint;
	_data_->_tmp111_ = _data_->self->priv->username_entry;
	_data_->_tmp112_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp111_);
	_data_->_tmp113_ = _data_->_tmp112_;
	_data_->_tmp114_ = _data_->self->priv->password_entry;
	_data_->_tmp115_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp114_);
	_data_->_tmp116_ = _data_->_tmp115_;
	_data_->_tmp117_ = _data_->calendar_home;
	_data_->_tmp118_ = _data_->self->priv->ignore_ssl_row;
	_data_->_tmp119_ = widgets_ignore_ssl_switch_row_get_active (_data_->_tmp118_);
	_data_->_tmp120_ = _data_->_tmp119_;
	_data_->_state_ = 3;
	services_cal_dav_core_login (_data_->_tmp109_, CAL_DAV_TYPE_GENERIC, _data_->_tmp110_, _data_->_tmp113_, _data_->_tmp116_, _data_->_tmp117_, _data_->cancellable, _data_->_tmp120_, dialogs_preferences_pages_cal_dav_setup_do_login_ready, _data_);
	return FALSE;
	_state_3:
	_data_->_tmp121_ = services_cal_dav_core_login_finish (_data_->_tmp109_, _data_->_res_);
	_data_->_tmp122_ = _data_->_tmp121_;
	_g_object_unref0 (_data_->_tmp109_);
	_data_->response = _data_->_tmp122_;
	_data_->_tmp123_ = _data_->response;
	_data_->_tmp124_ = http_response_get_status (_data_->_tmp123_);
	_data_->_tmp125_ = _data_->_tmp124_;
	if (_data_->_tmp125_) {
		_data_->_tmp126_ = services_log_service_get_default ();
		_data_->_tmp127_ = _data_->_tmp126_;
		services_log_service_info (_data_->_tmp127_, "CalDAVSetup", "Login successful, syncing account");
		_g_object_unref0 (_data_->_tmp127_);
		_data_->_tmp128_ = _data_->response;
		memset (&_data_->_tmp129_, 0, sizeof (GValue));
		http_response_get_data_object (_data_->_tmp128_, &_data_->_tmp129_);
		_data_->_tmp130_ = _data_->_tmp129_;
		_data_->_tmp131_ = g_value_get_object (&_data_->_tmp130_);
		_data_->_tmp132_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp131_, OBJECTS_TYPE_SOURCE, ObjectsSource));
		_data_->source = _data_->_tmp132_;
		_data_->_tmp133_ = _data_->self->priv->main_stack;
		gtk_stack_set_visible_child_name (_data_->_tmp133_, "loading-page");
		_data_->_tmp134_ = services_cal_dav_core_get_default ();
		_data_->_tmp135_ = _data_->_tmp134_;
		_data_->_tmp136_ = _data_->source;
		_data_->_state_ = 4;
		services_cal_dav_core_add_caldav_account (_data_->_tmp135_, _data_->_tmp136_, _data_->cancellable, dialogs_preferences_pages_cal_dav_setup_do_login_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp137_ = services_cal_dav_core_add_caldav_account_finish (_data_->_tmp135_, _data_->_res_);
		_http_response_unref0 (_data_->response);
		_data_->response = _data_->_tmp137_;
		_g_object_unref0 (_data_->_tmp135_);
		_data_->_tmp138_ = _data_->response;
		_data_->_tmp139_ = http_response_get_status (_data_->_tmp138_);
		_data_->_tmp140_ = _data_->_tmp139_;
		if (_data_->_tmp140_) {
			_data_->_tmp141_ = services_log_service_get_default ();
			_data_->_tmp142_ = _data_->_tmp141_;
			services_log_service_info (_data_->_tmp142_, "CalDAVSetup", "Account synced successfully");
			_g_object_unref0 (_data_->_tmp142_);
			_data_->_tmp143_ = dialogs_preferences_pages_base_page_get_preferences_dialog ((DialogsPreferencesPagesBasePage*) _data_->self);
			_data_->_tmp144_ = _data_->_tmp143_;
			adw_preferences_dialog_pop_subpage (_data_->_tmp144_);
		} else {
			_data_->_tmp145_ = services_log_service_get_default ();
			_data_->_tmp146_ = _data_->_tmp145_;
			_data_->_tmp147_ = _data_->response;
			_data_->_tmp148_ = http_response_get_error (_data_->_tmp147_);
			_data_->_tmp149_ = _data_->_tmp148_;
			_data_->_tmp150_ = g_strdup_printf ("Account sync failed: %s", _data_->_tmp149_);
			_data_->_tmp151_ = _data_->_tmp150_;
			services_log_service_error (_data_->_tmp146_, "CalDAVSetup", _data_->_tmp151_);
			_g_free0 (_data_->_tmp151_);
			_g_object_unref0 (_data_->_tmp146_);
			_data_->_tmp152_ = _data_->self->priv->main_stack;
			gtk_stack_set_visible_child_name (_data_->_tmp152_, "main-page");
			_data_->_tmp153_ = _data_->self->priv->login_button;
			widgets_loading_button_set_is_loading (_data_->_tmp153_, FALSE);
			_data_->_tmp154_ = _data_->self->priv->cancel_button;
			gtk_widget_set_visible ((GtkWidget*) _data_->_tmp154_, FALSE);
			_data_->_tmp155_ = _data_->self->priv->_accounts_page;
			_data_->_tmp156_ = _data_->response;
			_data_->_tmp157_ = http_response_get_error_code (_data_->_tmp156_);
			_data_->_tmp158_ = _data_->_tmp157_;
			_data_->_tmp159_ = _data_->response;
			_data_->_tmp160_ = http_response_get_error (_data_->_tmp159_);
			_data_->_tmp161_ = _data_->_tmp160_;
			_data_->_tmp162_ = string_strip (_data_->_tmp161_);
			_data_->_tmp163_ = _data_->_tmp162_;
			dialogs_preferences_pages_accounts_show_message_error (_data_->_tmp155_, _data_->_tmp158_, _data_->_tmp163_, TRUE);
			_g_free0 (_data_->_tmp163_);
		}
		_g_object_unref0 (_data_->source);
	} else {
		_data_->_tmp164_ = _data_->self->priv->login_button;
		widgets_loading_button_set_is_loading (_data_->_tmp164_, FALSE);
		_data_->_tmp165_ = _data_->self->priv->cancel_button;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp165_, FALSE);
		_data_->_tmp166_ = _data_->response;
		_data_->_tmp167_ = http_response_get_error_code (_data_->_tmp166_);
		_data_->_tmp168_ = _data_->_tmp167_;
		if (_data_->_tmp168_ == 409) {
			_data_->_tmp169_ = _data_->response;
			_data_->_tmp170_ = http_response_get_error (_data_->_tmp169_);
			_data_->_tmp171_ = _data_->_tmp170_;
			_data_->_tmp172_ = string_strip (_data_->_tmp171_);
			_data_->_tmp173_ = _data_->_tmp172_;
			_data_->_tmp174_ = adw_toast_new (_data_->_tmp173_);
			_data_->_tmp175_ = _data_->_tmp174_;
			_g_free0 (_data_->_tmp173_);
			_data_->toast = _data_->_tmp175_;
			_data_->_tmp176_ = _data_->toast;
			adw_toast_set_timeout (_data_->_tmp176_, (guint) 3);
			_data_->_tmp177_ = dialogs_preferences_pages_base_page_get_preferences_dialog ((DialogsPreferencesPagesBasePage*) _data_->self);
			_data_->_tmp178_ = _data_->_tmp177_;
			_data_->_tmp179_ = _data_->toast;
			_data_->_tmp180_ = _g_object_ref0 (_data_->_tmp179_);
			adw_preferences_dialog_add_toast (_data_->_tmp178_, _data_->_tmp180_);
			_g_object_unref0 (_data_->toast);
		} else {
			_data_->_tmp181_ = _data_->self->priv->_accounts_page;
			_data_->_tmp182_ = _data_->response;
			_data_->_tmp183_ = http_response_get_error_code (_data_->_tmp182_);
			_data_->_tmp184_ = _data_->_tmp183_;
			_data_->_tmp185_ = _data_->response;
			_data_->_tmp186_ = http_response_get_error (_data_->_tmp185_);
			_data_->_tmp187_ = _data_->_tmp186_;
			_data_->_tmp188_ = string_strip (_data_->_tmp187_);
			_data_->_tmp189_ = _data_->_tmp188_;
			dialogs_preferences_pages_accounts_show_message_error (_data_->_tmp181_, _data_->_tmp184_, _data_->_tmp189_, TRUE);
			_g_free0 (_data_->_tmp189_);
		}
	}
	_http_response_unref0 (_data_->response);
	_g_free0 (_data_->calendar_home);
	_g_free0 (_data_->dav_endpoint);
	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 gboolean
dialogs_preferences_pages_cal_dav_setup_is_valid_url (DialogsPreferencesPagesCalDAVSetup* self,
                                                      const gchar* uri)
{
	gchar* scheme = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (uri != NULL, FALSE);
	_tmp0_ = g_uri_parse_scheme (uri);
	scheme = _tmp0_;
	_tmp1_ = scheme;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_g_free0 (scheme);
		return result;
	}
	_tmp2_ = scheme;
	result = g_str_has_prefix (_tmp2_, "http");
	_g_free0 (scheme);
	return result;
}

DialogsPreferencesPagesAccounts*
dialogs_preferences_pages_cal_dav_setup_get_accounts_page (DialogsPreferencesPagesCalDAVSetup* self)
{
	DialogsPreferencesPagesAccounts* result;
	DialogsPreferencesPagesAccounts* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_accounts_page;
	result = _tmp0_;
	return result;
}

static void
dialogs_preferences_pages_cal_dav_setup_set_accounts_page (DialogsPreferencesPagesCalDAVSetup* self,
                                                           DialogsPreferencesPagesAccounts* value)
{
	DialogsPreferencesPagesAccounts* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_preferences_pages_cal_dav_setup_get_accounts_page (self);
	if (old_value != value) {
		DialogsPreferencesPagesAccounts* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_accounts_page);
		self->priv->_accounts_page = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_preferences_pages_cal_dav_setup_properties[DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_ACCOUNTS_PAGE_PROPERTY]);
	}
}

static Block114Data*
block114_data_ref (Block114Data* _data114_)
{
	g_atomic_int_inc (&_data114_->_ref_count_);
	return _data114_;
}

static void
block114_data_unref (void * _userdata_)
{
	Block114Data* _data114_;
	_data114_ = (Block114Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data114_->_ref_count_)) {
		DialogsPreferencesPagesCalDAVSetup* self;
		self = _data114_->self;
		_g_object_unref0 (_data114_->loading_page);
		_g_object_unref0 (_data114_->advanced_label);
		_g_object_unref0 (_data114_->advanced_icon);
		_g_object_unref0 (_data114_->advanced_revealer);
		_g_object_unref0 (self);
		g_slice_free (Block114Data, _data114_);
	}
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda324_ (Block114Data* _data114_)
{
	DialogsPreferencesPagesCalDAVSetup* self;
	gboolean revealed = FALSE;
	GtkRevealer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkRevealer* _tmp3_;
	const gchar* _tmp4_ = NULL;
	GtkLabel* _tmp5_;
	const gchar* _tmp6_ = NULL;
	GtkImage* _tmp7_;
	self = _data114_->self;
	_tmp0_ = _data114_->advanced_revealer;
	_tmp1_ = gtk_revealer_get_reveal_child (_tmp0_);
	_tmp2_ = _tmp1_;
	revealed = !_tmp2_;
	_tmp3_ = _data114_->advanced_revealer;
	gtk_revealer_set_reveal_child (_tmp3_, revealed);
	if (revealed) {
		_tmp4_ = _ ("Hide advanced options");
	} else {
		_tmp4_ = _ ("Show advanced options");
	}
	_tmp5_ = _data114_->advanced_label;
	gtk_label_set_label (_tmp5_, _tmp4_);
	if (revealed) {
		_tmp6_ = "go-up-symbolic";
	} else {
		_tmp6_ = "go-down-symbolic";
	}
	_tmp7_ = _data114_->advanced_icon;
	g_object_set (_tmp7_, "icon-name", _tmp6_, NULL);
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda324__gtk_button_clicked (GtkButton* _sender,
                                                                           gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda324_ (self);
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda325_ (DialogsPreferencesPagesCalDAVSetup* self)
{
	dialogs_preferences_pages_cal_dav_setup_validate_entries (self);
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda325__gtk_editable_changed (GtkEditable* _sender,
                                                                             gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda325_ ((DialogsPreferencesPagesCalDAVSetup*) self);
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda326_ (DialogsPreferencesPagesCalDAVSetup* self)
{
	dialogs_preferences_pages_cal_dav_setup_validate_entries (self);
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda326__gtk_editable_changed (GtkEditable* _sender,
                                                                             gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda326_ ((DialogsPreferencesPagesCalDAVSetup*) self);
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda327_ (DialogsPreferencesPagesCalDAVSetup* self)
{
	dialogs_preferences_pages_cal_dav_setup_validate_entries (self);
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda327__gtk_editable_changed (GtkEditable* _sender,
                                                                             gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda327_ ((DialogsPreferencesPagesCalDAVSetup*) self);
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda328_ (DialogsPreferencesPagesCalDAVSetup* self)
{
	WidgetsLoadingButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = self->priv->login_button;
	_tmp1_ = gtk_widget_get_sensitive ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		dialogs_preferences_pages_cal_dav_setup_on_login_button_clicked (self);
	}
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda328__adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                                                      gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda328_ ((DialogsPreferencesPagesCalDAVSetup*) self);
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda329_ (DialogsPreferencesPagesCalDAVSetup* self)
{
	dialogs_preferences_pages_cal_dav_setup_on_login_button_clicked (self);
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda329__gtk_button_clicked (GtkButton* _sender,
                                                                           gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda329_ ((DialogsPreferencesPagesCalDAVSetup*) self);
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda330_ (Block114Data* _data114_,
                                                       gint current,
                                                       gint total,
                                                       const gchar* message)
{
	DialogsPreferencesPagesCalDAVSetup* self;
	DialogsPreferencesPagesAccountsLoadingPage* _tmp0_;
	gdouble _tmp1_ = 0.0;
	DialogsPreferencesPagesAccountsLoadingPage* _tmp2_;
	self = _data114_->self;
	g_return_if_fail (message != NULL);
	_tmp0_ = _data114_->loading_page;
	dialogs_preferences_pages_accounts_loading_page_set_sync_label (_tmp0_, message);
	if (total > 0) {
		_tmp1_ = ((gdouble) current) / ((gdouble) total);
	} else {
		_tmp1_ = 0.0;
	}
	_tmp2_ = _data114_->loading_page;
	dialogs_preferences_pages_accounts_loading_page_set_progress (_tmp2_, _tmp1_);
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda330__services_cal_dav_core_sync_progress (ServicesCalDAVCore* _sender,
                                                                                            gint current,
                                                                                            gint total,
                                                                                            const gchar* message,
                                                                                            gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda330_ (self, current, total, message);
}

static void
_dialogs_preferences_pages_cal_dav_setup___lambda331_ (DialogsPreferencesPagesCalDAVSetup* self)
{
	ServicesCalDAVCore* _tmp0_;
	ServicesCalDAVCore* _tmp1_;
	dialogs_preferences_pages_base_page_clean_up ((DialogsPreferencesPagesBasePage*) self);
	_tmp0_ = services_cal_dav_core_get_default ();
	_tmp1_ = _tmp0_;
	services_cal_dav_core_clear (_tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
__dialogs_preferences_pages_cal_dav_setup___lambda331__gtk_widget_destroy (GtkWidget* _sender,
                                                                           gpointer self)
{
	_dialogs_preferences_pages_cal_dav_setup___lambda331_ ((DialogsPreferencesPagesCalDAVSetup*) self);
}

static GObject *
dialogs_preferences_pages_cal_dav_setup_constructor (GType type,
                                                     guint n_construct_properties,
                                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DialogsPreferencesPagesCalDAVSetup * self;
	Block114Data* _data114_;
	GtkImage* icon = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkImage* _tmp2_ = NULL;
	GtkLabel* title_label = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	GtkLabel* _tmp6_ = NULL;
	GtkLabel* description_label = NULL;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar** _tmp9_;
	GtkLabel* _tmp10_ = NULL;
	GtkBox* header_box = NULL;
	GtkBox* _tmp11_ = NULL;
	GtkBox* _tmp12_;
	GtkImage* _tmp13_;
	GtkBox* _tmp14_;
	GtkLabel* _tmp15_;
	GtkBox* _tmp16_;
	GtkLabel* _tmp17_;
	AdwEntryRow* _tmp18_;
	AdwEntryRow* _tmp19_;
	AdwEntryRow* _tmp20_;
	AdwEntryRow* _tmp21_;
	AdwPasswordEntryRow* _tmp22_;
	AdwPasswordEntryRow* _tmp23_;
	AdwPasswordEntryRow* _tmp24_;
	AdwPasswordEntryRow* _tmp25_;
	AdwPreferencesGroup* entries_group = NULL;
	AdwPreferencesGroup* _tmp26_;
	AdwPreferencesGroup* _tmp27_;
	AdwEntryRow* _tmp28_;
	AdwPreferencesGroup* _tmp29_;
	AdwEntryRow* _tmp30_;
	AdwPreferencesGroup* _tmp31_;
	AdwPasswordEntryRow* _tmp32_;
	AdwEntryRow* _tmp33_;
	AdwEntryRow* _tmp34_;
	WidgetsIgnoreSSLSwitchRow* _tmp35_;
	WidgetsBypassResolveSwitchRow* _tmp36_;
	AdwPreferencesGroup* advanced_group = NULL;
	AdwPreferencesGroup* _tmp37_ = NULL;
	AdwPreferencesGroup* _tmp38_;
	AdwPreferencesGroup* _tmp39_;
	AdwEntryRow* _tmp40_;
	AdwPreferencesGroup* _tmp41_;
	WidgetsIgnoreSSLSwitchRow* _tmp42_;
	AdwPreferencesGroup* _tmp43_;
	WidgetsBypassResolveSwitchRow* _tmp44_;
	AdwPreferencesGroup* _tmp45_;
	GtkWidget* _tmp46_;
	GtkRevealer* _tmp47_ = NULL;
	GtkImage* _tmp48_ = NULL;
	GtkLabel* _tmp49_;
	GtkBox* advanced_button_box = NULL;
	GtkBox* _tmp50_ = NULL;
	GtkBox* _tmp51_;
	GtkLabel* _tmp52_;
	GtkBox* _tmp53_;
	GtkImage* _tmp54_;
	GtkButton* advanced_button = NULL;
	GtkBox* _tmp55_;
	GtkWidget* _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	gchar** _tmp60_;
	GtkButton* _tmp61_ = NULL;
	GeeHashMap* _tmp62_;
	GtkButton* _tmp63_;
	gulong _tmp64_;
	GtkButton* _tmp65_;
	gchar* _tmp66_;
	gchar* _tmp67_;
	gchar** _tmp68_;
	WidgetsLoadingButton* _tmp69_ = NULL;
	gchar* _tmp70_;
	gchar* _tmp71_;
	gchar** _tmp72_;
	GtkButton* _tmp73_ = NULL;
	GtkBox* content_box = NULL;
	GtkBox* _tmp74_ = NULL;
	GtkBox* _tmp75_;
	GtkBox* _tmp76_;
	GtkBox* _tmp77_;
	AdwPreferencesGroup* _tmp78_;
	GtkBox* _tmp79_;
	GtkButton* _tmp80_;
	GtkBox* _tmp81_;
	GtkRevealer* _tmp82_;
	GtkBox* _tmp83_;
	WidgetsLoadingButton* _tmp84_;
	GtkBox* _tmp85_;
	GtkButton* _tmp86_;
	DialogsPreferencesPagesAccountsLoadingPage* _tmp87_ = NULL;
	GtkScrolledWindow* scrolled_window = NULL;
	GtkBox* _tmp88_;
	GtkWidget* _tmp89_;
	GtkScrolledWindow* _tmp90_ = NULL;
	GtkStack* _tmp91_ = NULL;
	GtkStack* _tmp92_;
	GtkScrolledWindow* _tmp93_;
	GtkStack* _tmp94_;
	DialogsPreferencesPagesAccountsLoadingPage* _tmp95_;
	AdwToolbarView* toolbar_view = NULL;
	AdwToolbarView* _tmp96_;
	AdwToolbarView* _tmp97_;
	AdwHeaderBar* _tmp98_;
	AdwHeaderBar* _tmp99_;
	AdwToolbarView* _tmp100_;
	GtkStack* _tmp101_;
	AdwToolbarView* _tmp102_;
	GeeHashMap* _tmp103_;
	AdwEntryRow* _tmp104_;
	gulong _tmp105_;
	AdwEntryRow* _tmp106_;
	GeeHashMap* _tmp107_;
	AdwEntryRow* _tmp108_;
	gulong _tmp109_;
	AdwEntryRow* _tmp110_;
	GeeHashMap* _tmp111_;
	AdwPasswordEntryRow* _tmp112_;
	gulong _tmp113_;
	AdwPasswordEntryRow* _tmp114_;
	GeeHashMap* _tmp115_;
	AdwPasswordEntryRow* _tmp116_;
	gulong _tmp117_;
	AdwPasswordEntryRow* _tmp118_;
	GeeHashMap* _tmp119_;
	WidgetsLoadingButton* _tmp120_;
	gulong _tmp121_;
	WidgetsLoadingButton* _tmp122_;
	GeeHashMap* _tmp123_;
	ServicesCalDAVCore* _tmp124_;
	ServicesCalDAVCore* _tmp125_;
	gulong _tmp126_;
	ServicesCalDAVCore* _tmp127_;
	ServicesCalDAVCore* _tmp128_;
	parent_class = G_OBJECT_CLASS (dialogs_preferences_pages_cal_dav_setup_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, DialogsPreferencesPagesCalDAVSetup);
	_data114_ = g_slice_new0 (Block114Data);
	_data114_->_ref_count_ = 1;
	_data114_->self = g_object_ref (self);
	_tmp0_ = g_strdup ("dimmed");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("network-server-symbolic");
	gtk_image_set_pixel_size (_tmp2_, 48);
	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 ("font-bold");
	_tmp4_ = g_strdup ("title-3");
	_tmp5_ = g_new0 (gchar*, 2 + 1);
	_tmp5_[0] = _tmp3_;
	_tmp5_[1] = _tmp4_;
	_tmp6_ = (GtkLabel*) gtk_label_new (_ ("Connect to CalDAV"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp6_, _tmp5_);
	_tmp5_ = (_vala_array_free (_tmp5_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp6_, 12);
	g_object_ref_sink (_tmp6_);
	title_label = _tmp6_;
	_tmp7_ = g_strdup ("dimmed");
	_tmp8_ = g_strdup ("caption");
	_tmp9_ = g_new0 (gchar*, 2 + 1);
	_tmp9_[0] = _tmp7_;
	_tmp9_[1] = _tmp8_;
	_tmp10_ = (GtkLabel*) gtk_label_new (_ ("Connect to any CalDAV-compatible server to sync your tasks"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp10_, _tmp9_);
	_tmp9_ = (_vala_array_free (_tmp9_, 2, (GDestroyNotify) g_free), NULL);
	gtk_label_set_wrap (_tmp10_, TRUE);
	gtk_label_set_justify (_tmp10_, GTK_JUSTIFY_CENTER);
	gtk_label_set_max_width_chars (_tmp10_, 40);
	g_object_ref_sink (_tmp10_);
	description_label = _tmp10_;
	_tmp11_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_halign ((GtkWidget*) _tmp11_, GTK_ALIGN_CENTER);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp11_, 18);
	g_object_ref_sink (_tmp11_);
	header_box = _tmp11_;
	_tmp12_ = header_box;
	_tmp13_ = icon;
	gtk_box_append (_tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = header_box;
	_tmp15_ = title_label;
	gtk_box_append (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = header_box;
	_tmp17_ = description_label;
	gtk_box_append (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = (AdwEntryRow*) adw_entry_row_new ();
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->server_entry);
	self->priv->server_entry = _tmp18_;
	_tmp19_ = self->priv->server_entry;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp19_, _ ("Server URL"));
	_tmp20_ = (AdwEntryRow*) adw_entry_row_new ();
	g_object_ref_sink (_tmp20_);
	_g_object_unref0 (self->priv->username_entry);
	self->priv->username_entry = _tmp20_;
	_tmp21_ = self->priv->username_entry;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp21_, _ ("Username"));
	_tmp22_ = (AdwPasswordEntryRow*) adw_password_entry_row_new ();
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->password_entry);
	self->priv->password_entry = _tmp22_;
	_tmp23_ = self->priv->password_entry;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp23_, _ ("Password"));
	_tmp24_ = self->priv->password_entry;
	adw_entry_row_set_input_purpose ((AdwEntryRow*) _tmp24_, GTK_INPUT_PURPOSE_PASSWORD);
	_tmp25_ = self->priv->password_entry;
	adw_entry_row_set_enable_emoji_completion ((AdwEntryRow*) _tmp25_, FALSE);
	_tmp26_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	g_object_ref_sink (_tmp26_);
	entries_group = _tmp26_;
	_tmp27_ = entries_group;
	_tmp28_ = self->priv->server_entry;
	adw_preferences_group_add (_tmp27_, (GtkWidget*) _tmp28_);
	_tmp29_ = entries_group;
	_tmp30_ = self->priv->username_entry;
	adw_preferences_group_add (_tmp29_, (GtkWidget*) _tmp30_);
	_tmp31_ = entries_group;
	_tmp32_ = self->priv->password_entry;
	adw_preferences_group_add (_tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = (AdwEntryRow*) adw_entry_row_new ();
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->calendar_home_entry);
	self->priv->calendar_home_entry = _tmp33_;
	_tmp34_ = self->priv->calendar_home_entry;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp34_, _ ("Calendar Home URL"));
	_tmp35_ = widgets_ignore_ssl_switch_row_new ();
	g_object_ref_sink (_tmp35_);
	_g_object_unref0 (self->priv->ignore_ssl_row);
	self->priv->ignore_ssl_row = _tmp35_;
	_tmp36_ = widgets_bypass_resolve_switch_row_new ();
	g_object_ref_sink (_tmp36_);
	_g_object_unref0 (self->priv->bypass_resolve_row);
	self->priv->bypass_resolve_row = _tmp36_;
	_tmp37_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp37_, 3);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp37_, 3);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp37_, 3);
	g_object_ref_sink (_tmp37_);
	advanced_group = _tmp37_;
	_tmp38_ = advanced_group;
	adw_preferences_group_set_title (_tmp38_, _ ("Advanced"));
	_tmp39_ = advanced_group;
	_tmp40_ = self->priv->calendar_home_entry;
	adw_preferences_group_add (_tmp39_, (GtkWidget*) _tmp40_);
	_tmp41_ = advanced_group;
	_tmp42_ = self->priv->ignore_ssl_row;
	adw_preferences_group_add (_tmp41_, (GtkWidget*) _tmp42_);
	_tmp43_ = advanced_group;
	_tmp44_ = self->priv->bypass_resolve_row;
	adw_preferences_group_add (_tmp43_, (GtkWidget*) _tmp44_);
	_tmp45_ = advanced_group;
	_tmp46_ = _g_object_ref0 ((GtkWidget*) _tmp45_);
	_tmp47_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp47_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	gtk_revealer_set_reveal_child (_tmp47_, FALSE);
	gtk_revealer_set_child (_tmp47_, _tmp46_);
	_g_object_unref0 (_tmp46_);
	g_object_ref_sink (_tmp47_);
	_data114_->advanced_revealer = _tmp47_;
	_tmp48_ = (GtkImage*) gtk_image_new_from_icon_name ("go-down-symbolic");
	gtk_image_set_pixel_size (_tmp48_, 12);
	g_object_ref_sink (_tmp48_);
	_data114_->advanced_icon = _tmp48_;
	_tmp49_ = (GtkLabel*) gtk_label_new (_ ("Show advanced options"));
	g_object_ref_sink (_tmp49_);
	_data114_->advanced_label = _tmp49_;
	_tmp50_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
	gtk_widget_set_halign ((GtkWidget*) _tmp50_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp50_);
	advanced_button_box = _tmp50_;
	_tmp51_ = advanced_button_box;
	_tmp52_ = _data114_->advanced_label;
	gtk_box_append (_tmp51_, (GtkWidget*) _tmp52_);
	_tmp53_ = advanced_button_box;
	_tmp54_ = _data114_->advanced_icon;
	gtk_box_append (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = advanced_button_box;
	_tmp56_ = _g_object_ref0 ((GtkWidget*) _tmp55_);
	_tmp57_ = g_strdup ("flat");
	_tmp58_ = g_strdup ("caption");
	_tmp59_ = g_strdup ("dimmed");
	_tmp60_ = g_new0 (gchar*, 3 + 1);
	_tmp60_[0] = _tmp57_;
	_tmp60_[1] = _tmp58_;
	_tmp60_[2] = _tmp59_;
	_tmp61_ = (GtkButton*) gtk_button_new ();
	gtk_button_set_child (_tmp61_, _tmp56_);
	_g_object_unref0 (_tmp56_);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp61_, _tmp60_);
	_tmp60_ = (_vala_array_free (_tmp60_, 3, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp61_, GTK_ALIGN_CENTER);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp61_, 12);
	g_object_ref_sink (_tmp61_);
	advanced_button = _tmp61_;
	_tmp62_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp63_ = advanced_button;
	_tmp64_ = g_signal_connect_data (_tmp63_, "clicked", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda324__gtk_button_clicked, block114_data_ref (_data114_), (GClosureNotify) block114_data_unref, 0);
	_tmp65_ = advanced_button;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp62_, (gpointer) ((guintptr) _tmp64_), (GObject*) _tmp65_);
	_tmp66_ = g_strdup ("suggested-action");
	_tmp67_ = g_strdup ("pill");
	_tmp68_ = g_new0 (gchar*, 2 + 1);
	_tmp68_[0] = _tmp66_;
	_tmp68_[1] = _tmp67_;
	_tmp69_ = widgets_loading_button_new_with_label (_ ("Log In"));
	gtk_widget_set_margin_top ((GtkWidget*) _tmp69_, 24);
	gtk_widget_set_sensitive ((GtkWidget*) _tmp69_, FALSE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp69_, _tmp68_);
	_tmp68_ = (_vala_array_free (_tmp68_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp69_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp69_);
	_g_object_unref0 (self->priv->login_button);
	self->priv->login_button = _tmp69_;
	_tmp70_ = g_strdup ("flat");
	_tmp71_ = g_strdup ("pill");
	_tmp72_ = g_new0 (gchar*, 2 + 1);
	_tmp72_[0] = _tmp70_;
	_tmp72_[1] = _tmp71_;
	_tmp73_ = (GtkButton*) gtk_button_new_with_label (_ ("Cancel"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp73_, _tmp72_);
	_tmp72_ = (_vala_array_free (_tmp72_, 2, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp73_, GTK_ALIGN_CENTER);
	gtk_widget_set_visible ((GtkWidget*) _tmp73_, FALSE);
	g_object_ref_sink (_tmp73_);
	_g_object_unref0 (self->priv->cancel_button);
	self->priv->cancel_button = _tmp73_;
	_tmp74_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp74_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp74_, TRUE);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp74_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp74_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp74_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp74_, 24);
	g_object_ref_sink (_tmp74_);
	content_box = _tmp74_;
	_tmp75_ = content_box;
	_tmp76_ = header_box;
	gtk_box_append (_tmp75_, (GtkWidget*) _tmp76_);
	_tmp77_ = content_box;
	_tmp78_ = entries_group;
	gtk_box_append (_tmp77_, (GtkWidget*) _tmp78_);
	_tmp79_ = content_box;
	_tmp80_ = advanced_button;
	gtk_box_append (_tmp79_, (GtkWidget*) _tmp80_);
	_tmp81_ = content_box;
	_tmp82_ = _data114_->advanced_revealer;
	gtk_box_append (_tmp81_, (GtkWidget*) _tmp82_);
	_tmp83_ = content_box;
	_tmp84_ = self->priv->login_button;
	gtk_box_append (_tmp83_, (GtkWidget*) _tmp84_);
	_tmp85_ = content_box;
	_tmp86_ = self->priv->cancel_button;
	gtk_box_append (_tmp85_, (GtkWidget*) _tmp86_);
	_tmp87_ = dialogs_preferences_pages_accounts_loading_page_new ();
	dialogs_preferences_pages_accounts_loading_page_set_show_progress (_tmp87_, TRUE);
	g_object_ref_sink (_tmp87_);
	_data114_->loading_page = _tmp87_;
	_tmp88_ = content_box;
	_tmp89_ = _g_object_ref0 ((GtkWidget*) _tmp88_);
	_tmp90_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp90_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp90_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp90_, TRUE);
	gtk_scrolled_window_set_child (_tmp90_, _tmp89_);
	_g_object_unref0 (_tmp89_);
	g_object_ref_sink (_tmp90_);
	scrolled_window = _tmp90_;
	_tmp91_ = (GtkStack*) gtk_stack_new ();
	gtk_widget_set_vexpand ((GtkWidget*) _tmp91_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp91_, TRUE);
	gtk_stack_set_transition_type (_tmp91_, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
	g_object_ref_sink (_tmp91_);
	_g_object_unref0 (self->priv->main_stack);
	self->priv->main_stack = _tmp91_;
	_tmp92_ = self->priv->main_stack;
	_tmp93_ = scrolled_window;
	gtk_stack_add_named (_tmp92_, (GtkWidget*) _tmp93_, "main-page");
	_tmp94_ = self->priv->main_stack;
	_tmp95_ = _data114_->loading_page;
	gtk_stack_add_named (_tmp94_, (GtkWidget*) _tmp95_, "loading-page");
	_tmp96_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp96_);
	toolbar_view = _tmp96_;
	_tmp97_ = toolbar_view;
	_tmp98_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp98_);
	_tmp99_ = _tmp98_;
	adw_toolbar_view_add_top_bar (_tmp97_, (GtkWidget*) _tmp99_);
	_g_object_unref0 (_tmp99_);
	_tmp100_ = toolbar_view;
	_tmp101_ = self->priv->main_stack;
	adw_toolbar_view_set_content (_tmp100_, (GtkWidget*) _tmp101_);
	_tmp102_ = toolbar_view;
	adw_navigation_page_set_child ((AdwNavigationPage*) self, (GtkWidget*) _tmp102_);
	_tmp103_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp104_ = self->priv->server_entry;
	_tmp105_ = g_signal_connect_object ((GtkEditable*) _tmp104_, "changed", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda325__gtk_editable_changed, self, 0);
	_tmp106_ = self->priv->server_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp103_, (gpointer) ((guintptr) _tmp105_), (GObject*) _tmp106_);
	_tmp107_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp108_ = self->priv->username_entry;
	_tmp109_ = g_signal_connect_object ((GtkEditable*) _tmp108_, "changed", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda326__gtk_editable_changed, self, 0);
	_tmp110_ = self->priv->username_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp107_, (gpointer) ((guintptr) _tmp109_), (GObject*) _tmp110_);
	_tmp111_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp112_ = self->priv->password_entry;
	_tmp113_ = g_signal_connect_object ((GtkEditable*) _tmp112_, "changed", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda327__gtk_editable_changed, self, 0);
	_tmp114_ = self->priv->password_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp111_, (gpointer) ((guintptr) _tmp113_), (GObject*) _tmp114_);
	_tmp115_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp116_ = self->priv->password_entry;
	_tmp117_ = g_signal_connect_object ((AdwEntryRow*) _tmp116_, "entry-activated", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda328__adw_entry_row_entry_activated, self, 0);
	_tmp118_ = self->priv->password_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp115_, (gpointer) ((guintptr) _tmp117_), (GObject*) _tmp118_);
	_tmp119_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp120_ = self->priv->login_button;
	_tmp121_ = g_signal_connect_object ((GtkButton*) _tmp120_, "clicked", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda329__gtk_button_clicked, self, 0);
	_tmp122_ = self->priv->login_button;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp119_, (gpointer) ((guintptr) _tmp121_), (GObject*) _tmp122_);
	_tmp123_ = ((DialogsPreferencesPagesBasePage*) self)->signal_map;
	_tmp124_ = services_cal_dav_core_get_default ();
	_tmp125_ = _tmp124_;
	_tmp126_ = g_signal_connect_data (_tmp125_, "sync-progress", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda330__services_cal_dav_core_sync_progress, block114_data_ref (_data114_), (GClosureNotify) block114_data_unref, 0);
	_tmp127_ = services_cal_dav_core_get_default ();
	_tmp128_ = _tmp127_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp123_, (gpointer) ((guintptr) _tmp126_), (GObject*) _tmp128_);
	_g_object_unref0 (_tmp128_);
	_g_object_unref0 (_tmp125_);
	g_signal_connect_object ((GtkWidget*) self, "destroy", (GCallback) __dialogs_preferences_pages_cal_dav_setup___lambda331__gtk_widget_destroy, self, 0);
	_g_object_unref0 (toolbar_view);
	_g_object_unref0 (scrolled_window);
	_g_object_unref0 (content_box);
	_g_object_unref0 (advanced_button);
	_g_object_unref0 (advanced_button_box);
	_g_object_unref0 (advanced_group);
	_g_object_unref0 (entries_group);
	_g_object_unref0 (header_box);
	_g_object_unref0 (description_label);
	_g_object_unref0 (title_label);
	_g_object_unref0 (icon);
	block114_data_unref (_data114_);
	_data114_ = NULL;
	return obj;
}

static void
dialogs_preferences_pages_cal_dav_setup_class_init (DialogsPreferencesPagesCalDAVSetupClass * klass,
                                                    gpointer klass_data)
{
	dialogs_preferences_pages_cal_dav_setup_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsPreferencesPagesCalDAVSetup_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dialogs_preferences_pages_cal_dav_setup_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dialogs_preferences_pages_cal_dav_setup_set_property;
	G_OBJECT_CLASS (klass)->constructor = dialogs_preferences_pages_cal_dav_setup_constructor;
	G_OBJECT_CLASS (klass)->finalize = dialogs_preferences_pages_cal_dav_setup_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_ACCOUNTS_PAGE_PROPERTY, dialogs_preferences_pages_cal_dav_setup_properties[DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_ACCOUNTS_PAGE_PROPERTY] = g_param_spec_object ("accounts-page", "accounts-page", "accounts-page", DIALOGS_PREFERENCES_PAGES_TYPE_ACCOUNTS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
dialogs_preferences_pages_cal_dav_setup_instance_init (DialogsPreferencesPagesCalDAVSetup * self,
                                                       gpointer klass)
{
	self->priv = dialogs_preferences_pages_cal_dav_setup_get_instance_private (self);
}

static void
dialogs_preferences_pages_cal_dav_setup_finalize (GObject * obj)
{
	DialogsPreferencesPagesCalDAVSetup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, DialogsPreferencesPagesCalDAVSetup);
	g_debug ("CalDAVSetup.vala:47: Destroying Dialogs.Preferences.Pages.CalDAVSetup\n");
	_g_object_unref0 (self->priv->_accounts_page);
	_g_object_unref0 (self->priv->server_entry);
	_g_object_unref0 (self->priv->username_entry);
	_g_object_unref0 (self->priv->password_entry);
	_g_object_unref0 (self->priv->login_button);
	_g_object_unref0 (self->priv->cancel_button);
	_g_object_unref0 (self->priv->main_stack);
	_g_object_unref0 (self->priv->calendar_home_entry);
	_g_object_unref0 (self->priv->ignore_ssl_row);
	_g_object_unref0 (self->priv->bypass_resolve_row);
	G_OBJECT_CLASS (dialogs_preferences_pages_cal_dav_setup_parent_class)->finalize (obj);
}

static GType
dialogs_preferences_pages_cal_dav_setup_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsPreferencesPagesCalDAVSetupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_preferences_pages_cal_dav_setup_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsPreferencesPagesCalDAVSetup), 0, (GInstanceInitFunc) dialogs_preferences_pages_cal_dav_setup_instance_init, NULL };
	GType dialogs_preferences_pages_cal_dav_setup_type_id;
	dialogs_preferences_pages_cal_dav_setup_type_id = g_type_register_static (DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, "DialogsPreferencesPagesCalDAVSetup", &g_define_type_info, 0);
	DialogsPreferencesPagesCalDAVSetup_private_offset = g_type_add_instance_private (dialogs_preferences_pages_cal_dav_setup_type_id, sizeof (DialogsPreferencesPagesCalDAVSetupPrivate));
	return dialogs_preferences_pages_cal_dav_setup_type_id;
}

GType
dialogs_preferences_pages_cal_dav_setup_get_type (void)
{
	static volatile gsize dialogs_preferences_pages_cal_dav_setup_type_id__once = 0;
	if (g_once_init_enter (&dialogs_preferences_pages_cal_dav_setup_type_id__once)) {
		GType dialogs_preferences_pages_cal_dav_setup_type_id;
		dialogs_preferences_pages_cal_dav_setup_type_id = dialogs_preferences_pages_cal_dav_setup_get_type_once ();
		g_once_init_leave (&dialogs_preferences_pages_cal_dav_setup_type_id__once, dialogs_preferences_pages_cal_dav_setup_type_id);
	}
	return dialogs_preferences_pages_cal_dav_setup_type_id__once;
}

static void
_vala_dialogs_preferences_pages_cal_dav_setup_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	DialogsPreferencesPagesCalDAVSetup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, DialogsPreferencesPagesCalDAVSetup);
	switch (property_id) {
		case DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_ACCOUNTS_PAGE_PROPERTY:
		g_value_set_object (value, dialogs_preferences_pages_cal_dav_setup_get_accounts_page (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dialogs_preferences_pages_cal_dav_setup_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	DialogsPreferencesPagesCalDAVSetup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_PREFERENCES_PAGES_TYPE_CAL_DAV_SETUP, DialogsPreferencesPagesCalDAVSetup);
	switch (property_id) {
		case DIALOGS_PREFERENCES_PAGES_CAL_DAV_SETUP_ACCOUNTS_PAGE_PROPERTY:
		dialogs_preferences_pages_cal_dav_setup_set_accounts_page (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);
}

