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

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gstdio.h>
#include <adwaita.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>

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

typedef void (*DcSettingWriter) (GKeyFile* kf, gpointer user_data);

#define DC_TYPE_SETTINGS_MANAGER (dc_settings_manager_get_type ())
#define DC_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_SETTINGS_MANAGER, DcSettingsManager))
#define DC_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_SETTINGS_MANAGER, DcSettingsManagerClass))
#define DC_IS_SETTINGS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_SETTINGS_MANAGER))
#define DC_IS_SETTINGS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_SETTINGS_MANAGER))
#define DC_SETTINGS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_SETTINGS_MANAGER, DcSettingsManagerClass))

typedef struct _DcSettingsManager DcSettingsManager;
typedef struct _DcSettingsManagerClass DcSettingsManagerClass;
typedef struct _DcSettingsManagerPrivate DcSettingsManagerPrivate;
enum  {
	DC_SETTINGS_MANAGER_0_PROPERTY,
	DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY,
	DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY,
	DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY,
	DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY,
	DC_SETTINGS_MANAGER_NUM_PROPERTIES
};
static GParamSpec* dc_settings_manager_properties[DC_SETTINGS_MANAGER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
typedef struct _Block19Data Block19Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block20Data Block20Data;
typedef struct _Block21Data Block21Data;
typedef struct _Block22Data Block22Data;
typedef struct _Block23Data Block23Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define DC_TYPE_SETTINGS_DIALOG (dc_settings_dialog_get_type ())
#define DC_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_SETTINGS_DIALOG, DcSettingsDialog))
#define DC_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_SETTINGS_DIALOG, DcSettingsDialogClass))
#define DC_IS_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_SETTINGS_DIALOG))
#define DC_IS_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_SETTINGS_DIALOG))
#define DC_SETTINGS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_SETTINGS_DIALOG, DcSettingsDialogClass))

typedef struct _DcSettingsDialog DcSettingsDialog;
typedef struct _DcSettingsDialogClass DcSettingsDialogClass;
typedef struct _DcSettingsDialogPrivate DcSettingsDialogPrivate;

#define DC_TYPE_RPC_CLIENT (dc_rpc_client_get_type ())
#define DC_RPC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_RPC_CLIENT, DcRpcClient))
#define DC_RPC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_RPC_CLIENT, DcRpcClientClass))
#define DC_IS_RPC_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_RPC_CLIENT))
#define DC_IS_RPC_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_RPC_CLIENT))
#define DC_RPC_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_RPC_CLIENT, DcRpcClientClass))

typedef struct _DcRpcClient DcRpcClient;
typedef struct _DcRpcClientClass DcRpcClientClass;

#define DC_TYPE_WINDOW (dc_window_get_type ())
#define DC_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_WINDOW, DcWindow))
#define DC_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_WINDOW, DcWindowClass))
#define DC_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_WINDOW))
#define DC_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_WINDOW))
#define DC_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_WINDOW, DcWindowClass))

typedef struct _DcWindow DcWindow;
typedef struct _DcWindowClass DcWindowClass;
enum  {
	DC_SETTINGS_DIALOG_0_PROPERTY,
	DC_SETTINGS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* dc_settings_dialog_properties[DC_SETTINGS_DIALOG_NUM_PROPERTIES];
typedef struct _Block24Data Block24Data;
typedef struct _DcWindowPrivate DcWindowPrivate;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _Block25Data Block25Data;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
typedef struct _DcSettingsDialogLoadAccountsData DcSettingsDialogLoadAccountsData;
typedef struct _DcSettingsDialogDoSwitchAccountData DcSettingsDialogDoSwitchAccountData;
typedef struct _Block26Data Block26Data;
typedef struct _DcSettingsDialogDoAddAccountData DcSettingsDialogDoAddAccountData;
typedef struct _Block27Data Block27Data;
typedef void (*DcVoidFunc) (gpointer user_data);
typedef struct _DcSettingsDialogConfirmRemoveAccountData DcSettingsDialogConfirmRemoveAccountData;
typedef struct _DcSettingsDialogOnBrowseRpcServerData DcSettingsDialogOnBrowseRpcServerData;
typedef struct _DcSettingsDialogDoRemoveAccountData DcSettingsDialogDoRemoveAccountData;
enum  {
	DC_SETTINGS_DIALOG_ACCOUNT_CHANGED_SIGNAL,
	DC_SETTINGS_DIALOG_NUM_SIGNALS
};
static guint dc_settings_dialog_signals[DC_SETTINGS_DIALOG_NUM_SIGNALS] = {0};

struct _DcSettingsManager {
	GObject parent_instance;
	DcSettingsManagerPrivate * priv;
};

struct _DcSettingsManagerClass {
	GObjectClass parent_class;
};

struct _DcSettingsManagerPrivate {
	gint _double_click_action;
	gboolean _markdown_rendering;
	gboolean _shift_enter_sends;
	gboolean _notifications_enabled;
	gchar* _rpc_server_path;
};

struct _Block19Data {
	int _ref_count_;
	DcSettingsManager* self;
	gint v;
};

struct _Block20Data {
	int _ref_count_;
	DcSettingsManager* self;
	gboolean v;
};

struct _Block21Data {
	int _ref_count_;
	DcSettingsManager* self;
	gboolean v;
};

struct _Block22Data {
	int _ref_count_;
	DcSettingsManager* self;
	gboolean v;
};

struct _Block23Data {
	int _ref_count_;
	DcSettingsManager* self;
	gchar* v;
};

struct _DcSettingsDialog {
	AdwDialog parent_instance;
	DcSettingsDialogPrivate * priv;
};

struct _DcSettingsDialogClass {
	AdwDialogClass parent_class;
};

struct _DcSettingsDialogPrivate {
	DcRpcClient* rpc;
	GtkListBox* accounts_list;
	GtkBox* content;
	DcWindow* app_window;
	AdwActionRow* rpc_row;
	GtkSwitch* rpc_custom_switch;
};

struct _Block24Data {
	int _ref_count_;
	DcSettingsDialog* self;
	GtkDropDown* dblclick_combo;
	GtkSwitch* md_switch;
	GtkSwitch* shift_switch;
	GtkSwitch* notif_switch;
};

struct _DcWindow {
	AdwApplicationWindow parent_instance;
	DcWindowPrivate * priv;
	DcSettingsManager* settings;
};

struct _DcWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _Block25Data {
	int _ref_count_;
	DcSettingsDialog* self;
	gint acct_id;
	gchar* acct_label;
};

struct _DcSettingsDialogLoadAccountsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	GtkListBox* _tmp0_;
	JsonNode* accounts_node;
	DcRpcClient* _tmp1_;
	JsonNode* _tmp2_;
	JsonNode* _tmp3_;
	JsonArray* accounts;
	JsonNode* _tmp4_;
	JsonArray* _tmp5_;
	JsonArray* _tmp6_;
	guint i;
	gboolean _tmp7_;
	Block25Data* _data25_;
	guint _tmp8_;
	JsonArray* _tmp9_;
	JsonObject* acct;
	JsonArray* _tmp10_;
	JsonObject* _tmp11_;
	JsonObject* _tmp12_;
	gint id;
	JsonObject* _tmp13_;
	gboolean configured;
	DcRpcClient* _tmp14_;
	gchar* email;
	gchar* display_name;
	gchar* _tmp15_;
	DcRpcClient* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	DcRpcClient* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	AdwActionRow* action_row;
	AdwActionRow* _tmp23_;
	AdwActionRow* _tmp24_;
	gboolean _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	AdwActionRow* _tmp30_;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	AdwActionRow* _tmp36_;
	AdwActionRow* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	AdwActionRow* _tmp40_;
	AdwActionRow* _tmp41_;
	AdwActionRow* _tmp42_;
	DcRpcClient* _tmp43_;
	gint _tmp44_;
	gint _tmp45_;
	GtkLabel* badge;
	GtkLabel* _tmp46_;
	GtkLabel* _tmp47_;
	GtkLabel* _tmp48_;
	GtkLabel* _tmp49_;
	AdwActionRow* _tmp50_;
	GtkLabel* _tmp51_;
	GtkImage* switch_icon;
	GtkImage* _tmp52_;
	GtkImage* _tmp53_;
	GtkImage* _tmp54_;
	AdwActionRow* _tmp55_;
	GtkImage* _tmp56_;
	GtkButton* remove_btn;
	GtkButton* _tmp57_;
	GtkButton* _tmp58_;
	GtkButton* _tmp59_;
	GtkButton* _tmp60_;
	GtkButton* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	gchar* _tmp64_;
	GtkButton* _tmp65_;
	AdwActionRow* _tmp66_;
	GtkButton* _tmp67_;
	GtkListBox* _tmp68_;
	AdwActionRow* _tmp69_;
	JsonArray* _tmp70_;
	AdwActionRow* empty;
	AdwActionRow* _tmp71_;
	AdwActionRow* _tmp72_;
	AdwActionRow* _tmp73_;
	GtkListBox* _tmp74_;
	AdwActionRow* _tmp75_;
	GError* e;
	AdwActionRow* err_row;
	AdwActionRow* _tmp76_;
	AdwActionRow* _tmp77_;
	AdwActionRow* _tmp78_;
	AdwActionRow* _tmp79_;
	GError* _tmp80_;
	const gchar* _tmp81_;
	GtkListBox* _tmp82_;
	AdwActionRow* _tmp83_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogDoSwitchAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gint acct_id;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	DcRpcClient* _tmp3_;
	DcRpcClient* _tmp4_;
	DcRpcClient* _tmp5_;
	DcRpcClient* _tmp6_;
	GError* e;
	DcWindow* _tmp7_;
	GError* _tmp8_;
	const gchar* _tmp9_;
	GError* _inner_error0_;
};

struct _Block26Data {
	int _ref_count_;
	DcSettingsDialog* self;
	AdwAlertDialog* dialog;
	GtkEntry* email_entry;
	GtkPasswordEntry* pass_entry;
};

struct _DcSettingsDialogDoAddAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gchar* email;
	gchar* password;
	gint acct_id;
	DcRpcClient* _tmp0_;
	DcRpcClient* _tmp1_;
	DcRpcClient* _tmp2_;
	DcRpcClient* _tmp3_;
	DcRpcClient* _tmp4_;
	GError* e;
	DcWindow* _tmp5_;
	GError* _tmp6_;
	const gchar* _tmp7_;
	GError* _inner_error0_;
};

struct _Block27Data {
	int _ref_count_;
	DcSettingsDialog* self;
	gint acct_id;
	gpointer _async_data_;
};

struct _DcSettingsDialogConfirmRemoveAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gint acct_id;
	gchar* label;
	Block27Data* _data27_;
	DcWindow* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
};

struct _DcSettingsDialogOnBrowseRpcServerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	GtkFileDialog* dlg;
	GtkFileDialog* _tmp0_;
	GtkFileDialog* _tmp1_;
	GtkFileDialog* _tmp2_;
	gchar* start;
	DcWindow* _tmp3_;
	DcSettingsManager* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	GtkFileDialog* _tmp18_;
	const gchar* _tmp19_;
	GFile* _tmp20_;
	GFile* _tmp21_;
	GFile* file;
	GtkFileDialog* _tmp22_;
	DcWindow* _tmp23_;
	GFile* _tmp24_;
	gchar* path;
	gchar* _tmp25_;
	gboolean _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	DcWindow* _tmp29_;
	DcSettingsManager* _tmp30_;
	const gchar* _tmp31_;
	DcWindow* _tmp32_;
	DcWindow* _tmp33_;
	GError* e;
	gboolean _tmp34_;
	GError* _tmp35_;
	GError* _tmp36_;
	DcWindow* _tmp37_;
	GError* _tmp38_;
	const gchar* _tmp39_;
	GtkSwitch* _tmp40_;
	DcWindow* _tmp41_;
	DcSettingsManager* _tmp42_;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	gint _tmp45_;
	gint _tmp46_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogDoRemoveAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gint acct_id;
	DcRpcClient* _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	DcRpcClient* _tmp4_;
	GError* e;
	DcWindow* _tmp5_;
	GError* _tmp6_;
	const gchar* _tmp7_;
	GError* _inner_error0_;
};

static gint DcSettingsManager_private_offset;
static gpointer dc_settings_manager_parent_class = NULL;
VALA_EXTERN gboolean dc_markdown_enabled;
static gint DcSettingsDialog_private_offset;
static gpointer dc_settings_dialog_parent_class = NULL;

VALA_EXTERN GType dc_settings_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsManager, g_object_unref)
VALA_EXTERN gchar* dc_settings_manager_get_config_path (void);
VALA_EXTERN void dc_settings_manager_load (DcSettingsManager* self);
static gint dc_settings_manager_kf_int (GKeyFile* kf,
                                 const gchar* k,
                                 gint d);
VALA_EXTERN void dc_settings_manager_set_double_click_action (DcSettingsManager* self,
                                                  gint value);
static gboolean dc_settings_manager_kf_bool (GKeyFile* kf,
                                      const gchar* k,
                                      gboolean d);
VALA_EXTERN void dc_settings_manager_set_markdown_rendering (DcSettingsManager* self,
                                                 gboolean value);
VALA_EXTERN gboolean dc_settings_manager_get_markdown_rendering (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_set_shift_enter_sends (DcSettingsManager* self,
                                                gboolean value);
VALA_EXTERN void dc_settings_manager_set_notifications_enabled (DcSettingsManager* self,
                                                    gboolean value);
static gchar* dc_settings_manager_kf_str (GKeyFile* kf,
                                   const gchar* k,
                                   const gchar* d);
VALA_EXTERN void dc_settings_manager_set_rpc_server_path (DcSettingsManager* self,
                                              const gchar* value);
VALA_EXTERN void dc_settings_manager_save_double_click_action (DcSettingsManager* self,
                                                   gint v);
static Block19Data* block19_data_ref (Block19Data* _data19_);
static void block19_data_unref (void * _userdata_);
VALA_EXTERN void dc_settings_manager_save_to_file (DcSettingsManager* self,
                                       DcSettingWriter writer,
                                       gpointer writer_target);
static void __lambda7_ (Block19Data* _data19_,
                 GKeyFile* kf);
static void ___lambda7__dc_setting_writer (GKeyFile* kf,
                                    gpointer self);
VALA_EXTERN void dc_settings_manager_save_markdown_rendering (DcSettingsManager* self,
                                                  gboolean v);
static Block20Data* block20_data_ref (Block20Data* _data20_);
static void block20_data_unref (void * _userdata_);
static void __lambda8_ (Block20Data* _data20_,
                 GKeyFile* kf);
static void ___lambda8__dc_setting_writer (GKeyFile* kf,
                                    gpointer self);
VALA_EXTERN void dc_settings_manager_save_shift_enter_sends (DcSettingsManager* self,
                                                 gboolean v);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static void __lambda9_ (Block21Data* _data21_,
                 GKeyFile* kf);
static void ___lambda9__dc_setting_writer (GKeyFile* kf,
                                    gpointer self);
VALA_EXTERN void dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                     gboolean v);
static Block22Data* block22_data_ref (Block22Data* _data22_);
static void block22_data_unref (void * _userdata_);
static void __lambda10_ (Block22Data* _data22_,
                  GKeyFile* kf);
static void ___lambda10__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                               const gchar* v);
static Block23Data* block23_data_ref (Block23Data* _data23_);
static void block23_data_unref (void * _userdata_);
static void __lambda11_ (Block23Data* _data23_,
                  GKeyFile* kf);
static void ___lambda11__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN DcSettingsManager* dc_settings_manager_new (void);
VALA_EXTERN DcSettingsManager* dc_settings_manager_construct (GType object_type);
VALA_EXTERN gint dc_settings_manager_get_double_click_action (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_shift_enter_sends (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_notifications_enabled (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_rpc_server_path (DcSettingsManager* self);
static void dc_settings_manager_finalize (GObject * obj);
static GType dc_settings_manager_get_type_once (void);
static void _vala_dc_settings_manager_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_dc_settings_manager_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
VALA_EXTERN GType dc_settings_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsDialog, g_object_unref)
VALA_EXTERN GType dc_rpc_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcClient, g_object_unref)
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
VALA_EXTERN DcSettingsDialog* dc_settings_dialog_new (DcRpcClient* rpc,
                                          DcWindow* window);
VALA_EXTERN DcSettingsDialog* dc_settings_dialog_construct (GType object_type,
                                                DcRpcClient* rpc,
                                                DcWindow* window);
static Block24Data* block24_data_ref (Block24Data* _data24_);
static void block24_data_unref (void * _userdata_);
static void dc_settings_dialog_on_row_activated (DcSettingsDialog* self,
                                          GtkListBoxRow* row);
static void _dc_settings_dialog_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                      GtkListBoxRow* row,
                                                                      gpointer self);
static void dc_settings_dialog_on_add_account (DcSettingsDialog* self);
static void _dc_settings_dialog_on_add_account_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self);
static void __lambda101_ (Block24Data* _data24_);
static void ___lambda101__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda102_ (Block24Data* _data24_);
static void ___lambda102__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda103_ (Block24Data* _data24_);
static void ___lambda103__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda104_ (Block24Data* _data24_);
static void ___lambda104__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda105_ (DcSettingsDialog* self);
static void dc_settings_dialog_on_browse_rpc_server (DcSettingsDialog* self,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static void dc_settings_dialog_on_browse_rpc_server_finish (DcSettingsDialog* self,
                                                     GAsyncResult* _res_);
static void ___lambda105__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dc_settings_dialog_on_rpc_switch_toggled (DcSettingsDialog* self);
static void _dc_settings_dialog_on_rpc_switch_toggled_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self);
static void dc_settings_dialog_update_rpc_row (DcSettingsDialog* self);
static void dc_settings_dialog_on_reset_settings (DcSettingsDialog* self);
static void _dc_settings_dialog_on_reset_settings_gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self);
static void dc_settings_dialog_load_accounts (DcSettingsDialog* self,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
static void dc_settings_dialog_load_accounts_finish (DcSettingsDialog* self,
                                              GAsyncResult* _res_);
static void dc_settings_dialog_load_accounts_data_free (gpointer _data);
static gboolean dc_settings_dialog_load_accounts_co (DcSettingsDialogLoadAccountsData* _data_);
VALA_EXTERN void dc_clear_listbox (GtkListBox* lb);
VALA_EXTERN void dc_rpc_client_get_all_accounts (DcRpcClient* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN JsonNode* dc_rpc_client_get_all_accounts_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void dc_settings_dialog_load_accounts_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static void _vala_JsonNode_free (JsonNode* self);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
VALA_EXTERN void dc_rpc_client_is_configured (DcRpcClient* self,
                                  gint acct_id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN gboolean dc_rpc_client_is_configured_finish (DcRpcClient* self,
                                             GAsyncResult* _res_,
                                             GError** error);
VALA_EXTERN void dc_rpc_client_get_config (DcRpcClient* self,
                               const gchar* key,
                               gint acct_id,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_client_get_config_finish (DcRpcClient* self,
                                        GAsyncResult* _res_,
                                        GError** error);
VALA_EXTERN gint dc_rpc_client_get_account_id (DcRpcClient* self);
static void ______lambda97_ (Block25Data* _data25_);
static void dc_settings_dialog_confirm_remove_account (DcSettingsDialog* self,
                                                gint acct_id,
                                                const gchar* label,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_settings_dialog_confirm_remove_account_finish (DcSettingsDialog* self,
                                                       GAsyncResult* _res_);
static void _______lambda97__gtk_button_clicked (GtkButton* _sender,
                                          gpointer self);
static void dc_settings_dialog_do_switch_account (DcSettingsDialog* self,
                                           gint acct_id,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void dc_settings_dialog_do_switch_account_finish (DcSettingsDialog* self,
                                                  GAsyncResult* _res_);
static void dc_settings_dialog_do_switch_account_data_free (gpointer _data);
static gboolean dc_settings_dialog_do_switch_account_co (DcSettingsDialogDoSwitchAccountData* _data_);
VALA_EXTERN void dc_rpc_client_stop_io (DcRpcClient* self,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_stop_io_finish (DcRpcClient* self,
                                   GAsyncResult* _res_,
                                   GError** error);
static void dc_settings_dialog_do_switch_account_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_select_account (DcRpcClient* self,
                                   gint acct_id,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_select_account_finish (DcRpcClient* self,
                                          GAsyncResult* _res_,
                                          GError** error);
VALA_EXTERN void dc_rpc_client_start_io (DcRpcClient* self,
                             gint acct_id,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_start_io_finish (DcRpcClient* self,
                                    GAsyncResult* _res_,
                                    GError** error);
VALA_EXTERN void dc_rpc_client_set_account_id (DcRpcClient* self,
                                   gint value);
VALA_EXTERN void dc_show_error (GtkWidget* parent,
                    const gchar* message);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
static void __lambda99_ (Block26Data* _data26_);
static void ___lambda99__gtk_password_entry_activate (GtkPasswordEntry* _sender,
                                               gpointer self);
static void __lambda100_ (Block26Data* _data26_,
                   const gchar* resp);
static void dc_settings_dialog_do_add_account (DcSettingsDialog* self,
                                        const gchar* email,
                                        const gchar* password,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static void dc_settings_dialog_do_add_account_finish (DcSettingsDialog* self,
                                               GAsyncResult* _res_);
static void ___lambda100__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                              const gchar* response,
                                              gpointer self);
static void dc_settings_dialog_do_add_account_data_free (gpointer _data);
static gboolean dc_settings_dialog_do_add_account_co (DcSettingsDialogDoAddAccountData* _data_);
VALA_EXTERN void dc_rpc_client_add_account (DcRpcClient* self,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_add_account_finish (DcRpcClient* self,
                                       GAsyncResult* _res_,
                                       GError** error);
static void dc_settings_dialog_do_add_account_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_add_or_update_transport (DcRpcClient* self,
                                            gint acct_id,
                                            const gchar* email,
                                            const gchar* password,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_add_or_update_transport_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static void dc_settings_dialog_confirm_remove_account_data_free (gpointer _data);
static gboolean dc_settings_dialog_confirm_remove_account_co (DcSettingsDialogConfirmRemoveAccountData* _data_);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
VALA_EXTERN void dc_confirm_action (GtkWidget* parent,
                        const gchar* title,
                        const gchar* body,
                        const gchar* action_id,
                        const gchar* action_label,
                        DcVoidFunc on_confirm,
                        gpointer on_confirm_target,
                        GDestroyNotify on_confirm_target_destroy_notify);
static void __lambda98_ (Block27Data* _data27_);
static void dc_settings_dialog_do_remove_account (DcSettingsDialog* self,
                                           gint acct_id,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void dc_settings_dialog_do_remove_account_finish (DcSettingsDialog* self,
                                                  GAsyncResult* _res_);
static void ___lambda98__dc_void_func (gpointer self);
VALA_EXTERN gchar* dc_account_finder_find_rpc_server (const gchar* override_path);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
static void dc_settings_dialog_on_browse_rpc_server_data_free (gpointer _data);
static gboolean dc_settings_dialog_on_browse_rpc_server_co (DcSettingsDialogOnBrowseRpcServerData* _data_);
static void dc_settings_dialog_on_browse_rpc_server_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void dc_settings_dialog_do_remove_account_data_free (gpointer _data);
static gboolean dc_settings_dialog_do_remove_account_co (DcSettingsDialogDoRemoveAccountData* _data_);
VALA_EXTERN void dc_rpc_client_remove_account (DcRpcClient* self,
                                   gint acct_id,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_remove_account_finish (DcRpcClient* self,
                                          GAsyncResult* _res_,
                                          GError** error);
static void dc_settings_dialog_do_remove_account_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void __lambda106_ (DcSettingsDialog* self);
static void dc_settings_dialog_delete_parla_config (void);
static void ___lambda106__dc_void_func (gpointer self);
static void dc_settings_dialog_finalize (GObject * obj);
static GType dc_settings_dialog_get_type_once (void);
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
dc_settings_manager_get_instance_private (DcSettingsManager* self)
{
	return G_STRUCT_MEMBER_P (self, DcSettingsManager_private_offset);
}

gchar*
dc_settings_manager_get_config_path (void)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	_tmp0_ = g_get_user_config_dir ();
	_tmp1_ = g_build_filename (_tmp0_, "parla", "settings.ini", NULL);
	result = _tmp1_;
	return result;
}

void
dc_settings_manager_load (DcSettingsManager* self)
{
	GKeyFile* kf = NULL;
	GKeyFile* _tmp0_;
	gboolean _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_key_file_new ();
	kf = _tmp0_;
	{
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = dc_settings_manager_get_config_path ();
		_tmp2_ = _tmp1_;
		g_key_file_load_from_file (kf, _tmp2_, G_KEY_FILE_NONE, &_inner_error0_);
		_g_free0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		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;
	}
	dc_settings_manager_set_double_click_action (self, dc_settings_manager_kf_int (kf, "double_click_action", 0));
	dc_settings_manager_set_markdown_rendering (self, dc_settings_manager_kf_bool (kf, "markdown_rendering", FALSE));
	_tmp3_ = self->priv->_markdown_rendering;
	dc_markdown_enabled = _tmp3_;
	dc_settings_manager_set_shift_enter_sends (self, dc_settings_manager_kf_bool (kf, "shift_enter_sends", FALSE));
	dc_settings_manager_set_notifications_enabled (self, dc_settings_manager_kf_bool (kf, "notifications_enabled", TRUE));
	_tmp4_ = dc_settings_manager_kf_str (kf, "rpc_server_path", "");
	_tmp5_ = _tmp4_;
	dc_settings_manager_set_rpc_server_path (self, _tmp5_);
	_g_free0 (_tmp5_);
	_g_key_file_unref0 (kf);
}

static gint
dc_settings_manager_kf_int (GKeyFile* kf,
                            const gchar* k,
                            gint d)
{
	gint _tmp1_ = -1;
	GError* _inner_error0_ = NULL;
	gint result;
	g_return_val_if_fail (kf != NULL, -1);
	g_return_val_if_fail (k != NULL, -1);
	{
		gint _tmp0_ = 0;
		_tmp0_ = g_key_file_get_integer (kf, "General", k, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		result = _tmp0_;
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		result = d;
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp1_;
}

static gboolean
dc_settings_manager_kf_bool (GKeyFile* kf,
                             const gchar* k,
                             gboolean d)
{
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (kf != NULL, FALSE);
	g_return_val_if_fail (k != NULL, FALSE);
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = g_key_file_get_boolean (kf, "General", k, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		result = _tmp0_;
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		result = d;
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp1_;
}

static gchar*
dc_settings_manager_kf_str (GKeyFile* kf,
                            const gchar* k,
                            const gchar* d)
{
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (kf != NULL, NULL);
	g_return_val_if_fail (k != NULL, NULL);
	g_return_val_if_fail (d != NULL, NULL);
	{
		gchar* _tmp0_ = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = g_key_file_get_string (kf, "General", k, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		result = _tmp2_;
		_g_free0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		gchar* _tmp3_;
		g_clear_error (&_inner_error0_);
		_tmp3_ = g_strdup (d);
		result = _tmp3_;
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

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

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

static void
__lambda7_ (Block19Data* _data19_,
            GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data19_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_integer (kf, "General", "double_click_action", _data19_->v);
}

static void
___lambda7__dc_setting_writer (GKeyFile* kf,
                               gpointer self)
{
	__lambda7_ (self, kf);
}

void
dc_settings_manager_save_double_click_action (DcSettingsManager* self,
                                              gint v)
{
	Block19Data* _data19_;
	g_return_if_fail (self != NULL);
	_data19_ = g_slice_new0 (Block19Data);
	_data19_->_ref_count_ = 1;
	_data19_->self = g_object_ref (self);
	_data19_->v = v;
	dc_settings_manager_set_double_click_action (self, _data19_->v);
	dc_settings_manager_save_to_file (self, ___lambda7__dc_setting_writer, _data19_);
	block19_data_unref (_data19_);
	_data19_ = NULL;
}

static Block20Data*
block20_data_ref (Block20Data* _data20_)
{
	g_atomic_int_inc (&_data20_->_ref_count_);
	return _data20_;
}

static void
block20_data_unref (void * _userdata_)
{
	Block20Data* _data20_;
	_data20_ = (Block20Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data20_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data20_->self;
		_g_object_unref0 (self);
		g_slice_free (Block20Data, _data20_);
	}
}

static void
__lambda8_ (Block20Data* _data20_,
            GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data20_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_boolean (kf, "General", "markdown_rendering", _data20_->v);
}

static void
___lambda8__dc_setting_writer (GKeyFile* kf,
                               gpointer self)
{
	__lambda8_ (self, kf);
}

void
dc_settings_manager_save_markdown_rendering (DcSettingsManager* self,
                                             gboolean v)
{
	Block20Data* _data20_;
	g_return_if_fail (self != NULL);
	_data20_ = g_slice_new0 (Block20Data);
	_data20_->_ref_count_ = 1;
	_data20_->self = g_object_ref (self);
	_data20_->v = v;
	dc_settings_manager_set_markdown_rendering (self, _data20_->v);
	dc_markdown_enabled = _data20_->v;
	dc_settings_manager_save_to_file (self, ___lambda8__dc_setting_writer, _data20_);
	block20_data_unref (_data20_);
	_data20_ = NULL;
}

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data21_->self;
		_g_object_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

static void
__lambda9_ (Block21Data* _data21_,
            GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data21_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_boolean (kf, "General", "shift_enter_sends", _data21_->v);
}

static void
___lambda9__dc_setting_writer (GKeyFile* kf,
                               gpointer self)
{
	__lambda9_ (self, kf);
}

void
dc_settings_manager_save_shift_enter_sends (DcSettingsManager* self,
                                            gboolean v)
{
	Block21Data* _data21_;
	g_return_if_fail (self != NULL);
	_data21_ = g_slice_new0 (Block21Data);
	_data21_->_ref_count_ = 1;
	_data21_->self = g_object_ref (self);
	_data21_->v = v;
	dc_settings_manager_set_shift_enter_sends (self, _data21_->v);
	dc_settings_manager_save_to_file (self, ___lambda9__dc_setting_writer, _data21_);
	block21_data_unref (_data21_);
	_data21_ = NULL;
}

static Block22Data*
block22_data_ref (Block22Data* _data22_)
{
	g_atomic_int_inc (&_data22_->_ref_count_);
	return _data22_;
}

static void
block22_data_unref (void * _userdata_)
{
	Block22Data* _data22_;
	_data22_ = (Block22Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data22_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data22_->self;
		_g_object_unref0 (self);
		g_slice_free (Block22Data, _data22_);
	}
}

static void
__lambda10_ (Block22Data* _data22_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data22_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_boolean (kf, "General", "notifications_enabled", _data22_->v);
}

static void
___lambda10__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda10_ (self, kf);
}

void
dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                gboolean v)
{
	Block22Data* _data22_;
	g_return_if_fail (self != NULL);
	_data22_ = g_slice_new0 (Block22Data);
	_data22_->_ref_count_ = 1;
	_data22_->self = g_object_ref (self);
	_data22_->v = v;
	dc_settings_manager_set_notifications_enabled (self, _data22_->v);
	dc_settings_manager_save_to_file (self, ___lambda10__dc_setting_writer, _data22_);
	block22_data_unref (_data22_);
	_data22_ = NULL;
}

static Block23Data*
block23_data_ref (Block23Data* _data23_)
{
	g_atomic_int_inc (&_data23_->_ref_count_);
	return _data23_;
}

static void
block23_data_unref (void * _userdata_)
{
	Block23Data* _data23_;
	_data23_ = (Block23Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data23_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data23_->self;
		_g_free0 (_data23_->v);
		_g_object_unref0 (self);
		g_slice_free (Block23Data, _data23_);
	}
}

static void
__lambda11_ (Block23Data* _data23_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data23_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_string (kf, "General", "rpc_server_path", _data23_->v);
}

static void
___lambda11__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda11_ (self, kf);
}

void
dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                          const gchar* v)
{
	Block23Data* _data23_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data23_ = g_slice_new0 (Block23Data);
	_data23_->_ref_count_ = 1;
	_data23_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data23_->v);
	_data23_->v = _tmp0_;
	dc_settings_manager_set_rpc_server_path (self, _data23_->v);
	dc_settings_manager_save_to_file (self, ___lambda11__dc_setting_writer, _data23_);
	block23_data_unref (_data23_);
	_data23_ = NULL;
}

void
dc_settings_manager_save_to_file (DcSettingsManager* self,
                                  DcSettingWriter writer,
                                  gpointer writer_target)
{
	GKeyFile* kf = NULL;
	GKeyFile* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_key_file_new ();
	kf = _tmp0_;
	{
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = dc_settings_manager_get_config_path ();
		_tmp2_ = _tmp1_;
		g_key_file_load_from_file (kf, _tmp2_, G_KEY_FILE_NONE, &_inner_error0_);
		_g_free0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		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;
	}
	writer (kf, writer_target);
	{
		gchar* dir = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp3_ = dc_settings_manager_get_config_path ();
		_tmp4_ = _tmp3_;
		_tmp5_ = g_path_get_dirname (_tmp4_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		dir = _tmp6_;
		g_mkdir_with_parents (dir, 0755);
		_tmp7_ = dc_settings_manager_get_config_path ();
		_tmp8_ = _tmp7_;
		g_key_file_save_to_file (kf, _tmp8_, &_inner_error0_);
		_g_free0 (_tmp8_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (dir);
			goto __catch1_g_error;
		}
		_g_free0 (dir);
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		GError* _tmp9_;
		const gchar* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp9_ = e;
		_tmp10_ = _tmp9_->message;
		g_warning ("settings_dialog.vala:79: Failed to save settings: %s", _tmp10_);
		_g_error_free0 (e);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_key_file_unref0 (kf);
}

DcSettingsManager*
dc_settings_manager_construct (GType object_type)
{
	DcSettingsManager * self = NULL;
	self = (DcSettingsManager*) g_object_new (object_type, NULL);
	return self;
}

DcSettingsManager*
dc_settings_manager_new (void)
{
	return dc_settings_manager_construct (DC_TYPE_SETTINGS_MANAGER);
}

gint
dc_settings_manager_get_double_click_action (DcSettingsManager* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_double_click_action;
	return result;
}

void
dc_settings_manager_set_double_click_action (DcSettingsManager* self,
                                             gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_double_click_action (self);
	if (old_value != value) {
		self->priv->_double_click_action = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY]);
	}
}

gboolean
dc_settings_manager_get_markdown_rendering (DcSettingsManager* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_markdown_rendering;
	return result;
}

void
dc_settings_manager_set_markdown_rendering (DcSettingsManager* self,
                                            gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_markdown_rendering (self);
	if (old_value != value) {
		self->priv->_markdown_rendering = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY]);
	}
}

gboolean
dc_settings_manager_get_shift_enter_sends (DcSettingsManager* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_shift_enter_sends;
	return result;
}

void
dc_settings_manager_set_shift_enter_sends (DcSettingsManager* self,
                                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_shift_enter_sends (self);
	if (old_value != value) {
		self->priv->_shift_enter_sends = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY]);
	}
}

gboolean
dc_settings_manager_get_notifications_enabled (DcSettingsManager* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_notifications_enabled;
	return result;
}

void
dc_settings_manager_set_notifications_enabled (DcSettingsManager* self,
                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_notifications_enabled (self);
	if (old_value != value) {
		self->priv->_notifications_enabled = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY]);
	}
}

const gchar*
dc_settings_manager_get_rpc_server_path (DcSettingsManager* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_rpc_server_path;
	result = _tmp0_;
	return result;
}

void
dc_settings_manager_set_rpc_server_path (DcSettingsManager* self,
                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_rpc_server_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_rpc_server_path);
		self->priv->_rpc_server_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY]);
	}
}

static void
dc_settings_manager_class_init (DcSettingsManagerClass * klass,
                                gpointer klass_data)
{
	dc_settings_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcSettingsManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_settings_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_settings_manager_set_property;
	G_OBJECT_CLASS (klass)->finalize = dc_settings_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY] = g_param_spec_int ("double-click-action", "double-click-action", "double-click-action", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY] = g_param_spec_boolean ("markdown-rendering", "markdown-rendering", "markdown-rendering", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY] = g_param_spec_boolean ("shift-enter-sends", "shift-enter-sends", "shift-enter-sends", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY] = g_param_spec_boolean ("notifications-enabled", "notifications-enabled", "notifications-enabled", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY] = g_param_spec_string ("rpc-server-path", "rpc-server-path", "rpc-server-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
dc_settings_manager_instance_init (DcSettingsManager * self,
                                   gpointer klass)
{
	gchar* _tmp0_;
	self->priv = dc_settings_manager_get_instance_private (self);
	self->priv->_double_click_action = 0;
	self->priv->_markdown_rendering = FALSE;
	self->priv->_shift_enter_sends = FALSE;
	self->priv->_notifications_enabled = TRUE;
	_tmp0_ = g_strdup ("");
	self->priv->_rpc_server_path = _tmp0_;
}

static void
dc_settings_manager_finalize (GObject * obj)
{
	DcSettingsManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_SETTINGS_MANAGER, DcSettingsManager);
	_g_free0 (self->priv->_rpc_server_path);
	G_OBJECT_CLASS (dc_settings_manager_parent_class)->finalize (obj);
}

static GType
dc_settings_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcSettingsManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_settings_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcSettingsManager), 0, (GInstanceInitFunc) dc_settings_manager_instance_init, NULL };
	GType dc_settings_manager_type_id;
	dc_settings_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "DcSettingsManager", &g_define_type_info, 0);
	DcSettingsManager_private_offset = g_type_add_instance_private (dc_settings_manager_type_id, sizeof (DcSettingsManagerPrivate));
	return dc_settings_manager_type_id;
}

GType
dc_settings_manager_get_type (void)
{
	static volatile gsize dc_settings_manager_type_id__once = 0;
	if (g_once_init_enter (&dc_settings_manager_type_id__once)) {
		GType dc_settings_manager_type_id;
		dc_settings_manager_type_id = dc_settings_manager_get_type_once ();
		g_once_init_leave (&dc_settings_manager_type_id__once, dc_settings_manager_type_id);
	}
	return dc_settings_manager_type_id__once;
}

static void
_vala_dc_settings_manager_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	DcSettingsManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_SETTINGS_MANAGER, DcSettingsManager);
	switch (property_id) {
		case DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY:
		g_value_set_int (value, dc_settings_manager_get_double_click_action (self));
		break;
		case DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_markdown_rendering (self));
		break;
		case DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_shift_enter_sends (self));
		break;
		case DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_notifications_enabled (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_rpc_server_path (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_settings_manager_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	DcSettingsManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_SETTINGS_MANAGER, DcSettingsManager);
	switch (property_id) {
		case DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY:
		dc_settings_manager_set_double_click_action (self, g_value_get_int (value));
		break;
		case DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY:
		dc_settings_manager_set_markdown_rendering (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY:
		dc_settings_manager_set_shift_enter_sends (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY:
		dc_settings_manager_set_notifications_enabled (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY:
		dc_settings_manager_set_rpc_server_path (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
dc_settings_dialog_get_instance_private (DcSettingsDialog* self)
{
	return G_STRUCT_MEMBER_P (self, DcSettingsDialog_private_offset);
}

static Block24Data*
block24_data_ref (Block24Data* _data24_)
{
	g_atomic_int_inc (&_data24_->_ref_count_);
	return _data24_;
}

static void
block24_data_unref (void * _userdata_)
{
	Block24Data* _data24_;
	_data24_ = (Block24Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data24_->self;
		_g_object_unref0 (_data24_->notif_switch);
		_g_object_unref0 (_data24_->shift_switch);
		_g_object_unref0 (_data24_->md_switch);
		_g_object_unref0 (_data24_->dblclick_combo);
		_g_object_unref0 (self);
		g_slice_free (Block24Data, _data24_);
	}
}

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

static void
_dc_settings_dialog_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                 GtkListBoxRow* row,
                                                                 gpointer self)
{
	dc_settings_dialog_on_row_activated ((DcSettingsDialog*) self, row);
}

static void
_dc_settings_dialog_on_add_account_gtk_button_clicked (GtkButton* _sender,
                                                       gpointer self)
{
	dc_settings_dialog_on_add_account ((DcSettingsDialog*) self);
}

static void
__lambda101_ (Block24Data* _data24_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	self = _data24_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_drop_down_get_selected (_data24_->dblclick_combo);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_double_click_action (_tmp1_, (gint) _tmp3_);
}

static void
___lambda101__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda101_ (self);
}

static void
__lambda102_ (Block24Data* _data24_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data24_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_switch_get_active (_data24_->md_switch);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_markdown_rendering (_tmp1_, _tmp3_);
}

static void
___lambda102__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda102_ (self);
}

static void
__lambda103_ (Block24Data* _data24_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data24_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_switch_get_active (_data24_->shift_switch);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_shift_enter_sends (_tmp1_, _tmp3_);
}

static void
___lambda103__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda103_ (self);
}

static void
__lambda104_ (Block24Data* _data24_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data24_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_switch_get_active (_data24_->notif_switch);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_notifications_enabled (_tmp1_, _tmp3_);
}

static void
___lambda104__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda104_ (self);
}

static void
__lambda105_ (DcSettingsDialog* self)
{
	dc_settings_dialog_on_browse_rpc_server (self, NULL, NULL);
}

static void
___lambda105__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda105_ ((DcSettingsDialog*) self);
}

static void
_dc_settings_dialog_on_rpc_switch_toggled_g_object_notify (GObject* _sender,
                                                           GParamSpec* pspec,
                                                           gpointer self)
{
	dc_settings_dialog_on_rpc_switch_toggled ((DcSettingsDialog*) self);
}

static void
_dc_settings_dialog_on_reset_settings_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self)
{
	dc_settings_dialog_on_reset_settings ((DcSettingsDialog*) self);
}

DcSettingsDialog*
dc_settings_dialog_construct (GType object_type,
                              DcRpcClient* rpc,
                              DcWindow* window)
{
	DcSettingsDialog * self = NULL;
	Block24Data* _data24_;
	DcRpcClient* _tmp0_;
	GtkBox* box = NULL;
	GtkBox* _tmp1_;
	AdwHeaderBar* header = NULL;
	AdwHeaderBar* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	GtkBox* _tmp7_;
	GtkLabel* accounts_label = NULL;
	GtkLabel* _tmp8_;
	GtkBox* _tmp9_;
	GtkListBox* _tmp10_;
	GtkListBox* _tmp11_;
	GtkListBox* _tmp12_;
	GtkListBox* _tmp13_;
	GtkBox* _tmp14_;
	GtkListBox* _tmp15_;
	GtkButton* add_btn = NULL;
	GtkButton* _tmp16_;
	GtkBox* _tmp17_;
	GtkLabel* behavior_label = NULL;
	GtkLabel* _tmp18_;
	GtkBox* _tmp19_;
	GtkListBox* behavior_list = NULL;
	GtkListBox* _tmp20_;
	AdwActionRow* dblclick_row = NULL;
	AdwActionRow* _tmp21_;
	gchar** dblclick_labels = NULL;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar** _tmp27_;
	gint dblclick_labels_length1;
	gint _dblclick_labels_size_;
	GtkDropDown* _tmp28_;
	DcWindow* _tmp29_;
	DcSettingsManager* _tmp30_;
	gint _tmp31_;
	gint _tmp32_;
	AdwActionRow* md_row = NULL;
	AdwActionRow* _tmp33_;
	GtkSwitch* _tmp34_;
	AdwActionRow* shift_row = NULL;
	AdwActionRow* _tmp35_;
	GtkSwitch* _tmp36_;
	DcWindow* _tmp37_;
	DcSettingsManager* _tmp38_;
	gboolean _tmp39_;
	gboolean _tmp40_;
	AdwActionRow* notif_row = NULL;
	AdwActionRow* _tmp41_;
	GtkSwitch* _tmp42_;
	DcWindow* _tmp43_;
	DcSettingsManager* _tmp44_;
	gboolean _tmp45_;
	gboolean _tmp46_;
	GtkBox* _tmp47_;
	GtkLabel* advanced_label = NULL;
	GtkLabel* _tmp48_;
	GtkBox* _tmp49_;
	GtkListBox* advanced_list = NULL;
	GtkListBox* _tmp50_;
	AdwActionRow* _tmp51_;
	AdwActionRow* _tmp52_;
	GtkButton* rpc_choose_btn = NULL;
	GtkButton* _tmp53_;
	AdwActionRow* _tmp54_;
	GtkSwitch* _tmp55_;
	GtkSwitch* _tmp56_;
	GtkSwitch* _tmp57_;
	GtkSwitch* _tmp58_;
	DcWindow* _tmp59_;
	DcSettingsManager* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	gint _tmp63_;
	gint _tmp64_;
	GtkSwitch* _tmp65_;
	GtkSwitch* _tmp66_;
	AdwActionRow* _tmp67_;
	GtkSwitch* _tmp68_;
	AdwActionRow* _tmp69_;
	GtkBox* _tmp70_;
	GtkBox* reset_box = NULL;
	GtkBox* _tmp71_;
	GtkButton* reset_btn = NULL;
	GtkButton* _tmp72_;
	GtkLabel* reset_label = NULL;
	GtkLabel* _tmp73_;
	GtkBox* _tmp74_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp75_;
	GtkBox* _tmp76_;
	g_return_val_if_fail (rpc != NULL, NULL);
	g_return_val_if_fail (window != NULL, NULL);
	_data24_ = g_slice_new0 (Block24Data);
	_data24_->_ref_count_ = 1;
	self = (DcSettingsDialog*) g_object_new (object_type, NULL);
	_data24_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (rpc);
	_g_object_unref0 (self->priv->rpc);
	self->priv->rpc = _tmp0_;
	self->priv->app_window = window;
	adw_dialog_set_title ((AdwDialog*) self, "Settings");
	adw_dialog_set_content_width ((AdwDialog*) self, 400);
	adw_dialog_set_content_height ((AdwDialog*) self, 480);
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp1_);
	box = _tmp1_;
	_tmp2_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp2_);
	header = _tmp2_;
	adw_header_bar_set_show_end_title_buttons (header, TRUE);
	gtk_box_append (box, (GtkWidget*) header);
	_tmp3_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 16);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->content);
	self->priv->content = _tmp3_;
	_tmp4_ = self->priv->content;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp4_, 16);
	_tmp5_ = self->priv->content;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp5_, 16);
	_tmp6_ = self->priv->content;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp6_, 12);
	_tmp7_ = self->priv->content;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp7_, 16);
	_tmp8_ = (GtkLabel*) gtk_label_new ("Accounts");
	g_object_ref_sink (_tmp8_);
	accounts_label = _tmp8_;
	gtk_widget_add_css_class ((GtkWidget*) accounts_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) accounts_label, GTK_ALIGN_START);
	_tmp9_ = self->priv->content;
	gtk_box_append (_tmp9_, (GtkWidget*) accounts_label);
	_tmp10_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->accounts_list);
	self->priv->accounts_list = _tmp10_;
	_tmp11_ = self->priv->accounts_list;
	gtk_list_box_set_selection_mode (_tmp11_, GTK_SELECTION_NONE);
	_tmp12_ = self->priv->accounts_list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp12_, "boxed-list");
	_tmp13_ = self->priv->accounts_list;
	g_signal_connect_object (_tmp13_, "row-activated", (GCallback) _dc_settings_dialog_on_row_activated_gtk_list_box_row_activated, self, 0);
	_tmp14_ = self->priv->content;
	_tmp15_ = self->priv->accounts_list;
	gtk_box_append (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = (GtkButton*) gtk_button_new_with_label ("Add Account");
	g_object_ref_sink (_tmp16_);
	add_btn = _tmp16_;
	gtk_widget_add_css_class ((GtkWidget*) add_btn, "suggested-action");
	gtk_widget_set_halign ((GtkWidget*) add_btn, GTK_ALIGN_START);
	g_signal_connect_object (add_btn, "clicked", (GCallback) _dc_settings_dialog_on_add_account_gtk_button_clicked, self, 0);
	_tmp17_ = self->priv->content;
	gtk_box_append (_tmp17_, (GtkWidget*) add_btn);
	_tmp18_ = (GtkLabel*) gtk_label_new ("Behavior");
	g_object_ref_sink (_tmp18_);
	behavior_label = _tmp18_;
	gtk_widget_add_css_class ((GtkWidget*) behavior_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) behavior_label, GTK_ALIGN_START);
	_tmp19_ = self->priv->content;
	gtk_box_append (_tmp19_, (GtkWidget*) behavior_label);
	_tmp20_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp20_);
	behavior_list = _tmp20_;
	gtk_list_box_set_selection_mode (behavior_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) behavior_list, "boxed-list");
	_tmp21_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp21_);
	dblclick_row = _tmp21_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) dblclick_row, "Double-click on message");
	adw_action_row_set_subtitle (dblclick_row, "Action when a message is double-clicked");
	_tmp22_ = g_strdup ("Reply to message");
	_tmp23_ = g_strdup ("React with ❤️");
	_tmp24_ = g_strdup ("React with 👍");
	_tmp25_ = g_strdup ("Open user profile");
	_tmp26_ = g_strdup ("Do nothing");
	_tmp27_ = g_new0 (gchar*, 5 + 1);
	_tmp27_[0] = _tmp22_;
	_tmp27_[1] = _tmp23_;
	_tmp27_[2] = _tmp24_;
	_tmp27_[3] = _tmp25_;
	_tmp27_[4] = _tmp26_;
	dblclick_labels = _tmp27_;
	dblclick_labels_length1 = 5;
	_dblclick_labels_size_ = dblclick_labels_length1;
	_tmp28_ = (GtkDropDown*) gtk_drop_down_new_from_strings (dblclick_labels);
	g_object_ref_sink (_tmp28_);
	_data24_->dblclick_combo = _tmp28_;
	_tmp29_ = self->priv->app_window;
	_tmp30_ = _tmp29_->settings;
	_tmp31_ = dc_settings_manager_get_double_click_action (_tmp30_);
	_tmp32_ = _tmp31_;
	gtk_drop_down_set_selected (_data24_->dblclick_combo, (guint) _tmp32_);
	gtk_widget_set_valign ((GtkWidget*) _data24_->dblclick_combo, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data24_->dblclick_combo, "notify::selected", (GCallback) ___lambda101__g_object_notify, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
	adw_action_row_add_suffix (dblclick_row, (GtkWidget*) _data24_->dblclick_combo);
	adw_action_row_set_activatable_widget (dblclick_row, (GtkWidget*) _data24_->dblclick_combo);
	gtk_list_box_append (behavior_list, (GtkWidget*) dblclick_row);
	_tmp33_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp33_);
	md_row = _tmp33_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) md_row, "Markdown rendering");
	adw_action_row_set_subtitle (md_row, "Format bold, italic, code and headings");
	_tmp34_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp34_);
	_data24_->md_switch = _tmp34_;
	gtk_switch_set_active (_data24_->md_switch, dc_markdown_enabled);
	gtk_widget_set_valign ((GtkWidget*) _data24_->md_switch, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data24_->md_switch, "notify::active", (GCallback) ___lambda102__g_object_notify, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
	adw_action_row_add_suffix (md_row, (GtkWidget*) _data24_->md_switch);
	adw_action_row_set_activatable_widget (md_row, (GtkWidget*) _data24_->md_switch);
	gtk_list_box_append (behavior_list, (GtkWidget*) md_row);
	_tmp35_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp35_);
	shift_row = _tmp35_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) shift_row, "Shift+Return sends message");
	adw_action_row_set_subtitle (shift_row, "When on, Return inserts a newline and Shift+Return sends");
	_tmp36_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp36_);
	_data24_->shift_switch = _tmp36_;
	_tmp37_ = self->priv->app_window;
	_tmp38_ = _tmp37_->settings;
	_tmp39_ = dc_settings_manager_get_shift_enter_sends (_tmp38_);
	_tmp40_ = _tmp39_;
	gtk_switch_set_active (_data24_->shift_switch, _tmp40_);
	gtk_widget_set_valign ((GtkWidget*) _data24_->shift_switch, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data24_->shift_switch, "notify::active", (GCallback) ___lambda103__g_object_notify, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
	adw_action_row_add_suffix (shift_row, (GtkWidget*) _data24_->shift_switch);
	adw_action_row_set_activatable_widget (shift_row, (GtkWidget*) _data24_->shift_switch);
	gtk_list_box_append (behavior_list, (GtkWidget*) shift_row);
	_tmp41_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp41_);
	notif_row = _tmp41_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) notif_row, "Desktop notifications");
	adw_action_row_set_subtitle (notif_row, "Notify on incoming messages when the window is not focused");
	_tmp42_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp42_);
	_data24_->notif_switch = _tmp42_;
	_tmp43_ = self->priv->app_window;
	_tmp44_ = _tmp43_->settings;
	_tmp45_ = dc_settings_manager_get_notifications_enabled (_tmp44_);
	_tmp46_ = _tmp45_;
	gtk_switch_set_active (_data24_->notif_switch, _tmp46_);
	gtk_widget_set_valign ((GtkWidget*) _data24_->notif_switch, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data24_->notif_switch, "notify::active", (GCallback) ___lambda104__g_object_notify, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
	adw_action_row_add_suffix (notif_row, (GtkWidget*) _data24_->notif_switch);
	adw_action_row_set_activatable_widget (notif_row, (GtkWidget*) _data24_->notif_switch);
	gtk_list_box_append (behavior_list, (GtkWidget*) notif_row);
	_tmp47_ = self->priv->content;
	gtk_box_append (_tmp47_, (GtkWidget*) behavior_list);
	_tmp48_ = (GtkLabel*) gtk_label_new ("Advanced");
	g_object_ref_sink (_tmp48_);
	advanced_label = _tmp48_;
	gtk_widget_add_css_class ((GtkWidget*) advanced_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) advanced_label, GTK_ALIGN_START);
	_tmp49_ = self->priv->content;
	gtk_box_append (_tmp49_, (GtkWidget*) advanced_label);
	_tmp50_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp50_);
	advanced_list = _tmp50_;
	gtk_list_box_set_selection_mode (advanced_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) advanced_list, "boxed-list");
	_tmp51_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp51_);
	_g_object_unref0 (self->priv->rpc_row);
	self->priv->rpc_row = _tmp51_;
	_tmp52_ = self->priv->rpc_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp52_, "deltachat-rpc-server");
	_tmp53_ = (GtkButton*) gtk_button_new_with_label ("Choose…");
	g_object_ref_sink (_tmp53_);
	rpc_choose_btn = _tmp53_;
	gtk_widget_set_valign ((GtkWidget*) rpc_choose_btn, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) rpc_choose_btn, "flat");
	gtk_widget_set_tooltip_text ((GtkWidget*) rpc_choose_btn, "Pick a deltachat-rpc-server binary");
	g_signal_connect_object (rpc_choose_btn, "clicked", (GCallback) ___lambda105__gtk_button_clicked, self, 0);
	_tmp54_ = self->priv->rpc_row;
	adw_action_row_add_suffix (_tmp54_, (GtkWidget*) rpc_choose_btn);
	_tmp55_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp55_);
	_g_object_unref0 (self->priv->rpc_custom_switch);
	self->priv->rpc_custom_switch = _tmp55_;
	_tmp56_ = self->priv->rpc_custom_switch;
	gtk_widget_set_valign ((GtkWidget*) _tmp56_, GTK_ALIGN_CENTER);
	_tmp57_ = self->priv->rpc_custom_switch;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp57_, "Use a custom deltachat-rpc-server binary");
	_tmp58_ = self->priv->rpc_custom_switch;
	_tmp59_ = self->priv->app_window;
	_tmp60_ = _tmp59_->settings;
	_tmp61_ = dc_settings_manager_get_rpc_server_path (_tmp60_);
	_tmp62_ = _tmp61_;
	_tmp63_ = strlen (_tmp62_);
	_tmp64_ = _tmp63_;
	gtk_switch_set_active (_tmp58_, _tmp64_ > 0);
	_tmp65_ = self->priv->rpc_custom_switch;
	g_signal_connect_object ((GObject*) _tmp65_, "notify::active", (GCallback) _dc_settings_dialog_on_rpc_switch_toggled_g_object_notify, self, 0);
	_tmp66_ = self->priv->rpc_custom_switch;
	g_object_bind_property_with_closures ((GObject*) _tmp66_, "active", (GObject*) rpc_choose_btn, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp67_ = self->priv->rpc_row;
	_tmp68_ = self->priv->rpc_custom_switch;
	adw_action_row_add_suffix (_tmp67_, (GtkWidget*) _tmp68_);
	_tmp69_ = self->priv->rpc_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp69_);
	_tmp70_ = self->priv->content;
	gtk_box_append (_tmp70_, (GtkWidget*) advanced_list);
	dc_settings_dialog_update_rpc_row (self);
	_tmp71_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp71_);
	reset_box = _tmp71_;
	gtk_widget_set_margin_top ((GtkWidget*) reset_box, 8);
	_tmp72_ = (GtkButton*) gtk_button_new_with_label ("Factory Reset");
	g_object_ref_sink (_tmp72_);
	reset_btn = _tmp72_;
	gtk_widget_add_css_class ((GtkWidget*) reset_btn, "destructive-action");
	gtk_widget_set_tooltip_text ((GtkWidget*) reset_btn, "Delete all Parla configuration and start fresh");
	g_signal_connect_object (reset_btn, "clicked", (GCallback) _dc_settings_dialog_on_reset_settings_gtk_button_clicked, self, 0);
	gtk_box_append (reset_box, (GtkWidget*) reset_btn);
	_tmp73_ = (GtkLabel*) gtk_label_new ("Remove all settings and close the app");
	g_object_ref_sink (_tmp73_);
	reset_label = _tmp73_;
	gtk_widget_add_css_class ((GtkWidget*) reset_label, "dim-label");
	gtk_widget_set_valign ((GtkWidget*) reset_label, GTK_ALIGN_CENTER);
	gtk_box_append (reset_box, (GtkWidget*) reset_label);
	_tmp74_ = self->priv->content;
	gtk_box_append (_tmp74_, (GtkWidget*) reset_box);
	_tmp75_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp75_);
	scroll = _tmp75_;
	gtk_widget_set_vexpand ((GtkWidget*) scroll, TRUE);
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp76_ = self->priv->content;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp76_);
	gtk_box_append (box, (GtkWidget*) scroll);
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) box);
	dc_settings_dialog_load_accounts (self, NULL, NULL);
	_g_object_unref0 (scroll);
	_g_object_unref0 (reset_label);
	_g_object_unref0 (reset_btn);
	_g_object_unref0 (reset_box);
	_g_object_unref0 (rpc_choose_btn);
	_g_object_unref0 (advanced_list);
	_g_object_unref0 (advanced_label);
	_g_object_unref0 (notif_row);
	_g_object_unref0 (shift_row);
	_g_object_unref0 (md_row);
	dblclick_labels = (_vala_array_free (dblclick_labels, dblclick_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (dblclick_row);
	_g_object_unref0 (behavior_list);
	_g_object_unref0 (behavior_label);
	_g_object_unref0 (add_btn);
	_g_object_unref0 (accounts_label);
	_g_object_unref0 (header);
	_g_object_unref0 (box);
	block24_data_unref (_data24_);
	_data24_ = NULL;
	return self;
}

DcSettingsDialog*
dc_settings_dialog_new (DcRpcClient* rpc,
                        DcWindow* window)
{
	return dc_settings_dialog_construct (DC_TYPE_SETTINGS_DIALOG, rpc, window);
}

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

static void
dc_settings_dialog_load_accounts (DcSettingsDialog* self,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	DcSettingsDialogLoadAccountsData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogLoadAccountsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_load_accounts_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_load_accounts_co (_data_);
}

static void
dc_settings_dialog_load_accounts_finish (DcSettingsDialog* self,
                                         GAsyncResult* _res_)
{
	DcSettingsDialogLoadAccountsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_settings_dialog_load_accounts_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	DcSettingsDialogLoadAccountsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_load_accounts_co (_data_);
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static gpointer
_json_array_ref0 (gpointer self)
{
	return self ? json_array_ref (self) : NULL;
}

static Block25Data*
block25_data_ref (Block25Data* _data25_)
{
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}

static void
block25_data_unref (void * _userdata_)
{
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data25_->self;
		_g_free0 (_data25_->acct_label);
		_g_object_unref0 (self);
		g_slice_free (Block25Data, _data25_);
	}
}

static gpointer
_json_object_ref0 (gpointer self)
{
	return self ? json_object_ref (self) : NULL;
}

static void
______lambda97_ (Block25Data* _data25_)
{
	DcSettingsDialog* self;
	const gchar* _tmp0_;
	self = _data25_->self;
	_tmp0_ = _data25_->acct_label;
	dc_settings_dialog_confirm_remove_account (self, _data25_->acct_id, _tmp0_, NULL, NULL);
}

static void
_______lambda97__gtk_button_clicked (GtkButton* _sender,
                                     gpointer self)
{
	______lambda97_ (self);
}

static gboolean
dc_settings_dialog_load_accounts_co (DcSettingsDialogLoadAccountsData* _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:
	_data_->_tmp0_ = _data_->self->priv->accounts_list;
	dc_clear_listbox (_data_->_tmp0_);
	{
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_all_accounts (_data_->_tmp1_, dc_settings_dialog_load_accounts_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = dc_rpc_client_get_all_accounts_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->accounts_node = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->accounts_node;
		if (_data_->_tmp3_ == NULL) {
			__vala_JsonNode_free0 (_data_->accounts_node);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp4_ = _data_->accounts_node;
		_data_->_tmp5_ = json_node_get_array (_data_->_tmp4_);
		_data_->_tmp6_ = _json_array_ref0 (_data_->_tmp5_);
		_data_->accounts = _data_->_tmp6_;
		{
			_data_->i = (guint) 0;
			{
				_data_->_tmp7_ = TRUE;
				while (TRUE) {
					_data_->_data25_ = g_slice_new0 (Block25Data);
					_data_->_data25_->_ref_count_ = 1;
					_data_->_data25_->self = g_object_ref (_data_->self);
					if (!_data_->_tmp7_) {
						_data_->_tmp8_ = _data_->i;
						_data_->i = _data_->_tmp8_ + 1;
					}
					_data_->_tmp7_ = FALSE;
					_data_->_tmp9_ = _data_->accounts;
					if (!(_data_->i < json_array_get_length (_data_->_tmp9_))) {
						block25_data_unref (_data_->_data25_);
						_data_->_data25_ = NULL;
						break;
					}
					_data_->_tmp10_ = _data_->accounts;
					_data_->_tmp11_ = json_array_get_object_element (_data_->_tmp10_, _data_->i);
					_data_->_tmp12_ = _json_object_ref0 (_data_->_tmp11_);
					_data_->acct = _data_->_tmp12_;
					_data_->_tmp13_ = _data_->acct;
					_data_->id = (gint) json_object_get_int_member (_data_->_tmp13_, "id");
					_data_->_tmp14_ = _data_->self->priv->rpc;
					_data_->_state_ = 2;
					dc_rpc_client_is_configured (_data_->_tmp14_, _data_->id, dc_settings_dialog_load_accounts_ready, _data_);
					return FALSE;
					_state_2:
					_data_->configured = dc_rpc_client_is_configured_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_json_object_unref0 (_data_->acct);
						block25_data_unref (_data_->_data25_);
						_data_->_data25_ = NULL;
						_json_array_unref0 (_data_->accounts);
						__vala_JsonNode_free0 (_data_->accounts_node);
						goto __catch0_g_error;
					}
					_data_->email = NULL;
					_data_->display_name = NULL;
					if (_data_->configured) {
						{
							_data_->_tmp16_ = _data_->self->priv->rpc;
							_data_->_state_ = 3;
							dc_rpc_client_get_config (_data_->_tmp16_, "addr", _data_->id, dc_settings_dialog_load_accounts_ready, _data_);
							return FALSE;
							_state_3:
							_data_->_tmp17_ = dc_rpc_client_get_config_finish (_data_->_tmp16_, _data_->_res_, &_data_->_inner_error0_);
							_data_->_tmp15_ = _data_->_tmp17_;
							if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
								goto __catch1_g_error;
							}
							_data_->_tmp18_ = _data_->_tmp15_;
							_data_->_tmp15_ = NULL;
							_g_free0 (_data_->email);
							_data_->email = _data_->_tmp18_;
							_data_->_tmp20_ = _data_->self->priv->rpc;
							_data_->_state_ = 4;
							dc_rpc_client_get_config (_data_->_tmp20_, "displayname", _data_->id, dc_settings_dialog_load_accounts_ready, _data_);
							return FALSE;
							_state_4:
							_data_->_tmp21_ = dc_rpc_client_get_config_finish (_data_->_tmp20_, _data_->_res_, &_data_->_inner_error0_);
							_data_->_tmp19_ = _data_->_tmp21_;
							if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
								_g_free0 (_data_->_tmp15_);
								goto __catch1_g_error;
							}
							_data_->_tmp22_ = _data_->_tmp19_;
							_data_->_tmp19_ = NULL;
							_g_free0 (_data_->display_name);
							_data_->display_name = _data_->_tmp22_;
							_g_free0 (_data_->_tmp19_);
							_g_free0 (_data_->_tmp15_);
						}
						goto __finally1;
						__catch1_g_error:
						{
							g_clear_error (&_data_->_inner_error0_);
						}
						__finally1:
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							_g_free0 (_data_->display_name);
							_g_free0 (_data_->email);
							_json_object_unref0 (_data_->acct);
							block25_data_unref (_data_->_data25_);
							_data_->_data25_ = NULL;
							_json_array_unref0 (_data_->accounts);
							__vala_JsonNode_free0 (_data_->accounts_node);
							goto __catch0_g_error;
						}
					}
					_data_->_tmp23_ = (AdwActionRow*) adw_action_row_new ();
					g_object_ref_sink (_data_->_tmp23_);
					_data_->action_row = _data_->_tmp23_;
					_data_->_tmp24_ = _data_->action_row;
					adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _data_->_tmp24_, FALSE);
					_data_->_tmp26_ = _data_->display_name;
					if (_data_->_tmp26_ != NULL) {
						_data_->_tmp27_ = _data_->display_name;
						_data_->_tmp28_ = strlen (_data_->_tmp27_);
						_data_->_tmp29_ = _data_->_tmp28_;
						_data_->_tmp25_ = _data_->_tmp29_ > 0;
					} else {
						_data_->_tmp25_ = FALSE;
					}
					if (_data_->_tmp25_) {
						_data_->_tmp30_ = _data_->action_row;
						_data_->_tmp31_ = _data_->display_name;
						adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp30_, _data_->_tmp31_);
					} else {
						if (_data_->configured) {
							_data_->_tmp33_ = _data_->email;
							_data_->_tmp34_ = g_strdup (_data_->_tmp33_);
							_data_->_tmp32_ = _data_->_tmp34_;
							if (_data_->_tmp32_ == NULL) {
								_data_->_tmp35_ = g_strdup_printf ("Account #%d", _data_->id);
								_g_free0 (_data_->_tmp32_);
								_data_->_tmp32_ = _data_->_tmp35_;
							}
							_data_->_tmp36_ = _data_->action_row;
							adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp36_, _data_->_tmp32_);
							_g_free0 (_data_->_tmp32_);
						} else {
							_data_->_tmp37_ = _data_->action_row;
							adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp37_, "Unconfigured account");
						}
					}
					_data_->_tmp39_ = _data_->email;
					_data_->_tmp38_ = _data_->_tmp39_;
					if (_data_->_tmp38_ == NULL) {
						_data_->_tmp38_ = "";
					}
					_data_->_tmp40_ = _data_->action_row;
					adw_action_row_set_subtitle (_data_->_tmp40_, _data_->_tmp38_);
					_data_->_tmp41_ = _data_->action_row;
					gtk_list_box_row_set_activatable ((GtkListBoxRow*) _data_->_tmp41_, TRUE);
					_data_->_data25_->acct_id = _data_->id;
					_data_->_tmp42_ = _data_->action_row;
					g_object_set_data_full ((GObject*) _data_->_tmp42_, "acct-id", (gpointer) ((gintptr) _data_->_data25_->acct_id), NULL);
					_data_->_tmp43_ = _data_->self->priv->rpc;
					_data_->_tmp44_ = dc_rpc_client_get_account_id (_data_->_tmp43_);
					_data_->_tmp45_ = _data_->_tmp44_;
					if (_data_->id == _data_->_tmp45_) {
						_data_->_tmp46_ = (GtkLabel*) gtk_label_new ("Active");
						g_object_ref_sink (_data_->_tmp46_);
						_data_->badge = _data_->_tmp46_;
						_data_->_tmp47_ = _data_->badge;
						gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp47_, "accent");
						_data_->_tmp48_ = _data_->badge;
						gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp48_, "caption");
						_data_->_tmp49_ = _data_->badge;
						gtk_widget_set_valign ((GtkWidget*) _data_->_tmp49_, GTK_ALIGN_CENTER);
						_data_->_tmp50_ = _data_->action_row;
						_data_->_tmp51_ = _data_->badge;
						adw_action_row_add_suffix (_data_->_tmp50_, (GtkWidget*) _data_->_tmp51_);
						_g_object_unref0 (_data_->badge);
					} else {
						if (_data_->configured) {
							_data_->_tmp52_ = (GtkImage*) gtk_image_new_from_icon_name ("go-next-symbolic");
							g_object_ref_sink (_data_->_tmp52_);
							_data_->switch_icon = _data_->_tmp52_;
							_data_->_tmp53_ = _data_->switch_icon;
							gtk_widget_set_valign ((GtkWidget*) _data_->_tmp53_, GTK_ALIGN_CENTER);
							_data_->_tmp54_ = _data_->switch_icon;
							gtk_widget_set_opacity ((GtkWidget*) _data_->_tmp54_, 0.5);
							_data_->_tmp55_ = _data_->action_row;
							_data_->_tmp56_ = _data_->switch_icon;
							adw_action_row_add_suffix (_data_->_tmp55_, (GtkWidget*) _data_->_tmp56_);
							_g_object_unref0 (_data_->switch_icon);
						}
					}
					_data_->_tmp57_ = (GtkButton*) gtk_button_new_from_icon_name ("user-trash-symbolic");
					g_object_ref_sink (_data_->_tmp57_);
					_data_->remove_btn = _data_->_tmp57_;
					_data_->_tmp58_ = _data_->remove_btn;
					gtk_widget_set_valign ((GtkWidget*) _data_->_tmp58_, GTK_ALIGN_CENTER);
					_data_->_tmp59_ = _data_->remove_btn;
					gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp59_, "flat");
					_data_->_tmp60_ = _data_->remove_btn;
					gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp60_, "error");
					_data_->_tmp61_ = _data_->remove_btn;
					gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp61_, "Remove account");
					_data_->_tmp63_ = _data_->email;
					_data_->_tmp62_ = _data_->_tmp63_;
					if (_data_->_tmp62_ == NULL) {
						_data_->_tmp62_ = "this account";
					}
					_data_->_tmp64_ = g_strdup (_data_->_tmp62_);
					_data_->_data25_->acct_label = _data_->_tmp64_;
					_data_->_tmp65_ = _data_->remove_btn;
					g_signal_connect_data (_data_->_tmp65_, "clicked", (GCallback) _______lambda97__gtk_button_clicked, block25_data_ref (_data_->_data25_), (GClosureNotify) block25_data_unref, 0);
					_data_->_tmp66_ = _data_->action_row;
					_data_->_tmp67_ = _data_->remove_btn;
					adw_action_row_add_suffix (_data_->_tmp66_, (GtkWidget*) _data_->_tmp67_);
					_data_->_tmp68_ = _data_->self->priv->accounts_list;
					_data_->_tmp69_ = _data_->action_row;
					gtk_list_box_append (_data_->_tmp68_, (GtkWidget*) _data_->_tmp69_);
					_g_object_unref0 (_data_->remove_btn);
					_g_object_unref0 (_data_->action_row);
					_g_free0 (_data_->display_name);
					_g_free0 (_data_->email);
					_json_object_unref0 (_data_->acct);
					block25_data_unref (_data_->_data25_);
					_data_->_data25_ = NULL;
				}
			}
		}
		_data_->_tmp70_ = _data_->accounts;
		if (json_array_get_length (_data_->_tmp70_) == ((guint) 0)) {
			_data_->_tmp71_ = (AdwActionRow*) adw_action_row_new ();
			g_object_ref_sink (_data_->_tmp71_);
			_data_->empty = _data_->_tmp71_;
			_data_->_tmp72_ = _data_->empty;
			adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp72_, "No accounts");
			_data_->_tmp73_ = _data_->empty;
			adw_action_row_set_subtitle (_data_->_tmp73_, "Add an account to get started");
			_data_->_tmp74_ = _data_->self->priv->accounts_list;
			_data_->_tmp75_ = _data_->empty;
			gtk_list_box_append (_data_->_tmp74_, (GtkWidget*) _data_->_tmp75_);
			_g_object_unref0 (_data_->empty);
		}
		_json_array_unref0 (_data_->accounts);
		__vala_JsonNode_free0 (_data_->accounts_node);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp76_ = (AdwActionRow*) adw_action_row_new ();
		g_object_ref_sink (_data_->_tmp76_);
		_data_->err_row = _data_->_tmp76_;
		_data_->_tmp77_ = _data_->err_row;
		adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _data_->_tmp77_, FALSE);
		_data_->_tmp78_ = _data_->err_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp78_, "Error loading accounts");
		_data_->_tmp79_ = _data_->err_row;
		_data_->_tmp80_ = _data_->e;
		_data_->_tmp81_ = _data_->_tmp80_->message;
		adw_action_row_set_subtitle (_data_->_tmp79_, _data_->_tmp81_);
		_data_->_tmp82_ = _data_->self->priv->accounts_list;
		_data_->_tmp83_ = _data_->err_row;
		gtk_list_box_append (_data_->_tmp82_, (GtkWidget*) _data_->_tmp83_);
		_g_object_unref0 (_data_->err_row);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_settings_dialog_on_row_activated (DcSettingsDialog* self,
                                     GtkListBoxRow* row)
{
	AdwActionRow* action_row = NULL;
	AdwActionRow* _tmp0_;
	AdwActionRow* _tmp1_;
	gint acct_id = 0;
	AdwActionRow* _tmp2_;
	gconstpointer _tmp3_;
	gboolean _tmp4_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (row, adw_action_row_get_type ()) ? ((AdwActionRow*) row) : NULL);
	action_row = _tmp0_;
	_tmp1_ = action_row;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (action_row);
		return;
	}
	_tmp2_ = action_row;
	_tmp3_ = g_object_get_data ((GObject*) _tmp2_, "acct-id");
	acct_id = (gint) ((gintptr) _tmp3_);
	if (acct_id <= 0) {
		_tmp4_ = TRUE;
	} else {
		DcRpcClient* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp5_ = self->priv->rpc;
		_tmp6_ = dc_rpc_client_get_account_id (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp4_ = acct_id == _tmp7_;
	}
	if (_tmp4_) {
		_g_object_unref0 (action_row);
		return;
	}
	dc_settings_dialog_do_switch_account (self, acct_id, NULL, NULL);
	_g_object_unref0 (action_row);
}

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

static void
dc_settings_dialog_do_switch_account (DcSettingsDialog* self,
                                      gint acct_id,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcSettingsDialogDoSwitchAccountData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogDoSwitchAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_do_switch_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	dc_settings_dialog_do_switch_account_co (_data_);
}

static void
dc_settings_dialog_do_switch_account_finish (DcSettingsDialog* self,
                                             GAsyncResult* _res_)
{
	DcSettingsDialogDoSwitchAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_settings_dialog_do_switch_account_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcSettingsDialogDoSwitchAccountData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_do_switch_account_co (_data_);
}

static gboolean
dc_settings_dialog_do_switch_account_co (DcSettingsDialogDoSwitchAccountData* _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:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
		_data_->_tmp2_ = _data_->_tmp1_;
		if (_data_->_tmp2_ > 0) {
			_data_->_tmp3_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_stop_io (_data_->_tmp3_, dc_settings_dialog_do_switch_account_ready, _data_);
			return FALSE;
			_state_1:
			dc_rpc_client_stop_io_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_select_account (_data_->_tmp4_, _data_->acct_id, dc_settings_dialog_do_switch_account_ready, _data_);
		return FALSE;
		_state_2:
		dc_rpc_client_select_account_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = _data_->self->priv->rpc;
		_data_->_state_ = 3;
		dc_rpc_client_start_io (_data_->_tmp5_, _data_->acct_id, dc_settings_dialog_do_switch_account_ready, _data_);
		return FALSE;
		_state_3:
		dc_rpc_client_start_io_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->self->priv->rpc;
		dc_rpc_client_set_account_id (_data_->_tmp6_, _data_->acct_id);
		g_signal_emit (_data_->self, dc_settings_dialog_signals[DC_SETTINGS_DIALOG_ACCOUNT_CHANGED_SIGNAL], 0);
		_data_->_state_ = 4;
		dc_settings_dialog_load_accounts (_data_->self, dc_settings_dialog_do_switch_account_ready, _data_);
		return FALSE;
		_state_4:
		dc_settings_dialog_load_accounts_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->self->priv->app_window;
		_data_->_tmp8_ = _data_->e;
		_data_->_tmp9_ = _data_->_tmp8_->message;
		dc_show_error ((GtkWidget*) _data_->_tmp7_, _data_->_tmp9_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static Block26Data*
block26_data_ref (Block26Data* _data26_)
{
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}

static void
block26_data_unref (void * _userdata_)
{
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data26_->self;
		_g_object_unref0 (_data26_->pass_entry);
		_g_object_unref0 (_data26_->email_entry);
		_g_object_unref0 (_data26_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}

static void
__lambda99_ (Block26Data* _data26_)
{
	DcSettingsDialog* self;
	self = _data26_->self;
	g_signal_emit_by_name (_data26_->dialog, "response", "add");
}

static void
___lambda99__gtk_password_entry_activate (GtkPasswordEntry* _sender,
                                          gpointer self)
{
	__lambda99_ (self);
}

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
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
__lambda100_ (Block26Data* _data26_,
              const gchar* resp)
{
	DcSettingsDialog* self;
	self = _data26_->self;
	g_return_if_fail (resp != NULL);
	if (g_strcmp0 (resp, "add") == 0) {
		gchar* email = NULL;
		const gchar* _tmp0_;
		const gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* password = NULL;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp0_ = gtk_editable_get_text ((GtkEditable*) _data26_->email_entry);
		_tmp1_ = _tmp0_;
		_tmp2_ = string_strip (_tmp1_);
		email = _tmp2_;
		_tmp3_ = gtk_editable_get_text ((GtkEditable*) _data26_->pass_entry);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup (_tmp4_);
		password = _tmp5_;
		_tmp8_ = email;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ > 0) {
			const gchar* _tmp11_;
			_tmp11_ = email;
			_tmp7_ = string_contains (_tmp11_, "@");
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			const gchar* _tmp12_;
			gint _tmp13_;
			gint _tmp14_;
			_tmp12_ = password;
			_tmp13_ = strlen (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp6_ = _tmp14_ > 0;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			_tmp15_ = email;
			_tmp16_ = password;
			dc_settings_dialog_do_add_account (self, _tmp15_, _tmp16_, NULL, NULL);
		}
		_g_free0 (password);
		_g_free0 (email);
	}
}

static void
___lambda100__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                         const gchar* response,
                                         gpointer self)
{
	__lambda100_ (self, response);
}

static void
dc_settings_dialog_on_add_account (DcSettingsDialog* self)
{
	Block26Data* _data26_;
	AdwAlertDialog* _tmp0_;
	GtkBox* box = NULL;
	GtkBox* _tmp1_;
	GtkEntry* _tmp2_;
	GtkPasswordEntry* _tmp3_;
	DcWindow* _tmp4_;
	g_return_if_fail (self != NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = g_object_ref (self);
	_tmp0_ = (AdwAlertDialog*) adw_alert_dialog_new ("Add Account", "Enter your email and password.");
	g_object_ref_sink (_tmp0_);
	_data26_->dialog = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp1_);
	box = _tmp1_;
	_tmp2_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp2_);
	_data26_->email_entry = _tmp2_;
	gtk_entry_set_placeholder_text (_data26_->email_entry, "user@example.com");
	gtk_entry_set_input_purpose (_data26_->email_entry, GTK_INPUT_PURPOSE_EMAIL);
	gtk_box_append (box, (GtkWidget*) _data26_->email_entry);
	_tmp3_ = (GtkPasswordEntry*) gtk_password_entry_new ();
	g_object_ref_sink (_tmp3_);
	_data26_->pass_entry = _tmp3_;
	g_object_set (_data26_->pass_entry, "placeholder-text", "Password", NULL);
	gtk_password_entry_set_show_peek_icon (_data26_->pass_entry, TRUE);
	gtk_box_append (box, (GtkWidget*) _data26_->pass_entry);
	adw_alert_dialog_set_extra_child (_data26_->dialog, (GtkWidget*) box);
	adw_alert_dialog_add_response (_data26_->dialog, "cancel", "Cancel");
	adw_alert_dialog_add_response (_data26_->dialog, "add", "Add");
	adw_alert_dialog_set_response_appearance (_data26_->dialog, "add", ADW_RESPONSE_SUGGESTED);
	adw_alert_dialog_set_default_response (_data26_->dialog, "add");
	g_signal_connect_data (_data26_->pass_entry, "activate", (GCallback) ___lambda99__gtk_password_entry_activate, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	g_signal_connect_data (_data26_->dialog, "response", (GCallback) ___lambda100__adw_alert_dialog_response, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	_tmp4_ = self->priv->app_window;
	adw_dialog_present ((AdwDialog*) _data26_->dialog, (GtkWidget*) _tmp4_);
	_g_object_unref0 (box);
	block26_data_unref (_data26_);
	_data26_ = NULL;
}

static void
dc_settings_dialog_do_add_account_data_free (gpointer _data)
{
	DcSettingsDialogDoAddAccountData* _data_;
	_data_ = _data;
	_g_free0 (_data_->email);
	_g_free0 (_data_->password);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogDoAddAccountData, _data_);
}

static void
dc_settings_dialog_do_add_account (DcSettingsDialog* self,
                                   const gchar* email,
                                   const gchar* password,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	DcSettingsDialogDoAddAccountData* _data_;
	DcSettingsDialog* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (email != NULL);
	g_return_if_fail (password != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogDoAddAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_do_add_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (email);
	_g_free0 (_data_->email);
	_data_->email = _tmp1_;
	_tmp2_ = g_strdup (password);
	_g_free0 (_data_->password);
	_data_->password = _tmp2_;
	dc_settings_dialog_do_add_account_co (_data_);
}

static void
dc_settings_dialog_do_add_account_finish (DcSettingsDialog* self,
                                          GAsyncResult* _res_)
{
	DcSettingsDialogDoAddAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_settings_dialog_do_add_account_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DcSettingsDialogDoAddAccountData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_do_add_account_co (_data_);
}

static gboolean
dc_settings_dialog_do_add_account_co (DcSettingsDialogDoAddAccountData* _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;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_add_account (_data_->_tmp0_, dc_settings_dialog_do_add_account_ready, _data_);
		return FALSE;
		_state_1:
		_data_->acct_id = dc_rpc_client_add_account_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_add_or_update_transport (_data_->_tmp1_, _data_->acct_id, _data_->email, _data_->password, dc_settings_dialog_do_add_account_ready, _data_);
		return FALSE;
		_state_2:
		dc_rpc_client_add_or_update_transport_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_state_ = 3;
		dc_rpc_client_select_account (_data_->_tmp2_, _data_->acct_id, dc_settings_dialog_do_add_account_ready, _data_);
		return FALSE;
		_state_3:
		dc_rpc_client_select_account_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->self->priv->rpc;
		_data_->_state_ = 4;
		dc_rpc_client_start_io (_data_->_tmp3_, _data_->acct_id, dc_settings_dialog_do_add_account_ready, _data_);
		return FALSE;
		_state_4:
		dc_rpc_client_start_io_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _data_->self->priv->rpc;
		dc_rpc_client_set_account_id (_data_->_tmp4_, _data_->acct_id);
		g_signal_emit (_data_->self, dc_settings_dialog_signals[DC_SETTINGS_DIALOG_ACCOUNT_CHANGED_SIGNAL], 0);
		_data_->_state_ = 5;
		dc_settings_dialog_load_accounts (_data_->self, dc_settings_dialog_do_add_account_ready, _data_);
		return FALSE;
		_state_5:
		dc_settings_dialog_load_accounts_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = _data_->self->priv->app_window;
		_data_->_tmp6_ = _data_->e;
		_data_->_tmp7_ = _data_->_tmp6_->message;
		dc_show_error ((GtkWidget*) _data_->_tmp5_, _data_->_tmp7_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_settings_dialog_confirm_remove_account_data_free (gpointer _data)
{
	DcSettingsDialogConfirmRemoveAccountData* _data_;
	_data_ = _data;
	_g_free0 (_data_->label);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogConfirmRemoveAccountData, _data_);
}

static void
dc_settings_dialog_confirm_remove_account (DcSettingsDialog* self,
                                           gint acct_id,
                                           const gchar* label,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcSettingsDialogConfirmRemoveAccountData* _data_;
	DcSettingsDialog* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogConfirmRemoveAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_confirm_remove_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_tmp1_ = g_strdup (label);
	_g_free0 (_data_->label);
	_data_->label = _tmp1_;
	dc_settings_dialog_confirm_remove_account_co (_data_);
}

static void
dc_settings_dialog_confirm_remove_account_finish (DcSettingsDialog* self,
                                                  GAsyncResult* _res_)
{
	DcSettingsDialogConfirmRemoveAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block27Data*
block27_data_ref (Block27Data* _data27_)
{
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}

static void
block27_data_unref (void * _userdata_)
{
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data27_->self;
		_g_object_unref0 (self);
		g_slice_free (Block27Data, _data27_);
	}
}

static void
__lambda98_ (Block27Data* _data27_)
{
	DcSettingsDialog* self;
	self = _data27_->self;
	dc_settings_dialog_do_remove_account (self, _data27_->acct_id, NULL, NULL);
}

static void
___lambda98__dc_void_func (gpointer self)
{
	__lambda98_ (self);
}

static gboolean
dc_settings_dialog_confirm_remove_account_co (DcSettingsDialogConfirmRemoveAccountData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data27_ = g_slice_new0 (Block27Data);
	_data_->_data27_->_ref_count_ = 1;
	_data_->_data27_->self = g_object_ref (_data_->self);
	_data_->_data27_->acct_id = _data_->acct_id;
	_data_->_data27_->_async_data_ = _data_;
	_data_->_tmp0_ = _data_->self->priv->app_window;
	_data_->_tmp1_ = g_strdup_printf ("Remove \"%s\"? This will delete all local data for this account.", _data_->label);
	_data_->_tmp2_ = _data_->_tmp1_;
	dc_confirm_action ((GtkWidget*) _data_->_tmp0_, "Remove Account", _data_->_tmp2_, "remove", "Remove", ___lambda98__dc_void_func, block27_data_ref (_data_->_data27_), block27_data_unref);
	_g_free0 (_data_->_tmp2_);
	block27_data_unref (_data_->_data27_);
	_data_->_data27_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_settings_dialog_update_rpc_row (DcSettingsDialog* self)
{
	gchar* custom = NULL;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = dc_settings_manager_get_rpc_server_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup (_tmp3_);
	custom = _tmp4_;
	_tmp5_ = custom;
	_tmp6_ = strlen (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_ > 0) {
		gboolean ok = FALSE;
		const gchar* _tmp8_;
		const gchar* _tmp9_ = NULL;
		AdwActionRow* _tmp10_;
		AdwActionRow* _tmp11_;
		const gchar* _tmp12_;
		_tmp8_ = custom;
		ok = g_file_test (_tmp8_, G_FILE_TEST_IS_EXECUTABLE);
		if (ok) {
			_tmp9_ = "Custom";
		} else {
			_tmp9_ = "❌ Custom path is not executable";
		}
		_tmp10_ = self->priv->rpc_row;
		adw_action_row_set_subtitle (_tmp10_, _tmp9_);
		_tmp11_ = self->priv->rpc_row;
		_tmp12_ = custom;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp11_, _tmp12_);
	} else {
		gchar* found = NULL;
		gchar* _tmp13_;
		const gchar* _tmp14_ = NULL;
		const gchar* _tmp15_;
		AdwActionRow* _tmp16_;
		const gchar* _tmp17_ = NULL;
		const gchar* _tmp18_;
		AdwActionRow* _tmp19_;
		_tmp13_ = dc_account_finder_find_rpc_server (NULL);
		found = _tmp13_;
		_tmp15_ = found;
		if (_tmp15_ != NULL) {
			_tmp14_ = "Auto-detected";
		} else {
			_tmp14_ = "❌ Not found";
		}
		_tmp16_ = self->priv->rpc_row;
		adw_action_row_set_subtitle (_tmp16_, _tmp14_);
		_tmp18_ = found;
		_tmp17_ = _tmp18_;
		if (_tmp17_ == NULL) {
			_tmp17_ = "No deltachat-rpc-server binary in the default locations";
		}
		_tmp19_ = self->priv->rpc_row;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp19_, _tmp17_);
		_g_free0 (found);
	}
	_g_free0 (custom);
}

static void
dc_settings_dialog_on_rpc_switch_toggled (DcSettingsDialog* self)
{
	GtkSwitch* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->rpc_custom_switch;
	_tmp1_ = gtk_switch_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		dc_settings_dialog_on_browse_rpc_server (self, NULL, NULL);
	} else {
		DcWindow* _tmp3_;
		DcSettingsManager* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp3_ = self->priv->app_window;
		_tmp4_ = _tmp3_->settings;
		_tmp5_ = dc_settings_manager_get_rpc_server_path (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ > 0) {
			DcWindow* _tmp9_;
			DcSettingsManager* _tmp10_;
			DcWindow* _tmp11_;
			_tmp9_ = self->priv->app_window;
			_tmp10_ = _tmp9_->settings;
			dc_settings_manager_save_rpc_server_path (_tmp10_, "");
			_tmp11_ = self->priv->app_window;
			dc_window_show_toast (_tmp11_, "Using auto-detected RPC server. Restart to apply.");
			dc_settings_dialog_update_rpc_row (self);
		}
	}
}

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

static void
dc_settings_dialog_on_browse_rpc_server (DcSettingsDialog* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	DcSettingsDialogOnBrowseRpcServerData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogOnBrowseRpcServerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_on_browse_rpc_server_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_on_browse_rpc_server_co (_data_);
}

static void
dc_settings_dialog_on_browse_rpc_server_finish (DcSettingsDialog* self,
                                                GAsyncResult* _res_)
{
	DcSettingsDialogOnBrowseRpcServerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_settings_dialog_on_browse_rpc_server_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	DcSettingsDialogOnBrowseRpcServerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_on_browse_rpc_server_co (_data_);
}

static gboolean
dc_settings_dialog_on_browse_rpc_server_co (DcSettingsDialogOnBrowseRpcServerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gtk_file_dialog_new ();
	_data_->dlg = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->dlg;
	gtk_file_dialog_set_title (_data_->_tmp1_, "Locate deltachat-rpc-server");
	_data_->_tmp2_ = _data_->dlg;
	gtk_file_dialog_set_modal (_data_->_tmp2_, TRUE);
	_data_->_tmp3_ = _data_->self->priv->app_window;
	_data_->_tmp4_ = _data_->_tmp3_->settings;
	_data_->_tmp5_ = dc_settings_manager_get_rpc_server_path (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
	_data_->start = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->start;
	_data_->_tmp9_ = strlen (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	if (_data_->_tmp10_ == 0) {
		_data_->_tmp12_ = dc_account_finder_find_rpc_server (NULL);
		_data_->_tmp11_ = _data_->_tmp12_;
		if (_data_->_tmp11_ == NULL) {
			_data_->_tmp13_ = g_strdup ("");
			_g_free0 (_data_->_tmp11_);
			_data_->_tmp11_ = _data_->_tmp13_;
		}
		_data_->_tmp14_ = _data_->_tmp11_;
		_data_->_tmp11_ = NULL;
		_g_free0 (_data_->start);
		_data_->start = _data_->_tmp14_;
		_g_free0 (_data_->_tmp11_);
	}
	_data_->_tmp15_ = _data_->start;
	_data_->_tmp16_ = strlen (_data_->_tmp15_);
	_data_->_tmp17_ = _data_->_tmp16_;
	if (_data_->_tmp17_ > 0) {
		_data_->_tmp18_ = _data_->dlg;
		_data_->_tmp19_ = _data_->start;
		_data_->_tmp20_ = g_file_new_for_path (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		gtk_file_dialog_set_initial_file (_data_->_tmp18_, _data_->_tmp21_);
		_g_object_unref0 (_data_->_tmp21_);
	}
	{
		_data_->_tmp22_ = _data_->dlg;
		_data_->_tmp23_ = _data_->self->priv->app_window;
		_data_->_state_ = 1;
		gtk_file_dialog_open (_data_->_tmp22_, (GtkWindow*) _data_->_tmp23_, NULL, dc_settings_dialog_on_browse_rpc_server_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp24_ = gtk_file_dialog_open_finish (_data_->_tmp22_, _data_->_res_, &_data_->_inner_error0_);
		_data_->file = _data_->_tmp24_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->file != NULL) {
			_data_->_tmp25_ = g_file_get_path (_data_->file);
			_data_->path = _data_->_tmp25_;
			_data_->_tmp27_ = _data_->path;
			if (_data_->_tmp27_ != NULL) {
				_data_->_tmp28_ = _data_->path;
				_data_->_tmp26_ = g_file_test (_data_->_tmp28_, G_FILE_TEST_IS_EXECUTABLE);
			} else {
				_data_->_tmp26_ = FALSE;
			}
			if (_data_->_tmp26_) {
				_data_->_tmp29_ = _data_->self->priv->app_window;
				_data_->_tmp30_ = _data_->_tmp29_->settings;
				_data_->_tmp31_ = _data_->path;
				dc_settings_manager_save_rpc_server_path (_data_->_tmp30_, _data_->_tmp31_);
				_data_->_tmp32_ = _data_->self->priv->app_window;
				dc_window_show_toast (_data_->_tmp32_, "RPC server path saved. Restart to apply.");
			} else {
				_data_->_tmp33_ = _data_->self->priv->app_window;
				dc_show_error ((GtkWidget*) _data_->_tmp33_, "Selected file is not an executable binary.");
			}
			_g_free0 (_data_->path);
		}
		_g_object_unref0 (_data_->file);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp35_ = _data_->e;
		if (!(_data_->_tmp35_->domain == GTK_DIALOG_ERROR)) {
			_data_->_tmp36_ = _data_->e;
			_data_->_tmp34_ = !g_error_matches (_data_->_tmp36_, G_IO_ERROR, G_IO_ERROR_CANCELLED);
		} else {
			_data_->_tmp34_ = FALSE;
		}
		if (_data_->_tmp34_) {
			_data_->_tmp37_ = _data_->self->priv->app_window;
			_data_->_tmp38_ = _data_->e;
			_data_->_tmp39_ = _data_->_tmp38_->message;
			dc_show_error ((GtkWidget*) _data_->_tmp37_, _data_->_tmp39_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->start);
		_g_object_unref0 (_data_->dlg);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp40_ = _data_->self->priv->rpc_custom_switch;
	_data_->_tmp41_ = _data_->self->priv->app_window;
	_data_->_tmp42_ = _data_->_tmp41_->settings;
	_data_->_tmp43_ = dc_settings_manager_get_rpc_server_path (_data_->_tmp42_);
	_data_->_tmp44_ = _data_->_tmp43_;
	_data_->_tmp45_ = strlen (_data_->_tmp44_);
	_data_->_tmp46_ = _data_->_tmp45_;
	gtk_switch_set_active (_data_->_tmp40_, _data_->_tmp46_ > 0);
	dc_settings_dialog_update_rpc_row (_data_->self);
	_g_free0 (_data_->start);
	_g_object_unref0 (_data_->dlg);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_settings_dialog_do_remove_account (DcSettingsDialog* self,
                                      gint acct_id,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcSettingsDialogDoRemoveAccountData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogDoRemoveAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_do_remove_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	dc_settings_dialog_do_remove_account_co (_data_);
}

static void
dc_settings_dialog_do_remove_account_finish (DcSettingsDialog* self,
                                             GAsyncResult* _res_)
{
	DcSettingsDialogDoRemoveAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_settings_dialog_do_remove_account_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcSettingsDialogDoRemoveAccountData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_do_remove_account_co (_data_);
}

static gboolean
dc_settings_dialog_do_remove_account_co (DcSettingsDialogDoRemoveAccountData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_remove_account (_data_->_tmp0_, _data_->acct_id, dc_settings_dialog_do_remove_account_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_remove_account_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		if (_data_->_tmp3_ == _data_->acct_id) {
			_data_->_tmp4_ = _data_->self->priv->rpc;
			dc_rpc_client_set_account_id (_data_->_tmp4_, 0);
		}
		g_signal_emit (_data_->self, dc_settings_dialog_signals[DC_SETTINGS_DIALOG_ACCOUNT_CHANGED_SIGNAL], 0);
		_data_->_state_ = 2;
		dc_settings_dialog_load_accounts (_data_->self, dc_settings_dialog_do_remove_account_ready, _data_);
		return FALSE;
		_state_2:
		dc_settings_dialog_load_accounts_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = _data_->self->priv->app_window;
		_data_->_tmp6_ = _data_->e;
		_data_->_tmp7_ = _data_->_tmp6_->message;
		dc_show_error ((GtkWidget*) _data_->_tmp5_, _data_->_tmp7_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda106_ (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	GtkApplication* _tmp1_;
	GtkApplication* _tmp2_;
	dc_settings_dialog_delete_parla_config ();
	_tmp0_ = self->priv->app_window;
	_tmp1_ = gtk_window_get_application ((GtkWindow*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_application_quit ((GApplication*) _tmp2_);
}

static void
___lambda106__dc_void_func (gpointer self)
{
	__lambda106_ ((DcSettingsDialog*) self);
}

static void
dc_settings_dialog_on_reset_settings (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->app_window;
	dc_confirm_action ((GtkWidget*) _tmp0_, "Factory Reset", "This will delete all Parla configuration files and close the applicati" \
"on. " "Your Delta Chat accounts and messages are not affected.", "reset", "Reset & Close", ___lambda106__dc_void_func, g_object_ref (self), g_object_unref);
}

static void
dc_settings_dialog_delete_parla_config (void)
{
	gchar* dir = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = g_get_user_config_dir ();
	_tmp1_ = g_build_filename (_tmp0_, "parla", NULL);
	dir = _tmp1_;
	_tmp2_ = g_build_filename (dir, "settings.ini", NULL);
	_tmp3_ = _tmp2_;
	g_unlink (_tmp3_);
	_g_free0 (_tmp3_);
	g_rmdir (dir);
	_g_free0 (dir);
}

static void
dc_settings_dialog_class_init (DcSettingsDialogClass * klass,
                               gpointer klass_data)
{
	dc_settings_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcSettingsDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dc_settings_dialog_finalize;
	dc_settings_dialog_signals[DC_SETTINGS_DIALOG_ACCOUNT_CHANGED_SIGNAL] = g_signal_new ("account-changed", DC_TYPE_SETTINGS_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dc_settings_dialog_instance_init (DcSettingsDialog * self,
                                  gpointer klass)
{
	self->priv = dc_settings_dialog_get_instance_private (self);
}

static void
dc_settings_dialog_finalize (GObject * obj)
{
	DcSettingsDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_SETTINGS_DIALOG, DcSettingsDialog);
	_g_object_unref0 (self->priv->rpc);
	_g_object_unref0 (self->priv->accounts_list);
	_g_object_unref0 (self->priv->content);
	_g_object_unref0 (self->priv->rpc_row);
	_g_object_unref0 (self->priv->rpc_custom_switch);
	G_OBJECT_CLASS (dc_settings_dialog_parent_class)->finalize (obj);
}

static GType
dc_settings_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcSettingsDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_settings_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcSettingsDialog), 0, (GInstanceInitFunc) dc_settings_dialog_instance_init, NULL };
	GType dc_settings_dialog_type_id;
	dc_settings_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "DcSettingsDialog", &g_define_type_info, 0);
	DcSettingsDialog_private_offset = g_type_add_instance_private (dc_settings_dialog_type_id, sizeof (DcSettingsDialogPrivate));
	return dc_settings_dialog_type_id;
}

GType
dc_settings_dialog_get_type (void)
{
	static volatile gsize dc_settings_dialog_type_id__once = 0;
	if (g_once_init_enter (&dc_settings_dialog_type_id__once)) {
		GType dc_settings_dialog_type_id;
		dc_settings_dialog_type_id = dc_settings_dialog_get_type_once ();
		g_once_init_leave (&dc_settings_dialog_type_id__once, dc_settings_dialog_type_id);
	}
	return dc_settings_dialog_type_id__once;
}

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);
}

