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

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

#include "onlineaccounts.h"
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <libedataserver/libedataserver.h>
#include <stdlib.h>
#include <string.h>
#include <granite-7.h>
#include <switchboard.h>

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

enum  {
	ONLINE_ACCOUNTS_MAIN_VIEW_0_PROPERTY,
	ONLINE_ACCOUNTS_MAIN_VIEW_NUM_PROPERTIES
};
static GParamSpec* online_accounts_main_view_properties[ONLINE_ACCOUNTS_MAIN_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block8Data Block8Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block9Data Block9Data;
typedef struct _Block10Data Block10Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block11Data Block11Data;
typedef struct _Block12Data Block12Data;

struct _Block8Data {
	int _ref_count_;
	OnlineAccountsMainView* self;
	ESource* e_source;
	gchar* icon_name;
};

struct _Block9Data {
	int _ref_count_;
	Block8Data * _data8_;
	GraniteMessageDialog* message_dialog;
};

struct _Block10Data {
	int _ref_count_;
	Block8Data * _data8_;
	OnlineAccountsImapDialog* imap_dialog;
};

struct _Block11Data {
	int _ref_count_;
	Block8Data * _data8_;
	OnlineAccountsCaldavDialog* caldav_dialog;
};

struct _Block12Data {
	int _ref_count_;
	OnlineAccountsMainView* self;
	GtkPopover* add_account_popover;
};

static gpointer online_accounts_main_view_parent_class = NULL;
static OnlineAccountsAccountsModel* online_accounts_main_view_accountsmodel;
static OnlineAccountsAccountsModel* online_accounts_main_view_accountsmodel = NULL;

static GtkWidget* online_accounts_main_view_create_account_row (OnlineAccountsMainView* self,
                                                         GObject* object);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static void __lambda43_ (Block8Data* _data8_);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void __lambda44_ (Block9Data* _data9_,
                  gint res);
static void ___lambda44__gtk_dialog_response (GtkDialog* _sender,
                                       gint response_id,
                                       gpointer self);
static void ___lambda43__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void ___lambda45_ (Block8Data* _data8_);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void ___lambda46_ (Block10Data* _data10_,
                   GObject* obj,
                   GAsyncResult* res);
static void _gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void ____lambda46__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
static void _____lambda47_ (Block11Data* _data11_,
                     GObject* obj,
                     GAsyncResult* res);
static void ______lambda47__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static void ____lambda45__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static GObject * online_accounts_main_view_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static Block12Data* block12_data_ref (Block12Data* _data12_);
static void block12_data_unref (void * _userdata_);
static GtkWidget* _online_accounts_main_view_create_account_row_gtk_list_box_create_widget_func (GObject* item,
                                                                                          gpointer self);
static void _online_accounts_main_view___lambda48_ (Block12Data* _data12_);
static void __online_accounts_main_view___lambda48__gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void _online_accounts_main_view___lambda49_ (Block12Data* _data12_);
static void __online_accounts_main_view___lambda49__gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self);
static void online_accounts_main_view_finalize (GObject * obj);
static GType online_accounts_main_view_get_type_once (void);

OnlineAccountsMainView*
online_accounts_main_view_construct (GType object_type)
{
	OnlineAccountsMainView * self = NULL;
	GThemedIcon* _tmp0_;
	GThemedIcon* _tmp1_;
	_tmp0_ = (GThemedIcon*) g_themed_icon_new ("io.elementary.settings.onlineaccounts");
	_tmp1_ = _tmp0_;
	self = (OnlineAccountsMainView*) g_object_new (object_type, "icon", _tmp1_, "title", _ ("Online Accounts"), NULL);
	_g_object_unref0 (_tmp1_);
	return self;
}

OnlineAccountsMainView*
online_accounts_main_view_new (void)
{
	return online_accounts_main_view_construct (ONLINE_ACCOUNTS_TYPE_MAIN_VIEW);
}

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

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		OnlineAccountsMainView* self;
		self = _data8_->self;
		_g_free0 (_data8_->icon_name);
		_g_object_unref0 (_data8_->e_source);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

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

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

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

static void
__lambda44_ (Block9Data* _data9_,
             gint res)
{
	Block8Data* _data8_;
	OnlineAccountsMainView* self;
	_data8_ = _data9_->_data8_;
	self = _data8_->self;
	if (res == ((gint) GTK_RESPONSE_ACCEPT)) {
		ESource* _tmp0_;
		_tmp0_ = _data8_->e_source;
		e_source_remove (_tmp0_, NULL, NULL, NULL);
	}
	gtk_window_destroy ((GtkWindow*) _data9_->message_dialog);
}

static void
___lambda44__gtk_dialog_response (GtkDialog* _sender,
                                  gint response_id,
                                  gpointer self)
{
	__lambda44_ (self, response_id);
}

static void
__lambda43_ (Block8Data* _data8_)
{
	OnlineAccountsMainView* self;
	Block9Data* _data9_;
	ESource* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	GThemedIcon* _tmp6_;
	GThemedIcon* _tmp7_;
	GThemedIcon* _tmp8_;
	GtkRoot* _tmp9_;
	GtkWindow* _tmp10_;
	GraniteMessageDialog* _tmp11_ = NULL;
	GraniteMessageDialog* _tmp12_;
	GtkButton* accept_button = NULL;
	GtkWidget* _tmp13_;
	GtkButton* _tmp14_;
	self = _data8_->self;
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->_data8_ = block8_data_ref (_data8_);
	_tmp0_ = _data8_->e_source;
	_tmp1_ = e_source_get_display_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup_printf (_ ("Remove “%s” from this device"), _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _data8_->icon_name;
	_tmp6_ = (GThemedIcon*) g_themed_icon_new_with_default_fallbacks (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = (GThemedIcon*) g_themed_icon_new ("edit-delete");
	_tmp9_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp10_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, gtk_window_get_type (), GtkWindow));
	_tmp11_ = granite_message_dialog_new (_tmp4_, _ ("This account will be removed and no longer appear in any apps on this " \
"device."), (GIcon*) _tmp7_, GTK_BUTTONS_CANCEL);
	granite_message_dialog_set_badge_icon (_tmp11_, (GIcon*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	gtk_window_set_transient_for ((GtkWindow*) _tmp11_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	g_object_ref_sink (_tmp11_);
	_tmp12_ = _tmp11_;
	_g_object_unref0 (_tmp7_);
	_g_free0 (_tmp4_);
	_data9_->message_dialog = _tmp12_;
	_tmp13_ = granite_dialog_add_button ((GraniteDialog*) _data9_->message_dialog, _ ("Remove Account"), (gint) GTK_RESPONSE_ACCEPT);
	_tmp14_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, gtk_button_get_type (), GtkButton));
	accept_button = _tmp14_;
	gtk_widget_add_css_class ((GtkWidget*) accept_button, GRANITE_STYLE_CLASS_DESTRUCTIVE_ACTION);
	g_signal_connect_data ((GtkDialog*) _data9_->message_dialog, "response", (GCallback) ___lambda44__gtk_dialog_response, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
	gtk_window_present ((GtkWindow*) _data9_->message_dialog);
	_g_object_unref0 (accept_button);
	block9_data_unref (_data9_);
	_data9_ = NULL;
}

static void
___lambda43__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda43_ (self);
}

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

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		OnlineAccountsMainView* self;
		self = _data10_->_data8_->self;
		_g_object_unref0 (_data10_->imap_dialog);
		block8_data_unref (_data10_->_data8_);
		_data10_->_data8_ = NULL;
		g_slice_free (Block10Data, _data10_);
	}
}

static void
_gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                         gint response_id,
                                         gpointer self)
{
	gtk_window_destroy ((GtkWindow*) self);
}

static void
___lambda46_ (Block10Data* _data10_,
              GObject* obj,
              GAsyncResult* res)
{
	Block8Data* _data8_;
	OnlineAccountsMainView* self;
	GError* _inner_error0_ = NULL;
	_data8_ = _data10_->_data8_;
	self = _data8_->self;
	g_return_if_fail (res != NULL);
	{
		OnlineAccountsImapDialog* _tmp0_;
		OnlineAccountsImapDialog* _tmp1_;
		_tmp0_ = _data10_->imap_dialog;
		online_accounts_imap_dialog_load_configuration_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = _data10_->imap_dialog;
		gtk_window_present ((GtkWindow*) _tmp1_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GraniteMessageDialog* error_dialog = NULL;
		ESource* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_;
		GThemedIcon* _tmp8_;
		GThemedIcon* _tmp9_;
		GThemedIcon* _tmp10_;
		GtkRoot* _tmp11_;
		GtkWindow* _tmp12_;
		GraniteMessageDialog* _tmp13_ = NULL;
		GraniteMessageDialog* _tmp14_;
		GraniteMessageDialog* _tmp15_;
		GError* _tmp16_;
		const gchar* _tmp17_;
		GraniteMessageDialog* _tmp18_;
		GraniteMessageDialog* _tmp19_;
		GraniteMessageDialog* _tmp20_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = _data8_->e_source;
		_tmp3_ = e_source_get_display_name (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf (_ ("There was an unexpected error while reading the configuration of '%s'."), _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _data8_->icon_name;
		_tmp8_ = (GThemedIcon*) g_themed_icon_new_with_default_fallbacks (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
		_tmp11_ = gtk_widget_get_root ((GtkWidget*) self);
		_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_window_get_type (), GtkWindow));
		_tmp13_ = granite_message_dialog_new (_ ("Edit account failed"), _tmp6_, (GIcon*) _tmp9_, GTK_BUTTONS_CLOSE);
		granite_message_dialog_set_badge_icon (_tmp13_, (GIcon*) _tmp10_);
		_g_object_unref0 (_tmp10_);
		gtk_window_set_transient_for ((GtkWindow*) _tmp13_, _tmp12_);
		_g_object_unref0 (_tmp12_);
		g_object_ref_sink (_tmp13_);
		_tmp14_ = _tmp13_;
		_g_object_unref0 (_tmp9_);
		_g_free0 (_tmp6_);
		error_dialog = _tmp14_;
		_tmp15_ = error_dialog;
		_tmp16_ = e;
		_tmp17_ = _tmp16_->message;
		granite_message_dialog_show_error_details (_tmp15_, _tmp17_);
		_tmp18_ = error_dialog;
		_tmp19_ = error_dialog;
		g_signal_connect_object ((GtkDialog*) _tmp18_, "response", (GCallback) _gtk_window_destroy_gtk_dialog_response, (GtkWindow*) _tmp19_, 0);
		_tmp20_ = error_dialog;
		gtk_window_present ((GtkWindow*) _tmp20_);
		_g_object_unref0 (error_dialog);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
____lambda46__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda46_ (self, source_object, res);
	block10_data_unref (self);
}

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

static void
block11_data_unref (void * _userdata_)
{
	Block11Data* _data11_;
	_data11_ = (Block11Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
		OnlineAccountsMainView* self;
		self = _data11_->_data8_->self;
		_g_object_unref0 (_data11_->caldav_dialog);
		block8_data_unref (_data11_->_data8_);
		_data11_->_data8_ = NULL;
		g_slice_free (Block11Data, _data11_);
	}
}

static void
_____lambda47_ (Block11Data* _data11_,
                GObject* obj,
                GAsyncResult* res)
{
	Block8Data* _data8_;
	OnlineAccountsMainView* self;
	GError* _inner_error0_ = NULL;
	_data8_ = _data11_->_data8_;
	self = _data8_->self;
	g_return_if_fail (res != NULL);
	{
		OnlineAccountsCaldavDialog* _tmp0_;
		OnlineAccountsCaldavDialog* _tmp1_;
		_tmp0_ = _data11_->caldav_dialog;
		online_accounts_caldav_dialog_load_configuration_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = _data11_->caldav_dialog;
		gtk_window_present ((GtkWindow*) _tmp1_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GraniteMessageDialog* error_dialog = NULL;
		ESource* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_;
		GThemedIcon* _tmp8_;
		GThemedIcon* _tmp9_;
		GThemedIcon* _tmp10_;
		GtkRoot* _tmp11_;
		GtkWindow* _tmp12_;
		GraniteMessageDialog* _tmp13_ = NULL;
		GraniteMessageDialog* _tmp14_;
		GraniteMessageDialog* _tmp15_;
		GError* _tmp16_;
		const gchar* _tmp17_;
		GraniteMessageDialog* _tmp18_;
		GraniteMessageDialog* _tmp19_;
		GraniteMessageDialog* _tmp20_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = _data8_->e_source;
		_tmp3_ = e_source_get_display_name (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf (_ ("There was an unexpected error while reading the configuration of '%s'."), _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _data8_->icon_name;
		_tmp8_ = (GThemedIcon*) g_themed_icon_new_with_default_fallbacks (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
		_tmp11_ = gtk_widget_get_root ((GtkWidget*) self);
		_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_window_get_type (), GtkWindow));
		_tmp13_ = granite_message_dialog_new (_ ("Edit account failed"), _tmp6_, (GIcon*) _tmp9_, GTK_BUTTONS_CLOSE);
		granite_message_dialog_set_badge_icon (_tmp13_, (GIcon*) _tmp10_);
		_g_object_unref0 (_tmp10_);
		gtk_window_set_transient_for ((GtkWindow*) _tmp13_, _tmp12_);
		_g_object_unref0 (_tmp12_);
		g_object_ref_sink (_tmp13_);
		_tmp14_ = _tmp13_;
		_g_object_unref0 (_tmp9_);
		_g_free0 (_tmp6_);
		error_dialog = _tmp14_;
		_tmp15_ = error_dialog;
		_tmp16_ = e;
		_tmp17_ = _tmp16_->message;
		granite_message_dialog_show_error_details (_tmp15_, _tmp17_);
		_tmp18_ = error_dialog;
		_tmp19_ = error_dialog;
		g_signal_connect_object ((GtkDialog*) _tmp18_, "response", (GCallback) _gtk_window_destroy_gtk_dialog_response, (GtkWindow*) _tmp19_, 0);
		_tmp20_ = error_dialog;
		gtk_window_present ((GtkWindow*) _tmp20_);
		_g_object_unref0 (error_dialog);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
______lambda47__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda47_ (self, source_object, res);
	block11_data_unref (self);
}

static void
___lambda45_ (Block8Data* _data8_)
{
	OnlineAccountsMainView* self;
	ESource* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->e_source;
	if (e_source_has_extension (_tmp0_, E_SOURCE_EXTENSION_MAIL_ACCOUNT)) {
		Block10Data* _data10_;
		GtkRoot* _tmp1_;
		GtkWindow* _tmp2_;
		OnlineAccountsImapDialog* _tmp3_ = NULL;
		OnlineAccountsImapDialog* _tmp4_;
		ESource* _tmp5_;
		_data10_ = g_slice_new0 (Block10Data);
		_data10_->_ref_count_ = 1;
		_data10_->_data8_ = block8_data_ref (_data8_);
		_tmp1_ = gtk_widget_get_root ((GtkWidget*) self);
		_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow));
		_tmp3_ = online_accounts_imap_dialog_new ();
		gtk_window_set_transient_for ((GtkWindow*) _tmp3_, _tmp2_);
		_g_object_unref0 (_tmp2_);
		g_object_ref_sink (_tmp3_);
		_data10_->imap_dialog = _tmp3_;
		_tmp4_ = _data10_->imap_dialog;
		_tmp5_ = _data8_->e_source;
		online_accounts_imap_dialog_load_configuration (_tmp4_, _tmp5_, NULL, ____lambda46__gasync_ready_callback, block10_data_ref (_data10_));
		block10_data_unref (_data10_);
		_data10_ = NULL;
	} else {
		ESource* _tmp6_;
		_tmp6_ = _data8_->e_source;
		if (e_source_has_extension (_tmp6_, E_SOURCE_EXTENSION_COLLECTION)) {
			ESourceCollection* collection_extension = NULL;
			ESource* _tmp7_;
			ESourceExtension* _tmp8_;
			ESourceCollection* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_tmp7_ = _data8_->e_source;
			_tmp8_ = e_source_get_extension (_tmp7_, E_SOURCE_EXTENSION_COLLECTION);
			collection_extension = G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, e_source_collection_get_type (), ESourceCollection);
			_tmp9_ = collection_extension;
			_tmp10_ = e_source_backend_get_backend_name ((ESourceBackend*) _tmp9_);
			_tmp11_ = _tmp10_;
			if (g_strcmp0 ("webdav", _tmp11_) == 0) {
				Block11Data* _data11_;
				GtkRoot* _tmp12_;
				GtkWindow* _tmp13_;
				OnlineAccountsCaldavDialog* _tmp14_ = NULL;
				OnlineAccountsCaldavDialog* _tmp15_;
				ESource* _tmp16_;
				_data11_ = g_slice_new0 (Block11Data);
				_data11_->_ref_count_ = 1;
				_data11_->_data8_ = block8_data_ref (_data8_);
				_tmp12_ = gtk_widget_get_root ((GtkWidget*) self);
				_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, gtk_window_get_type (), GtkWindow));
				_tmp14_ = online_accounts_caldav_dialog_new ();
				gtk_window_set_transient_for ((GtkWindow*) _tmp14_, _tmp13_);
				_g_object_unref0 (_tmp13_);
				g_object_ref_sink (_tmp14_);
				_data11_->caldav_dialog = _tmp14_;
				_tmp15_ = _data11_->caldav_dialog;
				_tmp16_ = _data8_->e_source;
				online_accounts_caldav_dialog_load_configuration (_tmp15_, _tmp16_, NULL, ______lambda47__gasync_ready_callback, block11_data_ref (_data11_));
				block11_data_unref (_data11_);
				_data11_ = NULL;
			}
		}
	}
}

static void
____lambda45__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	___lambda45_ (self);
}

static GtkWidget*
online_accounts_main_view_create_account_row (OnlineAccountsMainView* self,
                                              GObject* object)
{
	Block8Data* _data8_;
	ESource* _tmp0_;
	gchar* _tmp1_;
	ESource* _tmp2_;
	GtkLabel* label = NULL;
	ESource* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	GtkLabel* _tmp18_ = NULL;
	GtkLabel* _tmp19_;
	GtkImage* image = NULL;
	const gchar* _tmp20_;
	GtkImage* _tmp21_ = NULL;
	GtkImage* _tmp22_;
	GtkButton* remove_button = NULL;
	gchar* _tmp23_;
	GtkButton* _tmp24_ = NULL;
	GtkButton* _tmp25_;
	GtkButton* edit_button = NULL;
	gboolean _tmp26_ = FALSE;
	ESource* _tmp27_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp37_ = NULL;
	GtkGrid* _tmp38_;
	GtkImage* _tmp39_;
	GtkGrid* _tmp40_;
	GtkLabel* _tmp41_;
	GtkButton* _tmp42_;
	GtkButton* _tmp49_;
	GtkButton* _tmp50_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (object != NULL, NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, e_source_get_type (), ESource));
	_data8_->e_source = _tmp0_;
	_tmp1_ = g_strdup ("io.elementary.settings.onlineaccounts");
	_data8_->icon_name = _tmp1_;
	_tmp2_ = _data8_->e_source;
	if (e_source_has_extension (_tmp2_, E_SOURCE_EXTENSION_TASK_LIST)) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup ("onlineaccounts-tasks");
		_g_free0 (_data8_->icon_name);
		_data8_->icon_name = _tmp3_;
	} else {
		ESource* _tmp4_;
		_tmp4_ = _data8_->e_source;
		if (e_source_has_extension (_tmp4_, E_SOURCE_EXTENSION_CALENDAR)) {
			gchar* _tmp5_;
			_tmp5_ = g_strdup ("x-office-calendar");
			_g_free0 (_data8_->icon_name);
			_data8_->icon_name = _tmp5_;
		} else {
			ESource* _tmp6_;
			_tmp6_ = _data8_->e_source;
			if (e_source_has_extension (_tmp6_, E_SOURCE_EXTENSION_MAIL_ACCOUNT)) {
				gchar* _tmp7_;
				_tmp7_ = g_strdup ("onlineaccounts-mail");
				_g_free0 (_data8_->icon_name);
				_data8_->icon_name = _tmp7_;
			} else {
				ESource* _tmp8_;
				_tmp8_ = _data8_->e_source;
				if (e_source_has_extension (_tmp8_, E_SOURCE_EXTENSION_COLLECTION)) {
					ESourceCollection* collection_source = NULL;
					ESource* _tmp9_;
					ESourceExtension* _tmp10_;
					ESourceCollection* _tmp11_;
					const gchar* _tmp12_;
					const gchar* _tmp13_;
					gchar* _tmp14_;
					_tmp9_ = _data8_->e_source;
					_tmp10_ = e_source_get_extension (_tmp9_, E_SOURCE_EXTENSION_COLLECTION);
					collection_source = G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, e_source_collection_get_type (), ESourceCollection);
					_tmp11_ = collection_source;
					_tmp12_ = e_source_backend_get_backend_name ((ESourceBackend*) _tmp11_);
					_tmp13_ = _tmp12_;
					_tmp14_ = g_strdup_printf ("onlineaccounts-%s", _tmp13_);
					_g_free0 (_data8_->icon_name);
					_data8_->icon_name = _tmp14_;
				}
			}
		}
	}
	_tmp15_ = _data8_->e_source;
	_tmp16_ = e_source_get_display_name (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = (GtkLabel*) gtk_label_new (_tmp17_);
	gtk_widget_set_halign ((GtkWidget*) _tmp18_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp18_, TRUE);
	g_object_ref_sink (_tmp18_);
	label = _tmp18_;
	_tmp19_ = label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp19_, GRANITE_STYLE_CLASS_H3_LABEL);
	_tmp20_ = _data8_->icon_name;
	_tmp21_ = (GtkImage*) gtk_image_new_from_icon_name (_tmp20_);
	g_object_set (_tmp21_, "use-fallback", TRUE, NULL);
	g_object_ref_sink (_tmp21_);
	image = _tmp21_;
	_tmp22_ = image;
	gtk_widget_add_css_class ((GtkWidget*) _tmp22_, GRANITE_STYLE_CLASS_LARGE_ICONS);
	_tmp23_ = g_strdup (_ ("Remove this account"));
	_tmp24_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-delete-symbolic");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp24_, _tmp23_);
	_g_free0 (_tmp23_);
	g_object_ref_sink (_tmp24_);
	remove_button = _tmp24_;
	_tmp25_ = remove_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp25_, GRANITE_STYLE_CLASS_FLAT);
	edit_button = NULL;
	_tmp27_ = _data8_->e_source;
	if (e_source_has_extension (_tmp27_, E_SOURCE_EXTENSION_MAIL_ACCOUNT)) {
		_tmp26_ = TRUE;
	} else {
		gboolean _tmp28_ = FALSE;
		ESource* _tmp29_;
		_tmp29_ = _data8_->e_source;
		if (e_source_has_extension (_tmp29_, E_SOURCE_EXTENSION_COLLECTION)) {
			ESource* _tmp30_;
			ESourceExtension* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			_tmp30_ = _data8_->e_source;
			_tmp31_ = e_source_get_extension (_tmp30_, E_SOURCE_EXTENSION_COLLECTION);
			_tmp32_ = e_source_backend_get_backend_name ((ESourceBackend*) G_TYPE_CHECK_INSTANCE_CAST (_tmp31_, e_source_collection_get_type (), ESourceCollection));
			_tmp33_ = _tmp32_;
			_tmp28_ = g_strcmp0 ("webdav", _tmp33_) == 0;
		} else {
			_tmp28_ = FALSE;
		}
		_tmp26_ = _tmp28_;
	}
	if (_tmp26_) {
		gchar* _tmp34_;
		GtkButton* _tmp35_ = NULL;
		GtkButton* _tmp36_;
		_tmp34_ = g_strdup (_ ("Edit this account"));
		_tmp35_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-symbolic");
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp35_, _tmp34_);
		_g_free0 (_tmp34_);
		g_object_ref_sink (_tmp35_);
		_g_object_unref0 (edit_button);
		edit_button = _tmp35_;
		_tmp36_ = edit_button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp36_, GRANITE_STYLE_CLASS_FLAT);
	}
	_tmp37_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp37_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp37_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp37_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp37_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp37_, 6);
	g_object_ref_sink (_tmp37_);
	grid = _tmp37_;
	_tmp38_ = grid;
	_tmp39_ = image;
	gtk_grid_attach (_tmp38_, (GtkWidget*) _tmp39_, 0, 0, 1, 1);
	_tmp40_ = grid;
	_tmp41_ = label;
	gtk_grid_attach (_tmp40_, (GtkWidget*) _tmp41_, 1, 0, 1, 1);
	_tmp42_ = edit_button;
	if (_tmp42_ != NULL) {
		GtkGrid* _tmp43_;
		GtkButton* _tmp44_;
		GtkGrid* _tmp45_;
		GtkButton* _tmp46_;
		_tmp43_ = grid;
		_tmp44_ = edit_button;
		gtk_grid_attach (_tmp43_, (GtkWidget*) _tmp44_, 2, 0, 1, 1);
		_tmp45_ = grid;
		_tmp46_ = remove_button;
		gtk_grid_attach (_tmp45_, (GtkWidget*) _tmp46_, 3, 0, 1, 1);
	} else {
		GtkGrid* _tmp47_;
		GtkButton* _tmp48_;
		_tmp47_ = grid;
		_tmp48_ = remove_button;
		gtk_grid_attach (_tmp47_, (GtkWidget*) _tmp48_, 2, 0, 1, 1);
	}
	_tmp49_ = remove_button;
	g_signal_connect_data (_tmp49_, "clicked", (GCallback) ___lambda43__gtk_button_clicked, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp50_ = edit_button;
	if (_tmp50_ != NULL) {
		GtkButton* _tmp51_;
		_tmp51_ = edit_button;
		g_signal_connect_data (_tmp51_, "clicked", (GCallback) ____lambda45__gtk_button_clicked, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	}
	result = (GtkWidget*) grid;
	_g_object_unref0 (edit_button);
	_g_object_unref0 (remove_button);
	_g_object_unref0 (image);
	_g_object_unref0 (label);
	block8_data_unref (_data8_);
	_data8_ = NULL;
	return result;
}

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

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

static GtkWidget*
_online_accounts_main_view_create_account_row_gtk_list_box_create_widget_func (GObject* item,
                                                                               gpointer self)
{
	GtkWidget* result;
	result = online_accounts_main_view_create_account_row ((OnlineAccountsMainView*) self, item);
	return result;
}

static void
_online_accounts_main_view___lambda48_ (Block12Data* _data12_)
{
	OnlineAccountsMainView* self;
	GtkPopover* _tmp0_;
	OnlineAccountsCaldavDialog* caldav_dialog = NULL;
	GtkRoot* _tmp1_;
	GtkWindow* _tmp2_;
	OnlineAccountsCaldavDialog* _tmp3_ = NULL;
	OnlineAccountsCaldavDialog* _tmp4_;
	self = _data12_->self;
	_tmp0_ = _data12_->add_account_popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow));
	_tmp3_ = online_accounts_caldav_dialog_new ();
	gtk_window_set_transient_for ((GtkWindow*) _tmp3_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	caldav_dialog = _tmp3_;
	_tmp4_ = caldav_dialog;
	gtk_window_present ((GtkWindow*) _tmp4_);
	_g_object_unref0 (caldav_dialog);
}

static void
__online_accounts_main_view___lambda48__gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	_online_accounts_main_view___lambda48_ (self);
}

static void
_online_accounts_main_view___lambda49_ (Block12Data* _data12_)
{
	OnlineAccountsMainView* self;
	GtkPopover* _tmp0_;
	OnlineAccountsImapDialog* imap_dialog = NULL;
	GtkRoot* _tmp1_;
	GtkWindow* _tmp2_;
	OnlineAccountsImapDialog* _tmp3_ = NULL;
	OnlineAccountsImapDialog* _tmp4_;
	self = _data12_->self;
	_tmp0_ = _data12_->add_account_popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow));
	_tmp3_ = online_accounts_imap_dialog_new ();
	gtk_window_set_transient_for ((GtkWindow*) _tmp3_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	imap_dialog = _tmp3_;
	_tmp4_ = imap_dialog;
	gtk_window_present ((GtkWindow*) _tmp4_);
	_g_object_unref0 (imap_dialog);
}

static void
__online_accounts_main_view___lambda49__gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self)
{
	_online_accounts_main_view___lambda49_ (self);
}

static GObject *
online_accounts_main_view_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	OnlineAccountsMainView * self;
	Block12Data* _data12_;
	GranitePlaceholder* welcome = NULL;
	gchar* _tmp0_;
	GranitePlaceholder* _tmp1_ = NULL;
	GtkListBox* listbox = NULL;
	GtkListBox* _tmp2_;
	GtkListBox* _tmp3_;
	OnlineAccountsAccountsModel* _tmp4_;
	GListStore* _tmp5_;
	GListStore* _tmp6_;
	GtkListBox* _tmp7_;
	GranitePlaceholder* _tmp8_;
	GtkScrolledWindow* scroll = NULL;
	GtkListBox* _tmp9_;
	GtkWidget* _tmp10_;
	GtkScrolledWindow* _tmp11_ = NULL;
	OnlineAccountsAccountMenuItem* caldav_menuitem = NULL;
	OnlineAccountsAccountMenuItem* _tmp12_;
	OnlineAccountsAccountMenuItem* imap_menuitem = NULL;
	OnlineAccountsAccountMenuItem* _tmp13_;
	GtkBox* add_acount_box = NULL;
	GtkBox* _tmp14_ = NULL;
	GtkBox* _tmp15_;
	OnlineAccountsAccountMenuItem* _tmp16_;
	GtkBox* _tmp17_;
	OnlineAccountsAccountMenuItem* _tmp18_;
	GtkBox* _tmp19_;
	GtkWidget* _tmp20_;
	GtkPopover* _tmp21_ = NULL;
	GtkBox* add_button_content = NULL;
	GtkBox* _tmp22_;
	GtkBox* _tmp23_;
	GtkImage* _tmp24_;
	GtkImage* _tmp25_;
	GtkBox* _tmp26_;
	GtkLabel* _tmp27_;
	GtkLabel* _tmp28_;
	GtkMenuButton* add_button = NULL;
	GtkPopover* _tmp29_;
	GtkPopover* _tmp30_;
	GtkBox* _tmp31_;
	GtkWidget* _tmp32_;
	GtkMenuButton* _tmp33_ = NULL;
	GtkMenuButton* _tmp34_;
	GtkActionBar* action_bar = NULL;
	GtkActionBar* _tmp35_;
	GtkActionBar* _tmp36_;
	GtkActionBar* _tmp37_;
	GtkMenuButton* _tmp38_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp39_;
	GtkGrid* _tmp40_;
	GtkScrolledWindow* _tmp41_;
	GtkGrid* _tmp42_;
	GtkActionBar* _tmp43_;
	GtkFrame* frame = NULL;
	GtkGrid* _tmp44_;
	GtkWidget* _tmp45_;
	GtkFrame* _tmp46_ = NULL;
	GtkFrame* _tmp47_;
	OnlineAccountsAccountMenuItem* _tmp48_;
	OnlineAccountsAccountMenuItem* _tmp49_;
	parent_class = G_OBJECT_CLASS (online_accounts_main_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ONLINE_ACCOUNTS_TYPE_MAIN_VIEW, OnlineAccountsMainView);
	_data12_ = g_slice_new0 (Block12Data);
	_data12_->_ref_count_ = 1;
	_data12_->self = g_object_ref (self);
	_tmp0_ = g_strdup (_ ("Connect online accounts by clicking the icon in the toolbar below."));
	_tmp1_ = granite_placeholder_new (_ ("Connect Your Online Accounts"));
	granite_placeholder_set_description (_tmp1_, _tmp0_);
	_g_free0 (_tmp0_);
	g_object_ref_sink (_tmp1_);
	welcome = _tmp1_;
	_tmp2_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp2_);
	listbox = _tmp2_;
	_tmp3_ = listbox;
	_tmp4_ = online_accounts_main_view_accountsmodel;
	_tmp5_ = online_accounts_accounts_model_get_accounts_liststore (_tmp4_);
	_tmp6_ = _tmp5_;
	gtk_list_box_bind_model (_tmp3_, (GListModel*) _tmp6_, _online_accounts_main_view_create_account_row_gtk_list_box_create_widget_func, g_object_ref (self), g_object_unref);
	_tmp7_ = listbox;
	_tmp8_ = welcome;
	gtk_list_box_set_placeholder (_tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = listbox;
	_tmp10_ = _g_object_ref0 ((GtkWidget*) _tmp9_);
	_tmp11_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp11_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp11_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp11_, TRUE);
	gtk_scrolled_window_set_child (_tmp11_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	g_object_ref_sink (_tmp11_);
	scroll = _tmp11_;
	_tmp12_ = online_accounts_account_menu_item_new ("x-office-calendar", _ ("CalDAV"), _ ("Calendars and Tasks"));
	g_object_ref_sink (_tmp12_);
	caldav_menuitem = _tmp12_;
	_tmp13_ = online_accounts_account_menu_item_new ("onlineaccounts-mail", _ ("IMAP"), _ ("Mail"));
	g_object_ref_sink (_tmp13_);
	imap_menuitem = _tmp13_;
	_tmp14_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp14_, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp14_, 3);
	g_object_ref_sink (_tmp14_);
	add_acount_box = _tmp14_;
	_tmp15_ = add_acount_box;
	_tmp16_ = caldav_menuitem;
	gtk_box_append (_tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = add_acount_box;
	_tmp18_ = imap_menuitem;
	gtk_box_append (_tmp17_, (GtkWidget*) _tmp18_);
	_tmp19_ = add_acount_box;
	_tmp20_ = _g_object_ref0 ((GtkWidget*) _tmp19_);
	_tmp21_ = (GtkPopover*) gtk_popover_new ();
	gtk_popover_set_child (_tmp21_, _tmp20_);
	_g_object_unref0 (_tmp20_);
	g_object_ref_sink (_tmp21_);
	_data12_->add_account_popover = _tmp21_;
	_tmp22_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
	g_object_ref_sink (_tmp22_);
	add_button_content = _tmp22_;
	_tmp23_ = add_button_content;
	_tmp24_ = (GtkImage*) gtk_image_new_from_icon_name ("list-add-symbolic");
	g_object_ref_sink (_tmp24_);
	_tmp25_ = _tmp24_;
	gtk_box_append (_tmp23_, (GtkWidget*) _tmp25_);
	_g_object_unref0 (_tmp25_);
	_tmp26_ = add_button_content;
	_tmp27_ = (GtkLabel*) gtk_label_new (_ ("Add Account…"));
	g_object_ref_sink (_tmp27_);
	_tmp28_ = _tmp27_;
	gtk_box_append (_tmp26_, (GtkWidget*) _tmp28_);
	_g_object_unref0 (_tmp28_);
	_tmp29_ = _data12_->add_account_popover;
	_tmp30_ = _g_object_ref0 (_tmp29_);
	_tmp31_ = add_button_content;
	_tmp32_ = _g_object_ref0 ((GtkWidget*) _tmp31_);
	_tmp33_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_menu_button_set_popover (_tmp33_, _tmp30_);
	_g_object_unref0 (_tmp30_);
	gtk_menu_button_set_direction (_tmp33_, GTK_ARROW_UP);
	gtk_menu_button_set_has_frame (_tmp33_, FALSE);
	gtk_menu_button_set_child (_tmp33_, _tmp32_);
	_g_object_unref0 (_tmp32_);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp33_, 3);
	g_object_ref_sink (_tmp33_);
	add_button = _tmp33_;
	_tmp34_ = add_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp34_, GRANITE_STYLE_CLASS_FLAT);
	_tmp35_ = (GtkActionBar*) gtk_action_bar_new ();
	g_object_ref_sink (_tmp35_);
	action_bar = _tmp35_;
	_tmp36_ = action_bar;
	gtk_widget_add_css_class ((GtkWidget*) _tmp36_, GRANITE_STYLE_CLASS_FLAT);
	_tmp37_ = action_bar;
	_tmp38_ = add_button;
	gtk_action_bar_pack_start (_tmp37_, (GtkWidget*) _tmp38_);
	_tmp39_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp39_);
	grid = _tmp39_;
	_tmp40_ = grid;
	_tmp41_ = scroll;
	gtk_grid_attach (_tmp40_, (GtkWidget*) _tmp41_, 0, 0, 1, 1);
	_tmp42_ = grid;
	_tmp43_ = action_bar;
	gtk_grid_attach (_tmp42_, (GtkWidget*) _tmp43_, 0, 1, 1, 1);
	_tmp44_ = grid;
	_tmp45_ = _g_object_ref0 ((GtkWidget*) _tmp44_);
	_tmp46_ = (GtkFrame*) gtk_frame_new (NULL);
	gtk_frame_set_child (_tmp46_, _tmp45_);
	_g_object_unref0 (_tmp45_);
	g_object_ref_sink (_tmp46_);
	frame = _tmp46_;
	_tmp47_ = frame;
	switchboard_settings_page_set_child ((SwitchboardSettingsPage*) self, (GtkWidget*) _tmp47_);
	_tmp48_ = caldav_menuitem;
	g_signal_connect_data ((GtkButton*) _tmp48_, "clicked", (GCallback) __online_accounts_main_view___lambda48__gtk_button_clicked, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0);
	_tmp49_ = imap_menuitem;
	g_signal_connect_data ((GtkButton*) _tmp49_, "clicked", (GCallback) __online_accounts_main_view___lambda49__gtk_button_clicked, block12_data_ref (_data12_), (GClosureNotify) block12_data_unref, 0);
	_g_object_unref0 (frame);
	_g_object_unref0 (grid);
	_g_object_unref0 (action_bar);
	_g_object_unref0 (add_button);
	_g_object_unref0 (add_button_content);
	_g_object_unref0 (add_acount_box);
	_g_object_unref0 (imap_menuitem);
	_g_object_unref0 (caldav_menuitem);
	_g_object_unref0 (scroll);
	_g_object_unref0 (listbox);
	_g_object_unref0 (welcome);
	block12_data_unref (_data12_);
	_data12_ = NULL;
	return obj;
}

static void
online_accounts_main_view_class_init (OnlineAccountsMainViewClass * klass,
                                      gpointer klass_data)
{
	OnlineAccountsAccountsModel* _tmp0_;
	online_accounts_main_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = online_accounts_main_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = online_accounts_main_view_finalize;
	_tmp0_ = online_accounts_accounts_model_new ();
	_g_object_unref0 (online_accounts_main_view_accountsmodel);
	online_accounts_main_view_accountsmodel = _tmp0_;
}

static void
online_accounts_main_view_instance_init (OnlineAccountsMainView * self,
                                         gpointer klass)
{
}

static void
online_accounts_main_view_finalize (GObject * obj)
{
	OnlineAccountsMainView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ONLINE_ACCOUNTS_TYPE_MAIN_VIEW, OnlineAccountsMainView);
	G_OBJECT_CLASS (online_accounts_main_view_parent_class)->finalize (obj);
}

static GType
online_accounts_main_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OnlineAccountsMainViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) online_accounts_main_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OnlineAccountsMainView), 0, (GInstanceInitFunc) online_accounts_main_view_instance_init, NULL };
	GType online_accounts_main_view_type_id;
	online_accounts_main_view_type_id = g_type_register_static (SWITCHBOARD_TYPE_SETTINGS_PAGE, "OnlineAccountsMainView", &g_define_type_info, 0);
	return online_accounts_main_view_type_id;
}

GType
online_accounts_main_view_get_type (void)
{
	static volatile gsize online_accounts_main_view_type_id__once = 0;
	if (g_once_init_enter (&online_accounts_main_view_type_id__once)) {
		GType online_accounts_main_view_type_id;
		online_accounts_main_view_type_id = online_accounts_main_view_get_type_once ();
		g_once_init_leave (&online_accounts_main_view_type_id__once, online_accounts_main_view_type_id);
	}
	return online_accounts_main_view_type_id__once;
}

