/* 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 <gdk/gdk.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <float.h>
#include <math.h>

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

typedef void (*DcSettingWriter) (GKeyFile* kf, gpointer user_data);
typedef enum  {
	DC_SIDEBAR_MODE_FULL = 0,
	DC_SIDEBAR_MODE_COMPACT = 1,
	DC_SIDEBAR_MODE_HIDDEN = 2
} DcSidebarMode;

#define DC_TYPE_SIDEBAR_MODE (dc_sidebar_mode_get_type ())
typedef enum  {
	DC_MESSAGE_STYLE_BUBBLES = 0,
	DC_MESSAGE_STYLE_IRC = 1
} DcMessageStyle;

#define DC_TYPE_MESSAGE_STYLE (dc_message_style_get_type ())
typedef enum  {
	DC_BACKGROUND_MODE_SYSTEM = 0,
	DC_BACKGROUND_MODE_SOLID = 1,
	DC_BACKGROUND_MODE_GRADIENT = 2
} DcBackgroundMode;

#define DC_TYPE_BACKGROUND_MODE (dc_background_mode_get_type ())

#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;
typedef enum  {
	DC_RPC_SERVER_SOURCE_AUTO = 0,
	DC_RPC_SERVER_SOURCE_CUSTOM = 1,
	DC_RPC_SERVER_SOURCE_DESKTOP = 2
} DcRpcServerSource;

#define DC_TYPE_RPC_SERVER_SOURCE (dc_rpc_server_source_get_type ())
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_MINIMIZE_TO_TRAY_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY,
	DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY,
	DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY,
	DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY,
	DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY,
	DC_SETTINGS_MANAGER_BACKGROUND_MODE_PROPERTY,
	DC_SETTINGS_MANAGER_BACKGROUND_COLOR_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 _Block36Data Block36Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block37Data Block37Data;
typedef struct _Block38Data Block38Data;
typedef struct _Block39Data Block39Data;
typedef struct _Block40Data Block40Data;
typedef struct _Block41Data Block41Data;
typedef struct _Block42Data Block42Data;
typedef struct _Block43Data Block43Data;
typedef struct _Block44Data Block44Data;
typedef struct _Block45Data Block45Data;
typedef struct _Block46Data Block46Data;
typedef struct _Block47Data Block47Data;
typedef struct _Block48Data Block48Data;
typedef struct _Block49Data Block49Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL,
	DC_SETTINGS_MANAGER_NUM_SIGNALS
};
static guint dc_settings_manager_signals[DC_SETTINGS_MANAGER_NUM_SIGNALS] = {0};

#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_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;

#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;
enum  {
	DC_SETTINGS_DIALOG_0_PROPERTY,
	DC_SETTINGS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* dc_settings_dialog_properties[DC_SETTINGS_DIALOG_NUM_PROPERTIES];
typedef struct _Block50Data Block50Data;
typedef struct _DcWindowPrivate DcWindowPrivate;
typedef struct _Block51Data Block51Data;
typedef struct _DcSettingsDialogLoadProxySettingsData DcSettingsDialogLoadProxySettingsData;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
typedef struct _DcSettingsDialogNormalizeProxyUrlData DcSettingsDialogNormalizeProxyUrlData;
typedef struct _DcSettingsDialogSaveProxySettingsData DcSettingsDialogSaveProxySettingsData;
typedef struct _DcSettingsDialogUpdateRpcVersionRowData DcSettingsDialogUpdateRpcVersionRowData;
typedef struct _DcSettingsDialogCheckRpcUpdatesData DcSettingsDialogCheckRpcUpdatesData;
typedef struct _DcSettingsDialogOnBrowseRpcServerData DcSettingsDialogOnBrowseRpcServerData;

#define DC_TYPE_RPC_INSTALLER (dc_rpc_installer_get_type ())
#define DC_RPC_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_RPC_INSTALLER, DcRpcInstaller))
#define DC_RPC_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_RPC_INSTALLER, DcRpcInstallerClass))
#define DC_IS_RPC_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_RPC_INSTALLER))
#define DC_IS_RPC_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_RPC_INSTALLER))
#define DC_RPC_INSTALLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_RPC_INSTALLER, DcRpcInstallerClass))

typedef struct _DcRpcInstaller DcRpcInstaller;
typedef struct _DcRpcInstallerClass DcRpcInstallerClass;
typedef struct _DcSettingsDialogInstallManagedServerData DcSettingsDialogInstallManagedServerData;
typedef struct _DcSettingsDialogOpenRpcDownloadPageData DcSettingsDialogOpenRpcDownloadPageData;
typedef void (*DcVoidFunc) (gpointer user_data);

#define DC_TYPE_APPLICATION (dc_application_get_type ())
#define DC_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_APPLICATION, DcApplication))
#define DC_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_APPLICATION, DcApplicationClass))
#define DC_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_APPLICATION))
#define DC_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_APPLICATION))
#define DC_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_APPLICATION, DcApplicationClass))

typedef struct _DcApplication DcApplication;
typedef struct _DcApplicationClass DcApplicationClass;

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;
	gboolean _minimize_to_tray;
	gchar* _rpc_server_path;
	DcRpcServerSource _rpc_server_source;
	gboolean _rpc_check_updates_on_startup;
	DcSidebarMode _sidebar_mode;
	gchar* _default_account_addr;
	DcMessageStyle _message_style;
	gchar* _accent_color;
	DcBackgroundMode _background_mode;
	gchar* _background_color;
};

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

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

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

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

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

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

struct _Block42Data {
	int _ref_count_;
	DcSettingsManager* self;
	DcRpcServerSource v;
};

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

struct _Block44Data {
	int _ref_count_;
	DcSettingsManager* self;
	DcSidebarMode v;
};

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

struct _Block46Data {
	int _ref_count_;
	DcSettingsManager* self;
	DcMessageStyle v;
};

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

struct _Block48Data {
	int _ref_count_;
	DcSettingsManager* self;
	DcBackgroundMode v;
};

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

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

struct _DcSettingsDialogClass {
	AdwDialogClass parent_class;
};

struct _DcSettingsDialogPrivate {
	GtkBox* content;
	DcWindow* app_window;
	DcRpcClient* rpc;
	AdwActionRow* proxy_switch_row;
	AdwActionRow* proxy_url_row;
	GtkSwitch* proxy_switch;
	GtkEntry* proxy_entry;
	AdwActionRow* rpc_row;
	AdwActionRow* rpc_version_row;
	GtkDropDown* rpc_source_dropdown;
	GtkButton* rpc_choose_btn;
	GtkButton* rpc_download_btn;
	GtkButton* rpc_update_btn;
	gboolean loading_proxy;
	gboolean saving_proxy;
	gboolean saved_proxy_enabled;
	gchar* saved_proxy_url;
	gboolean syncing_rpc_source;
	guint rpc_version_request;
	gchar* rpc_current_version;
	gboolean rpc_update_check_available;
};

struct _Block50Data {
	int _ref_count_;
	DcSettingsDialog* self;
	GtkDropDown* dblclick_combo;
	GtkSwitch* md_switch;
	GtkSwitch* shift_switch;
	GtkSwitch* notif_switch;
	GtkDropDown* style_combo;
	GtkColorDialogButton* accent_btn;
	GtkDropDown* bg_mode_combo;
	GtkColorDialogButton* bg_color_btn;
	GtkSwitch* autocheck_switch;
};

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

struct _DcWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _Block51Data {
	int _ref_count_;
	Block50Data * _data50_;
	GtkSwitch* tray_switch;
};

struct _DcSettingsDialogLoadProxySettingsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gboolean _tmp0_;
	DcRpcClient* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	DcRpcClient* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	AdwActionRow* _tmp7_;
	AdwActionRow* _tmp8_;
	gchar* enabled;
	DcRpcClient* _tmp9_;
	DcRpcClient* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gchar* _tmp13_;
	gchar* proxy_url;
	DcRpcClient* _tmp14_;
	DcRpcClient* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* first;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	GtkSwitch* _tmp24_;
	GtkEntry* _tmp25_;
	const gchar* _tmp26_;
	GtkSwitch* _tmp27_;
	gboolean _tmp28_;
	gboolean _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	const gchar* _tmp32_;
	GtkSwitch* _tmp33_;
	gboolean _tmp34_;
	gboolean _tmp35_;
	AdwActionRow* _tmp36_;
	AdwActionRow* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	gint _tmp40_;
	gint _tmp41_;
	const gchar* _tmp42_;
	AdwActionRow* _tmp43_;
	GError* e;
	AdwActionRow* _tmp44_;
	AdwActionRow* _tmp45_;
	GError* _tmp46_;
	const gchar* _tmp47_;
	GError* _inner_error1_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogNormalizeProxyUrlData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gchar* url;
	gchar* result;
	JsonObject* qr;
	DcRpcClient* _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	JsonObject* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	JsonObject* _tmp7_;
	JsonObject* _tmp8_;
	JsonObject* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	JsonObject* _tmp14_;
	JsonObject* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	GError* e;
	GError* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogSaveProxySettingsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	DcRpcClient* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	DcRpcClient* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	DcWindow* _tmp8_;
	gchar* url;
	GtkEntry* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gboolean enabled;
	GtkSwitch* _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gboolean _tmp19_;
	const gchar* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	GtkSwitch* _tmp23_;
	gboolean _tmp24_;
	const gchar* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	const gchar* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gchar* normalized;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	GtkEntry* _tmp36_;
	const gchar* _tmp37_;
	DcRpcClient* _tmp38_;
	const gchar* _tmp39_;
	DcRpcClient* _tmp40_;
	gint _tmp41_;
	gint _tmp42_;
	const gchar* _tmp43_;
	DcRpcClient* _tmp44_;
	DcRpcClient* _tmp45_;
	gint _tmp46_;
	gint _tmp47_;
	DcRpcClient* _tmp48_;
	DcRpcClient* _tmp49_;
	gint _tmp50_;
	gint _tmp51_;
	DcRpcClient* _tmp52_;
	DcRpcClient* _tmp53_;
	gint _tmp54_;
	gint _tmp55_;
	const gchar* _tmp56_;
	AdwActionRow* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	gint _tmp60_;
	gint _tmp61_;
	const gchar* _tmp62_;
	AdwActionRow* _tmp63_;
	const gchar* _tmp64_;
	gchar* _tmp65_;
	DcWindow* _tmp66_;
	GError* e;
	GError* _tmp67_;
	const gchar* _tmp68_;
	gchar* _tmp69_;
	gchar* _tmp70_;
	GError* _inner_error1_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogUpdateRpcVersionRowData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gchar* rpc_path;
	guint request_id;
	guint _tmp0_;
	gboolean _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	AdwActionRow* _tmp4_;
	AdwActionRow* _tmp5_;
	GtkButton* _tmp6_;
	AdwActionRow* _tmp7_;
	AdwActionRow* _tmp8_;
	GtkButton* _tmp9_;
	GSubprocess* process;
	GSubprocess* _tmp10_;
	gchar* stdout_buf;
	gchar* stderr_buf;
	GSubprocess* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	gboolean _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* version;
	gchar* _tmp28_;
	gboolean _tmp29_;
	GSubprocess* _tmp30_;
	const gchar* _tmp31_;
	gint _tmp32_;
	gint _tmp33_;
	AdwActionRow* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	GtkButton* _tmp38_;
	AdwActionRow* _tmp39_;
	GtkButton* _tmp40_;
	GError* e;
	AdwActionRow* _tmp41_;
	AdwActionRow* _tmp42_;
	GError* _tmp43_;
	const gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	GtkButton* _tmp47_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogCheckRpcUpdatesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gboolean _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GtkButton* _tmp5_;
	gchar* previous_subtitle;
	AdwActionRow* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	AdwActionRow* _tmp10_;
	gchar* latest_tag;
	gchar* _tmp11_;
	gchar* latest_version;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	AdwActionRow* _tmp15_;
	const gchar* _tmp16_;
	DcWindow* _tmp17_;
	GtkButton* _tmp18_;
	gboolean managed_active;
	DcWindow* _tmp19_;
	DcSettingsManager* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	DcWindow* _tmp23_;
	DcSettingsManager* _tmp24_;
	DcRpcServerSource _tmp25_;
	DcRpcServerSource _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gboolean _tmp31_;
	const gchar* _tmp32_;
	AdwActionRow* _tmp33_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	DcWindow* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	AdwActionRow* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	DcWindow* _tmp48_;
	const gchar* _tmp49_;
	gchar* _tmp50_;
	gchar* _tmp51_;
	DcWindow* _tmp52_;
	const gchar* _tmp53_;
	gchar* _tmp54_;
	gchar* _tmp55_;
	AdwActionRow* _tmp56_;
	const gchar* _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	DcWindow* _tmp60_;
	AdwActionRow* _tmp61_;
	const gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	GError* e;
	AdwActionRow* _tmp65_;
	const gchar* _tmp66_;
	DcWindow* _tmp67_;
	GError* _tmp68_;
	const gchar* _tmp69_;
	gchar* _tmp70_;
	gchar* _tmp71_;
	GError* _inner_error1_;
	GtkButton* _tmp72_;
	GError* _inner_error0_;
};

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_;
	DcSettingsManager* _tmp33_;
	DcWindow* _tmp34_;
	DcWindow* _tmp35_;
	DcWindow* _tmp36_;
	GError* e;
	gboolean _tmp37_;
	GError* _tmp38_;
	GError* _tmp39_;
	DcWindow* _tmp40_;
	GError* _tmp41_;
	const gchar* _tmp42_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogInstallManagedServerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	GtkButton* _tmp0_;
	gchar* prev_subtitle;
	AdwActionRow* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	DcRpcInstaller* installer;
	DcRpcInstaller* _tmp5_;
	DcRpcInstaller* _tmp6_;
	DcRpcInstaller* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	DcWindow* _tmp10_;
	DcSettingsManager* _tmp11_;
	DcRpcServerSource _tmp12_;
	DcRpcServerSource _tmp13_;
	DcWindow* _tmp14_;
	DcSettingsManager* _tmp15_;
	DcWindow* _tmp16_;
	DcWindow* _tmp17_;
	GError* e;
	AdwActionRow* _tmp18_;
	const gchar* _tmp19_;
	DcWindow* _tmp20_;
	GError* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	GError* _inner_error1_;
	GtkButton* _tmp25_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogOpenRpcDownloadPageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	GtkUriLauncher* _tmp0_;
	GtkUriLauncher* _tmp1_;
	DcWindow* _tmp2_;
	GError* e;
	DcWindow* _tmp3_;
	GError* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	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_sidebar_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcSidebarMode dc_sidebar_mode_next (DcSidebarMode self);
VALA_EXTERN GType dc_message_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_background_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_settings_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsManager, g_object_unref)
VALA_EXTERN GType dc_rpc_server_source_get_type (void) G_GNUC_CONST ;
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);
VALA_EXTERN void dc_settings_manager_set_minimize_to_tray (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_set_rpc_server_source (DcSettingsManager* self,
                                                DcRpcServerSource value);
VALA_EXTERN void dc_settings_manager_set_rpc_check_updates_on_startup (DcSettingsManager* self,
                                                           gboolean value);
VALA_EXTERN void dc_settings_manager_set_sidebar_mode (DcSettingsManager* self,
                                           DcSidebarMode value);
VALA_EXTERN void dc_settings_manager_set_default_account_addr (DcSettingsManager* self,
                                                   const gchar* value);
VALA_EXTERN void dc_settings_manager_set_message_style (DcSettingsManager* self,
                                            DcMessageStyle value);
VALA_EXTERN void dc_settings_manager_set_accent_color (DcSettingsManager* self,
                                           const gchar* value);
VALA_EXTERN void dc_settings_manager_set_background_mode (DcSettingsManager* self,
                                              DcBackgroundMode value);
VALA_EXTERN void dc_settings_manager_set_background_color (DcSettingsManager* self,
                                               const gchar* value);
VALA_EXTERN void dc_settings_manager_save_double_click_action (DcSettingsManager* self,
                                                   gint v);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
VALA_EXTERN void dc_settings_manager_save_to_file (DcSettingsManager* self,
                                       DcSettingWriter writer,
                                       gpointer writer_target);
static void __lambda8_ (Block36Data* _data36_,
                 GKeyFile* kf);
static void ___lambda8__dc_setting_writer (GKeyFile* kf,
                                    gpointer self);
VALA_EXTERN void dc_settings_manager_save_markdown_rendering (DcSettingsManager* self,
                                                  gboolean v);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
static void __lambda9_ (Block37Data* _data37_,
                 GKeyFile* kf);
static void ___lambda9__dc_setting_writer (GKeyFile* kf,
                                    gpointer self);
VALA_EXTERN void dc_settings_manager_save_shift_enter_sends (DcSettingsManager* self,
                                                 gboolean v);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
static void __lambda10_ (Block38Data* _data38_,
                  GKeyFile* kf);
static void ___lambda10__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                     gboolean v);
static Block39Data* block39_data_ref (Block39Data* _data39_);
static void block39_data_unref (void * _userdata_);
static void __lambda11_ (Block39Data* _data39_,
                  GKeyFile* kf);
static void ___lambda11__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_minimize_to_tray (DcSettingsManager* self,
                                                gboolean v);
static Block40Data* block40_data_ref (Block40Data* _data40_);
static void block40_data_unref (void * _userdata_);
static void __lambda12_ (Block40Data* _data40_,
                  GKeyFile* kf);
static void ___lambda12__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                               const gchar* v);
static Block41Data* block41_data_ref (Block41Data* _data41_);
static void block41_data_unref (void * _userdata_);
static void __lambda13_ (Block41Data* _data41_,
                  GKeyFile* kf);
static void ___lambda13__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_source (DcSettingsManager* self,
                                                 DcRpcServerSource v);
static Block42Data* block42_data_ref (Block42Data* _data42_);
static void block42_data_unref (void * _userdata_);
static void __lambda14_ (Block42Data* _data42_,
                  GKeyFile* kf);
static void ___lambda14__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_rpc_check_updates_on_startup (DcSettingsManager* self,
                                                            gboolean v);
static Block43Data* block43_data_ref (Block43Data* _data43_);
static void block43_data_unref (void * _userdata_);
static void __lambda15_ (Block43Data* _data43_,
                  GKeyFile* kf);
static void ___lambda15__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_sidebar_mode (DcSettingsManager* self,
                                            DcSidebarMode v);
static Block44Data* block44_data_ref (Block44Data* _data44_);
static void block44_data_unref (void * _userdata_);
static void __lambda16_ (Block44Data* _data44_,
                  GKeyFile* kf);
static void ___lambda16__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_default_account_addr (DcSettingsManager* self,
                                                    const gchar* v);
static Block45Data* block45_data_ref (Block45Data* _data45_);
static void block45_data_unref (void * _userdata_);
static void __lambda17_ (Block45Data* _data45_,
                  GKeyFile* kf);
static void ___lambda17__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_message_style (DcSettingsManager* self,
                                             DcMessageStyle v);
static Block46Data* block46_data_ref (Block46Data* _data46_);
static void block46_data_unref (void * _userdata_);
static void __lambda18_ (Block46Data* _data46_,
                  GKeyFile* kf);
static void ___lambda18__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_accent_color (DcSettingsManager* self,
                                            const gchar* v);
static Block47Data* block47_data_ref (Block47Data* _data47_);
static void block47_data_unref (void * _userdata_);
static void __lambda19_ (Block47Data* _data47_,
                  GKeyFile* kf);
static void ___lambda19__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_background_mode (DcSettingsManager* self,
                                               DcBackgroundMode v);
static Block48Data* block48_data_ref (Block48Data* _data48_);
static void block48_data_unref (void * _userdata_);
static void __lambda20_ (Block48Data* _data48_,
                  GKeyFile* kf);
static void ___lambda20__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_background_color (DcSettingsManager* self,
                                                const gchar* v);
static Block49Data* block49_data_ref (Block49Data* _data49_);
static void block49_data_unref (void * _userdata_);
static void __lambda21_ (Block49Data* _data49_,
                  GKeyFile* kf);
static void ___lambda21__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 gboolean dc_settings_manager_get_minimize_to_tray (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_rpc_server_path (DcSettingsManager* self);
VALA_EXTERN DcRpcServerSource dc_settings_manager_get_rpc_server_source (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_rpc_check_updates_on_startup (DcSettingsManager* self);
VALA_EXTERN DcSidebarMode dc_settings_manager_get_sidebar_mode (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_default_account_addr (DcSettingsManager* self);
VALA_EXTERN DcMessageStyle dc_settings_manager_get_message_style (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_accent_color (DcSettingsManager* self);
VALA_EXTERN DcBackgroundMode dc_settings_manager_get_background_mode (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_background_color (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_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, 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 DcSettingsDialog* dc_settings_dialog_new (DcWindow* window,
                                          DcRpcClient* rpc);
VALA_EXTERN DcSettingsDialog* dc_settings_dialog_construct (GType object_type,
                                                DcWindow* window,
                                                DcRpcClient* rpc);
static Block50Data* block50_data_ref (Block50Data* _data50_);
static void block50_data_unref (void * _userdata_);
static void __lambda200_ (Block50Data* _data50_);
static void ___lambda200__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda201_ (Block50Data* _data50_);
static void ___lambda201__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda202_ (Block50Data* _data50_);
static void ___lambda202__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda203_ (Block50Data* _data50_);
static void ___lambda203__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN gboolean dc_platform_is_macos (void);
static Block51Data* block51_data_ref (Block51Data* _data51_);
static void block51_data_unref (void * _userdata_);
static void ___lambda204_ (Block51Data* _data51_);
static void ____lambda204__g_object_notify (GObject* _sender,
                                     GParamSpec* pspec,
                                     gpointer self);
static void __lambda205_ (Block50Data* _data50_);
static void ___lambda205__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void dc_settings_dialog_apply_hex_to_button (GtkColorDialogButton* btn,
                                             const gchar* hex);
static void __lambda206_ (Block50Data* _data50_);
static void ___lambda206__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda207_ (Block50Data* _data50_);
static void ___lambda207__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda208_ (Block50Data* _data50_);
static void dc_settings_dialog_apply_background (DcSettingsDialog* self);
static void ___lambda208__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda209_ (Block50Data* _data50_);
static void ___lambda209__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda210_ (DcSettingsDialog* self);
static void dc_settings_dialog_save_proxy_settings (DcSettingsDialog* self,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void dc_settings_dialog_save_proxy_settings_finish (DcSettingsDialog* self,
                                                    GAsyncResult* _res_);
static void ___lambda210__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda211_ (DcSettingsDialog* self);
static void ___lambda211__gtk_entry_activate (GtkEntry* _sender,
                                       gpointer self);
static void __lambda212_ (DcSettingsDialog* self);
static void ___lambda212__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                     gpointer self);
static void dc_settings_dialog_load_proxy_settings (DcSettingsDialog* self,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void dc_settings_dialog_load_proxy_settings_finish (DcSettingsDialog* self,
                                                    GAsyncResult* _res_);
static void dc_settings_dialog_on_rpc_source_changed (DcSettingsDialog* self);
static void _dc_settings_dialog_on_rpc_source_changed_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self);
static void __lambda221_ (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 ___lambda221__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda222_ (DcSettingsDialog* self);
static void dc_settings_dialog_install_managed_server (DcSettingsDialog* self,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_settings_dialog_install_managed_server_finish (DcSettingsDialog* self,
                                                       GAsyncResult* _res_);
static void ___lambda222__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda224_ (DcSettingsDialog* self);
static void dc_settings_dialog_check_rpc_updates (DcSettingsDialog* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void dc_settings_dialog_check_rpc_updates_finish (DcSettingsDialog* self,
                                                  GAsyncResult* _res_);
static void ___lambda224__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda225_ (Block50Data* _data50_);
static void ___lambda225__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_proxy_settings_data_free (gpointer _data);
static gboolean dc_settings_dialog_load_proxy_settings_co (DcSettingsDialogLoadProxySettingsData* _data_);
VALA_EXTERN gboolean dc_rpc_client_get_is_connected (DcRpcClient* self);
VALA_EXTERN gint dc_rpc_client_get_account_id (DcRpcClient* self);
static void dc_settings_dialog_set_proxy_controls_sensitive (DcSettingsDialog* self,
                                                      gboolean sensitive);
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);
static void dc_settings_dialog_load_proxy_settings_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static gchar* dc_settings_dialog_first_proxy_url (const gchar* urls);
static void dc_settings_dialog_normalize_proxy_url_data_free (gpointer _data);
static void dc_settings_dialog_normalize_proxy_url (DcSettingsDialog* self,
                                             const gchar* url,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gchar* dc_settings_dialog_normalize_proxy_url_finish (DcSettingsDialog* self,
                                                      GAsyncResult* _res_);
static gboolean dc_settings_dialog_normalize_proxy_url_co (DcSettingsDialogNormalizeProxyUrlData* _data_);
VALA_EXTERN void dc_rpc_client_check_qr (DcRpcClient* self,
                             gint acct_id,
                             const gchar* qr_text,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_check_qr_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static void dc_settings_dialog_normalize_proxy_url_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
VALA_EXTERN void dc_show_error (GtkWidget* parent,
                    const gchar* message);
static void dc_settings_dialog_save_proxy_settings_data_free (gpointer _data);
static gboolean dc_settings_dialog_save_proxy_settings_co (DcSettingsDialogSaveProxySettingsData* _data_);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
static void dc_settings_dialog_save_proxy_settings_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_batch_set_config (DcRpcClient* self,
                                     const gchar* key,
                                     const gchar* val,
                                     gint acct_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_batch_set_config_finish (DcRpcClient* self,
                                            GAsyncResult* _res_,
                                            GError** error);
VALA_EXTERN void dc_rpc_client_stop_io (DcRpcClient* self,
                            gint acct_id,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_stop_io_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);
static void dc_settings_dialog_sync_rpc_source_dropdown (DcSettingsDialog* self);
VALA_EXTERN gchar* dc_account_finder_find_rpc_server (const gchar* custom_path,
                                          DcRpcServerSource source);
VALA_EXTERN gboolean dc_rpc_installer_can_auto_install (void);
VALA_EXTERN gchar* dc_account_finder_get_managed_rpc_path (void);
VALA_EXTERN gchar* dc_account_finder_find_desktop_data_dir (void);
static void dc_settings_dialog_update_rpc_version_row (DcSettingsDialog* self,
                                                const gchar* rpc_path,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_settings_dialog_update_rpc_version_row_finish (DcSettingsDialog* self,
                                                       GAsyncResult* _res_);
static void dc_settings_dialog_update_rpc_version_row_data_free (gpointer _data);
static gboolean dc_settings_dialog_update_rpc_version_row_co (DcSettingsDialogUpdateRpcVersionRowData* _data_);
static void dc_settings_dialog_update_rpc_version_row_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_installer_extract_version (const gchar* text);
static void dc_settings_dialog_check_rpc_updates_data_free (gpointer _data);
static gboolean dc_settings_dialog_check_rpc_updates_co (DcSettingsDialogCheckRpcUpdatesData* _data_);
VALA_EXTERN void dc_rpc_installer_fetch_latest_tag (GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_installer_fetch_latest_tag_finish (GAsyncResult* _res_,
                                                 GError** error);
static void dc_settings_dialog_check_rpc_updates_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN void dc_window_reconnect_rpc_server (DcWindow* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_window_reconnect_rpc_server_finish (DcWindow* self,
                                            GAsyncResult* _res_);
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_install_managed_server_data_free (gpointer _data);
static gboolean dc_settings_dialog_install_managed_server_co (DcSettingsDialogInstallManagedServerData* _data_);
static void dc_settings_dialog_open_rpc_download_page (DcSettingsDialog* self,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_settings_dialog_open_rpc_download_page_finish (DcSettingsDialog* self,
                                                       GAsyncResult* _res_);
static void dc_settings_dialog_install_managed_server_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
VALA_EXTERN GType dc_rpc_installer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcInstaller, g_object_unref)
VALA_EXTERN DcRpcInstaller* dc_rpc_installer_new (void);
VALA_EXTERN DcRpcInstaller* dc_rpc_installer_construct (GType object_type);
static void __lambda223_ (DcSettingsDialog* self,
                   gint64 received,
                   gint64 total);
static void ___lambda223__dc_rpc_installer_progress (DcRpcInstaller* _sender,
                                              gint64 received,
                                              gint64 total,
                                              gpointer self);
VALA_EXTERN void dc_rpc_installer_download_latest (DcRpcInstaller* self,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_installer_download_latest_finish (DcRpcInstaller* self,
                                                GAsyncResult* _res_,
                                                GError** error);
static void dc_settings_dialog_open_rpc_download_page_data_free (gpointer _data);
static gboolean dc_settings_dialog_open_rpc_download_page_co (DcSettingsDialogOpenRpcDownloadPageData* _data_);
static void dc_settings_dialog_open_rpc_download_page_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
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 __lambda226_ (DcSettingsDialog* self);
static void dc_settings_dialog_delete_parla_config (void);
static void ___lambda226__dc_void_func (gpointer self);
VALA_EXTERN GType dc_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcApplication, g_object_unref)
VALA_EXTERN void dc_application_apply_background (DcApplication* self,
                                      DcBackgroundMode mode,
                                      const gchar* hex);
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 gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

DcSidebarMode
dc_sidebar_mode_next (DcSidebarMode self)
{
	DcSidebarMode result;
	switch (self) {
		case DC_SIDEBAR_MODE_FULL:
		{
			result = DC_SIDEBAR_MODE_COMPACT;
			return result;
		}
		case DC_SIDEBAR_MODE_COMPACT:
		{
			result = DC_SIDEBAR_MODE_HIDDEN;
			return result;
		}
		default:
		{
			result = DC_SIDEBAR_MODE_FULL;
			return result;
		}
	}
}

static GType
dc_sidebar_mode_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_SIDEBAR_MODE_FULL, "DC_SIDEBAR_MODE_FULL", "full"}, {DC_SIDEBAR_MODE_COMPACT, "DC_SIDEBAR_MODE_COMPACT", "compact"}, {DC_SIDEBAR_MODE_HIDDEN, "DC_SIDEBAR_MODE_HIDDEN", "hidden"}, {0, NULL, NULL}};
	GType dc_sidebar_mode_type_id;
	dc_sidebar_mode_type_id = g_enum_register_static ("DcSidebarMode", values);
	return dc_sidebar_mode_type_id;
}

GType
dc_sidebar_mode_get_type (void)
{
	static volatile gsize dc_sidebar_mode_type_id__once = 0;
	if (g_once_init_enter (&dc_sidebar_mode_type_id__once)) {
		GType dc_sidebar_mode_type_id;
		dc_sidebar_mode_type_id = dc_sidebar_mode_get_type_once ();
		g_once_init_leave (&dc_sidebar_mode_type_id__once, dc_sidebar_mode_type_id);
	}
	return dc_sidebar_mode_type_id__once;
}

static GType
dc_message_style_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_MESSAGE_STYLE_BUBBLES, "DC_MESSAGE_STYLE_BUBBLES", "bubbles"}, {DC_MESSAGE_STYLE_IRC, "DC_MESSAGE_STYLE_IRC", "irc"}, {0, NULL, NULL}};
	GType dc_message_style_type_id;
	dc_message_style_type_id = g_enum_register_static ("DcMessageStyle", values);
	return dc_message_style_type_id;
}

GType
dc_message_style_get_type (void)
{
	static volatile gsize dc_message_style_type_id__once = 0;
	if (g_once_init_enter (&dc_message_style_type_id__once)) {
		GType dc_message_style_type_id;
		dc_message_style_type_id = dc_message_style_get_type_once ();
		g_once_init_leave (&dc_message_style_type_id__once, dc_message_style_type_id);
	}
	return dc_message_style_type_id__once;
}

static GType
dc_background_mode_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_BACKGROUND_MODE_SYSTEM, "DC_BACKGROUND_MODE_SYSTEM", "system"}, {DC_BACKGROUND_MODE_SOLID, "DC_BACKGROUND_MODE_SOLID", "solid"}, {DC_BACKGROUND_MODE_GRADIENT, "DC_BACKGROUND_MODE_GRADIENT", "gradient"}, {0, NULL, NULL}};
	GType dc_background_mode_type_id;
	dc_background_mode_type_id = g_enum_register_static ("DcBackgroundMode", values);
	return dc_background_mode_type_id;
}

GType
dc_background_mode_get_type (void)
{
	static volatile gsize dc_background_mode_type_id__once = 0;
	if (g_once_init_enter (&dc_background_mode_type_id__once)) {
		GType dc_background_mode_type_id;
		dc_background_mode_type_id = dc_background_mode_get_type_once ();
		g_once_init_leave (&dc_background_mode_type_id__once, dc_background_mode_type_id);
	}
	return dc_background_mode_type_id__once;
}

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_;
	gint source = 0;
	gboolean _tmp6_ = FALSE;
	gint sb = 0;
	gboolean _tmp7_ = FALSE;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gint ms = 0;
	gboolean _tmp10_ = FALSE;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gint bm = 0;
	gboolean _tmp13_ = FALSE;
	gchar* _tmp14_;
	gchar* _tmp15_;
	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));
	dc_settings_manager_set_minimize_to_tray (self, dc_settings_manager_kf_bool (kf, "minimize_to_tray", FALSE));
	_tmp4_ = dc_settings_manager_kf_str (kf, "rpc_server_path", "");
	_tmp5_ = _tmp4_;
	dc_settings_manager_set_rpc_server_path (self, _tmp5_);
	_g_free0 (_tmp5_);
	source = dc_settings_manager_kf_int (kf, "rpc_server_source", (gint) DC_RPC_SERVER_SOURCE_AUTO);
	if (source < 0) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = source > 2;
	}
	if (_tmp6_) {
		source = (gint) DC_RPC_SERVER_SOURCE_AUTO;
	}
	dc_settings_manager_set_rpc_server_source (self, (DcRpcServerSource) source);
	dc_settings_manager_set_rpc_check_updates_on_startup (self, dc_settings_manager_kf_bool (kf, "rpc_check_updates_on_startup", TRUE));
	sb = dc_settings_manager_kf_int (kf, "sidebar_mode", (gint) DC_SIDEBAR_MODE_FULL);
	if (sb < 0) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = sb > 2;
	}
	if (_tmp7_) {
		sb = (gint) DC_SIDEBAR_MODE_FULL;
	}
	dc_settings_manager_set_sidebar_mode (self, (DcSidebarMode) sb);
	_tmp8_ = dc_settings_manager_kf_str (kf, "default_account_addr", "");
	_tmp9_ = _tmp8_;
	dc_settings_manager_set_default_account_addr (self, _tmp9_);
	_g_free0 (_tmp9_);
	ms = dc_settings_manager_kf_int (kf, "message_style", (gint) DC_MESSAGE_STYLE_BUBBLES);
	if (ms < 0) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = ms > 1;
	}
	if (_tmp10_) {
		ms = (gint) DC_MESSAGE_STYLE_BUBBLES;
	}
	dc_settings_manager_set_message_style (self, (DcMessageStyle) ms);
	_tmp11_ = dc_settings_manager_kf_str (kf, "accent_color", "");
	_tmp12_ = _tmp11_;
	dc_settings_manager_set_accent_color (self, _tmp12_);
	_g_free0 (_tmp12_);
	bm = dc_settings_manager_kf_int (kf, "background_mode", (gint) DC_BACKGROUND_MODE_SYSTEM);
	if (bm < 0) {
		_tmp13_ = TRUE;
	} else {
		_tmp13_ = bm > 2;
	}
	if (_tmp13_) {
		bm = (gint) DC_BACKGROUND_MODE_SYSTEM;
	}
	dc_settings_manager_set_background_mode (self, (DcBackgroundMode) bm);
	_tmp14_ = dc_settings_manager_kf_str (kf, "background_color", "");
	_tmp15_ = _tmp14_;
	dc_settings_manager_set_background_color (self, _tmp15_);
	_g_free0 (_tmp15_);
	_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 Block36Data*
block36_data_ref (Block36Data* _data36_)
{
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}

static void
block36_data_unref (void * _userdata_)
{
	Block36Data* _data36_;
	_data36_ = (Block36Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data36_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data36_->self;
		_g_object_unref0 (self);
		g_slice_free (Block36Data, _data36_);
	}
}

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

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

void
dc_settings_manager_save_double_click_action (DcSettingsManager* self,
                                              gint v)
{
	Block36Data* _data36_;
	g_return_if_fail (self != NULL);
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	_data36_->self = g_object_ref (self);
	_data36_->v = v;
	dc_settings_manager_set_double_click_action (self, _data36_->v);
	dc_settings_manager_save_to_file (self, ___lambda8__dc_setting_writer, _data36_);
	block36_data_unref (_data36_);
	_data36_ = NULL;
}

static Block37Data*
block37_data_ref (Block37Data* _data37_)
{
	g_atomic_int_inc (&_data37_->_ref_count_);
	return _data37_;
}

static void
block37_data_unref (void * _userdata_)
{
	Block37Data* _data37_;
	_data37_ = (Block37Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data37_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data37_->self;
		_g_object_unref0 (self);
		g_slice_free (Block37Data, _data37_);
	}
}

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

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

void
dc_settings_manager_save_markdown_rendering (DcSettingsManager* self,
                                             gboolean v)
{
	Block37Data* _data37_;
	g_return_if_fail (self != NULL);
	_data37_ = g_slice_new0 (Block37Data);
	_data37_->_ref_count_ = 1;
	_data37_->self = g_object_ref (self);
	_data37_->v = v;
	dc_settings_manager_set_markdown_rendering (self, _data37_->v);
	dc_markdown_enabled = _data37_->v;
	dc_settings_manager_save_to_file (self, ___lambda9__dc_setting_writer, _data37_);
	block37_data_unref (_data37_);
	_data37_ = NULL;
}

static Block38Data*
block38_data_ref (Block38Data* _data38_)
{
	g_atomic_int_inc (&_data38_->_ref_count_);
	return _data38_;
}

static void
block38_data_unref (void * _userdata_)
{
	Block38Data* _data38_;
	_data38_ = (Block38Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data38_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data38_->self;
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}

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

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

void
dc_settings_manager_save_shift_enter_sends (DcSettingsManager* self,
                                            gboolean v)
{
	Block38Data* _data38_;
	g_return_if_fail (self != NULL);
	_data38_ = g_slice_new0 (Block38Data);
	_data38_->_ref_count_ = 1;
	_data38_->self = g_object_ref (self);
	_data38_->v = v;
	dc_settings_manager_set_shift_enter_sends (self, _data38_->v);
	dc_settings_manager_save_to_file (self, ___lambda10__dc_setting_writer, _data38_);
	block38_data_unref (_data38_);
	_data38_ = NULL;
}

static Block39Data*
block39_data_ref (Block39Data* _data39_)
{
	g_atomic_int_inc (&_data39_->_ref_count_);
	return _data39_;
}

static void
block39_data_unref (void * _userdata_)
{
	Block39Data* _data39_;
	_data39_ = (Block39Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data39_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data39_->self;
		_g_object_unref0 (self);
		g_slice_free (Block39Data, _data39_);
	}
}

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

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

void
dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                gboolean v)
{
	Block39Data* _data39_;
	g_return_if_fail (self != NULL);
	_data39_ = g_slice_new0 (Block39Data);
	_data39_->_ref_count_ = 1;
	_data39_->self = g_object_ref (self);
	_data39_->v = v;
	dc_settings_manager_set_notifications_enabled (self, _data39_->v);
	dc_settings_manager_save_to_file (self, ___lambda11__dc_setting_writer, _data39_);
	block39_data_unref (_data39_);
	_data39_ = NULL;
}

static Block40Data*
block40_data_ref (Block40Data* _data40_)
{
	g_atomic_int_inc (&_data40_->_ref_count_);
	return _data40_;
}

static void
block40_data_unref (void * _userdata_)
{
	Block40Data* _data40_;
	_data40_ = (Block40Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data40_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data40_->self;
		_g_object_unref0 (self);
		g_slice_free (Block40Data, _data40_);
	}
}

static void
__lambda12_ (Block40Data* _data40_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data40_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_boolean (kf, "General", "minimize_to_tray", _data40_->v);
}

static void
___lambda12__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda12_ (self, kf);
}

void
dc_settings_manager_save_minimize_to_tray (DcSettingsManager* self,
                                           gboolean v)
{
	Block40Data* _data40_;
	g_return_if_fail (self != NULL);
	_data40_ = g_slice_new0 (Block40Data);
	_data40_->_ref_count_ = 1;
	_data40_->self = g_object_ref (self);
	_data40_->v = v;
	dc_settings_manager_set_minimize_to_tray (self, _data40_->v);
	dc_settings_manager_save_to_file (self, ___lambda12__dc_setting_writer, _data40_);
	block40_data_unref (_data40_);
	_data40_ = NULL;
}

static Block41Data*
block41_data_ref (Block41Data* _data41_)
{
	g_atomic_int_inc (&_data41_->_ref_count_);
	return _data41_;
}

static void
block41_data_unref (void * _userdata_)
{
	Block41Data* _data41_;
	_data41_ = (Block41Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data41_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data41_->self;
		_g_free0 (_data41_->v);
		_g_object_unref0 (self);
		g_slice_free (Block41Data, _data41_);
	}
}

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

static void
___lambda13__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda13_ (self, kf);
}

void
dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                          const gchar* v)
{
	Block41Data* _data41_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data41_ = g_slice_new0 (Block41Data);
	_data41_->_ref_count_ = 1;
	_data41_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data41_->v);
	_data41_->v = _tmp0_;
	dc_settings_manager_set_rpc_server_path (self, _data41_->v);
	dc_settings_manager_save_to_file (self, ___lambda13__dc_setting_writer, _data41_);
	block41_data_unref (_data41_);
	_data41_ = NULL;
}

static Block42Data*
block42_data_ref (Block42Data* _data42_)
{
	g_atomic_int_inc (&_data42_->_ref_count_);
	return _data42_;
}

static void
block42_data_unref (void * _userdata_)
{
	Block42Data* _data42_;
	_data42_ = (Block42Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data42_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data42_->self;
		_g_object_unref0 (self);
		g_slice_free (Block42Data, _data42_);
	}
}

static void
__lambda14_ (Block42Data* _data42_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data42_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_integer (kf, "General", "rpc_server_source", (gint) _data42_->v);
}

static void
___lambda14__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda14_ (self, kf);
}

void
dc_settings_manager_save_rpc_server_source (DcSettingsManager* self,
                                            DcRpcServerSource v)
{
	Block42Data* _data42_;
	g_return_if_fail (self != NULL);
	_data42_ = g_slice_new0 (Block42Data);
	_data42_->_ref_count_ = 1;
	_data42_->self = g_object_ref (self);
	_data42_->v = v;
	dc_settings_manager_set_rpc_server_source (self, _data42_->v);
	dc_settings_manager_save_to_file (self, ___lambda14__dc_setting_writer, _data42_);
	block42_data_unref (_data42_);
	_data42_ = NULL;
}

static Block43Data*
block43_data_ref (Block43Data* _data43_)
{
	g_atomic_int_inc (&_data43_->_ref_count_);
	return _data43_;
}

static void
block43_data_unref (void * _userdata_)
{
	Block43Data* _data43_;
	_data43_ = (Block43Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data43_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data43_->self;
		_g_object_unref0 (self);
		g_slice_free (Block43Data, _data43_);
	}
}

static void
__lambda15_ (Block43Data* _data43_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data43_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_boolean (kf, "General", "rpc_check_updates_on_startup", _data43_->v);
}

static void
___lambda15__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda15_ (self, kf);
}

void
dc_settings_manager_save_rpc_check_updates_on_startup (DcSettingsManager* self,
                                                       gboolean v)
{
	Block43Data* _data43_;
	g_return_if_fail (self != NULL);
	_data43_ = g_slice_new0 (Block43Data);
	_data43_->_ref_count_ = 1;
	_data43_->self = g_object_ref (self);
	_data43_->v = v;
	dc_settings_manager_set_rpc_check_updates_on_startup (self, _data43_->v);
	dc_settings_manager_save_to_file (self, ___lambda15__dc_setting_writer, _data43_);
	block43_data_unref (_data43_);
	_data43_ = NULL;
}

static Block44Data*
block44_data_ref (Block44Data* _data44_)
{
	g_atomic_int_inc (&_data44_->_ref_count_);
	return _data44_;
}

static void
block44_data_unref (void * _userdata_)
{
	Block44Data* _data44_;
	_data44_ = (Block44Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data44_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data44_->self;
		_g_object_unref0 (self);
		g_slice_free (Block44Data, _data44_);
	}
}

static void
__lambda16_ (Block44Data* _data44_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data44_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_integer (kf, "General", "sidebar_mode", (gint) _data44_->v);
}

static void
___lambda16__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda16_ (self, kf);
}

void
dc_settings_manager_save_sidebar_mode (DcSettingsManager* self,
                                       DcSidebarMode v)
{
	Block44Data* _data44_;
	g_return_if_fail (self != NULL);
	_data44_ = g_slice_new0 (Block44Data);
	_data44_->_ref_count_ = 1;
	_data44_->self = g_object_ref (self);
	_data44_->v = v;
	dc_settings_manager_set_sidebar_mode (self, _data44_->v);
	dc_settings_manager_save_to_file (self, ___lambda16__dc_setting_writer, _data44_);
	block44_data_unref (_data44_);
	_data44_ = NULL;
}

static Block45Data*
block45_data_ref (Block45Data* _data45_)
{
	g_atomic_int_inc (&_data45_->_ref_count_);
	return _data45_;
}

static void
block45_data_unref (void * _userdata_)
{
	Block45Data* _data45_;
	_data45_ = (Block45Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data45_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data45_->self;
		_g_free0 (_data45_->v);
		_g_object_unref0 (self);
		g_slice_free (Block45Data, _data45_);
	}
}

static void
__lambda17_ (Block45Data* _data45_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data45_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_string (kf, "General", "default_account_addr", _data45_->v);
}

static void
___lambda17__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda17_ (self, kf);
}

void
dc_settings_manager_save_default_account_addr (DcSettingsManager* self,
                                               const gchar* v)
{
	Block45Data* _data45_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data45_ = g_slice_new0 (Block45Data);
	_data45_->_ref_count_ = 1;
	_data45_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data45_->v);
	_data45_->v = _tmp0_;
	dc_settings_manager_set_default_account_addr (self, _data45_->v);
	dc_settings_manager_save_to_file (self, ___lambda17__dc_setting_writer, _data45_);
	block45_data_unref (_data45_);
	_data45_ = NULL;
}

static Block46Data*
block46_data_ref (Block46Data* _data46_)
{
	g_atomic_int_inc (&_data46_->_ref_count_);
	return _data46_;
}

static void
block46_data_unref (void * _userdata_)
{
	Block46Data* _data46_;
	_data46_ = (Block46Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data46_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data46_->self;
		_g_object_unref0 (self);
		g_slice_free (Block46Data, _data46_);
	}
}

static void
__lambda18_ (Block46Data* _data46_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data46_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_integer (kf, "General", "message_style", (gint) _data46_->v);
}

static void
___lambda18__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda18_ (self, kf);
}

void
dc_settings_manager_save_message_style (DcSettingsManager* self,
                                        DcMessageStyle v)
{
	Block46Data* _data46_;
	g_return_if_fail (self != NULL);
	_data46_ = g_slice_new0 (Block46Data);
	_data46_->_ref_count_ = 1;
	_data46_->self = g_object_ref (self);
	_data46_->v = v;
	dc_settings_manager_set_message_style (self, _data46_->v);
	dc_settings_manager_save_to_file (self, ___lambda18__dc_setting_writer, _data46_);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
	block46_data_unref (_data46_);
	_data46_ = NULL;
}

static Block47Data*
block47_data_ref (Block47Data* _data47_)
{
	g_atomic_int_inc (&_data47_->_ref_count_);
	return _data47_;
}

static void
block47_data_unref (void * _userdata_)
{
	Block47Data* _data47_;
	_data47_ = (Block47Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data47_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data47_->self;
		_g_free0 (_data47_->v);
		_g_object_unref0 (self);
		g_slice_free (Block47Data, _data47_);
	}
}

static void
__lambda19_ (Block47Data* _data47_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data47_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_string (kf, "General", "accent_color", _data47_->v);
}

static void
___lambda19__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda19_ (self, kf);
}

void
dc_settings_manager_save_accent_color (DcSettingsManager* self,
                                       const gchar* v)
{
	Block47Data* _data47_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data47_ = g_slice_new0 (Block47Data);
	_data47_->_ref_count_ = 1;
	_data47_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data47_->v);
	_data47_->v = _tmp0_;
	dc_settings_manager_set_accent_color (self, _data47_->v);
	dc_settings_manager_save_to_file (self, ___lambda19__dc_setting_writer, _data47_);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
	block47_data_unref (_data47_);
	_data47_ = NULL;
}

static Block48Data*
block48_data_ref (Block48Data* _data48_)
{
	g_atomic_int_inc (&_data48_->_ref_count_);
	return _data48_;
}

static void
block48_data_unref (void * _userdata_)
{
	Block48Data* _data48_;
	_data48_ = (Block48Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data48_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data48_->self;
		_g_object_unref0 (self);
		g_slice_free (Block48Data, _data48_);
	}
}

static void
__lambda20_ (Block48Data* _data48_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data48_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_integer (kf, "General", "background_mode", (gint) _data48_->v);
}

static void
___lambda20__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda20_ (self, kf);
}

void
dc_settings_manager_save_background_mode (DcSettingsManager* self,
                                          DcBackgroundMode v)
{
	Block48Data* _data48_;
	g_return_if_fail (self != NULL);
	_data48_ = g_slice_new0 (Block48Data);
	_data48_->_ref_count_ = 1;
	_data48_->self = g_object_ref (self);
	_data48_->v = v;
	dc_settings_manager_set_background_mode (self, _data48_->v);
	dc_settings_manager_save_to_file (self, ___lambda20__dc_setting_writer, _data48_);
	block48_data_unref (_data48_);
	_data48_ = NULL;
}

static Block49Data*
block49_data_ref (Block49Data* _data49_)
{
	g_atomic_int_inc (&_data49_->_ref_count_);
	return _data49_;
}

static void
block49_data_unref (void * _userdata_)
{
	Block49Data* _data49_;
	_data49_ = (Block49Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data49_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data49_->self;
		_g_free0 (_data49_->v);
		_g_object_unref0 (self);
		g_slice_free (Block49Data, _data49_);
	}
}

static void
__lambda21_ (Block49Data* _data49_,
             GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data49_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_string (kf, "General", "background_color", _data49_->v);
}

static void
___lambda21__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda21_ (self, kf);
}

void
dc_settings_manager_save_background_color (DcSettingsManager* self,
                                           const gchar* v)
{
	Block49Data* _data49_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data49_ = g_slice_new0 (Block49Data);
	_data49_->_ref_count_ = 1;
	_data49_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data49_->v);
	_data49_->v = _tmp0_;
	dc_settings_manager_set_background_color (self, _data49_->v);
	dc_settings_manager_save_to_file (self, ___lambda21__dc_setting_writer, _data49_);
	block49_data_unref (_data49_);
	_data49_ = 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:203: 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]);
	}
}

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

void
dc_settings_manager_set_minimize_to_tray (DcSettingsManager* self,
                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_minimize_to_tray (self);
	if (old_value != value) {
		self->priv->_minimize_to_tray = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_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]);
	}
}

DcRpcServerSource
dc_settings_manager_get_rpc_server_source (DcSettingsManager* self)
{
	DcRpcServerSource result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_rpc_server_source;
	return result;
}

void
dc_settings_manager_set_rpc_server_source (DcSettingsManager* self,
                                           DcRpcServerSource value)
{
	DcRpcServerSource old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_rpc_server_source (self);
	if (old_value != value) {
		self->priv->_rpc_server_source = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY]);
	}
}

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

void
dc_settings_manager_set_rpc_check_updates_on_startup (DcSettingsManager* self,
                                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_rpc_check_updates_on_startup (self);
	if (old_value != value) {
		self->priv->_rpc_check_updates_on_startup = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY]);
	}
}

DcSidebarMode
dc_settings_manager_get_sidebar_mode (DcSettingsManager* self)
{
	DcSidebarMode result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_sidebar_mode;
	return result;
}

void
dc_settings_manager_set_sidebar_mode (DcSettingsManager* self,
                                      DcSidebarMode value)
{
	DcSidebarMode old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_sidebar_mode (self);
	if (old_value != value) {
		self->priv->_sidebar_mode = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY]);
	}
}

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

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

DcMessageStyle
dc_settings_manager_get_message_style (DcSettingsManager* self)
{
	DcMessageStyle result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_message_style;
	return result;
}

void
dc_settings_manager_set_message_style (DcSettingsManager* self,
                                       DcMessageStyle value)
{
	DcMessageStyle old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_message_style (self);
	if (old_value != value) {
		self->priv->_message_style = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY]);
	}
}

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

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

DcBackgroundMode
dc_settings_manager_get_background_mode (DcSettingsManager* self)
{
	DcBackgroundMode result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_background_mode;
	return result;
}

void
dc_settings_manager_set_background_mode (DcSettingsManager* self,
                                         DcBackgroundMode value)
{
	DcBackgroundMode old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_background_mode (self);
	if (old_value != value) {
		self->priv->_background_mode = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_BACKGROUND_MODE_PROPERTY]);
	}
}

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

void
dc_settings_manager_set_background_color (DcSettingsManager* self,
                                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_background_color (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_background_color);
		self->priv->_background_color = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_BACKGROUND_COLOR_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_MINIMIZE_TO_TRAY_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY] = g_param_spec_boolean ("minimize-to-tray", "minimize-to-tray", "minimize-to-tray", FALSE, 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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY] = g_param_spec_enum ("rpc-server-source", "rpc-server-source", "rpc-server-source", DC_TYPE_RPC_SERVER_SOURCE, DC_RPC_SERVER_SOURCE_AUTO, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY] = g_param_spec_boolean ("rpc-check-updates-on-startup", "rpc-check-updates-on-startup", "rpc-check-updates-on-startup", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY] = g_param_spec_enum ("sidebar-mode", "sidebar-mode", "sidebar-mode", DC_TYPE_SIDEBAR_MODE, DC_SIDEBAR_MODE_FULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY] = g_param_spec_string ("default-account-addr", "default-account-addr", "default-account-addr", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY] = g_param_spec_enum ("message-style", "message-style", "message-style", DC_TYPE_MESSAGE_STYLE, DC_MESSAGE_STYLE_BUBBLES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY] = g_param_spec_string ("accent-color", "accent-color", "accent-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_BACKGROUND_MODE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_BACKGROUND_MODE_PROPERTY] = g_param_spec_enum ("background-mode", "background-mode", "background-mode", DC_TYPE_BACKGROUND_MODE, DC_BACKGROUND_MODE_SYSTEM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_BACKGROUND_COLOR_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_BACKGROUND_COLOR_PROPERTY] = g_param_spec_string ("background-color", "background-color", "background-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL] = g_signal_new ("appearance-changed", DC_TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dc_settings_manager_instance_init (DcSettingsManager * self,
                                   gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	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;
	self->priv->_minimize_to_tray = FALSE;
	_tmp0_ = g_strdup ("");
	self->priv->_rpc_server_path = _tmp0_;
	self->priv->_rpc_server_source = DC_RPC_SERVER_SOURCE_AUTO;
	self->priv->_rpc_check_updates_on_startup = TRUE;
	self->priv->_sidebar_mode = DC_SIDEBAR_MODE_FULL;
	_tmp1_ = g_strdup ("");
	self->priv->_default_account_addr = _tmp1_;
	self->priv->_message_style = DC_MESSAGE_STYLE_BUBBLES;
	_tmp2_ = g_strdup ("");
	self->priv->_accent_color = _tmp2_;
	self->priv->_background_mode = DC_BACKGROUND_MODE_SYSTEM;
	_tmp3_ = g_strdup ("");
	self->priv->_background_color = _tmp3_;
}

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_free0 (self->priv->_default_account_addr);
	_g_free0 (self->priv->_accent_color);
	_g_free0 (self->priv->_background_color);
	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_MINIMIZE_TO_TRAY_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_minimize_to_tray (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_rpc_server_path (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_rpc_server_source (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_rpc_check_updates_on_startup (self));
		break;
		case DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_sidebar_mode (self));
		break;
		case DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_default_account_addr (self));
		break;
		case DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_message_style (self));
		break;
		case DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_accent_color (self));
		break;
		case DC_SETTINGS_MANAGER_BACKGROUND_MODE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_background_mode (self));
		break;
		case DC_SETTINGS_MANAGER_BACKGROUND_COLOR_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_background_color (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_MINIMIZE_TO_TRAY_PROPERTY:
		dc_settings_manager_set_minimize_to_tray (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;
		case DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY:
		dc_settings_manager_set_rpc_server_source (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY:
		dc_settings_manager_set_rpc_check_updates_on_startup (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY:
		dc_settings_manager_set_sidebar_mode (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY:
		dc_settings_manager_set_default_account_addr (self, g_value_get_string (value));
		break;
		case DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY:
		dc_settings_manager_set_message_style (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY:
		dc_settings_manager_set_accent_color (self, g_value_get_string (value));
		break;
		case DC_SETTINGS_MANAGER_BACKGROUND_MODE_PROPERTY:
		dc_settings_manager_set_background_mode (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_BACKGROUND_COLOR_PROPERTY:
		dc_settings_manager_set_background_color (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 Block50Data*
block50_data_ref (Block50Data* _data50_)
{
	g_atomic_int_inc (&_data50_->_ref_count_);
	return _data50_;
}

static void
block50_data_unref (void * _userdata_)
{
	Block50Data* _data50_;
	_data50_ = (Block50Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data50_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data50_->self;
		_g_object_unref0 (_data50_->autocheck_switch);
		_g_object_unref0 (_data50_->bg_color_btn);
		_g_object_unref0 (_data50_->bg_mode_combo);
		_g_object_unref0 (_data50_->accent_btn);
		_g_object_unref0 (_data50_->style_combo);
		_g_object_unref0 (_data50_->notif_switch);
		_g_object_unref0 (_data50_->shift_switch);
		_g_object_unref0 (_data50_->md_switch);
		_g_object_unref0 (_data50_->dblclick_combo);
		_g_object_unref0 (self);
		g_slice_free (Block50Data, _data50_);
	}
}

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

static void
__lambda200_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkDropDown* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data50_->dblclick_combo;
	_tmp3_ = gtk_drop_down_get_selected (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_double_click_action (_tmp1_, (gint) _tmp4_);
}

static void
___lambda200__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda200_ (self);
}

static void
__lambda201_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkSwitch* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data50_->md_switch;
	_tmp3_ = gtk_switch_get_active (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_markdown_rendering (_tmp1_, _tmp4_);
}

static void
___lambda201__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda201_ (self);
}

static void
__lambda202_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkSwitch* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data50_->shift_switch;
	_tmp3_ = gtk_switch_get_active (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_shift_enter_sends (_tmp1_, _tmp4_);
}

static void
___lambda202__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda202_ (self);
}

static void
__lambda203_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkSwitch* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data50_->notif_switch;
	_tmp3_ = gtk_switch_get_active (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_notifications_enabled (_tmp1_, _tmp4_);
}

static void
___lambda203__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda203_ (self);
}

static Block51Data*
block51_data_ref (Block51Data* _data51_)
{
	g_atomic_int_inc (&_data51_->_ref_count_);
	return _data51_;
}

static void
block51_data_unref (void * _userdata_)
{
	Block51Data* _data51_;
	_data51_ = (Block51Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data51_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data51_->_data50_->self;
		_g_object_unref0 (_data51_->tray_switch);
		block50_data_unref (_data51_->_data50_);
		_data51_->_data50_ = NULL;
		g_slice_free (Block51Data, _data51_);
	}
}

static void
___lambda204_ (Block51Data* _data51_)
{
	Block50Data* _data50_;
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkSwitch* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	_data50_ = _data51_->_data50_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data51_->tray_switch;
	_tmp3_ = gtk_switch_get_active (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_minimize_to_tray (_tmp1_, _tmp4_);
}

static void
____lambda204__g_object_notify (GObject* _sender,
                                GParamSpec* pspec,
                                gpointer self)
{
	___lambda204_ (self);
}

static void
__lambda205_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_drop_down_get_selected (_data50_->style_combo);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_message_style (_tmp1_, (DcMessageStyle) _tmp3_);
}

static void
___lambda205__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda205_ (self);
}

static void
__lambda206_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	GdkRGBA c = {0};
	gchar* hex = NULL;
	GdkRGBA _tmp0_;
	GdkRGBA _tmp1_;
	GdkRGBA _tmp2_;
	gchar* _tmp3_;
	DcWindow* _tmp4_;
	DcSettingsManager* _tmp5_;
	self = _data50_->self;
	c = *gtk_color_dialog_button_get_rgba (_data50_->accent_btn);
	_tmp0_ = c;
	_tmp1_ = c;
	_tmp2_ = c;
	_tmp3_ = g_strdup_printf ("#%02x%02x%02x", (guint) (_tmp0_.red * 255), (guint) (_tmp1_.green * 255), (guint) (_tmp2_.blue * 255));
	hex = _tmp3_;
	_tmp4_ = self->priv->app_window;
	_tmp5_ = _tmp4_->settings;
	dc_settings_manager_save_accent_color (_tmp5_, hex);
	_g_free0 (hex);
}

static void
___lambda206__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda206_ (self);
}

static void
__lambda207_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	dc_settings_manager_save_accent_color (_tmp1_, "");
	dc_settings_dialog_apply_hex_to_button (_data50_->accent_btn, "");
}

static void
___lambda207__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda207_ (self);
}

static void
__lambda208_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcBackgroundMode mode = 0;
	guint _tmp0_;
	guint _tmp1_;
	DcWindow* _tmp2_;
	DcSettingsManager* _tmp3_;
	self = _data50_->self;
	_tmp0_ = gtk_drop_down_get_selected (_data50_->bg_mode_combo);
	_tmp1_ = _tmp0_;
	mode = (DcBackgroundMode) _tmp1_;
	gtk_widget_set_sensitive ((GtkWidget*) _data50_->bg_color_btn, mode != DC_BACKGROUND_MODE_SYSTEM);
	_tmp2_ = self->priv->app_window;
	_tmp3_ = _tmp2_->settings;
	dc_settings_manager_save_background_mode (_tmp3_, mode);
	dc_settings_dialog_apply_background (self);
}

static void
___lambda208__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda208_ (self);
}

static void
__lambda209_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	GdkRGBA c = {0};
	gchar* hex = NULL;
	GdkRGBA _tmp0_;
	GdkRGBA _tmp1_;
	GdkRGBA _tmp2_;
	gchar* _tmp3_;
	DcWindow* _tmp4_;
	DcSettingsManager* _tmp5_;
	self = _data50_->self;
	c = *gtk_color_dialog_button_get_rgba (_data50_->bg_color_btn);
	_tmp0_ = c;
	_tmp1_ = c;
	_tmp2_ = c;
	_tmp3_ = g_strdup_printf ("#%02x%02x%02x", (guint) (_tmp0_.red * 255), (guint) (_tmp1_.green * 255), (guint) (_tmp2_.blue * 255));
	hex = _tmp3_;
	_tmp4_ = self->priv->app_window;
	_tmp5_ = _tmp4_->settings;
	dc_settings_manager_save_background_color (_tmp5_, hex);
	dc_settings_dialog_apply_background (self);
	_g_free0 (hex);
}

static void
___lambda209__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda209_ (self);
}

static void
__lambda210_ (DcSettingsDialog* self)
{
	if (!self->priv->loading_proxy) {
		dc_settings_dialog_save_proxy_settings (self, NULL, NULL);
	}
}

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

static void
__lambda211_ (DcSettingsDialog* self)
{
	dc_settings_dialog_save_proxy_settings (self, NULL, NULL);
}

static void
___lambda211__gtk_entry_activate (GtkEntry* _sender,
                                  gpointer self)
{
	__lambda211_ ((DcSettingsDialog*) self);
}

static void
__lambda212_ (DcSettingsDialog* self)
{
	dc_settings_dialog_save_proxy_settings (self, NULL, NULL);
}

static void
___lambda212__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                gpointer self)
{
	__lambda212_ ((DcSettingsDialog*) self);
}

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

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

static void
___lambda221__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda221_ ((DcSettingsDialog*) self);
}

static void
__lambda222_ (DcSettingsDialog* self)
{
	dc_settings_dialog_install_managed_server (self, NULL, NULL);
}

static void
___lambda222__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda222_ ((DcSettingsDialog*) self);
}

static void
__lambda224_ (DcSettingsDialog* self)
{
	dc_settings_dialog_check_rpc_updates (self, NULL, NULL);
}

static void
___lambda224__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda224_ ((DcSettingsDialog*) self);
}

static void
__lambda225_ (Block50Data* _data50_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data50_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_switch_get_active (_data50_->autocheck_switch);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_rpc_check_updates_on_startup (_tmp1_, _tmp3_);
}

static void
___lambda225__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda225_ (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,
                              DcWindow* window,
                              DcRpcClient* rpc)
{
	DcSettingsDialog * self = NULL;
	Block50Data* _data50_;
	DcRpcClient* _tmp0_;
	GtkBox* box = NULL;
	GtkBox* _tmp1_;
	AdwHeaderBar* header = NULL;
	AdwHeaderBar* _tmp2_;
	AdwHeaderBar* _tmp3_;
	GtkBox* _tmp4_;
	AdwHeaderBar* _tmp5_;
	GtkBox* _tmp6_;
	GtkBox* _tmp7_;
	GtkBox* _tmp8_;
	GtkBox* _tmp9_;
	GtkBox* _tmp10_;
	GtkLabel* behavior_label = NULL;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkLabel* _tmp13_;
	GtkBox* _tmp14_;
	GtkLabel* _tmp15_;
	GtkListBox* behavior_list = NULL;
	GtkListBox* _tmp16_;
	GtkListBox* _tmp17_;
	GtkListBox* _tmp18_;
	AdwActionRow* dblclick_row = NULL;
	AdwActionRow* _tmp19_;
	AdwActionRow* _tmp20_;
	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_;
	gchar** _tmp28_;
	gint _tmp28__length1;
	GtkDropDown* _tmp29_;
	GtkDropDown* _tmp30_;
	DcWindow* _tmp31_;
	DcSettingsManager* _tmp32_;
	gint _tmp33_;
	gint _tmp34_;
	GtkDropDown* _tmp35_;
	GtkDropDown* _tmp36_;
	AdwActionRow* _tmp37_;
	GtkDropDown* _tmp38_;
	AdwActionRow* _tmp39_;
	GtkDropDown* _tmp40_;
	GtkListBox* _tmp41_;
	AdwActionRow* _tmp42_;
	AdwActionRow* md_row = NULL;
	AdwActionRow* _tmp43_;
	AdwActionRow* _tmp44_;
	AdwActionRow* _tmp45_;
	GtkSwitch* _tmp46_;
	GtkSwitch* _tmp47_;
	GtkSwitch* _tmp48_;
	GtkSwitch* _tmp49_;
	AdwActionRow* _tmp50_;
	GtkSwitch* _tmp51_;
	AdwActionRow* _tmp52_;
	GtkSwitch* _tmp53_;
	GtkListBox* _tmp54_;
	AdwActionRow* _tmp55_;
	AdwActionRow* shift_row = NULL;
	AdwActionRow* _tmp56_;
	AdwActionRow* _tmp57_;
	AdwActionRow* _tmp58_;
	GtkSwitch* _tmp59_;
	GtkSwitch* _tmp60_;
	DcWindow* _tmp61_;
	DcSettingsManager* _tmp62_;
	gboolean _tmp63_;
	gboolean _tmp64_;
	GtkSwitch* _tmp65_;
	GtkSwitch* _tmp66_;
	AdwActionRow* _tmp67_;
	GtkSwitch* _tmp68_;
	AdwActionRow* _tmp69_;
	GtkSwitch* _tmp70_;
	GtkListBox* _tmp71_;
	AdwActionRow* _tmp72_;
	AdwActionRow* notif_row = NULL;
	AdwActionRow* _tmp73_;
	AdwActionRow* _tmp74_;
	AdwActionRow* _tmp75_;
	GtkSwitch* _tmp76_;
	GtkSwitch* _tmp77_;
	DcWindow* _tmp78_;
	DcSettingsManager* _tmp79_;
	gboolean _tmp80_;
	gboolean _tmp81_;
	GtkSwitch* _tmp82_;
	GtkSwitch* _tmp83_;
	AdwActionRow* _tmp84_;
	GtkSwitch* _tmp85_;
	AdwActionRow* _tmp86_;
	GtkSwitch* _tmp87_;
	GtkListBox* _tmp88_;
	AdwActionRow* _tmp89_;
	GtkBox* _tmp107_;
	GtkListBox* _tmp108_;
	GtkLabel* appearance_label = NULL;
	GtkLabel* _tmp109_;
	GtkBox* _tmp110_;
	GtkListBox* appearance_list = NULL;
	GtkListBox* _tmp111_;
	AdwActionRow* style_row = NULL;
	AdwActionRow* _tmp112_;
	gchar** style_labels = NULL;
	gchar* _tmp113_;
	gchar* _tmp114_;
	gchar** _tmp115_;
	gint style_labels_length1;
	gint _style_labels_size_;
	GtkDropDown* _tmp116_;
	DcWindow* _tmp117_;
	DcSettingsManager* _tmp118_;
	DcMessageStyle _tmp119_;
	DcMessageStyle _tmp120_;
	AdwActionRow* accent_row = NULL;
	AdwActionRow* _tmp121_;
	GtkColorDialog* _tmp122_;
	GtkColorDialogButton* _tmp123_;
	DcWindow* _tmp124_;
	DcSettingsManager* _tmp125_;
	const gchar* _tmp126_;
	const gchar* _tmp127_;
	GtkButton* accent_reset_btn = NULL;
	GtkButton* _tmp128_;
	AdwActionRow* bg_row = NULL;
	AdwActionRow* _tmp129_;
	gchar** bg_mode_labels = NULL;
	gchar* _tmp130_;
	gchar* _tmp131_;
	gchar* _tmp132_;
	gchar** _tmp133_;
	gint bg_mode_labels_length1;
	gint _bg_mode_labels_size_;
	GtkDropDown* _tmp134_;
	DcWindow* _tmp135_;
	DcSettingsManager* _tmp136_;
	DcBackgroundMode _tmp137_;
	DcBackgroundMode _tmp138_;
	GtkColorDialog* _tmp139_;
	GtkColorDialogButton* _tmp140_;
	DcWindow* _tmp141_;
	DcSettingsManager* _tmp142_;
	const gchar* _tmp143_;
	const gchar* _tmp144_;
	DcWindow* _tmp145_;
	DcSettingsManager* _tmp146_;
	DcBackgroundMode _tmp147_;
	DcBackgroundMode _tmp148_;
	GtkBox* _tmp149_;
	GtkLabel* network_label = NULL;
	GtkLabel* _tmp150_;
	GtkBox* _tmp151_;
	GtkListBox* network_list = NULL;
	GtkListBox* _tmp152_;
	AdwActionRow* _tmp153_;
	AdwActionRow* _tmp154_;
	AdwActionRow* _tmp155_;
	GtkSwitch* _tmp156_;
	GtkSwitch* _tmp157_;
	GtkSwitch* _tmp158_;
	AdwActionRow* _tmp159_;
	GtkSwitch* _tmp160_;
	AdwActionRow* _tmp161_;
	GtkSwitch* _tmp162_;
	AdwActionRow* _tmp163_;
	AdwActionRow* _tmp164_;
	AdwActionRow* _tmp165_;
	AdwActionRow* _tmp166_;
	GtkEntry* _tmp167_;
	GtkEntry* _tmp168_;
	GtkEntry* _tmp169_;
	GtkEntry* _tmp170_;
	GtkEntry* _tmp171_;
	GtkEntry* _tmp172_;
	GtkEventControllerFocus* proxy_focus = NULL;
	GtkEventControllerFocus* _tmp173_;
	GtkEntry* _tmp174_;
	GtkEventController* _tmp175_;
	AdwActionRow* _tmp176_;
	GtkEntry* _tmp177_;
	AdwActionRow* _tmp178_;
	GtkEntry* _tmp179_;
	AdwActionRow* _tmp180_;
	GtkBox* _tmp181_;
	GtkLabel* advanced_label = NULL;
	GtkLabel* _tmp182_;
	GtkBox* _tmp183_;
	GtkListBox* advanced_list = NULL;
	GtkListBox* _tmp184_;
	AdwActionRow* _tmp185_;
	AdwActionRow* _tmp186_;
	gchar** rpc_source_labels = NULL;
	gchar* _tmp187_;
	gchar* _tmp188_;
	gchar* _tmp189_;
	gchar** _tmp190_;
	gint rpc_source_labels_length1;
	gint _rpc_source_labels_size_;
	GtkDropDown* _tmp191_;
	GtkDropDown* _tmp192_;
	DcWindow* _tmp193_;
	DcSettingsManager* _tmp194_;
	DcRpcServerSource _tmp195_;
	DcRpcServerSource _tmp196_;
	GtkDropDown* _tmp197_;
	GtkDropDown* _tmp198_;
	AdwActionRow* _tmp199_;
	GtkDropDown* _tmp200_;
	AdwActionRow* _tmp201_;
	GtkDropDown* _tmp202_;
	GtkButton* _tmp203_;
	GtkButton* _tmp204_;
	GtkButton* _tmp205_;
	GtkButton* _tmp206_;
	GtkButton* _tmp207_;
	AdwActionRow* _tmp208_;
	GtkButton* _tmp209_;
	GtkButton* _tmp210_;
	GtkButton* _tmp211_;
	GtkButton* _tmp212_;
	GtkButton* _tmp213_;
	GtkButton* _tmp214_;
	AdwActionRow* _tmp215_;
	GtkButton* _tmp216_;
	AdwActionRow* _tmp217_;
	AdwActionRow* _tmp218_;
	AdwActionRow* _tmp219_;
	AdwActionRow* _tmp220_;
	GtkButton* _tmp221_;
	GtkButton* _tmp222_;
	GtkButton* _tmp223_;
	GtkButton* _tmp224_;
	GtkButton* _tmp225_;
	AdwActionRow* _tmp226_;
	GtkButton* _tmp227_;
	AdwActionRow* _tmp228_;
	AdwActionRow* rpc_autocheck_row = NULL;
	AdwActionRow* _tmp229_;
	GtkSwitch* _tmp230_;
	DcWindow* _tmp231_;
	DcSettingsManager* _tmp232_;
	gboolean _tmp233_;
	gboolean _tmp234_;
	GtkBox* _tmp235_;
	GtkBox* reset_box = NULL;
	GtkBox* _tmp236_;
	GtkButton* reset_btn = NULL;
	GtkButton* _tmp237_;
	GtkLabel* reset_label = NULL;
	GtkLabel* _tmp238_;
	GtkBox* _tmp239_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp240_;
	GtkBox* _tmp241_;
	GtkBox* _tmp242_;
	GtkBox* _tmp243_;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	_data50_ = g_slice_new0 (Block50Data);
	_data50_->_ref_count_ = 1;
	self = (DcSettingsDialog*) g_object_new (object_type, NULL);
	_data50_->self = g_object_ref (self);
	self->priv->app_window = window;
	_tmp0_ = _g_object_ref0 (rpc);
	_g_object_unref0 (self->priv->rpc);
	self->priv->rpc = _tmp0_;
	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_;
	_tmp3_ = header;
	adw_header_bar_set_show_end_title_buttons (_tmp3_, TRUE);
	_tmp4_ = box;
	_tmp5_ = header;
	gtk_box_append (_tmp4_, (GtkWidget*) _tmp5_);
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 16);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->content);
	self->priv->content = _tmp6_;
	_tmp7_ = self->priv->content;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp7_, 16);
	_tmp8_ = self->priv->content;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp8_, 16);
	_tmp9_ = self->priv->content;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp9_, 12);
	_tmp10_ = self->priv->content;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp10_, 16);
	_tmp11_ = (GtkLabel*) gtk_label_new ("Behavior");
	g_object_ref_sink (_tmp11_);
	behavior_label = _tmp11_;
	_tmp12_ = behavior_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp12_, "title-3");
	_tmp13_ = behavior_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp13_, GTK_ALIGN_START);
	_tmp14_ = self->priv->content;
	_tmp15_ = behavior_label;
	gtk_box_append (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp16_);
	behavior_list = _tmp16_;
	_tmp17_ = behavior_list;
	gtk_list_box_set_selection_mode (_tmp17_, GTK_SELECTION_NONE);
	_tmp18_ = behavior_list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp18_, "boxed-list");
	_tmp19_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp19_);
	dblclick_row = _tmp19_;
	_tmp20_ = dblclick_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp20_, "Double-click on message");
	_tmp21_ = dblclick_row;
	adw_action_row_set_subtitle (_tmp21_, "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_ = dblclick_labels;
	_tmp28__length1 = dblclick_labels_length1;
	_tmp29_ = (GtkDropDown*) gtk_drop_down_new_from_strings (_tmp28_);
	g_object_ref_sink (_tmp29_);
	_data50_->dblclick_combo = _tmp29_;
	_tmp30_ = _data50_->dblclick_combo;
	_tmp31_ = self->priv->app_window;
	_tmp32_ = _tmp31_->settings;
	_tmp33_ = dc_settings_manager_get_double_click_action (_tmp32_);
	_tmp34_ = _tmp33_;
	gtk_drop_down_set_selected (_tmp30_, (guint) _tmp34_);
	_tmp35_ = _data50_->dblclick_combo;
	gtk_widget_set_valign ((GtkWidget*) _tmp35_, GTK_ALIGN_CENTER);
	_tmp36_ = _data50_->dblclick_combo;
	g_signal_connect_data ((GObject*) _tmp36_, "notify::selected", (GCallback) ___lambda200__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	_tmp37_ = dblclick_row;
	_tmp38_ = _data50_->dblclick_combo;
	adw_action_row_add_suffix (_tmp37_, (GtkWidget*) _tmp38_);
	_tmp39_ = dblclick_row;
	_tmp40_ = _data50_->dblclick_combo;
	adw_action_row_set_activatable_widget (_tmp39_, (GtkWidget*) _tmp40_);
	_tmp41_ = behavior_list;
	_tmp42_ = dblclick_row;
	gtk_list_box_append (_tmp41_, (GtkWidget*) _tmp42_);
	_tmp43_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp43_);
	md_row = _tmp43_;
	_tmp44_ = md_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp44_, "Markdown rendering");
	_tmp45_ = md_row;
	adw_action_row_set_subtitle (_tmp45_, "Format bold, italic, code and headings");
	_tmp46_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp46_);
	_data50_->md_switch = _tmp46_;
	_tmp47_ = _data50_->md_switch;
	gtk_switch_set_active (_tmp47_, dc_markdown_enabled);
	_tmp48_ = _data50_->md_switch;
	gtk_widget_set_valign ((GtkWidget*) _tmp48_, GTK_ALIGN_CENTER);
	_tmp49_ = _data50_->md_switch;
	g_signal_connect_data ((GObject*) _tmp49_, "notify::active", (GCallback) ___lambda201__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	_tmp50_ = md_row;
	_tmp51_ = _data50_->md_switch;
	adw_action_row_add_suffix (_tmp50_, (GtkWidget*) _tmp51_);
	_tmp52_ = md_row;
	_tmp53_ = _data50_->md_switch;
	adw_action_row_set_activatable_widget (_tmp52_, (GtkWidget*) _tmp53_);
	_tmp54_ = behavior_list;
	_tmp55_ = md_row;
	gtk_list_box_append (_tmp54_, (GtkWidget*) _tmp55_);
	_tmp56_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp56_);
	shift_row = _tmp56_;
	_tmp57_ = shift_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp57_, "Shift+Return sends message");
	_tmp58_ = shift_row;
	adw_action_row_set_subtitle (_tmp58_, "When on, Return inserts a newline and Shift+Return sends");
	_tmp59_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp59_);
	_data50_->shift_switch = _tmp59_;
	_tmp60_ = _data50_->shift_switch;
	_tmp61_ = self->priv->app_window;
	_tmp62_ = _tmp61_->settings;
	_tmp63_ = dc_settings_manager_get_shift_enter_sends (_tmp62_);
	_tmp64_ = _tmp63_;
	gtk_switch_set_active (_tmp60_, _tmp64_);
	_tmp65_ = _data50_->shift_switch;
	gtk_widget_set_valign ((GtkWidget*) _tmp65_, GTK_ALIGN_CENTER);
	_tmp66_ = _data50_->shift_switch;
	g_signal_connect_data ((GObject*) _tmp66_, "notify::active", (GCallback) ___lambda202__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	_tmp67_ = shift_row;
	_tmp68_ = _data50_->shift_switch;
	adw_action_row_add_suffix (_tmp67_, (GtkWidget*) _tmp68_);
	_tmp69_ = shift_row;
	_tmp70_ = _data50_->shift_switch;
	adw_action_row_set_activatable_widget (_tmp69_, (GtkWidget*) _tmp70_);
	_tmp71_ = behavior_list;
	_tmp72_ = shift_row;
	gtk_list_box_append (_tmp71_, (GtkWidget*) _tmp72_);
	_tmp73_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp73_);
	notif_row = _tmp73_;
	_tmp74_ = notif_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp74_, "Desktop notifications");
	_tmp75_ = notif_row;
	adw_action_row_set_subtitle (_tmp75_, "Notify on incoming messages when the window is not focused");
	_tmp76_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp76_);
	_data50_->notif_switch = _tmp76_;
	_tmp77_ = _data50_->notif_switch;
	_tmp78_ = self->priv->app_window;
	_tmp79_ = _tmp78_->settings;
	_tmp80_ = dc_settings_manager_get_notifications_enabled (_tmp79_);
	_tmp81_ = _tmp80_;
	gtk_switch_set_active (_tmp77_, _tmp81_);
	_tmp82_ = _data50_->notif_switch;
	gtk_widget_set_valign ((GtkWidget*) _tmp82_, GTK_ALIGN_CENTER);
	_tmp83_ = _data50_->notif_switch;
	g_signal_connect_data ((GObject*) _tmp83_, "notify::active", (GCallback) ___lambda203__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	_tmp84_ = notif_row;
	_tmp85_ = _data50_->notif_switch;
	adw_action_row_add_suffix (_tmp84_, (GtkWidget*) _tmp85_);
	_tmp86_ = notif_row;
	_tmp87_ = _data50_->notif_switch;
	adw_action_row_set_activatable_widget (_tmp86_, (GtkWidget*) _tmp87_);
	_tmp88_ = behavior_list;
	_tmp89_ = notif_row;
	gtk_list_box_append (_tmp88_, (GtkWidget*) _tmp89_);
	if (!dc_platform_is_macos ()) {
		Block51Data* _data51_;
		AdwActionRow* tray_row = NULL;
		AdwActionRow* _tmp90_;
		AdwActionRow* _tmp91_;
		AdwActionRow* _tmp92_;
		GtkSwitch* _tmp93_;
		GtkSwitch* _tmp94_;
		DcWindow* _tmp95_;
		DcSettingsManager* _tmp96_;
		gboolean _tmp97_;
		gboolean _tmp98_;
		GtkSwitch* _tmp99_;
		GtkSwitch* _tmp100_;
		AdwActionRow* _tmp101_;
		GtkSwitch* _tmp102_;
		AdwActionRow* _tmp103_;
		GtkSwitch* _tmp104_;
		GtkListBox* _tmp105_;
		AdwActionRow* _tmp106_;
		_data51_ = g_slice_new0 (Block51Data);
		_data51_->_ref_count_ = 1;
		_data51_->_data50_ = block50_data_ref (_data50_);
		_tmp90_ = (AdwActionRow*) adw_action_row_new ();
		g_object_ref_sink (_tmp90_);
		tray_row = _tmp90_;
		_tmp91_ = tray_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp91_, "Minimize to status bar");
		_tmp92_ = tray_row;
		adw_action_row_set_subtitle (_tmp92_, "Closing the window keeps Parla running in the status bar; " "notifications still appear");
		_tmp93_ = (GtkSwitch*) gtk_switch_new ();
		g_object_ref_sink (_tmp93_);
		_data51_->tray_switch = _tmp93_;
		_tmp94_ = _data51_->tray_switch;
		_tmp95_ = self->priv->app_window;
		_tmp96_ = _tmp95_->settings;
		_tmp97_ = dc_settings_manager_get_minimize_to_tray (_tmp96_);
		_tmp98_ = _tmp97_;
		gtk_switch_set_active (_tmp94_, _tmp98_);
		_tmp99_ = _data51_->tray_switch;
		gtk_widget_set_valign ((GtkWidget*) _tmp99_, GTK_ALIGN_CENTER);
		_tmp100_ = _data51_->tray_switch;
		g_signal_connect_data ((GObject*) _tmp100_, "notify::active", (GCallback) ____lambda204__g_object_notify, block51_data_ref (_data51_), (GClosureNotify) block51_data_unref, 0);
		_tmp101_ = tray_row;
		_tmp102_ = _data51_->tray_switch;
		adw_action_row_add_suffix (_tmp101_, (GtkWidget*) _tmp102_);
		_tmp103_ = tray_row;
		_tmp104_ = _data51_->tray_switch;
		adw_action_row_set_activatable_widget (_tmp103_, (GtkWidget*) _tmp104_);
		_tmp105_ = behavior_list;
		_tmp106_ = tray_row;
		gtk_list_box_append (_tmp105_, (GtkWidget*) _tmp106_);
		_g_object_unref0 (tray_row);
		block51_data_unref (_data51_);
		_data51_ = NULL;
	}
	_tmp107_ = self->priv->content;
	_tmp108_ = behavior_list;
	gtk_box_append (_tmp107_, (GtkWidget*) _tmp108_);
	_tmp109_ = (GtkLabel*) gtk_label_new ("Appearance");
	g_object_ref_sink (_tmp109_);
	appearance_label = _tmp109_;
	gtk_widget_add_css_class ((GtkWidget*) appearance_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) appearance_label, GTK_ALIGN_START);
	_tmp110_ = self->priv->content;
	gtk_box_append (_tmp110_, (GtkWidget*) appearance_label);
	_tmp111_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp111_);
	appearance_list = _tmp111_;
	gtk_list_box_set_selection_mode (appearance_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) appearance_list, "boxed-list");
	_tmp112_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp112_);
	style_row = _tmp112_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) style_row, "Message style");
	adw_action_row_set_subtitle (style_row, "Use chat bubbles or compact IRC-style lines");
	_tmp113_ = g_strdup ("Bubbles");
	_tmp114_ = g_strdup ("IRC");
	_tmp115_ = g_new0 (gchar*, 2 + 1);
	_tmp115_[0] = _tmp113_;
	_tmp115_[1] = _tmp114_;
	style_labels = _tmp115_;
	style_labels_length1 = 2;
	_style_labels_size_ = style_labels_length1;
	_tmp116_ = (GtkDropDown*) gtk_drop_down_new_from_strings (style_labels);
	g_object_ref_sink (_tmp116_);
	_data50_->style_combo = _tmp116_;
	_tmp117_ = self->priv->app_window;
	_tmp118_ = _tmp117_->settings;
	_tmp119_ = dc_settings_manager_get_message_style (_tmp118_);
	_tmp120_ = _tmp119_;
	gtk_drop_down_set_selected (_data50_->style_combo, (guint) _tmp120_);
	gtk_widget_set_valign ((GtkWidget*) _data50_->style_combo, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data50_->style_combo, "notify::selected", (GCallback) ___lambda205__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	adw_action_row_add_suffix (style_row, (GtkWidget*) _data50_->style_combo);
	adw_action_row_set_activatable_widget (style_row, (GtkWidget*) _data50_->style_combo);
	gtk_list_box_append (appearance_list, (GtkWidget*) style_row);
	_tmp121_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp121_);
	accent_row = _tmp121_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) accent_row, "Accent color");
	adw_action_row_set_subtitle (accent_row, "Override the system accent color");
	_tmp122_ = gtk_color_dialog_new ();
	_tmp123_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp122_);
	g_object_ref_sink (_tmp123_);
	_data50_->accent_btn = _tmp123_;
	gtk_widget_set_valign ((GtkWidget*) _data50_->accent_btn, GTK_ALIGN_CENTER);
	_tmp124_ = self->priv->app_window;
	_tmp125_ = _tmp124_->settings;
	_tmp126_ = dc_settings_manager_get_accent_color (_tmp125_);
	_tmp127_ = _tmp126_;
	dc_settings_dialog_apply_hex_to_button (_data50_->accent_btn, _tmp127_);
	g_signal_connect_data ((GObject*) _data50_->accent_btn, "notify::rgba", (GCallback) ___lambda206__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	_tmp128_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	g_object_ref_sink (_tmp128_);
	accent_reset_btn = _tmp128_;
	gtk_widget_set_valign ((GtkWidget*) accent_reset_btn, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) accent_reset_btn, "flat");
	gtk_widget_set_tooltip_text ((GtkWidget*) accent_reset_btn, "Use system accent color");
	g_signal_connect_data (accent_reset_btn, "clicked", (GCallback) ___lambda207__gtk_button_clicked, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	adw_action_row_add_suffix (accent_row, (GtkWidget*) _data50_->accent_btn);
	adw_action_row_add_suffix (accent_row, (GtkWidget*) accent_reset_btn);
	gtk_list_box_append (appearance_list, (GtkWidget*) accent_row);
	_tmp129_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp129_);
	bg_row = _tmp129_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) bg_row, "Background color");
	adw_action_row_set_subtitle (bg_row, "Tint the window background with a solid color or a gradient");
	_tmp130_ = g_strdup ("System");
	_tmp131_ = g_strdup ("Solid");
	_tmp132_ = g_strdup ("Gradient");
	_tmp133_ = g_new0 (gchar*, 3 + 1);
	_tmp133_[0] = _tmp130_;
	_tmp133_[1] = _tmp131_;
	_tmp133_[2] = _tmp132_;
	bg_mode_labels = _tmp133_;
	bg_mode_labels_length1 = 3;
	_bg_mode_labels_size_ = bg_mode_labels_length1;
	_tmp134_ = (GtkDropDown*) gtk_drop_down_new_from_strings (bg_mode_labels);
	g_object_ref_sink (_tmp134_);
	_data50_->bg_mode_combo = _tmp134_;
	_tmp135_ = self->priv->app_window;
	_tmp136_ = _tmp135_->settings;
	_tmp137_ = dc_settings_manager_get_background_mode (_tmp136_);
	_tmp138_ = _tmp137_;
	gtk_drop_down_set_selected (_data50_->bg_mode_combo, (guint) _tmp138_);
	gtk_widget_set_valign ((GtkWidget*) _data50_->bg_mode_combo, GTK_ALIGN_CENTER);
	_tmp139_ = gtk_color_dialog_new ();
	_tmp140_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp139_);
	g_object_ref_sink (_tmp140_);
	_data50_->bg_color_btn = _tmp140_;
	gtk_widget_set_valign ((GtkWidget*) _data50_->bg_color_btn, GTK_ALIGN_CENTER);
	_tmp141_ = self->priv->app_window;
	_tmp142_ = _tmp141_->settings;
	_tmp143_ = dc_settings_manager_get_background_color (_tmp142_);
	_tmp144_ = _tmp143_;
	dc_settings_dialog_apply_hex_to_button (_data50_->bg_color_btn, _tmp144_);
	_tmp145_ = self->priv->app_window;
	_tmp146_ = _tmp145_->settings;
	_tmp147_ = dc_settings_manager_get_background_mode (_tmp146_);
	_tmp148_ = _tmp147_;
	gtk_widget_set_sensitive ((GtkWidget*) _data50_->bg_color_btn, _tmp148_ != DC_BACKGROUND_MODE_SYSTEM);
	g_signal_connect_data ((GObject*) _data50_->bg_mode_combo, "notify::selected", (GCallback) ___lambda208__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	g_signal_connect_data ((GObject*) _data50_->bg_color_btn, "notify::rgba", (GCallback) ___lambda209__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	adw_action_row_add_suffix (bg_row, (GtkWidget*) _data50_->bg_mode_combo);
	adw_action_row_add_suffix (bg_row, (GtkWidget*) _data50_->bg_color_btn);
	gtk_list_box_append (appearance_list, (GtkWidget*) bg_row);
	_tmp149_ = self->priv->content;
	gtk_box_append (_tmp149_, (GtkWidget*) appearance_list);
	_tmp150_ = (GtkLabel*) gtk_label_new ("Network");
	g_object_ref_sink (_tmp150_);
	network_label = _tmp150_;
	gtk_widget_add_css_class ((GtkWidget*) network_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) network_label, GTK_ALIGN_START);
	_tmp151_ = self->priv->content;
	gtk_box_append (_tmp151_, (GtkWidget*) network_label);
	_tmp152_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp152_);
	network_list = _tmp152_;
	gtk_list_box_set_selection_mode (network_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) network_list, "boxed-list");
	_tmp153_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp153_);
	_g_object_unref0 (self->priv->proxy_switch_row);
	self->priv->proxy_switch_row = _tmp153_;
	_tmp154_ = self->priv->proxy_switch_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp154_, "Use Proxy");
	_tmp155_ = self->priv->proxy_switch_row;
	adw_action_row_set_subtitle (_tmp155_, "Route this profile through the configured proxy");
	_tmp156_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp156_);
	_g_object_unref0 (self->priv->proxy_switch);
	self->priv->proxy_switch = _tmp156_;
	_tmp157_ = self->priv->proxy_switch;
	gtk_widget_set_valign ((GtkWidget*) _tmp157_, GTK_ALIGN_CENTER);
	_tmp158_ = self->priv->proxy_switch;
	g_signal_connect_object ((GObject*) _tmp158_, "notify::active", (GCallback) ___lambda210__g_object_notify, self, 0);
	_tmp159_ = self->priv->proxy_switch_row;
	_tmp160_ = self->priv->proxy_switch;
	adw_action_row_add_suffix (_tmp159_, (GtkWidget*) _tmp160_);
	_tmp161_ = self->priv->proxy_switch_row;
	_tmp162_ = self->priv->proxy_switch;
	adw_action_row_set_activatable_widget (_tmp161_, (GtkWidget*) _tmp162_);
	_tmp163_ = self->priv->proxy_switch_row;
	gtk_list_box_append (network_list, (GtkWidget*) _tmp163_);
	_tmp164_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp164_);
	_g_object_unref0 (self->priv->proxy_url_row);
	self->priv->proxy_url_row = _tmp164_;
	_tmp165_ = self->priv->proxy_url_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp165_, "Proxy URL");
	_tmp166_ = self->priv->proxy_url_row;
	adw_action_row_set_subtitle (_tmp166_, "socks5://, http://, https://, or ss://");
	_tmp167_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp167_);
	_g_object_unref0 (self->priv->proxy_entry);
	self->priv->proxy_entry = _tmp167_;
	_tmp168_ = self->priv->proxy_entry;
	gtk_entry_set_placeholder_text (_tmp168_, "socks5://127.0.0.1:9050");
	_tmp169_ = self->priv->proxy_entry;
	gtk_entry_set_input_purpose (_tmp169_, GTK_INPUT_PURPOSE_URL);
	_tmp170_ = self->priv->proxy_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp170_, TRUE);
	_tmp171_ = self->priv->proxy_entry;
	gtk_widget_set_valign ((GtkWidget*) _tmp171_, GTK_ALIGN_CENTER);
	_tmp172_ = self->priv->proxy_entry;
	g_signal_connect_object (_tmp172_, "activate", (GCallback) ___lambda211__gtk_entry_activate, self, 0);
	_tmp173_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	proxy_focus = _tmp173_;
	g_signal_connect_object (proxy_focus, "leave", (GCallback) ___lambda212__gtk_event_controller_focus_leave, self, 0);
	_tmp174_ = self->priv->proxy_entry;
	_tmp175_ = _g_object_ref0 ((GtkEventController*) proxy_focus);
	gtk_widget_add_controller ((GtkWidget*) _tmp174_, _tmp175_);
	_tmp176_ = self->priv->proxy_url_row;
	_tmp177_ = self->priv->proxy_entry;
	adw_action_row_add_suffix (_tmp176_, (GtkWidget*) _tmp177_);
	_tmp178_ = self->priv->proxy_url_row;
	_tmp179_ = self->priv->proxy_entry;
	adw_action_row_set_activatable_widget (_tmp178_, (GtkWidget*) _tmp179_);
	_tmp180_ = self->priv->proxy_url_row;
	gtk_list_box_append (network_list, (GtkWidget*) _tmp180_);
	_tmp181_ = self->priv->content;
	gtk_box_append (_tmp181_, (GtkWidget*) network_list);
	dc_settings_dialog_load_proxy_settings (self, NULL, NULL);
	_tmp182_ = (GtkLabel*) gtk_label_new ("Advanced");
	g_object_ref_sink (_tmp182_);
	advanced_label = _tmp182_;
	gtk_widget_add_css_class ((GtkWidget*) advanced_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) advanced_label, GTK_ALIGN_START);
	_tmp183_ = self->priv->content;
	gtk_box_append (_tmp183_, (GtkWidget*) advanced_label);
	_tmp184_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp184_);
	advanced_list = _tmp184_;
	gtk_list_box_set_selection_mode (advanced_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) advanced_list, "boxed-list");
	_tmp185_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp185_);
	_g_object_unref0 (self->priv->rpc_row);
	self->priv->rpc_row = _tmp185_;
	_tmp186_ = self->priv->rpc_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp186_, "RPC server");
	_tmp187_ = g_strdup ("Auto");
	_tmp188_ = g_strdup ("Custom");
	_tmp189_ = g_strdup ("Desktop");
	_tmp190_ = g_new0 (gchar*, 3 + 1);
	_tmp190_[0] = _tmp187_;
	_tmp190_[1] = _tmp188_;
	_tmp190_[2] = _tmp189_;
	rpc_source_labels = _tmp190_;
	rpc_source_labels_length1 = 3;
	_rpc_source_labels_size_ = rpc_source_labels_length1;
	_tmp191_ = (GtkDropDown*) gtk_drop_down_new_from_strings (rpc_source_labels);
	g_object_ref_sink (_tmp191_);
	_g_object_unref0 (self->priv->rpc_source_dropdown);
	self->priv->rpc_source_dropdown = _tmp191_;
	_tmp192_ = self->priv->rpc_source_dropdown;
	_tmp193_ = self->priv->app_window;
	_tmp194_ = _tmp193_->settings;
	_tmp195_ = dc_settings_manager_get_rpc_server_source (_tmp194_);
	_tmp196_ = _tmp195_;
	gtk_drop_down_set_selected (_tmp192_, (guint) _tmp196_);
	_tmp197_ = self->priv->rpc_source_dropdown;
	gtk_widget_set_valign ((GtkWidget*) _tmp197_, GTK_ALIGN_CENTER);
	_tmp198_ = self->priv->rpc_source_dropdown;
	g_signal_connect_object ((GObject*) _tmp198_, "notify::selected", (GCallback) _dc_settings_dialog_on_rpc_source_changed_g_object_notify, self, 0);
	_tmp199_ = self->priv->rpc_row;
	_tmp200_ = self->priv->rpc_source_dropdown;
	adw_action_row_add_suffix (_tmp199_, (GtkWidget*) _tmp200_);
	_tmp201_ = self->priv->rpc_row;
	_tmp202_ = self->priv->rpc_source_dropdown;
	adw_action_row_set_activatable_widget (_tmp201_, (GtkWidget*) _tmp202_);
	_tmp203_ = (GtkButton*) gtk_button_new_with_label ("Choose");
	g_object_ref_sink (_tmp203_);
	_g_object_unref0 (self->priv->rpc_choose_btn);
	self->priv->rpc_choose_btn = _tmp203_;
	_tmp204_ = self->priv->rpc_choose_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp204_, GTK_ALIGN_CENTER);
	_tmp205_ = self->priv->rpc_choose_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp205_, "flat");
	_tmp206_ = self->priv->rpc_choose_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp206_, "Choose a deltachat-rpc-server binary");
	_tmp207_ = self->priv->rpc_choose_btn;
	g_signal_connect_object (_tmp207_, "clicked", (GCallback) ___lambda221__gtk_button_clicked, self, 0);
	_tmp208_ = self->priv->rpc_row;
	_tmp209_ = self->priv->rpc_choose_btn;
	adw_action_row_add_suffix (_tmp208_, (GtkWidget*) _tmp209_);
	_tmp210_ = (GtkButton*) gtk_button_new_with_label ("Install");
	g_object_ref_sink (_tmp210_);
	_g_object_unref0 (self->priv->rpc_download_btn);
	self->priv->rpc_download_btn = _tmp210_;
	_tmp211_ = self->priv->rpc_download_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp211_, GTK_ALIGN_CENTER);
	_tmp212_ = self->priv->rpc_download_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp212_, "flat");
	_tmp213_ = self->priv->rpc_download_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp213_, "Download the latest deltachat-rpc-server into Parla's data dir");
	_tmp214_ = self->priv->rpc_download_btn;
	g_signal_connect_object (_tmp214_, "clicked", (GCallback) ___lambda222__gtk_button_clicked, self, 0);
	_tmp215_ = self->priv->rpc_row;
	_tmp216_ = self->priv->rpc_download_btn;
	adw_action_row_add_suffix (_tmp215_, (GtkWidget*) _tmp216_);
	_tmp217_ = self->priv->rpc_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp217_);
	_tmp218_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp218_);
	_g_object_unref0 (self->priv->rpc_version_row);
	self->priv->rpc_version_row = _tmp218_;
	_tmp219_ = self->priv->rpc_version_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp219_, "RPC server version");
	_tmp220_ = self->priv->rpc_version_row;
	adw_action_row_set_subtitle (_tmp220_, "Checking...");
	_tmp221_ = (GtkButton*) gtk_button_new_with_label ("Check");
	g_object_ref_sink (_tmp221_);
	_g_object_unref0 (self->priv->rpc_update_btn);
	self->priv->rpc_update_btn = _tmp221_;
	_tmp222_ = self->priv->rpc_update_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp222_, GTK_ALIGN_CENTER);
	_tmp223_ = self->priv->rpc_update_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp223_, "flat");
	_tmp224_ = self->priv->rpc_update_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp224_, "Check latest deltachat-rpc-server release");
	_tmp225_ = self->priv->rpc_update_btn;
	g_signal_connect_object (_tmp225_, "clicked", (GCallback) ___lambda224__gtk_button_clicked, self, 0);
	_tmp226_ = self->priv->rpc_version_row;
	_tmp227_ = self->priv->rpc_update_btn;
	adw_action_row_add_suffix (_tmp226_, (GtkWidget*) _tmp227_);
	_tmp228_ = self->priv->rpc_version_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp228_);
	_tmp229_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp229_);
	rpc_autocheck_row = _tmp229_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) rpc_autocheck_row, "Check for engine updates on startup");
	adw_action_row_set_subtitle (rpc_autocheck_row, "Notify when a newer deltachat-rpc-server is available");
	_tmp230_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp230_);
	_data50_->autocheck_switch = _tmp230_;
	_tmp231_ = self->priv->app_window;
	_tmp232_ = _tmp231_->settings;
	_tmp233_ = dc_settings_manager_get_rpc_check_updates_on_startup (_tmp232_);
	_tmp234_ = _tmp233_;
	gtk_switch_set_active (_data50_->autocheck_switch, _tmp234_);
	gtk_widget_set_valign ((GtkWidget*) _data50_->autocheck_switch, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data50_->autocheck_switch, "notify::active", (GCallback) ___lambda225__g_object_notify, block50_data_ref (_data50_), (GClosureNotify) block50_data_unref, 0);
	adw_action_row_add_suffix (rpc_autocheck_row, (GtkWidget*) _data50_->autocheck_switch);
	adw_action_row_set_activatable_widget (rpc_autocheck_row, (GtkWidget*) _data50_->autocheck_switch);
	gtk_list_box_append (advanced_list, (GtkWidget*) rpc_autocheck_row);
	_tmp235_ = self->priv->content;
	gtk_box_append (_tmp235_, (GtkWidget*) advanced_list);
	dc_settings_dialog_update_rpc_row (self);
	_tmp236_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp236_);
	reset_box = _tmp236_;
	gtk_widget_set_margin_top ((GtkWidget*) reset_box, 8);
	_tmp237_ = (GtkButton*) gtk_button_new_with_label ("Factory Reset");
	g_object_ref_sink (_tmp237_);
	reset_btn = _tmp237_;
	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);
	_tmp238_ = (GtkLabel*) gtk_label_new ("Remove all settings and close the app");
	g_object_ref_sink (_tmp238_);
	reset_label = _tmp238_;
	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);
	_tmp239_ = self->priv->content;
	gtk_box_append (_tmp239_, (GtkWidget*) reset_box);
	_tmp240_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp240_);
	scroll = _tmp240_;
	gtk_widget_set_vexpand ((GtkWidget*) scroll, TRUE);
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp241_ = self->priv->content;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp241_);
	_tmp242_ = box;
	gtk_box_append (_tmp242_, (GtkWidget*) scroll);
	_tmp243_ = box;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp243_);
	_g_object_unref0 (scroll);
	_g_object_unref0 (reset_label);
	_g_object_unref0 (reset_btn);
	_g_object_unref0 (reset_box);
	_g_object_unref0 (rpc_autocheck_row);
	rpc_source_labels = (_vala_array_free (rpc_source_labels, rpc_source_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (advanced_list);
	_g_object_unref0 (advanced_label);
	_g_object_unref0 (proxy_focus);
	_g_object_unref0 (network_list);
	_g_object_unref0 (network_label);
	bg_mode_labels = (_vala_array_free (bg_mode_labels, bg_mode_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (bg_row);
	_g_object_unref0 (accent_reset_btn);
	_g_object_unref0 (accent_row);
	style_labels = (_vala_array_free (style_labels, style_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (style_row);
	_g_object_unref0 (appearance_list);
	_g_object_unref0 (appearance_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 (header);
	_g_object_unref0 (box);
	block50_data_unref (_data50_);
	_data50_ = NULL;
	return self;
}

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

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

static void
dc_settings_dialog_load_proxy_settings (DcSettingsDialog* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	DcSettingsDialogLoadProxySettingsData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogLoadProxySettingsData);
	_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_proxy_settings_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_load_proxy_settings_co (_data_);
}

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

static void
dc_settings_dialog_load_proxy_settings_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	DcSettingsDialogLoadProxySettingsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_load_proxy_settings_co (_data_);
}

static gboolean
dc_settings_dialog_load_proxy_settings_co (DcSettingsDialogLoadProxySettingsData* _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_->_tmp1_ = _data_->self->priv->rpc;
	_data_->_tmp2_ = dc_rpc_client_get_is_connected (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (!_data_->_tmp3_) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_tmp5_ = dc_rpc_client_get_account_id (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp0_ = _data_->_tmp6_ <= 0;
	}
	if (_data_->_tmp0_) {
		dc_settings_dialog_set_proxy_controls_sensitive (_data_->self, FALSE);
		_data_->_tmp7_ = _data_->self->priv->proxy_switch_row;
		adw_action_row_set_subtitle (_data_->_tmp7_, "No active profile");
		_data_->_tmp8_ = _data_->self->priv->proxy_url_row;
		adw_action_row_set_subtitle (_data_->_tmp8_, "No active profile");
		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_->self->priv->loading_proxy = TRUE;
	dc_settings_dialog_set_proxy_controls_sensitive (_data_->self, FALSE);
	{
		_data_->_tmp9_ = _data_->self->priv->rpc;
		_data_->_tmp10_ = _data_->self->priv->rpc;
		_data_->_tmp11_ = dc_rpc_client_get_account_id (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_state_ = 1;
		dc_rpc_client_get_config (_data_->_tmp9_, "proxy_enabled", _data_->_tmp12_, dc_settings_dialog_load_proxy_settings_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp13_ = dc_rpc_client_get_config_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
		_data_->enabled = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = _data_->self->priv->rpc;
		_data_->_tmp15_ = _data_->self->priv->rpc;
		_data_->_tmp16_ = dc_rpc_client_get_account_id (_data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_state_ = 2;
		dc_rpc_client_get_config (_data_->_tmp14_, "proxy_url", _data_->_tmp17_, dc_settings_dialog_load_proxy_settings_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp18_ = dc_rpc_client_get_config_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_);
		_data_->proxy_url = _data_->_tmp18_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->enabled);
			goto __catch0_g_error;
		}
		_data_->_tmp20_ = _data_->proxy_url;
		_data_->_tmp19_ = _data_->_tmp20_;
		if (_data_->_tmp19_ == NULL) {
			_data_->_tmp19_ = "";
		}
		_data_->_tmp21_ = dc_settings_dialog_first_proxy_url (_data_->_tmp19_);
		_data_->first = _data_->_tmp21_;
		_data_->_tmp23_ = _data_->enabled;
		_data_->_tmp22_ = _data_->_tmp23_;
		if (_data_->_tmp22_ == NULL) {
			_data_->_tmp22_ = "";
		}
		_data_->_tmp24_ = _data_->self->priv->proxy_switch;
		gtk_switch_set_active (_data_->_tmp24_, g_strcmp0 (_data_->_tmp22_, "1") == 0);
		_data_->_tmp25_ = _data_->self->priv->proxy_entry;
		_data_->_tmp26_ = _data_->first;
		gtk_editable_set_text ((GtkEditable*) _data_->_tmp25_, _data_->_tmp26_);
		_data_->_tmp27_ = _data_->self->priv->proxy_switch;
		_data_->_tmp28_ = gtk_switch_get_active (_data_->_tmp27_);
		_data_->_tmp29_ = _data_->_tmp28_;
		_data_->self->priv->saved_proxy_enabled = _data_->_tmp29_;
		_data_->_tmp30_ = _data_->first;
		_data_->_tmp31_ = g_strdup (_data_->_tmp30_);
		_g_free0 (_data_->self->priv->saved_proxy_url);
		_data_->self->priv->saved_proxy_url = _data_->_tmp31_;
		_data_->_tmp33_ = _data_->self->priv->proxy_switch;
		_data_->_tmp34_ = gtk_switch_get_active (_data_->_tmp33_);
		_data_->_tmp35_ = _data_->_tmp34_;
		if (_data_->_tmp35_) {
			_data_->_tmp32_ = "Enabled for current profile";
		} else {
			_data_->_tmp32_ = "Disabled for current profile";
		}
		_data_->_tmp36_ = _data_->self->priv->proxy_switch_row;
		adw_action_row_set_subtitle (_data_->_tmp36_, _data_->_tmp32_);
		_data_->_tmp37_ = _data_->self->priv->proxy_url_row;
		adw_action_row_set_subtitle (_data_->_tmp37_, "socks5://, http://, https://, or ss://");
		_data_->_tmp39_ = _data_->first;
		_data_->_tmp40_ = strlen (_data_->_tmp39_);
		_data_->_tmp41_ = _data_->_tmp40_;
		if (_data_->_tmp41_ > 0) {
			_data_->_tmp42_ = _data_->first;
			_data_->_tmp38_ = _data_->_tmp42_;
		} else {
			_data_->_tmp38_ = NULL;
		}
		_data_->_tmp43_ = _data_->self->priv->proxy_url_row;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp43_, _data_->_tmp38_);
		_g_free0 (_data_->first);
		_g_free0 (_data_->proxy_url);
		_g_free0 (_data_->enabled);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp44_ = _data_->self->priv->proxy_switch_row;
		adw_action_row_set_subtitle (_data_->_tmp44_, "Unable to read proxy settings");
		_data_->_tmp45_ = _data_->self->priv->proxy_url_row;
		_data_->_tmp46_ = _data_->e;
		_data_->_tmp47_ = _data_->_tmp46_->message;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp45_, _data_->_tmp47_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		_data_->self->priv->loading_proxy = FALSE;
		dc_settings_dialog_set_proxy_controls_sensitive (_data_->self, TRUE);
	}
	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_set_proxy_controls_sensitive (DcSettingsDialog* self,
                                                 gboolean sensitive)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean active = FALSE;
	GtkSwitch* _tmp8_;
	GtkEntry* _tmp9_;
	g_return_if_fail (self != NULL);
	if (sensitive) {
		DcRpcClient* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = self->priv->rpc;
		_tmp3_ = dc_rpc_client_get_is_connected (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp1_ = _tmp4_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		DcRpcClient* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp5_ = self->priv->rpc;
		_tmp6_ = dc_rpc_client_get_account_id (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp0_ = _tmp7_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	active = _tmp0_;
	_tmp8_ = self->priv->proxy_switch;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp8_, active);
	_tmp9_ = self->priv->proxy_entry;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp9_, active);
}

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 gchar*
dc_settings_dialog_first_proxy_url (const gchar* urls)
{
	gchar** _tmp0_;
	gchar** _tmp1_;
	gchar* _tmp8_;
	gchar* result;
	g_return_val_if_fail (urls != NULL, NULL);
	_tmp1_ = _tmp0_ = g_strsplit (urls, "\n", 0);
	{
		gchar** line_collection = NULL;
		gint line_collection_length1 = 0;
		gint _line_collection_size_ = 0;
		gint line_it = 0;
		line_collection = _tmp1_;
		line_collection_length1 = _vala_array_length (_tmp0_);
		for (line_it = 0; line_it < line_collection_length1; line_it = line_it + 1) {
			gchar* _tmp2_;
			gchar* line = NULL;
			_tmp2_ = g_strdup (line_collection[line_it]);
			line = _tmp2_;
			{
				gchar* s = NULL;
				const gchar* _tmp3_;
				gchar* _tmp4_;
				const gchar* _tmp5_;
				gint _tmp6_;
				gint _tmp7_;
				_tmp3_ = line;
				_tmp4_ = string_strip (_tmp3_);
				s = _tmp4_;
				_tmp5_ = s;
				_tmp6_ = strlen (_tmp5_);
				_tmp7_ = _tmp6_;
				if (_tmp7_ > 0) {
					result = s;
					_g_free0 (line);
					line_collection = (_vala_array_free (line_collection, line_collection_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_g_free0 (s);
				_g_free0 (line);
			}
		}
		line_collection = (_vala_array_free (line_collection, line_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp8_ = g_strdup ("");
	result = _tmp8_;
	return result;
}

static void
dc_settings_dialog_normalize_proxy_url_data_free (gpointer _data)
{
	DcSettingsDialogNormalizeProxyUrlData* _data_;
	_data_ = _data;
	_g_free0 (_data_->url);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogNormalizeProxyUrlData, _data_);
}

static void
dc_settings_dialog_normalize_proxy_url (DcSettingsDialog* self,
                                        const gchar* url,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	DcSettingsDialogNormalizeProxyUrlData* _data_;
	DcSettingsDialog* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogNormalizeProxyUrlData);
	_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_normalize_proxy_url_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp1_;
	dc_settings_dialog_normalize_proxy_url_co (_data_);
}

static gchar*
dc_settings_dialog_normalize_proxy_url_finish (DcSettingsDialog* self,
                                               GAsyncResult* _res_)
{
	gchar* result;
	DcSettingsDialogNormalizeProxyUrlData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_settings_dialog_normalize_proxy_url_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	DcSettingsDialogNormalizeProxyUrlData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_normalize_proxy_url_co (_data_);
}

static gboolean
dc_settings_dialog_normalize_proxy_url_co (DcSettingsDialogNormalizeProxyUrlData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_state_ = 1;
		dc_rpc_client_check_qr (_data_->_tmp0_, _data_->_tmp3_, _data_->url, dc_settings_dialog_normalize_proxy_url_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp4_ = dc_rpc_client_check_qr_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		_data_->qr = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp7_ = _data_->qr;
		if (_data_->_tmp7_ == NULL) {
			_data_->_tmp6_ = TRUE;
		} else {
			_data_->_tmp8_ = _data_->qr;
			_data_->_tmp6_ = !json_object_has_member (_data_->_tmp8_, "kind");
		}
		if (_data_->_tmp6_) {
			_data_->_tmp5_ = TRUE;
		} else {
			_data_->_tmp9_ = _data_->qr;
			_data_->_tmp10_ = json_object_get_string_member (_data_->_tmp9_, "kind");
			_data_->_tmp5_ = g_strcmp0 (_data_->_tmp10_, "proxy") != 0;
		}
		if (_data_->_tmp5_) {
			_data_->_tmp11_ = g_strconcat ("Invalid proxy URL: ", _data_->url, NULL);
			_data_->_tmp12_ = _data_->_tmp11_;
			dc_show_error ((GtkWidget*) _data_->self, _data_->_tmp12_);
			_g_free0 (_data_->_tmp12_);
			_data_->result = NULL;
			_json_object_unref0 (_data_->qr);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp14_ = _data_->qr;
		if (json_object_has_member (_data_->_tmp14_, "url")) {
			_data_->_tmp15_ = _data_->qr;
			_data_->_tmp16_ = json_object_get_string_member (_data_->_tmp15_, "url");
			_data_->_tmp13_ = _data_->_tmp16_;
		} else {
			_data_->_tmp13_ = _data_->url;
		}
		_data_->_tmp17_ = g_strdup (_data_->_tmp13_);
		_data_->result = _data_->_tmp17_;
		_json_object_unref0 (_data_->qr);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp18_ = _data_->e;
		_data_->_tmp19_ = _data_->_tmp18_->message;
		_data_->_tmp20_ = g_strdup_printf ("Invalid proxy URL: %s\n%s", _data_->url, _data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		dc_show_error ((GtkWidget*) _data_->self, _data_->_tmp21_);
		_g_free0 (_data_->_tmp21_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_settings_dialog_save_proxy_settings (DcSettingsDialog* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	DcSettingsDialogSaveProxySettingsData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogSaveProxySettingsData);
	_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_save_proxy_settings_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_save_proxy_settings_co (_data_);
}

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

static void
dc_settings_dialog_save_proxy_settings_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	DcSettingsDialogSaveProxySettingsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_save_proxy_settings_co (_data_);
}

static gboolean
dc_settings_dialog_save_proxy_settings_co (DcSettingsDialogSaveProxySettingsData* _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:
	if (_data_->self->priv->loading_proxy) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp0_ = _data_->self->priv->saving_proxy;
	}
	if (_data_->_tmp0_) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->self->priv->rpc;
	_data_->_tmp3_ = dc_rpc_client_get_is_connected (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	if (!_data_->_tmp4_) {
		_data_->_tmp1_ = TRUE;
	} else {
		_data_->_tmp5_ = _data_->self->priv->rpc;
		_data_->_tmp6_ = dc_rpc_client_get_account_id (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp1_ = _data_->_tmp7_ <= 0;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp8_ = _data_->self->priv->app_window;
		dc_window_show_toast (_data_->_tmp8_, "No active profile");
		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_->_tmp9_ = _data_->self->priv->proxy_entry;
	_data_->_tmp10_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = string_strip (_data_->_tmp11_);
	_data_->url = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->self->priv->proxy_switch;
	_data_->_tmp14_ = gtk_switch_get_active (_data_->_tmp13_);
	_data_->_tmp15_ = _data_->_tmp14_;
	_data_->enabled = _data_->_tmp15_;
	if (_data_->enabled == _data_->self->priv->saved_proxy_enabled) {
		_data_->_tmp17_ = _data_->url;
		_data_->_tmp18_ = _data_->self->priv->saved_proxy_url;
		_data_->_tmp16_ = g_strcmp0 (_data_->_tmp17_, _data_->_tmp18_) == 0;
	} else {
		_data_->_tmp16_ = FALSE;
	}
	if (_data_->_tmp16_) {
		_g_free0 (_data_->url);
		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;
	}
	if (_data_->enabled) {
		_data_->_tmp20_ = _data_->url;
		_data_->_tmp21_ = strlen (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp19_ = _data_->_tmp22_ == 0;
	} else {
		_data_->_tmp19_ = FALSE;
	}
	if (_data_->_tmp19_) {
		dc_show_error ((GtkWidget*) _data_->self, "Enter a proxy URL before enabling the proxy.");
		_data_->self->priv->loading_proxy = TRUE;
		_data_->_tmp23_ = _data_->self->priv->proxy_switch;
		gtk_switch_set_active (_data_->_tmp23_, FALSE);
		_data_->self->priv->loading_proxy = FALSE;
		_data_->enabled = FALSE;
		if (!_data_->self->priv->saved_proxy_enabled) {
			_data_->_tmp25_ = _data_->self->priv->saved_proxy_url;
			_data_->_tmp26_ = strlen (_data_->_tmp25_);
			_data_->_tmp27_ = _data_->_tmp26_;
			_data_->_tmp24_ = _data_->_tmp27_ == 0;
		} else {
			_data_->_tmp24_ = FALSE;
		}
		if (_data_->_tmp24_) {
			_g_free0 (_data_->url);
			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_->self->priv->saving_proxy = TRUE;
	dc_settings_dialog_set_proxy_controls_sensitive (_data_->self, FALSE);
	_data_->_tmp28_ = _data_->url;
	_data_->_tmp29_ = strlen (_data_->_tmp28_);
	_data_->_tmp30_ = _data_->_tmp29_;
	if (_data_->_tmp30_ > 0) {
		_data_->_tmp31_ = _data_->url;
		_data_->_state_ = 1;
		dc_settings_dialog_normalize_proxy_url (_data_->self, _data_->_tmp31_, dc_settings_dialog_save_proxy_settings_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp32_ = dc_settings_dialog_normalize_proxy_url_finish (_data_->self, _data_->_res_);
		_data_->normalized = _data_->_tmp32_;
		_data_->_tmp33_ = _data_->normalized;
		if (_data_->_tmp33_ == NULL) {
			_data_->self->priv->saving_proxy = FALSE;
			dc_settings_dialog_set_proxy_controls_sensitive (_data_->self, TRUE);
			_g_free0 (_data_->normalized);
			_g_free0 (_data_->url);
			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_->_tmp34_ = _data_->normalized;
		_data_->_tmp35_ = g_strdup (_data_->_tmp34_);
		_g_free0 (_data_->url);
		_data_->url = _data_->_tmp35_;
		_data_->_tmp36_ = _data_->self->priv->proxy_entry;
		_data_->_tmp37_ = _data_->url;
		gtk_editable_set_text ((GtkEditable*) _data_->_tmp36_, _data_->_tmp37_);
		_g_free0 (_data_->normalized);
	}
	{
		_data_->_tmp38_ = _data_->self->priv->rpc;
		_data_->_tmp39_ = _data_->url;
		_data_->_tmp40_ = _data_->self->priv->rpc;
		_data_->_tmp41_ = dc_rpc_client_get_account_id (_data_->_tmp40_);
		_data_->_tmp42_ = _data_->_tmp41_;
		_data_->_state_ = 2;
		dc_rpc_client_batch_set_config (_data_->_tmp38_, "proxy_url", _data_->_tmp39_, _data_->_tmp42_, dc_settings_dialog_save_proxy_settings_ready, _data_);
		return FALSE;
		_state_2:
		dc_rpc_client_batch_set_config_finish (_data_->_tmp38_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->enabled) {
			_data_->_tmp43_ = "1";
		} else {
			_data_->_tmp43_ = "0";
		}
		_data_->_tmp44_ = _data_->self->priv->rpc;
		_data_->_tmp45_ = _data_->self->priv->rpc;
		_data_->_tmp46_ = dc_rpc_client_get_account_id (_data_->_tmp45_);
		_data_->_tmp47_ = _data_->_tmp46_;
		_data_->_state_ = 3;
		dc_rpc_client_batch_set_config (_data_->_tmp44_, "proxy_enabled", _data_->_tmp43_, _data_->_tmp47_, dc_settings_dialog_save_proxy_settings_ready, _data_);
		return FALSE;
		_state_3:
		dc_rpc_client_batch_set_config_finish (_data_->_tmp44_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp48_ = _data_->self->priv->rpc;
		_data_->_tmp49_ = _data_->self->priv->rpc;
		_data_->_tmp50_ = dc_rpc_client_get_account_id (_data_->_tmp49_);
		_data_->_tmp51_ = _data_->_tmp50_;
		_data_->_state_ = 4;
		dc_rpc_client_stop_io (_data_->_tmp48_, _data_->_tmp51_, dc_settings_dialog_save_proxy_settings_ready, _data_);
		return FALSE;
		_state_4:
		dc_rpc_client_stop_io_finish (_data_->_tmp48_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp52_ = _data_->self->priv->rpc;
		_data_->_tmp53_ = _data_->self->priv->rpc;
		_data_->_tmp54_ = dc_rpc_client_get_account_id (_data_->_tmp53_);
		_data_->_tmp55_ = _data_->_tmp54_;
		_data_->_state_ = 5;
		dc_rpc_client_start_io (_data_->_tmp52_, _data_->_tmp55_, dc_settings_dialog_save_proxy_settings_ready, _data_);
		return FALSE;
		_state_5:
		dc_rpc_client_start_io_finish (_data_->_tmp52_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->enabled) {
			_data_->_tmp56_ = "Enabled for current profile";
		} else {
			_data_->_tmp56_ = "Disabled for current profile";
		}
		_data_->_tmp57_ = _data_->self->priv->proxy_switch_row;
		adw_action_row_set_subtitle (_data_->_tmp57_, _data_->_tmp56_);
		_data_->_tmp59_ = _data_->url;
		_data_->_tmp60_ = strlen (_data_->_tmp59_);
		_data_->_tmp61_ = _data_->_tmp60_;
		if (_data_->_tmp61_ > 0) {
			_data_->_tmp62_ = _data_->url;
			_data_->_tmp58_ = _data_->_tmp62_;
		} else {
			_data_->_tmp58_ = NULL;
		}
		_data_->_tmp63_ = _data_->self->priv->proxy_url_row;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp63_, _data_->_tmp58_);
		_data_->self->priv->saved_proxy_enabled = _data_->enabled;
		_data_->_tmp64_ = _data_->url;
		_data_->_tmp65_ = g_strdup (_data_->_tmp64_);
		_g_free0 (_data_->self->priv->saved_proxy_url);
		_data_->self->priv->saved_proxy_url = _data_->_tmp65_;
		_data_->_tmp66_ = _data_->self->priv->app_window;
		dc_window_show_toast (_data_->_tmp66_, "Proxy settings saved");
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp67_ = _data_->e;
		_data_->_tmp68_ = _data_->_tmp67_->message;
		_data_->_tmp69_ = g_strconcat ("Failed to save proxy settings: ", _data_->_tmp68_, NULL);
		_data_->_tmp70_ = _data_->_tmp69_;
		dc_show_error ((GtkWidget*) _data_->self, _data_->_tmp70_);
		_g_free0 (_data_->_tmp70_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		_data_->self->priv->saving_proxy = FALSE;
		dc_settings_dialog_set_proxy_controls_sensitive (_data_->self, TRUE);
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->url);
		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_free0 (_data_->url);
	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_;
	DcRpcServerSource source = 0;
	DcWindow* _tmp5_;
	DcSettingsManager* _tmp6_;
	DcRpcServerSource _tmp7_;
	DcRpcServerSource _tmp8_;
	gchar* found = NULL;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	GtkButton* _tmp11_;
	GtkButton* _tmp12_;
	GtkButton* _tmp13_;
	GtkButton* _tmp14_;
	const gchar* _tmp15_ = NULL;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gboolean _tmp19_;
	GtkButton* _tmp20_;
	const gchar* _tmp50_;
	g_return_if_fail (self != NULL);
	dc_settings_dialog_sync_rpc_source_dropdown (self);
	_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_ = self->priv->app_window;
	_tmp6_ = _tmp5_->settings;
	_tmp7_ = dc_settings_manager_get_rpc_server_source (_tmp6_);
	_tmp8_ = _tmp7_;
	source = _tmp8_;
	_tmp9_ = custom;
	_tmp10_ = dc_account_finder_find_rpc_server (_tmp9_, source);
	found = _tmp10_;
	_tmp11_ = self->priv->rpc_choose_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp11_, source == DC_RPC_SERVER_SOURCE_CUSTOM);
	_tmp12_ = self->priv->rpc_choose_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp12_, source == DC_RPC_SERVER_SOURCE_CUSTOM);
	_tmp13_ = self->priv->rpc_download_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp13_, source == DC_RPC_SERVER_SOURCE_AUTO);
	_tmp14_ = self->priv->rpc_download_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp14_, dc_rpc_installer_can_auto_install ());
	_tmp16_ = found;
	_tmp17_ = dc_account_finder_get_managed_rpc_path ();
	_tmp18_ = _tmp17_;
	_tmp19_ = g_strcmp0 (_tmp16_, _tmp18_) == 0;
	_g_free0 (_tmp18_);
	if (_tmp19_) {
		_tmp15_ = "Update";
	} else {
		_tmp15_ = "Install";
	}
	_tmp20_ = self->priv->rpc_download_btn;
	gtk_button_set_label (_tmp20_, _tmp15_);
	switch (source) {
		case DC_RPC_SERVER_SOURCE_CUSTOM:
		{
			const gchar* _tmp21_;
			gint _tmp22_;
			gint _tmp23_;
			_tmp21_ = custom;
			_tmp22_ = strlen (_tmp21_);
			_tmp23_ = _tmp22_;
			if (_tmp23_ == 0) {
				AdwActionRow* _tmp24_;
				AdwActionRow* _tmp25_;
				_tmp24_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp24_, "No custom binary selected");
				_tmp25_ = self->priv->rpc_row;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp25_, "Choose a deltachat-rpc-server binary");
			} else {
				const gchar* _tmp26_ = NULL;
				const gchar* _tmp27_;
				AdwActionRow* _tmp28_;
				AdwActionRow* _tmp29_;
				const gchar* _tmp30_;
				_tmp27_ = found;
				if (_tmp27_ != NULL) {
					_tmp26_ = "Using custom binary";
				} else {
					_tmp26_ = "Custom path is not executable";
				}
				_tmp28_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp28_, _tmp26_);
				_tmp29_ = self->priv->rpc_row;
				_tmp30_ = custom;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp29_, _tmp30_);
			}
			break;
		}
		case DC_RPC_SERVER_SOURCE_DESKTOP:
		{
			gchar* desktop_dir = NULL;
			gchar* _tmp31_;
			const gchar* _tmp32_;
			_tmp31_ = dc_account_finder_find_desktop_data_dir ();
			desktop_dir = _tmp31_;
			_tmp32_ = found;
			if (_tmp32_ == NULL) {
				AdwActionRow* _tmp33_;
				AdwActionRow* _tmp34_;
				_tmp33_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp33_, "Delta Chat Desktop server not found");
				_tmp34_ = self->priv->rpc_row;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp34_, "Install Delta Chat Desktop or choose another server source");
			} else {
				const gchar* _tmp35_;
				_tmp35_ = desktop_dir;
				if (_tmp35_ == NULL) {
					AdwActionRow* _tmp36_;
					AdwActionRow* _tmp37_;
					_tmp36_ = self->priv->rpc_row;
					adw_action_row_set_subtitle (_tmp36_, "Desktop account store not found");
					_tmp37_ = self->priv->rpc_row;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp37_, "Sign in to Delta Chat Desktop or choose another server source");
				} else {
					AdwActionRow* _tmp38_;
					AdwActionRow* _tmp39_;
					const gchar* _tmp40_;
					const gchar* _tmp41_;
					gchar* _tmp42_;
					gchar* _tmp43_;
					_tmp38_ = self->priv->rpc_row;
					adw_action_row_set_subtitle (_tmp38_, "Using Delta Chat Desktop server and accounts");
					_tmp39_ = self->priv->rpc_row;
					_tmp40_ = found;
					_tmp41_ = desktop_dir;
					_tmp42_ = g_strdup_printf ("%s\n%s", _tmp40_, _tmp41_);
					_tmp43_ = _tmp42_;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp39_, _tmp43_);
					_g_free0 (_tmp43_);
				}
			}
			_g_free0 (desktop_dir);
			break;
		}
		default:
		case DC_RPC_SERVER_SOURCE_AUTO:
		{
			const gchar* _tmp44_ = NULL;
			const gchar* _tmp45_;
			AdwActionRow* _tmp46_;
			const gchar* _tmp47_ = NULL;
			const gchar* _tmp48_;
			AdwActionRow* _tmp49_;
			_tmp45_ = found;
			if (_tmp45_ != NULL) {
				_tmp44_ = "Using Parla or system server";
			} else {
				_tmp44_ = "Standalone server not found";
			}
			_tmp46_ = self->priv->rpc_row;
			adw_action_row_set_subtitle (_tmp46_, _tmp44_);
			_tmp48_ = found;
			_tmp47_ = _tmp48_;
			if (_tmp47_ == NULL) {
				_tmp47_ = "Install deltachat-rpc-server or choose a custom binary";
			}
			_tmp49_ = self->priv->rpc_row;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp49_, _tmp47_);
			break;
		}
	}
	_tmp50_ = found;
	dc_settings_dialog_update_rpc_version_row (self, _tmp50_, NULL, NULL);
	_g_free0 (found);
	_g_free0 (custom);
}

static void
dc_settings_dialog_update_rpc_version_row_data_free (gpointer _data)
{
	DcSettingsDialogUpdateRpcVersionRowData* _data_;
	_data_ = _data;
	_g_free0 (_data_->rpc_path);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogUpdateRpcVersionRowData, _data_);
}

static void
dc_settings_dialog_update_rpc_version_row (DcSettingsDialog* self,
                                           const gchar* rpc_path,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcSettingsDialogUpdateRpcVersionRowData* _data_;
	DcSettingsDialog* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogUpdateRpcVersionRowData);
	_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_update_rpc_version_row_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (rpc_path);
	_g_free0 (_data_->rpc_path);
	_data_->rpc_path = _tmp1_;
	dc_settings_dialog_update_rpc_version_row_co (_data_);
}

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

static void
dc_settings_dialog_update_rpc_version_row_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	DcSettingsDialogUpdateRpcVersionRowData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_update_rpc_version_row_co (_data_);
}

static gboolean
dc_settings_dialog_update_rpc_version_row_co (DcSettingsDialogUpdateRpcVersionRowData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->self->priv->rpc_version_request = _data_->self->priv->rpc_version_request + 1;
	_data_->_tmp0_ = _data_->self->priv->rpc_version_request;
	_data_->request_id = _data_->_tmp0_;
	if (_data_->rpc_path == NULL) {
		_data_->_tmp1_ = TRUE;
	} else {
		_data_->_tmp2_ = strlen (_data_->rpc_path);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp1_ = _data_->_tmp3_ == 0;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp4_ = _data_->self->priv->rpc_version_row;
		adw_action_row_set_subtitle (_data_->_tmp4_, "Not available");
		_data_->_tmp5_ = _data_->self->priv->rpc_version_row;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp5_, "No executable server selected");
		_g_free0 (_data_->self->priv->rpc_current_version);
		_data_->self->priv->rpc_current_version = NULL;
		_data_->self->priv->rpc_update_check_available = FALSE;
		_data_->_tmp6_ = _data_->self->priv->rpc_update_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp6_, FALSE);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp7_ = _data_->self->priv->rpc_version_row;
	adw_action_row_set_subtitle (_data_->_tmp7_, "Checking...");
	_data_->_tmp8_ = _data_->self->priv->rpc_version_row;
	gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp8_, _data_->rpc_path);
	_g_free0 (_data_->self->priv->rpc_current_version);
	_data_->self->priv->rpc_current_version = NULL;
	_data_->self->priv->rpc_update_check_available = FALSE;
	_data_->_tmp9_ = _data_->self->priv->rpc_update_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp9_, FALSE);
	{
		_data_->_tmp10_ = g_subprocess_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE | G_SUBPROCESS_FLAGS_STDERR_PIPE, &_data_->_inner_error0_, _data_->rpc_path, "--version", NULL);
		_data_->process = _data_->_tmp10_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp11_ = _data_->process;
		_data_->_tmp12_ = NULL;
		_data_->_tmp13_ = NULL;
		_data_->_state_ = 1;
		g_subprocess_communicate_utf8_async (_data_->_tmp11_, NULL, NULL, dc_settings_dialog_update_rpc_version_row_ready, _data_);
		return FALSE;
		_state_1:
		g_subprocess_communicate_utf8_finish (_data_->_tmp11_, _data_->_res_, &_data_->_tmp12_, &_data_->_tmp13_, &_data_->_inner_error0_);
		_g_free0 (_data_->stdout_buf);
		_data_->stdout_buf = _data_->_tmp12_;
		_g_free0 (_data_->stderr_buf);
		_data_->stderr_buf = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->stderr_buf);
			_g_free0 (_data_->stdout_buf);
			_g_object_unref0 (_data_->process);
			goto __catch0_g_error;
		}
		if (_data_->request_id != _data_->self->priv->rpc_version_request) {
			_g_free0 (_data_->stderr_buf);
			_g_free0 (_data_->stdout_buf);
			_g_object_unref0 (_data_->process);
			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_->_tmp16_ = _data_->stdout_buf;
		_data_->_tmp15_ = _data_->_tmp16_;
		if (_data_->_tmp15_ == NULL) {
			_data_->_tmp15_ = "";
		}
		_data_->_tmp17_ = string_strip (_data_->_tmp15_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp19_ = strlen (_data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = _data_->_tmp20_ > 0;
		_g_free0 (_data_->_tmp18_);
		if (_data_->_tmp21_) {
			_data_->_tmp23_ = _data_->stdout_buf;
			_data_->_tmp22_ = _data_->_tmp23_;
			if (_data_->_tmp22_ == NULL) {
				_data_->_tmp22_ = "";
			}
			_data_->_tmp24_ = string_strip (_data_->_tmp22_);
			_g_free0 (_data_->_tmp14_);
			_data_->_tmp14_ = _data_->_tmp24_;
		} else {
			_data_->_tmp26_ = _data_->stderr_buf;
			_data_->_tmp25_ = _data_->_tmp26_;
			if (_data_->_tmp25_ == NULL) {
				_data_->_tmp25_ = "";
			}
			_data_->_tmp27_ = string_strip (_data_->_tmp25_);
			_g_free0 (_data_->_tmp14_);
			_data_->_tmp14_ = _data_->_tmp27_;
		}
		_data_->_tmp28_ = _data_->_tmp14_;
		_data_->_tmp14_ = NULL;
		_data_->version = _data_->_tmp28_;
		_data_->_tmp30_ = _data_->process;
		if (g_subprocess_get_successful (_data_->_tmp30_)) {
			_data_->_tmp31_ = _data_->version;
			_data_->_tmp32_ = strlen (_data_->_tmp31_);
			_data_->_tmp33_ = _data_->_tmp32_;
			_data_->_tmp29_ = _data_->_tmp33_ > 0;
		} else {
			_data_->_tmp29_ = FALSE;
		}
		if (_data_->_tmp29_) {
			_data_->_tmp34_ = _data_->self->priv->rpc_version_row;
			_data_->_tmp35_ = _data_->version;
			adw_action_row_set_subtitle (_data_->_tmp34_, _data_->_tmp35_);
			_data_->_tmp36_ = _data_->version;
			_data_->_tmp37_ = dc_rpc_installer_extract_version (_data_->_tmp36_);
			_g_free0 (_data_->self->priv->rpc_current_version);
			_data_->self->priv->rpc_current_version = _data_->_tmp37_;
			_data_->self->priv->rpc_update_check_available = TRUE;
			_data_->_tmp38_ = _data_->self->priv->rpc_update_btn;
			gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp38_, TRUE);
		} else {
			_data_->_tmp39_ = _data_->self->priv->rpc_version_row;
			adw_action_row_set_subtitle (_data_->_tmp39_, "Unable to read version");
			_g_free0 (_data_->self->priv->rpc_current_version);
			_data_->self->priv->rpc_current_version = NULL;
			_data_->self->priv->rpc_update_check_available = FALSE;
			_data_->_tmp40_ = _data_->self->priv->rpc_update_btn;
			gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp40_, FALSE);
		}
		_g_free0 (_data_->version);
		_g_free0 (_data_->_tmp14_);
		_g_free0 (_data_->stderr_buf);
		_g_free0 (_data_->stdout_buf);
		_g_object_unref0 (_data_->process);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		if (_data_->request_id != _data_->self->priv->rpc_version_request) {
			_g_error_free0 (_data_->e);
			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_->_tmp41_ = _data_->self->priv->rpc_version_row;
		adw_action_row_set_subtitle (_data_->_tmp41_, "Unable to read version");
		_data_->_tmp42_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp43_ = _data_->e;
		_data_->_tmp44_ = _data_->_tmp43_->message;
		_data_->_tmp45_ = g_strdup_printf ("%s\n%s", _data_->rpc_path, _data_->_tmp44_);
		_data_->_tmp46_ = _data_->_tmp45_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp42_, _data_->_tmp46_);
		_g_free0 (_data_->_tmp46_);
		_g_free0 (_data_->self->priv->rpc_current_version);
		_data_->self->priv->rpc_current_version = NULL;
		_data_->self->priv->rpc_update_check_available = FALSE;
		_data_->_tmp47_ = _data_->self->priv->rpc_update_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp47_, FALSE);
		_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_check_rpc_updates_data_free (gpointer _data)
{
	DcSettingsDialogCheckRpcUpdatesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogCheckRpcUpdatesData, _data_);
}

static void
dc_settings_dialog_check_rpc_updates (DcSettingsDialog* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcSettingsDialogCheckRpcUpdatesData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogCheckRpcUpdatesData);
	_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_check_rpc_updates_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_check_rpc_updates_co (_data_);
}

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

static void
dc_settings_dialog_check_rpc_updates_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcSettingsDialogCheckRpcUpdatesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_check_rpc_updates_co (_data_);
}

static gboolean
dc_settings_dialog_check_rpc_updates_co (DcSettingsDialogCheckRpcUpdatesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->rpc_update_btn;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->rpc_update_btn;
		_data_->_tmp3_ = gtk_widget_get_sensitive ((GtkWidget*) _data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp0_ = !_data_->_tmp4_;
	}
	if (_data_->_tmp0_) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = _data_->self->priv->rpc_update_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp5_, FALSE);
	_data_->_tmp6_ = _data_->self->priv->rpc_version_row;
	_data_->_tmp7_ = adw_action_row_get_subtitle (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = g_strdup (_data_->_tmp8_);
	_data_->previous_subtitle = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->self->priv->rpc_version_row;
	adw_action_row_set_subtitle (_data_->_tmp10_, "Checking for updates...");
	{
		_data_->_state_ = 1;
		dc_rpc_installer_fetch_latest_tag (dc_settings_dialog_check_rpc_updates_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = dc_rpc_installer_fetch_latest_tag_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->latest_tag = _data_->_tmp11_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp12_ = _data_->latest_tag;
		_data_->_tmp13_ = dc_rpc_installer_extract_version (_data_->_tmp12_);
		_data_->latest_version = _data_->_tmp13_;
		_data_->_tmp14_ = _data_->latest_version;
		if (_data_->_tmp14_ == NULL) {
			_data_->_tmp15_ = _data_->self->priv->rpc_version_row;
			_data_->_tmp16_ = _data_->previous_subtitle;
			adw_action_row_set_subtitle (_data_->_tmp15_, _data_->_tmp16_);
			_data_->_tmp17_ = _data_->self->priv->app_window;
			dc_window_show_toast (_data_->_tmp17_, "Could not parse latest RPC server version");
			_g_free0 (_data_->latest_version);
			_g_free0 (_data_->latest_tag);
			{
				_data_->_tmp18_ = _data_->self->priv->rpc_update_btn;
				gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp18_, _data_->self->priv->rpc_update_check_available);
			}
			_g_free0 (_data_->previous_subtitle);
			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_->_tmp19_ = _data_->self->priv->app_window;
		_data_->_tmp20_ = _data_->_tmp19_->settings;
		_data_->_tmp21_ = dc_settings_manager_get_rpc_server_path (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = _data_->self->priv->app_window;
		_data_->_tmp24_ = _data_->_tmp23_->settings;
		_data_->_tmp25_ = dc_settings_manager_get_rpc_server_source (_data_->_tmp24_);
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_tmp27_ = dc_account_finder_find_rpc_server (_data_->_tmp22_, _data_->_tmp26_);
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_tmp29_ = dc_account_finder_get_managed_rpc_path ();
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_tmp31_ = g_strcmp0 (_data_->_tmp28_, _data_->_tmp30_) == 0;
		_g_free0 (_data_->_tmp30_);
		_g_free0 (_data_->_tmp28_);
		_data_->managed_active = _data_->_tmp31_;
		_data_->_tmp32_ = _data_->self->priv->rpc_current_version;
		if (_data_->_tmp32_ == NULL) {
			_data_->_tmp33_ = _data_->self->priv->rpc_version_row;
			_data_->_tmp34_ = _data_->latest_version;
			_data_->_tmp35_ = g_strdup_printf ("Latest available: %s", _data_->_tmp34_);
			_data_->_tmp36_ = _data_->_tmp35_;
			adw_action_row_set_subtitle (_data_->_tmp33_, _data_->_tmp36_);
			_g_free0 (_data_->_tmp36_);
			_data_->_tmp37_ = _data_->self->priv->app_window;
			_data_->_tmp38_ = _data_->latest_version;
			_data_->_tmp39_ = g_strconcat ("Latest RPC server: ", _data_->_tmp38_, NULL);
			_data_->_tmp40_ = _data_->_tmp39_;
			dc_window_show_toast (_data_->_tmp37_, _data_->_tmp40_);
			_g_free0 (_data_->_tmp40_);
		} else {
			_data_->_tmp41_ = _data_->self->priv->rpc_current_version;
			_data_->_tmp42_ = _data_->latest_version;
			if (g_strcmp0 (_data_->_tmp41_, _data_->_tmp42_) != 0) {
				_data_->_tmp43_ = _data_->self->priv->rpc_version_row;
				_data_->_tmp44_ = _data_->latest_version;
				_data_->_tmp45_ = _data_->self->priv->rpc_current_version;
				_data_->_tmp46_ = g_strdup_printf ("Latest: %s (installed %s)", _data_->_tmp44_, _data_->_tmp45_);
				_data_->_tmp47_ = _data_->_tmp46_;
				adw_action_row_set_subtitle (_data_->_tmp43_, _data_->_tmp47_);
				_g_free0 (_data_->_tmp47_);
				if (_data_->managed_active) {
					_data_->_tmp48_ = _data_->self->priv->app_window;
					_data_->_tmp49_ = _data_->latest_version;
					_data_->_tmp50_ = g_strdup_printf ("Update available: %s — press Install to update", _data_->_tmp49_);
					_data_->_tmp51_ = _data_->_tmp50_;
					dc_window_show_toast (_data_->_tmp48_, _data_->_tmp51_);
					_g_free0 (_data_->_tmp51_);
				} else {
					_data_->_tmp52_ = _data_->self->priv->app_window;
					_data_->_tmp53_ = _data_->latest_version;
					_data_->_tmp54_ = g_strconcat ("RPC server version differs: ", _data_->_tmp53_, NULL);
					_data_->_tmp55_ = _data_->_tmp54_;
					dc_window_show_toast (_data_->_tmp52_, _data_->_tmp55_);
					_g_free0 (_data_->_tmp55_);
				}
			} else {
				_data_->_tmp56_ = _data_->self->priv->rpc_version_row;
				_data_->_tmp57_ = _data_->self->priv->rpc_current_version;
				_data_->_tmp58_ = g_strdup_printf ("Up to date: %s", _data_->_tmp57_);
				_data_->_tmp59_ = _data_->_tmp58_;
				adw_action_row_set_subtitle (_data_->_tmp56_, _data_->_tmp59_);
				_g_free0 (_data_->_tmp59_);
				_data_->_tmp60_ = _data_->self->priv->app_window;
				dc_window_show_toast (_data_->_tmp60_, "RPC server is up to date");
			}
		}
		_data_->_tmp61_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp62_ = _data_->latest_tag;
		_data_->_tmp63_ = g_strdup_printf ("Latest release: https://github.com/chatmail/core/releases/tag/%s", _data_->_tmp62_);
		_data_->_tmp64_ = _data_->_tmp63_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp61_, _data_->_tmp64_);
		_g_free0 (_data_->_tmp64_);
		_g_free0 (_data_->latest_version);
		_g_free0 (_data_->latest_tag);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp65_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp66_ = _data_->previous_subtitle;
		adw_action_row_set_subtitle (_data_->_tmp65_, _data_->_tmp66_);
		_data_->_tmp67_ = _data_->self->priv->app_window;
		_data_->_tmp68_ = _data_->e;
		_data_->_tmp69_ = _data_->_tmp68_->message;
		_data_->_tmp70_ = g_strconcat ("Update check failed: ", _data_->_tmp69_, NULL);
		_data_->_tmp71_ = _data_->_tmp70_;
		dc_window_show_toast (_data_->_tmp67_, _data_->_tmp71_);
		_g_free0 (_data_->_tmp71_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		_data_->_tmp72_ = _data_->self->priv->rpc_update_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp72_, _data_->self->priv->rpc_update_check_available);
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->previous_subtitle);
		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_free0 (_data_->previous_subtitle);
	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_sync_rpc_source_dropdown (DcSettingsDialog* self)
{
	GtkDropDown* _tmp0_;
	DcWindow* _tmp1_;
	DcSettingsManager* _tmp2_;
	DcRpcServerSource _tmp3_;
	DcRpcServerSource _tmp4_;
	g_return_if_fail (self != NULL);
	self->priv->syncing_rpc_source = TRUE;
	_tmp0_ = self->priv->rpc_source_dropdown;
	_tmp1_ = self->priv->app_window;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = dc_settings_manager_get_rpc_server_source (_tmp2_);
	_tmp4_ = _tmp3_;
	gtk_drop_down_set_selected (_tmp0_, (guint) _tmp4_);
	self->priv->syncing_rpc_source = FALSE;
}

static void
dc_settings_dialog_on_rpc_source_changed (DcSettingsDialog* self)
{
	DcRpcServerSource source = 0;
	GtkDropDown* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	gboolean _tmp3_ = FALSE;
	DcWindow* _tmp10_;
	DcSettingsManager* _tmp11_;
	DcWindow* _tmp12_;
	DcWindow* _tmp13_;
	g_return_if_fail (self != NULL);
	if (self->priv->syncing_rpc_source) {
		return;
	}
	_tmp0_ = self->priv->rpc_source_dropdown;
	_tmp1_ = gtk_drop_down_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	source = (DcRpcServerSource) _tmp2_;
	if (source == DC_RPC_SERVER_SOURCE_CUSTOM) {
		DcWindow* _tmp4_;
		DcSettingsManager* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp4_ = self->priv->app_window;
		_tmp5_ = _tmp4_->settings;
		_tmp6_ = dc_settings_manager_get_rpc_server_path (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = strlen (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp3_ = _tmp9_ == 0;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		dc_settings_dialog_on_browse_rpc_server (self, NULL, NULL);
		return;
	}
	_tmp10_ = self->priv->app_window;
	_tmp11_ = _tmp10_->settings;
	dc_settings_manager_save_rpc_server_source (_tmp11_, source);
	_tmp12_ = self->priv->app_window;
	dc_window_show_toast (_tmp12_, "RPC server preference saved");
	dc_settings_dialog_update_rpc_row (self);
	_tmp13_ = self->priv->app_window;
	dc_window_reconnect_rpc_server (_tmp13_, NULL, NULL);
}

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, DC_RPC_SERVER_SOURCE_AUTO);
		_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;
				_data_->_tmp33_ = _data_->_tmp32_->settings;
				dc_settings_manager_save_rpc_server_source (_data_->_tmp33_, DC_RPC_SERVER_SOURCE_CUSTOM);
				dc_settings_dialog_sync_rpc_source_dropdown (_data_->self);
				_data_->_tmp34_ = _data_->self->priv->app_window;
				dc_window_show_toast (_data_->_tmp34_, "RPC server path saved");
				_data_->_tmp35_ = _data_->self->priv->app_window;
				dc_window_reconnect_rpc_server (_data_->_tmp35_, NULL, NULL);
			} else {
				_data_->_tmp36_ = _data_->self->priv->app_window;
				dc_show_error ((GtkWidget*) _data_->_tmp36_, "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_->_tmp38_ = _data_->e;
		if (!(_data_->_tmp38_->domain == GTK_DIALOG_ERROR)) {
			_data_->_tmp39_ = _data_->e;
			_data_->_tmp37_ = !g_error_matches (_data_->_tmp39_, G_IO_ERROR, G_IO_ERROR_CANCELLED);
		} else {
			_data_->_tmp37_ = FALSE;
		}
		if (_data_->_tmp37_) {
			_data_->_tmp40_ = _data_->self->priv->app_window;
			_data_->_tmp41_ = _data_->e;
			_data_->_tmp42_ = _data_->_tmp41_->message;
			dc_show_error ((GtkWidget*) _data_->_tmp40_, _data_->_tmp42_);
		}
		_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;
	}
	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_install_managed_server_data_free (gpointer _data)
{
	DcSettingsDialogInstallManagedServerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogInstallManagedServerData, _data_);
}

static void
dc_settings_dialog_install_managed_server (DcSettingsDialog* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcSettingsDialogInstallManagedServerData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogInstallManagedServerData);
	_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_install_managed_server_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_install_managed_server_co (_data_);
}

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

static void
dc_settings_dialog_install_managed_server_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	DcSettingsDialogInstallManagedServerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_install_managed_server_co (_data_);
}

static void
__lambda223_ (DcSettingsDialog* self,
              gint64 received,
              gint64 total)
{
	if (total > ((gint64) 0)) {
		AdwActionRow* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp0_ = self->priv->rpc_row;
		_tmp1_ = g_strdup_printf ("Downloading… %.0f%%", (((gdouble) received) / ((gdouble) total)) * 100.0);
		_tmp2_ = _tmp1_;
		adw_action_row_set_subtitle (_tmp0_, _tmp2_);
		_g_free0 (_tmp2_);
	} else {
		AdwActionRow* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = self->priv->rpc_row;
		_tmp4_ = g_strdup_printf ("Downloading… %.1f MB", received / 1048576.0);
		_tmp5_ = _tmp4_;
		adw_action_row_set_subtitle (_tmp3_, _tmp5_);
		_g_free0 (_tmp5_);
	}
}

static void
___lambda223__dc_rpc_installer_progress (DcRpcInstaller* _sender,
                                         gint64 received,
                                         gint64 total,
                                         gpointer self)
{
	__lambda223_ ((DcSettingsDialog*) self, received, total);
}

static gboolean
dc_settings_dialog_install_managed_server_co (DcSettingsDialogInstallManagedServerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!dc_rpc_installer_can_auto_install ()) {
		_data_->_state_ = 1;
		dc_settings_dialog_open_rpc_download_page (_data_->self, dc_settings_dialog_install_managed_server_ready, _data_);
		return FALSE;
		_state_1:
		dc_settings_dialog_open_rpc_download_page_finish (_data_->self, _data_->_res_);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp0_ = _data_->self->priv->rpc_download_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp0_, FALSE);
	_data_->_tmp1_ = _data_->self->priv->rpc_row;
	_data_->_tmp2_ = adw_action_row_get_subtitle (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = g_strdup (_data_->_tmp3_);
	_data_->prev_subtitle = _data_->_tmp4_;
	_data_->_tmp5_ = dc_rpc_installer_new ();
	_data_->installer = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->installer;
	g_signal_connect_object (_data_->_tmp6_, "progress", (GCallback) ___lambda223__dc_rpc_installer_progress, _data_->self, 0);
	{
		_data_->_tmp7_ = _data_->installer;
		_data_->_state_ = 2;
		dc_rpc_installer_download_latest (_data_->_tmp7_, dc_settings_dialog_install_managed_server_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp8_ = dc_rpc_installer_download_latest_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_g_free0 (_data_->_tmp9_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp10_ = _data_->self->priv->app_window;
		_data_->_tmp11_ = _data_->_tmp10_->settings;
		_data_->_tmp12_ = dc_settings_manager_get_rpc_server_source (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		if (_data_->_tmp13_ != DC_RPC_SERVER_SOURCE_AUTO) {
			_data_->_tmp14_ = _data_->self->priv->app_window;
			_data_->_tmp15_ = _data_->_tmp14_->settings;
			dc_settings_manager_save_rpc_server_source (_data_->_tmp15_, DC_RPC_SERVER_SOURCE_AUTO);
			dc_settings_dialog_sync_rpc_source_dropdown (_data_->self);
		}
		_data_->_tmp16_ = _data_->self->priv->app_window;
		dc_window_show_toast (_data_->_tmp16_, "RPC server installed");
		_data_->_tmp17_ = _data_->self->priv->app_window;
		_data_->_state_ = 3;
		dc_window_reconnect_rpc_server (_data_->_tmp17_, dc_settings_dialog_install_managed_server_ready, _data_);
		return FALSE;
		_state_3:
		dc_window_reconnect_rpc_server_finish (_data_->_tmp17_, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp18_ = _data_->self->priv->rpc_row;
		_data_->_tmp19_ = _data_->prev_subtitle;
		adw_action_row_set_subtitle (_data_->_tmp18_, _data_->_tmp19_);
		_data_->_tmp20_ = _data_->self->priv->app_window;
		_data_->_tmp21_ = _data_->e;
		_data_->_tmp22_ = _data_->_tmp21_->message;
		_data_->_tmp23_ = g_strconcat ("Download failed: ", _data_->_tmp22_, NULL);
		_data_->_tmp24_ = _data_->_tmp23_;
		dc_window_show_toast (_data_->_tmp20_, _data_->_tmp24_);
		_g_free0 (_data_->_tmp24_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		_data_->_tmp25_ = _data_->self->priv->rpc_download_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp25_, TRUE);
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->installer);
		_g_free0 (_data_->prev_subtitle);
		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;
	}
	dc_settings_dialog_update_rpc_row (_data_->self);
	_g_object_unref0 (_data_->installer);
	_g_free0 (_data_->prev_subtitle);
	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_open_rpc_download_page_data_free (gpointer _data)
{
	DcSettingsDialogOpenRpcDownloadPageData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogOpenRpcDownloadPageData, _data_);
}

static void
dc_settings_dialog_open_rpc_download_page (DcSettingsDialog* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcSettingsDialogOpenRpcDownloadPageData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogOpenRpcDownloadPageData);
	_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_open_rpc_download_page_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_open_rpc_download_page_co (_data_);
}

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

static void
dc_settings_dialog_open_rpc_download_page_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	DcSettingsDialogOpenRpcDownloadPageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_open_rpc_download_page_co (_data_);
}

static gboolean
dc_settings_dialog_open_rpc_download_page_co (DcSettingsDialogOpenRpcDownloadPageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = gtk_uri_launcher_new ("https://github.com/chatmail/core/releases/latest");
		_data_->_tmp1_ = _data_->_tmp0_;
		_data_->_tmp2_ = _data_->self->priv->app_window;
		_data_->_state_ = 1;
		gtk_uri_launcher_launch (_data_->_tmp1_, (GtkWindow*) _data_->_tmp2_, NULL, dc_settings_dialog_open_rpc_download_page_ready, _data_);
		return FALSE;
		_state_1:
		gtk_uri_launcher_launch_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_g_object_unref0 (_data_->_tmp1_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp3_ = _data_->self->priv->app_window;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		_data_->_tmp6_ = g_strconcat ("Unable to open download page: ", _data_->_tmp5_, NULL);
		_data_->_tmp7_ = _data_->_tmp6_;
		dc_show_error ((GtkWidget*) _data_->_tmp3_, _data_->_tmp7_);
		_g_free0 (_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
__lambda226_ (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
___lambda226__dc_void_func (gpointer self)
{
	__lambda226_ ((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", ___lambda226__dc_void_func, g_object_ref (self), g_object_unref);
}

static void
dc_settings_dialog_apply_background (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	GtkApplication* _tmp1_;
	GtkApplication* _tmp2_;
	DcWindow* _tmp3_;
	DcSettingsManager* _tmp4_;
	DcBackgroundMode _tmp5_;
	DcBackgroundMode _tmp6_;
	DcWindow* _tmp7_;
	DcSettingsManager* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->app_window;
	_tmp1_ = gtk_window_get_application ((GtkWindow*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->app_window;
	_tmp4_ = _tmp3_->settings;
	_tmp5_ = dc_settings_manager_get_background_mode (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->app_window;
	_tmp8_ = _tmp7_->settings;
	_tmp9_ = dc_settings_manager_get_background_color (_tmp8_);
	_tmp10_ = _tmp9_;
	dc_application_apply_background (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, DC_TYPE_APPLICATION, DcApplication), _tmp6_, _tmp10_);
}

static void
dc_settings_dialog_apply_hex_to_button (GtkColorDialogButton* btn,
                                        const gchar* hex)
{
	GdkRGBA rgba = {0};
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gint _tmp2_;
	GdkRGBA _tmp3_;
	g_return_if_fail (btn != NULL);
	g_return_if_fail (hex != NULL);
	memset (&rgba, 0, sizeof (GdkRGBA));
	_tmp1_ = strlen (hex);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = !gdk_rgba_parse (&rgba, hex);
	}
	if (_tmp0_) {
		gdk_rgba_parse (&rgba, "#3584e4");
	}
	_tmp3_ = rgba;
	gtk_color_dialog_button_set_rgba (btn, &_tmp3_);
}

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

static void
dc_settings_dialog_instance_init (DcSettingsDialog * self,
                                  gpointer klass)
{
	gchar* _tmp0_;
	self->priv = dc_settings_dialog_get_instance_private (self);
	self->priv->loading_proxy = FALSE;
	self->priv->saving_proxy = FALSE;
	self->priv->saved_proxy_enabled = FALSE;
	_tmp0_ = g_strdup ("");
	self->priv->saved_proxy_url = _tmp0_;
	self->priv->syncing_rpc_source = FALSE;
	self->priv->rpc_version_request = (guint) 0;
	self->priv->rpc_current_version = NULL;
	self->priv->rpc_update_check_available = FALSE;
}

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->content);
	_g_object_unref0 (self->priv->rpc);
	_g_object_unref0 (self->priv->proxy_switch_row);
	_g_object_unref0 (self->priv->proxy_url_row);
	_g_object_unref0 (self->priv->proxy_switch);
	_g_object_unref0 (self->priv->proxy_entry);
	_g_object_unref0 (self->priv->rpc_row);
	_g_object_unref0 (self->priv->rpc_version_row);
	_g_object_unref0 (self->priv->rpc_source_dropdown);
	_g_object_unref0 (self->priv->rpc_choose_btn);
	_g_object_unref0 (self->priv->rpc_download_btn);
	_g_object_unref0 (self->priv->rpc_update_btn);
	_g_free0 (self->priv->saved_proxy_url);
	_g_free0 (self->priv->rpc_current_version);
	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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

