/* 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 <pango/pango.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <adwaita.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <float.h>
#include <math.h>

#define DC_FONT_SIZE_SYSTEM 0
#define DC_FONT_SIZE_MIN 6
#define DC_FONT_SIZE_MAX 32
#define DC_FONT_SIZE_FALLBACK 11
#define DC_AUTO_DOWNLOAD_NEVER (32 * 1024)
#define DC_AUTO_DOWNLOAD_DEFAULT (1024 * 1024)
#define PARLA_RPC_SERVER_PATH ""
#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_THEME_OVERRIDE_SYSTEM = 0,
	DC_THEME_OVERRIDE_LIGHT = 1,
	DC_THEME_OVERRIDE_DARK = 2
} DcThemeOverride;

#define DC_TYPE_THEME_OVERRIDE (dc_theme_override_get_type ())
typedef enum  {
	DC_MESSAGE_STYLE_BUBBLES = 0,
	DC_MESSAGE_STYLE_IRC = 1,
	DC_MESSAGE_STYLE_WORKSPACE = 2
} DcMessageStyle;

#define DC_TYPE_MESSAGE_STYLE (dc_message_style_get_type ())
typedef enum  {
	DC_BUBBLE_AVATAR_DISPLAY_NONE = 0,
	DC_BUBBLE_AVATAR_DISPLAY_OTHER = 1,
	DC_BUBBLE_AVATAR_DISPLAY_BOTH = 2
} DcBubbleAvatarDisplay;

#define DC_TYPE_BUBBLE_AVATAR_DISPLAY (dc_bubble_avatar_display_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 ())
typedef enum  {
	DC_FONT_ATTRIBUTE_REGULAR = 0,
	DC_FONT_ATTRIBUTE_ITALIC = 1,
	DC_FONT_ATTRIBUTE_BOLD = 2,
	DC_FONT_ATTRIBUTE_BOLD_ITALIC = 3
} DcFontAttribute;

#define DC_TYPE_FONT_ATTRIBUTE (dc_font_attribute_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_MARKDOWN_MODE_ENABLED = 0,
	DC_MARKDOWN_MODE_STRIPPED = 1,
	DC_MARKDOWN_MODE_DISABLED = 2
} DcMarkdownMode;

#define DC_TYPE_MARKDOWN_MODE (dc_markdown_mode_get_type ())
typedef enum  {
	DC_CODE_THEME_ADAPTIVE = 0,
	DC_CODE_THEME_SOLARIZED = 1,
	DC_CODE_THEME_MONOKAI = 2,
	DC_CODE_THEME_NORD = 3,
	DC_CODE_THEME_NONE = 4
} DcCodeTheme;

#define DC_TYPE_CODE_THEME (dc_code_theme_get_type ())
typedef enum  {
	DC_RPC_SERVER_SOURCE_AUTO = 0,
	DC_RPC_SERVER_SOURCE_CUSTOM = 1
} 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_MODE_PROPERTY,
	DC_SETTINGS_MANAGER_CODE_THEME_PROPERTY,
	DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY,
	DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY,
	DC_SETTINGS_MANAGER_SHOW_NOTIFICATION_CONTENTS_PROPERTY,
	DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY,
	DC_SETTINGS_MANAGER_SYSTEM_AUDIO_PLAYER_PROPERTY,
	DC_SETTINGS_MANAGER_ANIMATE_STICKERS_PROPERTY,
	DC_SETTINGS_MANAGER_AUTO_DOWNLOAD_LIMIT_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY,
	DC_SETTINGS_MANAGER_ACCOUNTS_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_THEME_OVERRIDE_PROPERTY,
	DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY,
	DC_SETTINGS_MANAGER_BUBBLE_AVATAR_DISPLAY_PROPERTY,
	DC_SETTINGS_MANAGER_BUBBLE_AVATARS_IN_DIRECT_CHATS_PROPERTY,
	DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY,
	DC_SETTINGS_MANAGER_BACKGROUND_MODE_PROPERTY,
	DC_SETTINGS_MANAGER_BACKGROUND_COLOR_PROPERTY,
	DC_SETTINGS_MANAGER_FONT_FAMILY_PROPERTY,
	DC_SETTINGS_MANAGER_FONT_ATTRIBUTE_PROPERTY,
	DC_SETTINGS_MANAGER_FONT_SIZE_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)))
#define __vala_PangoFontDescription_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoFontDescription_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block84Data Block84Data;
typedef struct _Block85Data Block85Data;
typedef struct _Block86Data Block86Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL,
	DC_SETTINGS_MANAGER_FONT_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 _Block87Data Block87Data;
typedef struct _DcWindowPrivate DcWindowPrivate;
typedef struct _Block88Data Block88Data;
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;
typedef struct _DcSettingsDialogOnBrowseAccountsPathData DcSettingsDialogOnBrowseAccountsPathData;

#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;
	DcMarkdownMode _markdown_mode;
	DcCodeTheme _code_theme;
	gboolean _shift_enter_sends;
	gboolean _notifications_enabled;
	gboolean _show_notification_contents;
	gboolean _minimize_to_tray;
	gboolean _system_audio_player;
	gboolean _animate_stickers;
	gint _auto_download_limit;
	gchar* _rpc_server_path;
	gchar* _accounts_path;
	DcRpcServerSource _rpc_server_source;
	gboolean _rpc_check_updates_on_startup;
	DcSidebarMode _sidebar_mode;
	gchar* _default_account_addr;
	DcThemeOverride _theme_override;
	DcMessageStyle _message_style;
	DcBubbleAvatarDisplay _bubble_avatar_display;
	gboolean _bubble_avatars_in_direct_chats;
	gchar* _accent_color;
	DcBackgroundMode _background_mode;
	gchar* _background_color;
	gchar* _font_family;
	DcFontAttribute _font_attribute;
	gint _font_size;
};

struct _Block84Data {
	int _ref_count_;
	DcSettingsManager* self;
	gchar* key;
	gint value;
};

struct _Block85Data {
	int _ref_count_;
	DcSettingsManager* self;
	gchar* key;
	gboolean value;
};

struct _Block86Data {
	int _ref_count_;
	DcSettingsManager* self;
	gchar* key;
	gchar* value;
};

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;
	AdwActionRow* accounts_path_row;
	GtkButton* accounts_path_reset_btn;
	gboolean loading_proxy;
	gboolean saving_proxy;
	gboolean saved_proxy_enabled;
	gchar* saved_proxy_url;
	gboolean syncing_rpc_source;
	gboolean syncing_font_controls;
	AdwActionRow* font_type_row;
	GtkFontDialogButton* font_btn;
	guint rpc_version_request;
	gchar* rpc_current_version;
	gboolean rpc_update_check_available;
};

struct _Block87Data {
	int _ref_count_;
	DcSettingsDialog* self;
	GtkDropDown* theme_combo;
	GtkDropDown* code_combo;
	GtkDropDown* style_combo;
	GtkDropDown* avatar_combo;
	GtkCheckButton* direct_avatar_check;
	GtkColorDialogButton* accent_btn;
	GtkDropDown* bg_mode_combo;
	GtkColorDialogButton* bg_color_btn;
	GtkDropDown* dblclick_combo;
	GtkDropDown* md_combo;
	GtkSwitch* shift_switch;
	GtkSwitch* audio_switch;
	GtkSwitch* notif_switch;
	GtkSwitch* notification_contents_switch;
	GtkSwitch* sticker_switch;
	GtkDropDown* download_combo;
	GtkSwitch* autocheck_switch;
};

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

struct _DcWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _Block88Data {
	int _ref_count_;
	Block87Data * _data87_;
	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_;
	gchar* stdout_buf;
	gchar* stderr_buf;
	gboolean successful;
	GSubprocess* process;
	GSubprocess* _tmp10_;
	GSubprocess* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GSubprocess* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	gboolean _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* version;
	gchar* _tmp29_;
	gboolean _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_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	DcWindow* _tmp23_;
	DcSettingsManager* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gboolean _tmp29_;
	const gchar* _tmp30_;
	AdwActionRow* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	DcWindow* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	AdwActionRow* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	DcWindow* _tmp46_;
	const gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	DcWindow* _tmp50_;
	const gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_;
	AdwActionRow* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	DcWindow* _tmp58_;
	AdwActionRow* _tmp59_;
	const gchar* _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	GError* e;
	AdwActionRow* _tmp63_;
	const gchar* _tmp64_;
	DcWindow* _tmp65_;
	GError* _tmp66_;
	const gchar* _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	GError* _inner_error1_;
	GtkButton* _tmp70_;
	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;
	GError* _tmp37_;
	DcWindow* _tmp38_;
	GError* _tmp39_;
	const gchar* _tmp40_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogOnBrowseAccountsPathData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	GtkFileDialog* dlg;
	GtkFileDialog* _tmp0_;
	GtkFileDialog* _tmp1_;
	GtkFileDialog* _tmp2_;
	gchar* path;
	DcWindow* _tmp3_;
	DcSettingsManager* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	GtkFileDialog* _tmp7_;
	const gchar* _tmp8_;
	GFile* _tmp9_;
	GFile* _tmp10_;
	GFile* folder;
	GtkFileDialog* _tmp11_;
	DcWindow* _tmp12_;
	GFile* _tmp13_;
	gchar* selected_path;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	DcWindow* _tmp16_;
	DcSettingsManager* _tmp17_;
	const gchar* _tmp18_;
	DcWindow* _tmp19_;
	DcWindow* _tmp20_;
	GError* e;
	GError* _tmp21_;
	DcWindow* _tmp22_;
	GError* _tmp23_;
	const gchar* _tmp24_;
	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 DcMarkdownMode dc_markdown_mode;
VALA_EXTERN DcCodeTheme dc_syntax_highlight_theme;
VALA_EXTERN gboolean dc_audio_player_prefer_system;
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 GType dc_theme_override_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_message_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_bubble_avatar_display_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_background_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_font_attribute_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PangoStyle dc_font_attribute_pango_style (DcFontAttribute self);
VALA_EXTERN PangoWeight dc_font_attribute_pango_weight (DcFontAttribute self);
VALA_EXTERN gchar* dc_font_attribute_css_style (DcFontAttribute self);
VALA_EXTERN gchar* dc_font_attribute_css_weight (DcFontAttribute self);
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_markdown_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_code_theme_get_type (void) G_GNUC_CONST ;
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 gboolean dc_settings_manager_rpc_server_path_is_fixed (void);
VALA_EXTERN gchar* dc_settings_manager_effective_rpc_server_path (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_rpc_server_path (DcSettingsManager* self);
VALA_EXTERN DcRpcServerSource dc_settings_manager_effective_rpc_server_source (DcSettingsManager* self);
VALA_EXTERN DcRpcServerSource dc_settings_manager_get_rpc_server_source (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_rpc_auto_update_enabled (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_rpc_check_updates_on_startup (DcSettingsManager* self);
VALA_EXTERN gchar* dc_settings_manager_default_accounts_path (DcSettingsManager* self);
VALA_EXTERN gchar* dc_account_finder_get_data_dir (void);
static gchar* dc_settings_manager_normalize_accounts_path (DcSettingsManager* self,
                                                    const gchar* value);
VALA_EXTERN gboolean dc_settings_manager_is_default_accounts_path (DcSettingsManager* self,
                                                       const gchar* value);
VALA_EXTERN gboolean dc_settings_manager_uses_default_accounts_path (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_accounts_path (DcSettingsManager* self);
VALA_EXTERN gchar* dc_settings_manager_effective_accounts_path (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_load (DcSettingsManager* self);
static gint dc_settings_manager_kf_enum (GKeyFile* kf,
                                  const gchar* k,
                                  gint d,
                                  gint max);
VALA_EXTERN void dc_settings_manager_set_double_click_action (DcSettingsManager* self,
                                                  gint value);
static DcMarkdownMode dc_settings_manager_kf_markdown_mode (GKeyFile* kf);
VALA_EXTERN void dc_settings_manager_set_markdown_mode (DcSettingsManager* self,
                                            DcMarkdownMode value);
VALA_EXTERN DcMarkdownMode dc_settings_manager_get_markdown_mode (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_set_code_theme (DcSettingsManager* self,
                                         DcCodeTheme value);
VALA_EXTERN DcCodeTheme dc_settings_manager_get_code_theme (DcSettingsManager* self);
static gboolean dc_settings_manager_kf_bool (GKeyFile* kf,
                                      const gchar* k,
                                      gboolean d);
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_show_notification_contents (DcSettingsManager* self,
                                                         gboolean value);
VALA_EXTERN void dc_settings_manager_set_minimize_to_tray (DcSettingsManager* self,
                                               gboolean value);
VALA_EXTERN void dc_settings_manager_set_system_audio_player (DcSettingsManager* self,
                                                  gboolean value);
VALA_EXTERN gboolean dc_settings_manager_get_system_audio_player (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_set_animate_stickers (DcSettingsManager* self,
                                               gboolean value);
VALA_EXTERN gint dc_settings_manager_normalize_auto_download_limit (gint bytes);
static gint dc_settings_manager_kf_int (GKeyFile* kf,
                                 const gchar* k,
                                 gint d);
VALA_EXTERN void dc_settings_manager_set_auto_download_limit (DcSettingsManager* self,
                                                  gint 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_accounts_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_theme_override (DcSettingsManager* self,
                                             DcThemeOverride value);
VALA_EXTERN void dc_settings_manager_set_message_style (DcSettingsManager* self,
                                            DcMessageStyle value);
VALA_EXTERN void dc_settings_manager_set_bubble_avatar_display (DcSettingsManager* self,
                                                    DcBubbleAvatarDisplay value);
VALA_EXTERN void dc_settings_manager_set_bubble_avatars_in_direct_chats (DcSettingsManager* self,
                                                             gboolean 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_set_font_family (DcSettingsManager* self,
                                          const gchar* value);
VALA_EXTERN void dc_settings_manager_set_font_attribute (DcSettingsManager* self,
                                             DcFontAttribute value);
VALA_EXTERN gint dc_settings_manager_clamp_font_size (gint size);
VALA_EXTERN void dc_settings_manager_set_font_size (DcSettingsManager* self,
                                        gint value);
VALA_EXTERN void dc_settings_manager_save_double_click_action (DcSettingsManager* self,
                                                   gint v);
static void dc_settings_manager_save_int (DcSettingsManager* self,
                                   const gchar* key,
                                   gint value);
VALA_EXTERN void dc_settings_manager_save_markdown_mode (DcSettingsManager* self,
                                             DcMarkdownMode mode);
VALA_EXTERN void dc_settings_manager_save_code_theme (DcSettingsManager* self,
                                          DcCodeTheme theme);
VALA_EXTERN void dc_settings_manager_save_shift_enter_sends (DcSettingsManager* self,
                                                 gboolean v);
static void dc_settings_manager_save_bool (DcSettingsManager* self,
                                    const gchar* key,
                                    gboolean value);
VALA_EXTERN void dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                     gboolean v);
VALA_EXTERN void dc_settings_manager_save_show_notification_contents (DcSettingsManager* self,
                                                          gboolean v);
VALA_EXTERN void dc_settings_manager_save_minimize_to_tray (DcSettingsManager* self,
                                                gboolean v);
VALA_EXTERN void dc_settings_manager_save_system_audio_player (DcSettingsManager* self,
                                                   gboolean v);
VALA_EXTERN void dc_settings_manager_save_animate_stickers (DcSettingsManager* self,
                                                gboolean v);
VALA_EXTERN void dc_settings_manager_save_auto_download_limit (DcSettingsManager* self,
                                                   gint bytes);
VALA_EXTERN gint dc_settings_manager_get_auto_download_limit (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                               const gchar* v);
static void dc_settings_manager_save_string (DcSettingsManager* self,
                                      const gchar* key,
                                      const gchar* value);
VALA_EXTERN void dc_settings_manager_save_accounts_path (DcSettingsManager* self,
                                             const gchar* v);
VALA_EXTERN void dc_settings_manager_reset_accounts_path (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_source (DcSettingsManager* self,
                                                 DcRpcServerSource v);
VALA_EXTERN void dc_settings_manager_save_rpc_check_updates_on_startup (DcSettingsManager* self,
                                                            gboolean v);
VALA_EXTERN void dc_settings_manager_save_sidebar_mode (DcSettingsManager* self,
                                            DcSidebarMode v);
VALA_EXTERN void dc_settings_manager_save_default_account_addr (DcSettingsManager* self,
                                                    const gchar* v);
VALA_EXTERN void dc_settings_manager_save_theme_override (DcSettingsManager* self,
                                              DcThemeOverride v);
VALA_EXTERN void dc_settings_manager_save_message_style (DcSettingsManager* self,
                                             DcMessageStyle v);
VALA_EXTERN void dc_settings_manager_save_bubble_avatar_display (DcSettingsManager* self,
                                                     DcBubbleAvatarDisplay v);
VALA_EXTERN void dc_settings_manager_save_bubble_avatars_in_direct_chats (DcSettingsManager* self,
                                                              gboolean v);
VALA_EXTERN void dc_settings_manager_save_accent_color (DcSettingsManager* self,
                                            const gchar* v);
VALA_EXTERN void dc_settings_manager_save_background_mode (DcSettingsManager* self,
                                               DcBackgroundMode v);
VALA_EXTERN void dc_settings_manager_save_background_color (DcSettingsManager* self,
                                                const gchar* v);
VALA_EXTERN void dc_settings_manager_save_font_size (DcSettingsManager* self,
                                         gint v);
static void dc_settings_manager_save_font (DcSettingsManager* self,
                                    const gchar* family,
                                    DcFontAttribute attr,
                                    gint size);
VALA_EXTERN const gchar* dc_settings_manager_get_font_family (DcSettingsManager* self);
VALA_EXTERN DcFontAttribute dc_settings_manager_get_font_attribute (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_save_font_description (DcSettingsManager* self,
                                                PangoFontDescription* desc);
static DcFontAttribute dc_settings_manager_attribute_from_font_description (PangoFontDescription* desc);
static gint dc_settings_manager_size_from_font_description (PangoFontDescription* desc);
VALA_EXTERN void dc_settings_manager_reset_font_defaults (DcSettingsManager* self);
VALA_EXTERN gint dc_settings_manager_get_font_size (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_save_to_file (DcSettingsManager* self,
                                       DcSettingWriter writer,
                                       gpointer writer_target);
static void __lambda291_ (DcSettingsManager* self,
                   GKeyFile* kf);
static void ___lambda291__dc_setting_writer (GKeyFile* kf,
                                      gpointer self);
VALA_EXTERN gint dc_settings_manager_system_font_size (void);
static gchar* dc_settings_manager_system_font_name (void);
static void _vala_PangoFontDescription_free (PangoFontDescription* self);
VALA_EXTERN gint dc_settings_manager_effective_font_size (DcSettingsManager* self);
VALA_EXTERN PangoFontDescription* dc_settings_manager_effective_font_description (DcSettingsManager* self);
static Block84Data* block84_data_ref (Block84Data* _data84_);
static void block84_data_unref (void * _userdata_);
static void __lambda285_ (Block84Data* _data84_,
                   GKeyFile* kf);
static void ___lambda285__dc_setting_writer (GKeyFile* kf,
                                      gpointer self);
static Block85Data* block85_data_ref (Block85Data* _data85_);
static void block85_data_unref (void * _userdata_);
static void __lambda253_ (Block85Data* _data85_,
                   GKeyFile* kf);
static void ___lambda253__dc_setting_writer (GKeyFile* kf,
                                      gpointer self);
static Block86Data* block86_data_ref (Block86Data* _data86_);
static void block86_data_unref (void * _userdata_);
static void __lambda153_ (Block86Data* _data86_,
                   GKeyFile* kf);
static void ___lambda153__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_show_notification_contents (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_minimize_to_tray (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_animate_stickers (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 DcThemeOverride dc_settings_manager_get_theme_override (DcSettingsManager* self);
VALA_EXTERN DcMessageStyle dc_settings_manager_get_message_style (DcSettingsManager* self);
VALA_EXTERN DcBubbleAvatarDisplay dc_settings_manager_get_bubble_avatar_display (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_bubble_avatars_in_direct_chats (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 Block87Data* block87_data_ref (Block87Data* _data87_);
static void block87_data_unref (void * _userdata_);
static GtkListBox* dc_settings_dialog_settings_list (DcSettingsDialog* self,
                                              const gchar* title);
static AdwActionRow* dc_settings_dialog_action_row (const gchar* title,
                                             const gchar* subtitle);
static GtkDropDown* dc_settings_dialog_row_dropdown (AdwActionRow* row,
                                              gchar** labels,
                                              gint labels_length1,
                                              guint selected);
static void __lambda284_ (Block87Data* _data87_);
static void dc_settings_dialog_apply_theme_override (DcSettingsDialog* self);
static void ___lambda284__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda286_ (Block87Data* _data87_);
static void ___lambda286__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda287_ (Block87Data* _data87_);
static void ___lambda287__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda288_ (Block87Data* _data87_);
static void ___lambda288__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda289_ (Block87Data* _data87_);
static void ___lambda289__gtk_check_button_toggled (GtkCheckButton* _sender,
                                             gpointer self);
static void __lambda290_ (DcSettingsDialog* self);
static PangoFontDescription* _vala_PangoFontDescription_copy (PangoFontDescription* self);
static void dc_settings_dialog_sync_font_controls (DcSettingsDialog* self);
static void ___lambda290__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda292_ (DcSettingsDialog* self);
static void ___lambda292__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dc_settings_dialog_apply_hex_to_button (GtkColorDialogButton* btn,
                                             const gchar* hex);
static void __lambda293_ (Block87Data* _data87_);
static gchar* dc_settings_dialog_hex_from_rgba (GdkRGBA* c);
static void ___lambda293__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda294_ (Block87Data* _data87_);
static void ___lambda294__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda295_ (Block87Data* _data87_);
static void dc_settings_dialog_apply_background (DcSettingsDialog* self);
static void ___lambda295__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda296_ (Block87Data* _data87_);
static void ___lambda296__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda297_ (Block87Data* _data87_);
static void ___lambda297__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda298_ (Block87Data* _data87_);
static void ___lambda298__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static GtkSwitch* dc_settings_dialog_row_switch (AdwActionRow* row,
                                          gboolean active);
static void __lambda299_ (Block87Data* _data87_);
static void ___lambda299__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda300_ (Block87Data* _data87_);
static void ___lambda300__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN gboolean dc_platform_is_macos (void);
static Block88Data* block88_data_ref (Block88Data* _data88_);
static void block88_data_unref (void * _userdata_);
static void ___lambda301_ (Block88Data* _data88_);
VALA_EXTERN void dc_window_set_minimize_to_tray (DcWindow* self,
                                     gboolean enabled);
static void ____lambda301__g_object_notify (GObject* _sender,
                                     GParamSpec* pspec,
                                     gpointer self);
static void __lambda302_ (Block87Data* _data87_);
VALA_EXTERN void dc_window_set_notifications_enabled (DcWindow* self,
                                          gboolean enabled);
static void ___lambda302__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda303_ (Block87Data* _data87_);
static void ___lambda303__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda304_ (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 ___lambda304__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda305_ (DcSettingsDialog* self);
static void ___lambda305__gtk_entry_activate (GtkEntry* _sender,
                                       gpointer self);
static void __lambda306_ (DcSettingsDialog* self);
static void ___lambda306__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 __lambda307_ (Block87Data* _data87_);
static void ___lambda307__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static guint dc_settings_dialog_auto_download_limit_index (gint bytes);
static void __lambda308_ (Block87Data* _data87_);
VALA_EXTERN void dc_window_set_auto_download_limit (DcWindow* self,
                                        gint bytes,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN void dc_window_set_auto_download_limit_finish (DcWindow* self,
                                               GAsyncResult* _res_);
static gint dc_settings_dialog_auto_download_limit_for_index (guint index);
static void ___lambda308__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
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 __lambda321_ (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 ___lambda321__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda322_ (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 ___lambda322__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda324_ (DcSettingsDialog* self);
static void dc_settings_dialog_on_browse_accounts_path (DcSettingsDialog* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static void dc_settings_dialog_on_browse_accounts_path_finish (DcSettingsDialog* self,
                                                        GAsyncResult* _res_);
static void ___lambda324__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda325_ (DcSettingsDialog* self);
static void dc_settings_dialog_sync_accounts_path_row (DcSettingsDialog* self);
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 ___lambda325__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda326_ (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 ___lambda326__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda327_ (Block87Data* _data87_);
static void ___lambda327__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);
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_);
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_);
VALA_EXTERN gboolean dc_is_dialog_dismissal (GError* _error_);
static void dc_settings_dialog_on_browse_accounts_path_data_free (gpointer _data);
static gboolean dc_settings_dialog_on_browse_accounts_path_co (DcSettingsDialogOnBrowseAccountsPathData* _data_);
static void dc_settings_dialog_on_browse_accounts_path_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 __lambda323_ (DcSettingsDialog* self,
                   gint64 received,
                   gint64 total);
static void ___lambda323__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 __lambda328_ (DcSettingsDialog* self);
static void dc_settings_dialog_delete_parla_config (void);
VALA_EXTERN void dc_window_quit_application (DcWindow* self);
static void ___lambda328__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);
VALA_EXTERN void dc_application_apply_theme_override (DcApplication* self,
                                          DcThemeOverride theme);
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 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_theme_override_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_THEME_OVERRIDE_SYSTEM, "DC_THEME_OVERRIDE_SYSTEM", "system"}, {DC_THEME_OVERRIDE_LIGHT, "DC_THEME_OVERRIDE_LIGHT", "light"}, {DC_THEME_OVERRIDE_DARK, "DC_THEME_OVERRIDE_DARK", "dark"}, {0, NULL, NULL}};
	GType dc_theme_override_type_id;
	dc_theme_override_type_id = g_enum_register_static ("DcThemeOverride", values);
	return dc_theme_override_type_id;
}

GType
dc_theme_override_get_type (void)
{
	static volatile gsize dc_theme_override_type_id__once = 0;
	if (g_once_init_enter (&dc_theme_override_type_id__once)) {
		GType dc_theme_override_type_id;
		dc_theme_override_type_id = dc_theme_override_get_type_once ();
		g_once_init_leave (&dc_theme_override_type_id__once, dc_theme_override_type_id);
	}
	return dc_theme_override_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"}, {DC_MESSAGE_STYLE_WORKSPACE, "DC_MESSAGE_STYLE_WORKSPACE", "workspace"}, {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_bubble_avatar_display_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_BUBBLE_AVATAR_DISPLAY_NONE, "DC_BUBBLE_AVATAR_DISPLAY_NONE", "none"}, {DC_BUBBLE_AVATAR_DISPLAY_OTHER, "DC_BUBBLE_AVATAR_DISPLAY_OTHER", "other"}, {DC_BUBBLE_AVATAR_DISPLAY_BOTH, "DC_BUBBLE_AVATAR_DISPLAY_BOTH", "both"}, {0, NULL, NULL}};
	GType dc_bubble_avatar_display_type_id;
	dc_bubble_avatar_display_type_id = g_enum_register_static ("DcBubbleAvatarDisplay", values);
	return dc_bubble_avatar_display_type_id;
}

GType
dc_bubble_avatar_display_get_type (void)
{
	static volatile gsize dc_bubble_avatar_display_type_id__once = 0;
	if (g_once_init_enter (&dc_bubble_avatar_display_type_id__once)) {
		GType dc_bubble_avatar_display_type_id;
		dc_bubble_avatar_display_type_id = dc_bubble_avatar_display_get_type_once ();
		g_once_init_leave (&dc_bubble_avatar_display_type_id__once, dc_bubble_avatar_display_type_id);
	}
	return dc_bubble_avatar_display_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;
}

PangoStyle
dc_font_attribute_pango_style (DcFontAttribute self)
{
	PangoStyle _tmp0_ = 0;
	gboolean _tmp1_ = FALSE;
	PangoStyle result;
	if (self == DC_FONT_ATTRIBUTE_ITALIC) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = self == DC_FONT_ATTRIBUTE_BOLD_ITALIC;
	}
	if (_tmp1_) {
		_tmp0_ = PANGO_STYLE_ITALIC;
	} else {
		_tmp0_ = PANGO_STYLE_NORMAL;
	}
	result = _tmp0_;
	return result;
}

PangoWeight
dc_font_attribute_pango_weight (DcFontAttribute self)
{
	PangoWeight _tmp0_ = 0;
	gboolean _tmp1_ = FALSE;
	PangoWeight result;
	if (self == DC_FONT_ATTRIBUTE_BOLD) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = self == DC_FONT_ATTRIBUTE_BOLD_ITALIC;
	}
	if (_tmp1_) {
		_tmp0_ = PANGO_WEIGHT_BOLD;
	} else {
		_tmp0_ = PANGO_WEIGHT_NORMAL;
	}
	result = _tmp0_;
	return result;
}

gchar*
dc_font_attribute_css_style (DcFontAttribute self)
{
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* result;
	if (dc_font_attribute_pango_style (self) == PANGO_STYLE_ITALIC) {
		_tmp0_ = "italic";
	} else {
		_tmp0_ = "normal";
	}
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

gchar*
dc_font_attribute_css_weight (DcFontAttribute self)
{
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* result;
	if (dc_font_attribute_pango_weight (self) == PANGO_WEIGHT_BOLD) {
		_tmp0_ = "bold";
	} else {
		_tmp0_ = "normal";
	}
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static GType
dc_font_attribute_get_type_once (void)
{
	static const GEnumValue values[] = {{DC_FONT_ATTRIBUTE_REGULAR, "DC_FONT_ATTRIBUTE_REGULAR", "regular"}, {DC_FONT_ATTRIBUTE_ITALIC, "DC_FONT_ATTRIBUTE_ITALIC", "italic"}, {DC_FONT_ATTRIBUTE_BOLD, "DC_FONT_ATTRIBUTE_BOLD", "bold"}, {DC_FONT_ATTRIBUTE_BOLD_ITALIC, "DC_FONT_ATTRIBUTE_BOLD_ITALIC", "bold-italic"}, {0, NULL, NULL}};
	GType dc_font_attribute_type_id;
	dc_font_attribute_type_id = g_enum_register_static ("DcFontAttribute", values);
	return dc_font_attribute_type_id;
}

GType
dc_font_attribute_get_type (void)
{
	static volatile gsize dc_font_attribute_type_id__once = 0;
	if (g_once_init_enter (&dc_font_attribute_type_id__once)) {
		GType dc_font_attribute_type_id;
		dc_font_attribute_type_id = dc_font_attribute_get_type_once ();
		g_once_init_leave (&dc_font_attribute_type_id__once, dc_font_attribute_type_id);
	}
	return dc_font_attribute_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;
}

/**
         * True when this build pins the deltachat-rpc-server to a fixed binary
         * (meson -Drpc_server_path=...). Such builds always use that binary as
         * the Custom server and never auto-update the engine.
         */
gboolean
dc_settings_manager_rpc_server_path_is_fixed (void)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean result;
	_tmp0_ = strlen (PARLA_RPC_SERVER_PATH);
	_tmp1_ = _tmp0_;
	result = _tmp1_ > 0;
	return result;
}

/** Server path to actually use: the pinned one if set, else the user's. */
gchar*
dc_settings_manager_effective_rpc_server_path (DcSettingsManager* self)
{
	const gchar* _tmp0_ = NULL;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (dc_settings_manager_rpc_server_path_is_fixed ()) {
		_tmp0_ = PARLA_RPC_SERVER_PATH;
	} else {
		const gchar* _tmp1_;
		_tmp1_ = self->priv->_rpc_server_path;
		_tmp0_ = _tmp1_;
	}
	_tmp2_ = g_strdup (_tmp0_);
	result = _tmp2_;
	return result;
}

/** Server source to actually use: Custom when pinned, else the user's. */
DcRpcServerSource
dc_settings_manager_effective_rpc_server_source (DcSettingsManager* self)
{
	DcRpcServerSource _tmp0_ = 0;
	DcRpcServerSource result;
	g_return_val_if_fail (self != NULL, 0);
	if (dc_settings_manager_rpc_server_path_is_fixed ()) {
		_tmp0_ = DC_RPC_SERVER_SOURCE_CUSTOM;
	} else {
		DcRpcServerSource _tmp1_;
		_tmp1_ = self->priv->_rpc_server_source;
		_tmp0_ = _tmp1_;
	}
	result = _tmp0_;
	return result;
}

/** Whether Parla may check for / install engine updates. */
gboolean
dc_settings_manager_rpc_auto_update_enabled (DcSettingsManager* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (!dc_settings_manager_rpc_server_path_is_fixed ()) {
		gboolean _tmp1_;
		_tmp1_ = self->priv->_rpc_check_updates_on_startup;
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gchar*
dc_settings_manager_default_accounts_path (DcSettingsManager* self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = dc_account_finder_get_data_dir ();
	_tmp1_ = _tmp0_;
	_tmp2_ = g_build_filename (_tmp1_, "accounts", NULL);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

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
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static gchar*
dc_settings_manager_normalize_accounts_path (DcSettingsManager* self,
                                             const gchar* value)
{
	gchar* path = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = string_strip (value);
	path = _tmp0_;
	while (TRUE) {
		gboolean _tmp1_ = FALSE;
		const gchar* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gboolean _tmp8_ = FALSE;
		const gchar* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gchar* _tmp17_;
		_tmp2_ = path;
		_tmp3_ = strlen (_tmp2_);
		_tmp4_ = _tmp3_;
		if (_tmp4_ > 1) {
			gboolean _tmp5_ = FALSE;
			const gchar* _tmp6_;
			_tmp6_ = path;
			if (g_str_has_suffix (_tmp6_, "/")) {
				_tmp5_ = TRUE;
			} else {
				const gchar* _tmp7_;
				_tmp7_ = path;
				_tmp5_ = g_str_has_suffix (_tmp7_, "\\");
			}
			_tmp1_ = _tmp5_;
		} else {
			_tmp1_ = FALSE;
		}
		if (!_tmp1_) {
			break;
		}
		_tmp9_ = path;
		_tmp10_ = strlen (_tmp9_);
		_tmp11_ = _tmp10_;
		if (_tmp11_ == 3) {
			const gchar* _tmp12_;
			_tmp12_ = path;
			_tmp8_ = string_get (_tmp12_, (glong) 1) == ':';
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			break;
		}
		_tmp13_ = path;
		_tmp14_ = path;
		_tmp15_ = strlen (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = string_slice (_tmp13_, (glong) 0, (glong) (_tmp16_ - 1));
		_g_free0 (path);
		path = _tmp17_;
	}
	result = path;
	return result;
}

gboolean
dc_settings_manager_is_default_accounts_path (DcSettingsManager* self,
                                              const gchar* value)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (value != NULL, FALSE);
	_tmp0_ = dc_settings_manager_normalize_accounts_path (self, value);
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_settings_manager_default_accounts_path (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strcmp0 (_tmp1_, _tmp3_) == 0;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	result = _tmp4_;
	return result;
}

gboolean
dc_settings_manager_uses_default_accounts_path (DcSettingsManager* self)
{
	const gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_accounts_path;
	result = dc_settings_manager_is_default_accounts_path (self, _tmp0_);
	return result;
}

gchar*
dc_settings_manager_effective_accounts_path (DcSettingsManager* self)
{
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_accounts_path;
	_tmp2_ = strlen (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ > 0) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp4_ = self->priv->_accounts_path;
		_tmp5_ = g_strdup (_tmp4_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp5_;
	} else {
		gchar* _tmp6_;
		_tmp6_ = dc_settings_manager_default_accounts_path (self);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp6_;
	}
	_tmp7_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp7_;
	_g_free0 (_tmp0_);
	return result;
}

void
dc_settings_manager_load (DcSettingsManager* self)
{
	GKeyFile* kf = NULL;
	GKeyFile* _tmp0_;
	DcMarkdownMode _tmp3_;
	DcCodeTheme _tmp4_;
	gboolean _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	gint source = 0;
	gint sb = 0;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gint theme = 0;
	gint ms = 0;
	gint bad = 0;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gint bm = 0;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gint fa = 0;
	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_enum (kf, "double_click_action", 0, 5));
	dc_settings_manager_set_markdown_mode (self, dc_settings_manager_kf_markdown_mode (kf));
	_tmp3_ = self->priv->_markdown_mode;
	dc_markdown_mode = _tmp3_;
	dc_settings_manager_set_code_theme (self, (DcCodeTheme) dc_settings_manager_kf_enum (kf, "code_theme", (gint) DC_CODE_THEME_ADAPTIVE, (gint) DC_CODE_THEME_NONE));
	_tmp4_ = self->priv->_code_theme;
	dc_syntax_highlight_theme = _tmp4_;
	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_show_notification_contents (self, dc_settings_manager_kf_bool (kf, "show_notification_contents", TRUE));
	dc_settings_manager_set_minimize_to_tray (self, dc_settings_manager_kf_bool (kf, "minimize_to_tray", FALSE));
	dc_settings_manager_set_system_audio_player (self, dc_settings_manager_kf_bool (kf, "system_audio_player", FALSE));
	_tmp5_ = self->priv->_system_audio_player;
	dc_audio_player_prefer_system = _tmp5_;
	dc_settings_manager_set_animate_stickers (self, dc_settings_manager_kf_bool (kf, "animate_stickers", TRUE));
	dc_settings_manager_set_auto_download_limit (self, dc_settings_manager_normalize_auto_download_limit (dc_settings_manager_kf_int (kf, "auto_download_limit", DC_AUTO_DOWNLOAD_DEFAULT)));
	_tmp6_ = dc_settings_manager_kf_str (kf, "rpc_server_path", "");
	_tmp7_ = _tmp6_;
	dc_settings_manager_set_rpc_server_path (self, _tmp7_);
	_g_free0 (_tmp7_);
	_tmp8_ = dc_settings_manager_kf_str (kf, "accounts_path", "");
	_tmp9_ = _tmp8_;
	_tmp10_ = dc_settings_manager_normalize_accounts_path (self, _tmp9_);
	_tmp11_ = _tmp10_;
	dc_settings_manager_set_accounts_path (self, _tmp11_);
	_g_free0 (_tmp11_);
	_g_free0 (_tmp9_);
	_tmp12_ = self->priv->_accounts_path;
	if (dc_settings_manager_is_default_accounts_path (self, _tmp12_)) {
		dc_settings_manager_set_accounts_path (self, "");
	}
	source = dc_settings_manager_kf_enum (kf, "rpc_server_source", (gint) DC_RPC_SERVER_SOURCE_AUTO, 1);
	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_enum (kf, "sidebar_mode", (gint) DC_SIDEBAR_MODE_FULL, 2);
	dc_settings_manager_set_sidebar_mode (self, (DcSidebarMode) sb);
	_tmp13_ = dc_settings_manager_kf_str (kf, "default_account_addr", "");
	_tmp14_ = _tmp13_;
	dc_settings_manager_set_default_account_addr (self, _tmp14_);
	_g_free0 (_tmp14_);
	theme = dc_settings_manager_kf_enum (kf, "theme_override", (gint) DC_THEME_OVERRIDE_SYSTEM, 2);
	dc_settings_manager_set_theme_override (self, (DcThemeOverride) theme);
	ms = dc_settings_manager_kf_enum (kf, "message_style", (gint) DC_MESSAGE_STYLE_BUBBLES, 2);
	dc_settings_manager_set_message_style (self, (DcMessageStyle) ms);
	bad = dc_settings_manager_kf_enum (kf, "bubble_avatar_display", (gint) DC_BUBBLE_AVATAR_DISPLAY_NONE, 2);
	dc_settings_manager_set_bubble_avatar_display (self, (DcBubbleAvatarDisplay) bad);
	dc_settings_manager_set_bubble_avatars_in_direct_chats (self, dc_settings_manager_kf_bool (kf, "bubble_avatars_in_direct_chats", FALSE));
	_tmp15_ = dc_settings_manager_kf_str (kf, "accent_color", "");
	_tmp16_ = _tmp15_;
	dc_settings_manager_set_accent_color (self, _tmp16_);
	_g_free0 (_tmp16_);
	bm = dc_settings_manager_kf_enum (kf, "background_mode", (gint) DC_BACKGROUND_MODE_SYSTEM, 2);
	dc_settings_manager_set_background_mode (self, (DcBackgroundMode) bm);
	_tmp17_ = dc_settings_manager_kf_str (kf, "background_color", "");
	_tmp18_ = _tmp17_;
	dc_settings_manager_set_background_color (self, _tmp18_);
	_g_free0 (_tmp18_);
	_tmp19_ = dc_settings_manager_kf_str (kf, "font_family", "");
	_tmp20_ = _tmp19_;
	_tmp21_ = string_strip (_tmp20_);
	_tmp22_ = _tmp21_;
	dc_settings_manager_set_font_family (self, _tmp22_);
	_g_free0 (_tmp22_);
	_g_free0 (_tmp20_);
	fa = dc_settings_manager_kf_enum (kf, "font_attribute", (gint) DC_FONT_ATTRIBUTE_REGULAR, 3);
	dc_settings_manager_set_font_attribute (self, (DcFontAttribute) fa);
	dc_settings_manager_set_font_size (self, dc_settings_manager_clamp_font_size (dc_settings_manager_kf_int (kf, "font_size", DC_FONT_SIZE_SYSTEM)));
	_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 gint
dc_settings_manager_kf_enum (GKeyFile* kf,
                             const gchar* k,
                             gint d,
                             gint max)
{
	gint v = 0;
	gint _tmp0_ = 0;
	gboolean _tmp1_ = FALSE;
	gint result;
	g_return_val_if_fail (kf != NULL, -1);
	g_return_val_if_fail (k != NULL, -1);
	v = dc_settings_manager_kf_int (kf, k, d);
	if (v >= 0) {
		_tmp1_ = v <= max;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = v;
	} else {
		_tmp0_ = d;
	}
	result = _tmp0_;
	return result;
}

static DcMarkdownMode
dc_settings_manager_kf_markdown_mode (GKeyFile* kf)
{
	GError* _inner_error0_ = NULL;
	DcMarkdownMode result;
	g_return_val_if_fail (kf != NULL, 0);
	{
		gint value = 0;
		gboolean _tmp0_ = FALSE;
		value = g_key_file_get_integer (kf, "General", "markdown_rendering", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (value >= ((gint) DC_MARKDOWN_MODE_ENABLED)) {
			_tmp0_ = value <= ((gint) DC_MARKDOWN_MODE_DISABLED);
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			result = (DcMarkdownMode) value;
			return result;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return 0;
	}
	{
		DcMarkdownMode _tmp1_ = 0;
		gboolean _tmp2_ = FALSE;
		_tmp2_ = g_key_file_get_boolean (kf, "General", "markdown_rendering", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		if (_tmp2_) {
			_tmp1_ = DC_MARKDOWN_MODE_ENABLED;
		} else {
			_tmp1_ = DC_MARKDOWN_MODE_DISABLED;
		}
		result = _tmp1_;
		return result;
	}
	goto __finally1;
	__catch1_g_error:
	{
		g_clear_error (&_inner_error0_);
		result = DC_MARKDOWN_MODE_ENABLED;
		return result;
	}
	__finally1:
	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 0;
}

void
dc_settings_manager_save_double_click_action (DcSettingsManager* self,
                                              gint v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_double_click_action (self, v);
	dc_settings_manager_save_int (self, "double_click_action", v);
}

void
dc_settings_manager_save_markdown_mode (DcSettingsManager* self,
                                        DcMarkdownMode mode)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_markdown_mode (self, mode);
	dc_markdown_mode = mode;
	dc_settings_manager_save_int (self, "markdown_rendering", (gint) mode);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
}

void
dc_settings_manager_save_code_theme (DcSettingsManager* self,
                                     DcCodeTheme theme)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_code_theme (self, theme);
	dc_syntax_highlight_theme = theme;
	dc_settings_manager_save_int (self, "code_theme", (gint) theme);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
}

void
dc_settings_manager_save_shift_enter_sends (DcSettingsManager* self,
                                            gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_shift_enter_sends (self, v);
	dc_settings_manager_save_bool (self, "shift_enter_sends", v);
}

void
dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_notifications_enabled (self, v);
	dc_settings_manager_save_bool (self, "notifications_enabled", v);
}

void
dc_settings_manager_save_show_notification_contents (DcSettingsManager* self,
                                                     gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_show_notification_contents (self, v);
	dc_settings_manager_save_bool (self, "show_notification_contents", v);
}

void
dc_settings_manager_save_minimize_to_tray (DcSettingsManager* self,
                                           gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_minimize_to_tray (self, v);
	dc_settings_manager_save_bool (self, "minimize_to_tray", v);
}

void
dc_settings_manager_save_system_audio_player (DcSettingsManager* self,
                                              gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_system_audio_player (self, v);
	dc_audio_player_prefer_system = v;
	dc_settings_manager_save_bool (self, "system_audio_player", v);
}

void
dc_settings_manager_save_animate_stickers (DcSettingsManager* self,
                                           gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_animate_stickers (self, v);
	dc_settings_manager_save_bool (self, "animate_stickers", v);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
}

void
dc_settings_manager_save_auto_download_limit (DcSettingsManager* self,
                                              gint bytes)
{
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_auto_download_limit (self, dc_settings_manager_normalize_auto_download_limit (bytes));
	_tmp0_ = self->priv->_auto_download_limit;
	dc_settings_manager_save_int (self, "auto_download_limit", _tmp0_);
}

gint
dc_settings_manager_normalize_auto_download_limit (gint bytes)
{
	gint result;
	switch (bytes) {
		case 0:
		case DC_AUTO_DOWNLOAD_NEVER:
		case 256 * 1024:
		case 512 * 1024:
		case 1024 * 1024:
		case (2 * 1024) * 1024:
		case (5 * 1024) * 1024:
		{
			result = bytes;
			return result;
		}
		default:
		{
			result = DC_AUTO_DOWNLOAD_DEFAULT;
			return result;
		}
	}
}

void
dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                          const gchar* v)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	dc_settings_manager_set_rpc_server_path (self, v);
	dc_settings_manager_save_string (self, "rpc_server_path", v);
}

void
dc_settings_manager_save_accounts_path (DcSettingsManager* self,
                                        const gchar* v)
{
	gchar* clean_path = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_tmp0_ = dc_settings_manager_normalize_accounts_path (self, v);
	clean_path = _tmp0_;
	_tmp2_ = clean_path;
	if (dc_settings_manager_is_default_accounts_path (self, _tmp2_)) {
		_tmp1_ = "";
	} else {
		const gchar* _tmp3_;
		_tmp3_ = clean_path;
		_tmp1_ = _tmp3_;
	}
	dc_settings_manager_set_accounts_path (self, _tmp1_);
	_tmp4_ = self->priv->_accounts_path;
	dc_settings_manager_save_string (self, "accounts_path", _tmp4_);
	_g_free0 (clean_path);
}

void
dc_settings_manager_reset_accounts_path (DcSettingsManager* self)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_save_accounts_path (self, "");
}

void
dc_settings_manager_save_rpc_server_source (DcSettingsManager* self,
                                            DcRpcServerSource v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_rpc_server_source (self, v);
	dc_settings_manager_save_int (self, "rpc_server_source", (gint) v);
}

void
dc_settings_manager_save_rpc_check_updates_on_startup (DcSettingsManager* self,
                                                       gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_rpc_check_updates_on_startup (self, v);
	dc_settings_manager_save_bool (self, "rpc_check_updates_on_startup", v);
}

void
dc_settings_manager_save_sidebar_mode (DcSettingsManager* self,
                                       DcSidebarMode v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_sidebar_mode (self, v);
	dc_settings_manager_save_int (self, "sidebar_mode", (gint) v);
}

void
dc_settings_manager_save_default_account_addr (DcSettingsManager* self,
                                               const gchar* v)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	dc_settings_manager_set_default_account_addr (self, v);
	dc_settings_manager_save_string (self, "default_account_addr", v);
}

void
dc_settings_manager_save_theme_override (DcSettingsManager* self,
                                         DcThemeOverride v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_theme_override (self, v);
	dc_settings_manager_save_int (self, "theme_override", (gint) v);
}

void
dc_settings_manager_save_message_style (DcSettingsManager* self,
                                        DcMessageStyle v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_message_style (self, v);
	dc_settings_manager_save_int (self, "message_style", (gint) v);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
}

void
dc_settings_manager_save_bubble_avatar_display (DcSettingsManager* self,
                                                DcBubbleAvatarDisplay v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_bubble_avatar_display (self, v);
	dc_settings_manager_save_int (self, "bubble_avatar_display", (gint) v);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
}

void
dc_settings_manager_save_bubble_avatars_in_direct_chats (DcSettingsManager* self,
                                                         gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_bubble_avatars_in_direct_chats (self, v);
	dc_settings_manager_save_bool (self, "bubble_avatars_in_direct_chats", v);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
}

void
dc_settings_manager_save_accent_color (DcSettingsManager* self,
                                       const gchar* v)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	dc_settings_manager_set_accent_color (self, v);
	dc_settings_manager_save_string (self, "accent_color", v);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
}

void
dc_settings_manager_save_background_mode (DcSettingsManager* self,
                                          DcBackgroundMode v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_background_mode (self, v);
	dc_settings_manager_save_int (self, "background_mode", (gint) v);
}

void
dc_settings_manager_save_background_color (DcSettingsManager* self,
                                           const gchar* v)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	dc_settings_manager_set_background_color (self, v);
	dc_settings_manager_save_string (self, "background_color", v);
}

void
dc_settings_manager_save_font_size (DcSettingsManager* self,
                                    gint v)
{
	const gchar* _tmp0_;
	DcFontAttribute _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_font_family;
	_tmp1_ = self->priv->_font_attribute;
	dc_settings_manager_save_font (self, _tmp0_, _tmp1_, v);
}

void
dc_settings_manager_save_font_description (DcSettingsManager* self,
                                           PangoFontDescription* desc)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	gchar* family = NULL;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (desc != NULL);
	_tmp1_ = pango_font_description_get_family (desc);
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp2_ = g_strdup (_tmp0_);
	family = _tmp2_;
	dc_settings_manager_save_font (self, family, dc_settings_manager_attribute_from_font_description (desc), dc_settings_manager_size_from_font_description (desc));
	_g_free0 (family);
}

void
dc_settings_manager_reset_font_defaults (DcSettingsManager* self)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_save_font (self, "", DC_FONT_ATTRIBUTE_REGULAR, DC_FONT_SIZE_SYSTEM);
}

static void
__lambda291_ (DcSettingsManager* self,
              GKeyFile* kf)
{
	const gchar* _tmp0_;
	DcFontAttribute _tmp1_;
	gint _tmp2_;
	g_return_if_fail (kf != NULL);
	_tmp0_ = self->priv->_font_family;
	g_key_file_set_string (kf, "General", "font_family", _tmp0_);
	_tmp1_ = self->priv->_font_attribute;
	g_key_file_set_integer (kf, "General", "font_attribute", (gint) _tmp1_);
	_tmp2_ = self->priv->_font_size;
	g_key_file_set_integer (kf, "General", "font_size", _tmp2_);
}

static void
___lambda291__dc_setting_writer (GKeyFile* kf,
                                 gpointer self)
{
	__lambda291_ ((DcSettingsManager*) self, kf);
}

static void
dc_settings_manager_save_font (DcSettingsManager* self,
                               const gchar* family,
                               DcFontAttribute attr,
                               gint size)
{
	gchar* clean_family = NULL;
	gchar* _tmp0_;
	gint clean_size = 0;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (family != NULL);
	_tmp0_ = string_strip (family);
	clean_family = _tmp0_;
	clean_size = dc_settings_manager_clamp_font_size (size);
	_tmp3_ = self->priv->_font_family;
	_tmp4_ = clean_family;
	if (g_strcmp0 (_tmp3_, _tmp4_) == 0) {
		DcFontAttribute _tmp5_;
		_tmp5_ = self->priv->_font_attribute;
		_tmp2_ = _tmp5_ == attr;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		gint _tmp6_;
		_tmp6_ = self->priv->_font_size;
		_tmp1_ = _tmp6_ == clean_size;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_g_free0 (clean_family);
		return;
	}
	_tmp7_ = clean_family;
	dc_settings_manager_set_font_family (self, _tmp7_);
	dc_settings_manager_set_font_attribute (self, attr);
	dc_settings_manager_set_font_size (self, clean_size);
	dc_settings_manager_save_to_file (self, ___lambda291__dc_setting_writer, self);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_FONT_CHANGED_SIGNAL], 0);
	_g_free0 (clean_family);
}

gint
dc_settings_manager_clamp_font_size (gint size)
{
	gint result;
	if (size <= DC_FONT_SIZE_SYSTEM) {
		result = DC_FONT_SIZE_SYSTEM;
		return result;
	}
	if (size < DC_FONT_SIZE_MIN) {
		result = DC_FONT_SIZE_MIN;
		return result;
	}
	if (size > DC_FONT_SIZE_MAX) {
		result = DC_FONT_SIZE_MAX;
		return result;
	}
	result = size;
	return result;
}

static void
_vala_PangoFontDescription_free (PangoFontDescription* self)
{
	g_boxed_free (pango_font_description_get_type (), self);
}

gint
dc_settings_manager_system_font_size (void)
{
	gchar* font_name = NULL;
	gchar* _tmp0_;
	PangoFontDescription* desc = NULL;
	const gchar* _tmp1_;
	PangoFontDescription* _tmp2_;
	gint size = 0;
	PangoFontDescription* _tmp3_;
	gint _tmp4_ = 0;
	gint result;
	_tmp0_ = dc_settings_manager_system_font_name ();
	font_name = _tmp0_;
	_tmp1_ = font_name;
	_tmp2_ = pango_font_description_from_string (_tmp1_);
	desc = _tmp2_;
	_tmp3_ = desc;
	size = dc_settings_manager_size_from_font_description (_tmp3_);
	if (size > 0) {
		_tmp4_ = dc_settings_manager_clamp_font_size (size);
	} else {
		_tmp4_ = DC_FONT_SIZE_FALLBACK;
	}
	result = _tmp4_;
	__vala_PangoFontDescription_free0 (desc);
	_g_free0 (font_name);
	return result;
}

gint
dc_settings_manager_effective_font_size (DcSettingsManager* self)
{
	gint _tmp0_ = 0;
	gint _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp1_ = self->priv->_font_size;
	if (_tmp1_ > 0) {
		gint _tmp2_;
		_tmp2_ = self->priv->_font_size;
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = dc_settings_manager_system_font_size ();
	}
	result = _tmp0_;
	return result;
}

PangoFontDescription*
dc_settings_manager_effective_font_description (DcSettingsManager* self)
{
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	PangoFontDescription* desc = NULL;
	PangoFontDescription* _tmp7_;
	DcFontAttribute _tmp8_;
	DcFontAttribute _tmp9_;
	PangoFontDescription* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = self->priv->_font_family;
	_tmp2_ = strlen (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ > 0) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp4_ = self->priv->_font_family;
		_tmp5_ = g_strdup (_tmp4_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp5_;
	} else {
		gchar* _tmp6_;
		_tmp6_ = dc_settings_manager_system_font_name ();
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp6_;
	}
	_tmp7_ = pango_font_description_from_string (_tmp0_);
	desc = _tmp7_;
	_tmp8_ = self->priv->_font_attribute;
	pango_font_description_set_style (desc, dc_font_attribute_pango_style (_tmp8_));
	_tmp9_ = self->priv->_font_attribute;
	pango_font_description_set_weight (desc, dc_font_attribute_pango_weight (_tmp9_));
	pango_font_description_set_size (desc, dc_settings_manager_effective_font_size (self) * PANGO_SCALE);
	result = desc;
	_g_free0 (_tmp0_);
	return result;
}

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

static gchar*
dc_settings_manager_system_font_name (void)
{
	GtkSettings* gtk_settings = NULL;
	GtkSettings* _tmp0_;
	GtkSettings* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GtkSettings* _tmp3_;
	GtkSettings* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* result;
	_tmp0_ = gtk_settings_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	gtk_settings = _tmp1_;
	_tmp3_ = gtk_settings;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		GtkSettings* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp4_ = gtk_settings;
		g_object_get (_tmp4_, "gtk-font-name", &_tmp5_, NULL);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp8_ = strlen (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp2_ = _tmp9_ == 0;
		_g_free0 (_tmp7_);
	}
	if (_tmp2_) {
		gchar* _tmp10_;
		_tmp10_ = g_strdup_printf ("Sans %d", DC_FONT_SIZE_FALLBACK);
		result = _tmp10_;
		_g_object_unref0 (gtk_settings);
		return result;
	}
	_tmp11_ = gtk_settings;
	g_object_get (_tmp11_, "gtk-font-name", &_tmp12_, NULL);
	_tmp13_ = _tmp12_;
	result = _tmp13_;
	_g_object_unref0 (gtk_settings);
	return result;
}

static gint
dc_settings_manager_size_from_font_description (PangoFontDescription* desc)
{
	gint size = 0;
	gint result;
	g_return_val_if_fail (desc != NULL, -1);
	size = pango_font_description_get_size (desc);
	if (size <= 0) {
		result = DC_FONT_SIZE_SYSTEM;
		return result;
	}
	result = (size + (PANGO_SCALE / 2)) / PANGO_SCALE;
	return result;
}

static DcFontAttribute
dc_settings_manager_attribute_from_font_description (PangoFontDescription* desc)
{
	gboolean _tmp0_ = FALSE;
	gboolean italic = FALSE;
	gboolean bold = FALSE;
	gboolean _tmp1_ = FALSE;
	DcFontAttribute result;
	g_return_val_if_fail (desc != NULL, 0);
	if (pango_font_description_get_style (desc) == PANGO_STYLE_ITALIC) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = pango_font_description_get_style (desc) == PANGO_STYLE_OBLIQUE;
	}
	italic = _tmp0_;
	bold = ((gint) pango_font_description_get_weight (desc)) >= ((gint) PANGO_WEIGHT_BOLD);
	if (italic) {
		_tmp1_ = bold;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		result = DC_FONT_ATTRIBUTE_BOLD_ITALIC;
		return result;
	}
	if (italic) {
		result = DC_FONT_ATTRIBUTE_ITALIC;
		return result;
	}
	if (bold) {
		result = DC_FONT_ATTRIBUTE_BOLD;
		return result;
	}
	result = DC_FONT_ATTRIBUTE_REGULAR;
	return result;
}

static Block84Data*
block84_data_ref (Block84Data* _data84_)
{
	g_atomic_int_inc (&_data84_->_ref_count_);
	return _data84_;
}

static void
block84_data_unref (void * _userdata_)
{
	Block84Data* _data84_;
	_data84_ = (Block84Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data84_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data84_->self;
		_g_free0 (_data84_->key);
		_g_object_unref0 (self);
		g_slice_free (Block84Data, _data84_);
	}
}

static void
__lambda285_ (Block84Data* _data84_,
              GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data84_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_integer (kf, "General", _data84_->key, _data84_->value);
}

static void
___lambda285__dc_setting_writer (GKeyFile* kf,
                                 gpointer self)
{
	__lambda285_ (self, kf);
}

static void
dc_settings_manager_save_int (DcSettingsManager* self,
                              const gchar* key,
                              gint value)
{
	Block84Data* _data84_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_data84_ = g_slice_new0 (Block84Data);
	_data84_->_ref_count_ = 1;
	_data84_->self = g_object_ref (self);
	_tmp0_ = g_strdup (key);
	_g_free0 (_data84_->key);
	_data84_->key = _tmp0_;
	_data84_->value = value;
	dc_settings_manager_save_to_file (self, ___lambda285__dc_setting_writer, _data84_);
	block84_data_unref (_data84_);
	_data84_ = NULL;
}

static Block85Data*
block85_data_ref (Block85Data* _data85_)
{
	g_atomic_int_inc (&_data85_->_ref_count_);
	return _data85_;
}

static void
block85_data_unref (void * _userdata_)
{
	Block85Data* _data85_;
	_data85_ = (Block85Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data85_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data85_->self;
		_g_free0 (_data85_->key);
		_g_object_unref0 (self);
		g_slice_free (Block85Data, _data85_);
	}
}

static void
__lambda253_ (Block85Data* _data85_,
              GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data85_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_boolean (kf, "General", _data85_->key, _data85_->value);
}

static void
___lambda253__dc_setting_writer (GKeyFile* kf,
                                 gpointer self)
{
	__lambda253_ (self, kf);
}

static void
dc_settings_manager_save_bool (DcSettingsManager* self,
                               const gchar* key,
                               gboolean value)
{
	Block85Data* _data85_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_data85_ = g_slice_new0 (Block85Data);
	_data85_->_ref_count_ = 1;
	_data85_->self = g_object_ref (self);
	_tmp0_ = g_strdup (key);
	_g_free0 (_data85_->key);
	_data85_->key = _tmp0_;
	_data85_->value = value;
	dc_settings_manager_save_to_file (self, ___lambda253__dc_setting_writer, _data85_);
	block85_data_unref (_data85_);
	_data85_ = NULL;
}

static Block86Data*
block86_data_ref (Block86Data* _data86_)
{
	g_atomic_int_inc (&_data86_->_ref_count_);
	return _data86_;
}

static void
block86_data_unref (void * _userdata_)
{
	Block86Data* _data86_;
	_data86_ = (Block86Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data86_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data86_->self;
		_g_free0 (_data86_->key);
		_g_free0 (_data86_->value);
		_g_object_unref0 (self);
		g_slice_free (Block86Data, _data86_);
	}
}

static void
__lambda153_ (Block86Data* _data86_,
              GKeyFile* kf)
{
	DcSettingsManager* self;
	self = _data86_->self;
	g_return_if_fail (kf != NULL);
	g_key_file_set_string (kf, "General", _data86_->key, _data86_->value);
}

static void
___lambda153__dc_setting_writer (GKeyFile* kf,
                                 gpointer self)
{
	__lambda153_ (self, kf);
}

static void
dc_settings_manager_save_string (DcSettingsManager* self,
                                 const gchar* key,
                                 const gchar* value)
{
	Block86Data* _data86_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	g_return_if_fail (value != NULL);
	_data86_ = g_slice_new0 (Block86Data);
	_data86_->_ref_count_ = 1;
	_data86_->self = g_object_ref (self);
	_tmp0_ = g_strdup (key);
	_g_free0 (_data86_->key);
	_data86_->key = _tmp0_;
	_tmp1_ = g_strdup (value);
	_g_free0 (_data86_->value);
	_data86_->value = _tmp1_;
	dc_settings_manager_save_to_file (self, ___lambda153__dc_setting_writer, _data86_);
	block86_data_unref (_data86_);
	_data86_ = 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:512: 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]);
	}
}

DcMarkdownMode
dc_settings_manager_get_markdown_mode (DcSettingsManager* self)
{
	DcMarkdownMode result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_markdown_mode;
	return result;
}

void
dc_settings_manager_set_markdown_mode (DcSettingsManager* self,
                                       DcMarkdownMode value)
{
	DcMarkdownMode old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_markdown_mode (self);
	if (old_value != value) {
		self->priv->_markdown_mode = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MARKDOWN_MODE_PROPERTY]);
	}
}

DcCodeTheme
dc_settings_manager_get_code_theme (DcSettingsManager* self)
{
	DcCodeTheme result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_code_theme;
	return result;
}

void
dc_settings_manager_set_code_theme (DcSettingsManager* self,
                                    DcCodeTheme value)
{
	DcCodeTheme old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_code_theme (self);
	if (old_value != value) {
		self->priv->_code_theme = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_CODE_THEME_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_show_notification_contents (DcSettingsManager* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_notification_contents;
	return result;
}

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

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

void
dc_settings_manager_set_system_audio_player (DcSettingsManager* self,
                                             gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_system_audio_player (self);
	if (old_value != value) {
		self->priv->_system_audio_player = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SYSTEM_AUDIO_PLAYER_PROPERTY]);
	}
}

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

void
dc_settings_manager_set_animate_stickers (DcSettingsManager* self,
                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_animate_stickers (self);
	if (old_value != value) {
		self->priv->_animate_stickers = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_ANIMATE_STICKERS_PROPERTY]);
	}
}

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

void
dc_settings_manager_set_auto_download_limit (DcSettingsManager* self,
                                             gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_auto_download_limit (self);
	if (old_value != value) {
		self->priv->_auto_download_limit = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_AUTO_DOWNLOAD_LIMIT_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]);
	}
}

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

void
dc_settings_manager_set_accounts_path (DcSettingsManager* self,
                                       const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_accounts_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_accounts_path);
		self->priv->_accounts_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_ACCOUNTS_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]);
	}
}

DcThemeOverride
dc_settings_manager_get_theme_override (DcSettingsManager* self)
{
	DcThemeOverride result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_theme_override;
	return result;
}

void
dc_settings_manager_set_theme_override (DcSettingsManager* self,
                                        DcThemeOverride value)
{
	DcThemeOverride old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_theme_override (self);
	if (old_value != value) {
		self->priv->_theme_override = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_THEME_OVERRIDE_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]);
	}
}

DcBubbleAvatarDisplay
dc_settings_manager_get_bubble_avatar_display (DcSettingsManager* self)
{
	DcBubbleAvatarDisplay result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_bubble_avatar_display;
	return result;
}

void
dc_settings_manager_set_bubble_avatar_display (DcSettingsManager* self,
                                               DcBubbleAvatarDisplay value)
{
	DcBubbleAvatarDisplay old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_bubble_avatar_display (self);
	if (old_value != value) {
		self->priv->_bubble_avatar_display = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_BUBBLE_AVATAR_DISPLAY_PROPERTY]);
	}
}

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

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

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

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

DcFontAttribute
dc_settings_manager_get_font_attribute (DcSettingsManager* self)
{
	DcFontAttribute result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_font_attribute;
	return result;
}

void
dc_settings_manager_set_font_attribute (DcSettingsManager* self,
                                        DcFontAttribute value)
{
	DcFontAttribute old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_font_attribute (self);
	if (old_value != value) {
		self->priv->_font_attribute = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_FONT_ATTRIBUTE_PROPERTY]);
	}
}

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

void
dc_settings_manager_set_font_size (DcSettingsManager* self,
                                   gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_font_size (self);
	if (old_value != value) {
		self->priv->_font_size = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_FONT_SIZE_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_MODE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MARKDOWN_MODE_PROPERTY] = g_param_spec_enum ("markdown-mode", "markdown-mode", "markdown-mode", DC_TYPE_MARKDOWN_MODE, DC_MARKDOWN_MODE_ENABLED, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_CODE_THEME_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_CODE_THEME_PROPERTY] = g_param_spec_enum ("code-theme", "code-theme", "code-theme", DC_TYPE_CODE_THEME, DC_CODE_THEME_ADAPTIVE, 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_SHOW_NOTIFICATION_CONTENTS_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SHOW_NOTIFICATION_CONTENTS_PROPERTY] = g_param_spec_boolean ("show-notification-contents", "show-notification-contents", "show-notification-contents", 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_SYSTEM_AUDIO_PLAYER_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SYSTEM_AUDIO_PLAYER_PROPERTY] = g_param_spec_boolean ("system-audio-player", "system-audio-player", "system-audio-player", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_ANIMATE_STICKERS_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_ANIMATE_STICKERS_PROPERTY] = g_param_spec_boolean ("animate-stickers", "animate-stickers", "animate-stickers", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_AUTO_DOWNLOAD_LIMIT_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_AUTO_DOWNLOAD_LIMIT_PROPERTY] = g_param_spec_int ("auto-download-limit", "auto-download-limit", "auto-download-limit", G_MININT, G_MAXINT, DC_AUTO_DOWNLOAD_DEFAULT, 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_ACCOUNTS_PATH_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_ACCOUNTS_PATH_PROPERTY] = g_param_spec_string ("accounts-path", "accounts-path", "accounts-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_THEME_OVERRIDE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_THEME_OVERRIDE_PROPERTY] = g_param_spec_enum ("theme-override", "theme-override", "theme-override", DC_TYPE_THEME_OVERRIDE, DC_THEME_OVERRIDE_SYSTEM, 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_BUBBLE_AVATAR_DISPLAY_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_BUBBLE_AVATAR_DISPLAY_PROPERTY] = g_param_spec_enum ("bubble-avatar-display", "bubble-avatar-display", "bubble-avatar-display", DC_TYPE_BUBBLE_AVATAR_DISPLAY, DC_BUBBLE_AVATAR_DISPLAY_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_BUBBLE_AVATARS_IN_DIRECT_CHATS_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_BUBBLE_AVATARS_IN_DIRECT_CHATS_PROPERTY] = g_param_spec_boolean ("bubble-avatars-in-direct-chats", "bubble-avatars-in-direct-chats", "bubble-avatars-in-direct-chats", FALSE, 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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_FONT_FAMILY_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_FONT_FAMILY_PROPERTY] = g_param_spec_string ("font-family", "font-family", "font-family", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_FONT_ATTRIBUTE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_FONT_ATTRIBUTE_PROPERTY] = g_param_spec_enum ("font-attribute", "font-attribute", "font-attribute", DC_TYPE_FONT_ATTRIBUTE, DC_FONT_ATTRIBUTE_REGULAR, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_FONT_SIZE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_FONT_SIZE_PROPERTY] = g_param_spec_int ("font-size", "font-size", "font-size", G_MININT, G_MAXINT, DC_FONT_SIZE_SYSTEM, 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);
	dc_settings_manager_signals[DC_SETTINGS_MANAGER_FONT_CHANGED_SIGNAL] = g_signal_new ("font-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_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	self->priv = dc_settings_manager_get_instance_private (self);
	self->priv->_double_click_action = 0;
	self->priv->_markdown_mode = DC_MARKDOWN_MODE_ENABLED;
	self->priv->_code_theme = DC_CODE_THEME_ADAPTIVE;
	self->priv->_shift_enter_sends = FALSE;
	self->priv->_notifications_enabled = TRUE;
	self->priv->_show_notification_contents = TRUE;
	self->priv->_minimize_to_tray = FALSE;
	self->priv->_system_audio_player = FALSE;
	self->priv->_animate_stickers = TRUE;
	self->priv->_auto_download_limit = DC_AUTO_DOWNLOAD_DEFAULT;
	_tmp0_ = g_strdup ("");
	self->priv->_rpc_server_path = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->_accounts_path = _tmp1_;
	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;
	_tmp2_ = g_strdup ("");
	self->priv->_default_account_addr = _tmp2_;
	self->priv->_theme_override = DC_THEME_OVERRIDE_SYSTEM;
	self->priv->_message_style = DC_MESSAGE_STYLE_BUBBLES;
	self->priv->_bubble_avatar_display = DC_BUBBLE_AVATAR_DISPLAY_NONE;
	self->priv->_bubble_avatars_in_direct_chats = FALSE;
	_tmp3_ = g_strdup ("");
	self->priv->_accent_color = _tmp3_;
	self->priv->_background_mode = DC_BACKGROUND_MODE_SYSTEM;
	_tmp4_ = g_strdup ("");
	self->priv->_background_color = _tmp4_;
	_tmp5_ = g_strdup ("");
	self->priv->_font_family = _tmp5_;
	self->priv->_font_attribute = DC_FONT_ATTRIBUTE_REGULAR;
	self->priv->_font_size = DC_FONT_SIZE_SYSTEM;
}

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->_accounts_path);
	_g_free0 (self->priv->_default_account_addr);
	_g_free0 (self->priv->_accent_color);
	_g_free0 (self->priv->_background_color);
	_g_free0 (self->priv->_font_family);
	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_MODE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_markdown_mode (self));
		break;
		case DC_SETTINGS_MANAGER_CODE_THEME_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_code_theme (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_SHOW_NOTIFICATION_CONTENTS_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_show_notification_contents (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_SYSTEM_AUDIO_PLAYER_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_system_audio_player (self));
		break;
		case DC_SETTINGS_MANAGER_ANIMATE_STICKERS_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_animate_stickers (self));
		break;
		case DC_SETTINGS_MANAGER_AUTO_DOWNLOAD_LIMIT_PROPERTY:
		g_value_set_int (value, dc_settings_manager_get_auto_download_limit (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_ACCOUNTS_PATH_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_accounts_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_THEME_OVERRIDE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_theme_override (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_BUBBLE_AVATAR_DISPLAY_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_bubble_avatar_display (self));
		break;
		case DC_SETTINGS_MANAGER_BUBBLE_AVATARS_IN_DIRECT_CHATS_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_bubble_avatars_in_direct_chats (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;
		case DC_SETTINGS_MANAGER_FONT_FAMILY_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_font_family (self));
		break;
		case DC_SETTINGS_MANAGER_FONT_ATTRIBUTE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_font_attribute (self));
		break;
		case DC_SETTINGS_MANAGER_FONT_SIZE_PROPERTY:
		g_value_set_int (value, dc_settings_manager_get_font_size (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_MODE_PROPERTY:
		dc_settings_manager_set_markdown_mode (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_CODE_THEME_PROPERTY:
		dc_settings_manager_set_code_theme (self, g_value_get_enum (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_SHOW_NOTIFICATION_CONTENTS_PROPERTY:
		dc_settings_manager_set_show_notification_contents (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_SYSTEM_AUDIO_PLAYER_PROPERTY:
		dc_settings_manager_set_system_audio_player (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_ANIMATE_STICKERS_PROPERTY:
		dc_settings_manager_set_animate_stickers (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_AUTO_DOWNLOAD_LIMIT_PROPERTY:
		dc_settings_manager_set_auto_download_limit (self, g_value_get_int (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_ACCOUNTS_PATH_PROPERTY:
		dc_settings_manager_set_accounts_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_THEME_OVERRIDE_PROPERTY:
		dc_settings_manager_set_theme_override (self, g_value_get_enum (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_BUBBLE_AVATAR_DISPLAY_PROPERTY:
		dc_settings_manager_set_bubble_avatar_display (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_BUBBLE_AVATARS_IN_DIRECT_CHATS_PROPERTY:
		dc_settings_manager_set_bubble_avatars_in_direct_chats (self, g_value_get_boolean (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;
		case DC_SETTINGS_MANAGER_FONT_FAMILY_PROPERTY:
		dc_settings_manager_set_font_family (self, g_value_get_string (value));
		break;
		case DC_SETTINGS_MANAGER_FONT_ATTRIBUTE_PROPERTY:
		dc_settings_manager_set_font_attribute (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_FONT_SIZE_PROPERTY:
		dc_settings_manager_set_font_size (self, g_value_get_int (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 Block87Data*
block87_data_ref (Block87Data* _data87_)
{
	g_atomic_int_inc (&_data87_->_ref_count_);
	return _data87_;
}

static void
block87_data_unref (void * _userdata_)
{
	Block87Data* _data87_;
	_data87_ = (Block87Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data87_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data87_->self;
		_g_object_unref0 (_data87_->autocheck_switch);
		_g_object_unref0 (_data87_->download_combo);
		_g_object_unref0 (_data87_->sticker_switch);
		_g_object_unref0 (_data87_->notification_contents_switch);
		_g_object_unref0 (_data87_->notif_switch);
		_g_object_unref0 (_data87_->audio_switch);
		_g_object_unref0 (_data87_->shift_switch);
		_g_object_unref0 (_data87_->md_combo);
		_g_object_unref0 (_data87_->dblclick_combo);
		_g_object_unref0 (_data87_->bg_color_btn);
		_g_object_unref0 (_data87_->bg_mode_combo);
		_g_object_unref0 (_data87_->accent_btn);
		_g_object_unref0 (_data87_->direct_avatar_check);
		_g_object_unref0 (_data87_->avatar_combo);
		_g_object_unref0 (_data87_->style_combo);
		_g_object_unref0 (_data87_->code_combo);
		_g_object_unref0 (_data87_->theme_combo);
		_g_object_unref0 (self);
		g_slice_free (Block87Data, _data87_);
	}
}

static void
__lambda284_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkDropDown* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->theme_combo;
	_tmp3_ = gtk_drop_down_get_selected (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_theme_override (_tmp1_, (DcThemeOverride) _tmp4_);
	dc_settings_dialog_apply_theme_override (self);
}

static void
___lambda284__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda284_ (self);
}

static void
__lambda286_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkDropDown* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->code_combo;
	_tmp3_ = gtk_drop_down_get_selected (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_code_theme (_tmp1_, (DcCodeTheme) _tmp4_);
}

static void
___lambda286__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda286_ (self);
}

static void
__lambda287_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkDropDown* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->style_combo;
	_tmp3_ = gtk_drop_down_get_selected (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_message_style (_tmp1_, (DcMessageStyle) _tmp4_);
}

static void
___lambda287__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda287_ (self);
}

static void
__lambda288_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkDropDown* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->avatar_combo;
	_tmp3_ = gtk_drop_down_get_selected (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_bubble_avatar_display (_tmp1_, (DcBubbleAvatarDisplay) _tmp4_);
}

static void
___lambda288__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda288_ (self);
}

static void
__lambda289_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkCheckButton* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->direct_avatar_check;
	_tmp3_ = gtk_check_button_get_active (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_bubble_avatars_in_direct_chats (_tmp1_, _tmp4_);
}

static void
___lambda289__gtk_check_button_toggled (GtkCheckButton* _sender,
                                        gpointer self)
{
	__lambda289_ (self);
}

static PangoFontDescription*
_vala_PangoFontDescription_copy (PangoFontDescription* self)
{
	return g_boxed_copy (pango_font_description_get_type (), self);
}

static gpointer
__vala_PangoFontDescription_copy0 (gpointer self)
{
	return self ? _vala_PangoFontDescription_copy (self) : NULL;
}

static void
__lambda290_ (DcSettingsDialog* self)
{
	PangoFontDescription* desc = NULL;
	GtkFontDialogButton* _tmp0_;
	PangoFontDescription* _tmp1_;
	PangoFontDescription* _tmp2_;
	PangoFontDescription* _tmp3_;
	if (self->priv->syncing_font_controls) {
		return;
	}
	_tmp0_ = self->priv->font_btn;
	_tmp1_ = gtk_font_dialog_button_get_font_desc (_tmp0_);
	_tmp2_ = __vala_PangoFontDescription_copy0 (_tmp1_);
	desc = _tmp2_;
	_tmp3_ = desc;
	if (_tmp3_ != NULL) {
		DcWindow* _tmp4_;
		DcSettingsManager* _tmp5_;
		PangoFontDescription* _tmp6_;
		_tmp4_ = self->priv->app_window;
		_tmp5_ = _tmp4_->settings;
		_tmp6_ = desc;
		dc_settings_manager_save_font_description (_tmp5_, _tmp6_);
		dc_settings_dialog_sync_font_controls (self);
	}
	__vala_PangoFontDescription_free0 (desc);
}

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

static void
__lambda292_ (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	dc_settings_manager_reset_font_defaults (_tmp1_);
	dc_settings_dialog_sync_font_controls (self);
}

static void
___lambda292__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda292_ ((DcSettingsDialog*) self);
}

static void
__lambda293_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkColorDialogButton* _tmp2_;
	GdkRGBA _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->accent_btn;
	_tmp3_ = *gtk_color_dialog_button_get_rgba (_tmp2_);
	_tmp4_ = dc_settings_dialog_hex_from_rgba (&_tmp3_);
	_tmp5_ = _tmp4_;
	dc_settings_manager_save_accent_color (_tmp1_, _tmp5_);
	_g_free0 (_tmp5_);
}

static void
___lambda293__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda293_ (self);
}

static void
__lambda294_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkColorDialogButton* _tmp2_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	dc_settings_manager_save_accent_color (_tmp1_, "");
	_tmp2_ = _data87_->accent_btn;
	dc_settings_dialog_apply_hex_to_button (_tmp2_, "");
}

static void
___lambda294__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda294_ (self);
}

static void
__lambda295_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcBackgroundMode mode = 0;
	GtkDropDown* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	GtkColorDialogButton* _tmp3_;
	DcWindow* _tmp4_;
	DcSettingsManager* _tmp5_;
	self = _data87_->self;
	_tmp0_ = _data87_->bg_mode_combo;
	_tmp1_ = gtk_drop_down_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	mode = (DcBackgroundMode) _tmp2_;
	_tmp3_ = _data87_->bg_color_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, mode != DC_BACKGROUND_MODE_SYSTEM);
	_tmp4_ = self->priv->app_window;
	_tmp5_ = _tmp4_->settings;
	dc_settings_manager_save_background_mode (_tmp5_, mode);
	dc_settings_dialog_apply_background (self);
}

static void
___lambda295__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda295_ (self);
}

static void
__lambda296_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkColorDialogButton* _tmp2_;
	GdkRGBA _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->bg_color_btn;
	_tmp3_ = *gtk_color_dialog_button_get_rgba (_tmp2_);
	_tmp4_ = dc_settings_dialog_hex_from_rgba (&_tmp3_);
	_tmp5_ = _tmp4_;
	dc_settings_manager_save_background_color (_tmp1_, _tmp5_);
	_g_free0 (_tmp5_);
	dc_settings_dialog_apply_background (self);
}

static void
___lambda296__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda296_ (self);
}

static void
__lambda297_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	guint selected = 0U;
	GtkDropDown* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	gint action = 0;
	DcWindow* _tmp3_;
	DcSettingsManager* _tmp4_;
	self = _data87_->self;
	_tmp0_ = _data87_->dblclick_combo;
	_tmp1_ = gtk_drop_down_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	selected = _tmp2_;
	action = (gint) selected;
	if (selected == ((guint) 4)) {
		action = 5;
	} else {
		if (selected == ((guint) 5)) {
			action = 4;
		}
	}
	_tmp3_ = self->priv->app_window;
	_tmp4_ = _tmp3_->settings;
	dc_settings_manager_save_double_click_action (_tmp4_, action);
}

static void
___lambda297__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda297_ (self);
}

static void
__lambda298_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkDropDown* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->md_combo;
	_tmp3_ = gtk_drop_down_get_selected (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_markdown_mode (_tmp1_, (DcMarkdownMode) _tmp4_);
}

static void
___lambda298__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda298_ (self);
}

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

static void
___lambda299__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda299_ (self);
}

static void
__lambda300_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkSwitch* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data87_->audio_switch;
	_tmp3_ = gtk_switch_get_active (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_system_audio_player (_tmp1_, _tmp4_);
}

static void
___lambda300__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda300_ (self);
}

static Block88Data*
block88_data_ref (Block88Data* _data88_)
{
	g_atomic_int_inc (&_data88_->_ref_count_);
	return _data88_;
}

static void
block88_data_unref (void * _userdata_)
{
	Block88Data* _data88_;
	_data88_ = (Block88Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data88_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data88_->_data87_->self;
		_g_object_unref0 (_data88_->tray_switch);
		block87_data_unref (_data88_->_data87_);
		_data88_->_data87_ = NULL;
		g_slice_free (Block88Data, _data88_);
	}
}

static void
___lambda301_ (Block88Data* _data88_)
{
	Block87Data* _data87_;
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	GtkSwitch* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	_data87_ = _data88_->_data87_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _data88_->tray_switch;
	_tmp2_ = gtk_switch_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	dc_window_set_minimize_to_tray (_tmp0_, _tmp3_);
}

static void
____lambda301__g_object_notify (GObject* _sender,
                                GParamSpec* pspec,
                                gpointer self)
{
	___lambda301_ (self);
}

static void
__lambda302_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = gtk_switch_get_active (_data87_->notif_switch);
	_tmp2_ = _tmp1_;
	dc_window_set_notifications_enabled (_tmp0_, _tmp2_);
}

static void
___lambda302__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda302_ (self);
}

static void
__lambda303_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_switch_get_active (_data87_->notification_contents_switch);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_show_notification_contents (_tmp1_, _tmp3_);
}

static void
___lambda303__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda303_ (self);
}

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

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

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

static void
___lambda305__gtk_entry_activate (GtkEntry* _sender,
                                  gpointer self)
{
	__lambda305_ ((DcSettingsDialog*) self);
}

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

static void
___lambda306__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                gpointer self)
{
	__lambda306_ ((DcSettingsDialog*) self);
}

static void
__lambda307_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_switch_get_active (_data87_->sticker_switch);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_animate_stickers (_tmp1_, _tmp3_);
}

static void
___lambda307__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda307_ (self);
}

static void
__lambda308_ (Block87Data* _data87_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	self = _data87_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = gtk_drop_down_get_selected (_data87_->download_combo);
	_tmp2_ = _tmp1_;
	dc_window_set_auto_download_limit (_tmp0_, dc_settings_dialog_auto_download_limit_for_index (_tmp2_), NULL, NULL);
}

static void
___lambda308__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda308_ (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
__lambda321_ (DcSettingsDialog* self)
{
	dc_settings_dialog_on_browse_rpc_server (self, NULL, NULL);
}

static void
___lambda321__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda321_ ((DcSettingsDialog*) self);
}

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

static void
___lambda322__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda322_ ((DcSettingsDialog*) self);
}

static void
__lambda324_ (DcSettingsDialog* self)
{
	dc_settings_dialog_on_browse_accounts_path (self, NULL, NULL);
}

static void
___lambda324__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda324_ ((DcSettingsDialog*) self);
}

static void
__lambda325_ (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	DcWindow* _tmp2_;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	dc_settings_manager_reset_accounts_path (_tmp1_);
	dc_settings_dialog_sync_accounts_path_row (self);
	_tmp2_ = self->priv->app_window;
	dc_window_reconnect_rpc_server (_tmp2_, NULL, NULL);
}

static void
___lambda325__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda325_ ((DcSettingsDialog*) self);
}

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

static void
___lambda326__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda326_ ((DcSettingsDialog*) self);
}

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

static void
___lambda327__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda327_ (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;
	Block87Data* _data87_;
	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_;
	GtkListBox* appearance_list = NULL;
	GtkListBox* _tmp11_;
	AdwActionRow* theme_row = NULL;
	AdwActionRow* _tmp12_;
	gchar** theme_labels = NULL;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar** _tmp16_;
	gint theme_labels_length1;
	gint _theme_labels_size_;
	AdwActionRow* _tmp17_;
	gchar** _tmp18_;
	gint _tmp18__length1;
	DcWindow* _tmp19_;
	DcSettingsManager* _tmp20_;
	DcThemeOverride _tmp21_;
	DcThemeOverride _tmp22_;
	GtkDropDown* _tmp23_;
	GtkDropDown* _tmp24_;
	GtkListBox* _tmp25_;
	AdwActionRow* _tmp26_;
	AdwActionRow* code_row = NULL;
	AdwActionRow* _tmp27_;
	gchar** code_labels = NULL;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar** _tmp33_;
	gint code_labels_length1;
	gint _code_labels_size_;
	AdwActionRow* _tmp34_;
	gchar** _tmp35_;
	gint _tmp35__length1;
	DcWindow* _tmp36_;
	DcSettingsManager* _tmp37_;
	DcCodeTheme _tmp38_;
	DcCodeTheme _tmp39_;
	GtkDropDown* _tmp40_;
	GtkDropDown* _tmp41_;
	GtkListBox* _tmp42_;
	AdwActionRow* _tmp43_;
	AdwActionRow* style_row = NULL;
	AdwActionRow* _tmp44_;
	gchar** style_labels = NULL;
	gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gchar** _tmp48_;
	gint style_labels_length1;
	gint _style_labels_size_;
	AdwActionRow* _tmp49_;
	gchar** _tmp50_;
	gint _tmp50__length1;
	DcWindow* _tmp51_;
	DcSettingsManager* _tmp52_;
	DcMessageStyle _tmp53_;
	DcMessageStyle _tmp54_;
	GtkDropDown* _tmp55_;
	GtkDropDown* _tmp56_;
	GtkListBox* _tmp57_;
	AdwActionRow* _tmp58_;
	AdwActionRow* avatar_row = NULL;
	AdwActionRow* _tmp59_;
	gchar** avatar_labels = NULL;
	gchar* _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	gchar** _tmp63_;
	gint avatar_labels_length1;
	gint _avatar_labels_size_;
	AdwActionRow* _tmp64_;
	gchar** _tmp65_;
	gint _tmp65__length1;
	DcWindow* _tmp66_;
	DcSettingsManager* _tmp67_;
	DcBubbleAvatarDisplay _tmp68_;
	DcBubbleAvatarDisplay _tmp69_;
	GtkDropDown* _tmp70_;
	GtkDropDown* _tmp71_;
	GtkListBox* _tmp72_;
	AdwActionRow* _tmp73_;
	AdwActionRow* direct_avatar_row = NULL;
	AdwActionRow* _tmp74_;
	GtkCheckButton* _tmp75_;
	GtkCheckButton* _tmp76_;
	DcWindow* _tmp77_;
	DcSettingsManager* _tmp78_;
	gboolean _tmp79_;
	gboolean _tmp80_;
	GtkCheckButton* _tmp81_;
	AdwActionRow* _tmp82_;
	GtkCheckButton* _tmp83_;
	AdwActionRow* _tmp84_;
	GtkCheckButton* _tmp85_;
	GtkListBox* _tmp86_;
	AdwActionRow* _tmp87_;
	AdwActionRow* _tmp88_;
	GtkFontDialog* font_dialog = NULL;
	GtkFontDialog* _tmp89_;
	GtkFontDialog* _tmp90_;
	GtkFontDialog* _tmp91_;
	GtkFontDialog* _tmp92_;
	GtkFontDialog* _tmp93_;
	GtkFontDialogButton* _tmp94_;
	GtkFontDialogButton* _tmp95_;
	GtkFontDialogButton* _tmp96_;
	GtkFontDialogButton* _tmp97_;
	GtkFontDialogButton* _tmp98_;
	DcWindow* _tmp99_;
	DcSettingsManager* _tmp100_;
	PangoFontDescription* _tmp101_;
	PangoFontDescription* _tmp102_;
	GtkFontDialogButton* _tmp103_;
	AdwActionRow* _tmp104_;
	GtkFontDialogButton* _tmp105_;
	GtkButton* font_reset_btn = NULL;
	GtkButton* _tmp106_;
	GtkButton* _tmp107_;
	GtkButton* _tmp108_;
	GtkButton* _tmp109_;
	GtkButton* _tmp110_;
	AdwActionRow* _tmp111_;
	GtkButton* _tmp112_;
	GtkListBox* _tmp113_;
	AdwActionRow* _tmp114_;
	AdwActionRow* accent_row = NULL;
	AdwActionRow* _tmp115_;
	GtkColorDialog* _tmp116_;
	GtkColorDialogButton* _tmp117_;
	GtkColorDialogButton* _tmp118_;
	GtkColorDialogButton* _tmp119_;
	DcWindow* _tmp120_;
	DcSettingsManager* _tmp121_;
	const gchar* _tmp122_;
	const gchar* _tmp123_;
	GtkColorDialogButton* _tmp124_;
	GtkButton* accent_reset_btn = NULL;
	GtkButton* _tmp125_;
	GtkButton* _tmp126_;
	GtkButton* _tmp127_;
	GtkButton* _tmp128_;
	GtkButton* _tmp129_;
	AdwActionRow* _tmp130_;
	GtkColorDialogButton* _tmp131_;
	AdwActionRow* _tmp132_;
	GtkButton* _tmp133_;
	GtkListBox* _tmp134_;
	AdwActionRow* _tmp135_;
	AdwActionRow* bg_row = NULL;
	AdwActionRow* _tmp136_;
	gchar** bg_mode_labels = NULL;
	gchar* _tmp137_;
	gchar* _tmp138_;
	gchar* _tmp139_;
	gchar** _tmp140_;
	gint bg_mode_labels_length1;
	gint _bg_mode_labels_size_;
	AdwActionRow* _tmp141_;
	gchar** _tmp142_;
	gint _tmp142__length1;
	DcWindow* _tmp143_;
	DcSettingsManager* _tmp144_;
	DcBackgroundMode _tmp145_;
	DcBackgroundMode _tmp146_;
	GtkDropDown* _tmp147_;
	GtkColorDialog* _tmp148_;
	GtkColorDialogButton* _tmp149_;
	GtkColorDialogButton* _tmp150_;
	GtkColorDialogButton* _tmp151_;
	DcWindow* _tmp152_;
	DcSettingsManager* _tmp153_;
	const gchar* _tmp154_;
	const gchar* _tmp155_;
	GtkColorDialogButton* _tmp156_;
	DcWindow* _tmp157_;
	DcSettingsManager* _tmp158_;
	DcBackgroundMode _tmp159_;
	DcBackgroundMode _tmp160_;
	GtkDropDown* _tmp161_;
	GtkColorDialogButton* _tmp162_;
	AdwActionRow* _tmp163_;
	GtkColorDialogButton* _tmp164_;
	GtkListBox* _tmp165_;
	AdwActionRow* _tmp166_;
	GtkListBox* behavior_list = NULL;
	GtkListBox* _tmp167_;
	AdwActionRow* dblclick_row = NULL;
	AdwActionRow* _tmp168_;
	gchar** dblclick_labels = NULL;
	gchar* _tmp169_;
	gchar* _tmp170_;
	gchar* _tmp171_;
	gchar* _tmp172_;
	gchar* _tmp173_;
	gchar* _tmp174_;
	gchar** _tmp175_;
	gint dblclick_labels_length1;
	gint _dblclick_labels_size_;
	guint dblclick_selected = 0U;
	DcWindow* _tmp176_;
	DcSettingsManager* _tmp177_;
	gint _tmp178_;
	gint _tmp179_;
	AdwActionRow* _tmp180_;
	gchar** _tmp181_;
	gint _tmp181__length1;
	GtkDropDown* _tmp182_;
	GtkDropDown* _tmp183_;
	GtkListBox* _tmp184_;
	AdwActionRow* _tmp185_;
	AdwActionRow* md_row = NULL;
	AdwActionRow* _tmp186_;
	gchar** md_labels = NULL;
	gchar* _tmp187_;
	gchar* _tmp188_;
	gchar* _tmp189_;
	gchar** _tmp190_;
	gint md_labels_length1;
	gint _md_labels_size_;
	AdwActionRow* _tmp191_;
	gchar** _tmp192_;
	gint _tmp192__length1;
	DcWindow* _tmp193_;
	DcSettingsManager* _tmp194_;
	DcMarkdownMode _tmp195_;
	DcMarkdownMode _tmp196_;
	GtkDropDown* _tmp197_;
	GtkDropDown* _tmp198_;
	AdwActionRow* shift_row = NULL;
	AdwActionRow* _tmp199_;
	AdwActionRow* _tmp200_;
	DcWindow* _tmp201_;
	DcSettingsManager* _tmp202_;
	gboolean _tmp203_;
	gboolean _tmp204_;
	GtkSwitch* _tmp205_;
	GtkSwitch* _tmp206_;
	GtkListBox* _tmp207_;
	AdwActionRow* _tmp208_;
	AdwActionRow* audio_row = NULL;
	AdwActionRow* _tmp209_;
	AdwActionRow* _tmp210_;
	DcWindow* _tmp211_;
	DcSettingsManager* _tmp212_;
	gboolean _tmp213_;
	gboolean _tmp214_;
	GtkSwitch* _tmp215_;
	GtkSwitch* _tmp216_;
	GtkListBox* notifications_list = NULL;
	GtkListBox* _tmp227_;
	AdwActionRow* notif_row = NULL;
	AdwActionRow* _tmp228_;
	DcWindow* _tmp229_;
	DcSettingsManager* _tmp230_;
	gboolean _tmp231_;
	gboolean _tmp232_;
	GtkSwitch* _tmp233_;
	AdwActionRow* notification_contents_row = NULL;
	AdwActionRow* _tmp234_;
	DcWindow* _tmp235_;
	DcSettingsManager* _tmp236_;
	gboolean _tmp237_;
	gboolean _tmp238_;
	GtkSwitch* _tmp239_;
	GtkListBox* network_list = NULL;
	GtkListBox* _tmp240_;
	AdwActionRow* _tmp241_;
	AdwActionRow* _tmp242_;
	GtkSwitch* _tmp243_;
	GtkSwitch* _tmp244_;
	AdwActionRow* _tmp245_;
	AdwActionRow* _tmp246_;
	GtkEntry* _tmp247_;
	GtkEntry* _tmp248_;
	GtkEntry* _tmp249_;
	GtkEntry* _tmp250_;
	GtkEntry* _tmp251_;
	GtkEntry* _tmp252_;
	GtkEventControllerFocus* proxy_focus = NULL;
	GtkEventControllerFocus* _tmp253_;
	GtkEntry* _tmp254_;
	GtkEventController* _tmp255_;
	AdwActionRow* _tmp256_;
	GtkEntry* _tmp257_;
	AdwActionRow* _tmp258_;
	GtkEntry* _tmp259_;
	AdwActionRow* _tmp260_;
	AdwActionRow* sticker_row = NULL;
	AdwActionRow* _tmp261_;
	DcWindow* _tmp262_;
	DcSettingsManager* _tmp263_;
	gboolean _tmp264_;
	gboolean _tmp265_;
	GtkSwitch* _tmp266_;
	AdwActionRow* download_row = NULL;
	AdwActionRow* _tmp267_;
	gchar** download_labels = NULL;
	gchar* _tmp268_;
	gchar* _tmp269_;
	gchar* _tmp270_;
	gchar* _tmp271_;
	gchar* _tmp272_;
	gchar* _tmp273_;
	gchar* _tmp274_;
	gchar** _tmp275_;
	gint download_labels_length1;
	gint _download_labels_size_;
	DcWindow* _tmp276_;
	DcSettingsManager* _tmp277_;
	gint _tmp278_;
	gint _tmp279_;
	GtkDropDown* _tmp280_;
	GtkListBox* advanced_list = NULL;
	GtkListBox* _tmp281_;
	AdwActionRow* _tmp282_;
	AdwActionRow* _tmp283_;
	GtkListBox* chatmail_list = NULL;
	GtkListBox* _tmp284_;
	AdwActionRow* _tmp285_;
	gchar** rpc_source_labels = NULL;
	gchar* _tmp286_;
	gchar* _tmp287_;
	gchar** _tmp288_;
	gint rpc_source_labels_length1;
	gint _rpc_source_labels_size_;
	AdwActionRow* _tmp289_;
	DcWindow* _tmp290_;
	DcSettingsManager* _tmp291_;
	GtkDropDown* _tmp292_;
	GtkDropDown* _tmp293_;
	GtkButton* _tmp294_;
	GtkButton* _tmp295_;
	GtkButton* _tmp296_;
	GtkButton* _tmp297_;
	GtkButton* _tmp298_;
	AdwActionRow* _tmp299_;
	GtkButton* _tmp300_;
	GtkButton* _tmp301_;
	GtkButton* _tmp302_;
	GtkButton* _tmp303_;
	GtkButton* _tmp304_;
	GtkButton* _tmp305_;
	AdwActionRow* _tmp306_;
	GtkButton* _tmp307_;
	AdwActionRow* _tmp308_;
	AdwActionRow* _tmp309_;
	GtkButton* accounts_path_change_btn = NULL;
	GtkButton* _tmp310_;
	AdwActionRow* _tmp311_;
	GtkButton* _tmp312_;
	GtkButton* _tmp313_;
	GtkButton* _tmp314_;
	GtkButton* _tmp315_;
	GtkButton* _tmp316_;
	AdwActionRow* _tmp317_;
	GtkButton* _tmp318_;
	AdwActionRow* _tmp319_;
	AdwActionRow* _tmp320_;
	GtkButton* _tmp321_;
	GtkButton* _tmp322_;
	GtkButton* _tmp323_;
	GtkButton* _tmp324_;
	GtkButton* _tmp325_;
	AdwActionRow* _tmp326_;
	GtkButton* _tmp327_;
	AdwActionRow* _tmp328_;
	AdwActionRow* rpc_autocheck_row = NULL;
	AdwActionRow* _tmp329_;
	DcWindow* _tmp330_;
	DcSettingsManager* _tmp331_;
	gboolean _tmp332_;
	gboolean _tmp333_;
	GtkSwitch* _tmp334_;
	GtkBox* reset_box = NULL;
	GtkBox* _tmp335_;
	GtkButton* reset_btn = NULL;
	GtkButton* _tmp336_;
	GtkLabel* reset_label = NULL;
	GtkLabel* _tmp337_;
	GtkBox* _tmp338_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp339_;
	GtkBox* _tmp340_;
	GtkBox* _tmp341_;
	GtkBox* _tmp342_;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	_data87_ = g_slice_new0 (Block87Data);
	_data87_->_ref_count_ = 1;
	self = (DcSettingsDialog*) g_object_new (object_type, NULL);
	_data87_->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_ = dc_settings_dialog_settings_list (self, "Appearance");
	appearance_list = _tmp11_;
	_tmp12_ = dc_settings_dialog_action_row ("GTK theme", "Override the system light or dark theme");
	theme_row = _tmp12_;
	_tmp13_ = g_strdup ("System");
	_tmp14_ = g_strdup ("Light");
	_tmp15_ = g_strdup ("Dark");
	_tmp16_ = g_new0 (gchar*, 3 + 1);
	_tmp16_[0] = _tmp13_;
	_tmp16_[1] = _tmp14_;
	_tmp16_[2] = _tmp15_;
	theme_labels = _tmp16_;
	theme_labels_length1 = 3;
	_theme_labels_size_ = theme_labels_length1;
	_tmp17_ = theme_row;
	_tmp18_ = theme_labels;
	_tmp18__length1 = theme_labels_length1;
	_tmp19_ = self->priv->app_window;
	_tmp20_ = _tmp19_->settings;
	_tmp21_ = dc_settings_manager_get_theme_override (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = dc_settings_dialog_row_dropdown (_tmp17_, _tmp18_, (gint) _tmp18__length1, (guint) _tmp22_);
	_data87_->theme_combo = _tmp23_;
	_tmp24_ = _data87_->theme_combo;
	g_signal_connect_data ((GObject*) _tmp24_, "notify::selected", (GCallback) ___lambda284__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp25_ = appearance_list;
	_tmp26_ = theme_row;
	gtk_list_box_append (_tmp25_, (GtkWidget*) _tmp26_);
	_tmp27_ = dc_settings_dialog_action_row ("Code highlighting", "Color scheme for code blocks in messages");
	code_row = _tmp27_;
	_tmp28_ = g_strdup ("Adaptive");
	_tmp29_ = g_strdup ("Solarized");
	_tmp30_ = g_strdup ("Monokai");
	_tmp31_ = g_strdup ("Nord");
	_tmp32_ = g_strdup ("None");
	_tmp33_ = g_new0 (gchar*, 5 + 1);
	_tmp33_[0] = _tmp28_;
	_tmp33_[1] = _tmp29_;
	_tmp33_[2] = _tmp30_;
	_tmp33_[3] = _tmp31_;
	_tmp33_[4] = _tmp32_;
	code_labels = _tmp33_;
	code_labels_length1 = 5;
	_code_labels_size_ = code_labels_length1;
	_tmp34_ = code_row;
	_tmp35_ = code_labels;
	_tmp35__length1 = code_labels_length1;
	_tmp36_ = self->priv->app_window;
	_tmp37_ = _tmp36_->settings;
	_tmp38_ = dc_settings_manager_get_code_theme (_tmp37_);
	_tmp39_ = _tmp38_;
	_tmp40_ = dc_settings_dialog_row_dropdown (_tmp34_, _tmp35_, (gint) _tmp35__length1, (guint) _tmp39_);
	_data87_->code_combo = _tmp40_;
	_tmp41_ = _data87_->code_combo;
	g_signal_connect_data ((GObject*) _tmp41_, "notify::selected", (GCallback) ___lambda286__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp42_ = appearance_list;
	_tmp43_ = code_row;
	gtk_list_box_append (_tmp42_, (GtkWidget*) _tmp43_);
	_tmp44_ = dc_settings_dialog_action_row ("Message style", "Chat bubbles, compact IRC lines or workspace rows");
	style_row = _tmp44_;
	_tmp45_ = g_strdup ("Bubbles");
	_tmp46_ = g_strdup ("IRC");
	_tmp47_ = g_strdup ("Workspace");
	_tmp48_ = g_new0 (gchar*, 3 + 1);
	_tmp48_[0] = _tmp45_;
	_tmp48_[1] = _tmp46_;
	_tmp48_[2] = _tmp47_;
	style_labels = _tmp48_;
	style_labels_length1 = 3;
	_style_labels_size_ = style_labels_length1;
	_tmp49_ = style_row;
	_tmp50_ = style_labels;
	_tmp50__length1 = style_labels_length1;
	_tmp51_ = self->priv->app_window;
	_tmp52_ = _tmp51_->settings;
	_tmp53_ = dc_settings_manager_get_message_style (_tmp52_);
	_tmp54_ = _tmp53_;
	_tmp55_ = dc_settings_dialog_row_dropdown (_tmp49_, _tmp50_, (gint) _tmp50__length1, (guint) _tmp54_);
	_data87_->style_combo = _tmp55_;
	_tmp56_ = _data87_->style_combo;
	g_signal_connect_data ((GObject*) _tmp56_, "notify::selected", (GCallback) ___lambda287__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp57_ = appearance_list;
	_tmp58_ = style_row;
	gtk_list_box_append (_tmp57_, (GtkWidget*) _tmp58_);
	_tmp59_ = dc_settings_dialog_action_row ("Bubble avatars", "Show small avatars beside message bubbles");
	avatar_row = _tmp59_;
	_tmp60_ = g_strdup ("none");
	_tmp61_ = g_strdup ("other");
	_tmp62_ = g_strdup ("both");
	_tmp63_ = g_new0 (gchar*, 3 + 1);
	_tmp63_[0] = _tmp60_;
	_tmp63_[1] = _tmp61_;
	_tmp63_[2] = _tmp62_;
	avatar_labels = _tmp63_;
	avatar_labels_length1 = 3;
	_avatar_labels_size_ = avatar_labels_length1;
	_tmp64_ = avatar_row;
	_tmp65_ = avatar_labels;
	_tmp65__length1 = avatar_labels_length1;
	_tmp66_ = self->priv->app_window;
	_tmp67_ = _tmp66_->settings;
	_tmp68_ = dc_settings_manager_get_bubble_avatar_display (_tmp67_);
	_tmp69_ = _tmp68_;
	_tmp70_ = dc_settings_dialog_row_dropdown (_tmp64_, _tmp65_, (gint) _tmp65__length1, (guint) _tmp69_);
	_data87_->avatar_combo = _tmp70_;
	_tmp71_ = _data87_->avatar_combo;
	g_signal_connect_data ((GObject*) _tmp71_, "notify::selected", (GCallback) ___lambda288__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp72_ = appearance_list;
	_tmp73_ = avatar_row;
	gtk_list_box_append (_tmp72_, (GtkWidget*) _tmp73_);
	_tmp74_ = dc_settings_dialog_action_row ("Use avatars in 1:1 chats", "Use the bubble avatar setting in direct conversations");
	direct_avatar_row = _tmp74_;
	_tmp75_ = (GtkCheckButton*) gtk_check_button_new ();
	g_object_ref_sink (_tmp75_);
	_data87_->direct_avatar_check = _tmp75_;
	_tmp76_ = _data87_->direct_avatar_check;
	_tmp77_ = self->priv->app_window;
	_tmp78_ = _tmp77_->settings;
	_tmp79_ = dc_settings_manager_get_bubble_avatars_in_direct_chats (_tmp78_);
	_tmp80_ = _tmp79_;
	gtk_check_button_set_active (_tmp76_, _tmp80_);
	_tmp81_ = _data87_->direct_avatar_check;
	g_signal_connect_data (_tmp81_, "toggled", (GCallback) ___lambda289__gtk_check_button_toggled, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp82_ = direct_avatar_row;
	_tmp83_ = _data87_->direct_avatar_check;
	adw_action_row_add_suffix (_tmp82_, (GtkWidget*) _tmp83_);
	_tmp84_ = direct_avatar_row;
	_tmp85_ = _data87_->direct_avatar_check;
	adw_action_row_set_activatable_widget (_tmp84_, (GtkWidget*) _tmp85_);
	_tmp86_ = appearance_list;
	_tmp87_ = direct_avatar_row;
	gtk_list_box_append (_tmp86_, (GtkWidget*) _tmp87_);
	_tmp88_ = dc_settings_dialog_action_row ("Conversation font", "Use the system font or choose another family, style and size");
	_g_object_unref0 (self->priv->font_type_row);
	self->priv->font_type_row = _tmp88_;
	_tmp89_ = gtk_font_dialog_new ();
	font_dialog = _tmp89_;
	_tmp90_ = font_dialog;
	gtk_font_dialog_set_title (_tmp90_, "Choose Font");
	_tmp91_ = font_dialog;
	gtk_font_dialog_set_modal (_tmp91_, TRUE);
	_tmp92_ = font_dialog;
	_tmp93_ = _g_object_ref0 (_tmp92_);
	_tmp94_ = (GtkFontDialogButton*) gtk_font_dialog_button_new (_tmp93_);
	g_object_ref_sink (_tmp94_);
	_g_object_unref0 (self->priv->font_btn);
	self->priv->font_btn = _tmp94_;
	_tmp95_ = self->priv->font_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp95_, GTK_ALIGN_CENTER);
	_tmp96_ = self->priv->font_btn;
	gtk_font_dialog_button_set_use_font (_tmp96_, FALSE);
	_tmp97_ = self->priv->font_btn;
	gtk_font_dialog_button_set_use_size (_tmp97_, FALSE);
	_tmp98_ = self->priv->font_btn;
	_tmp99_ = self->priv->app_window;
	_tmp100_ = _tmp99_->settings;
	_tmp101_ = dc_settings_manager_effective_font_description (_tmp100_);
	_tmp102_ = _tmp101_;
	gtk_font_dialog_button_set_font_desc (_tmp98_, _tmp102_);
	__vala_PangoFontDescription_free0 (_tmp102_);
	_tmp103_ = self->priv->font_btn;
	g_signal_connect_object ((GObject*) _tmp103_, "notify::font-desc", (GCallback) ___lambda290__g_object_notify, self, 0);
	_tmp104_ = self->priv->font_type_row;
	_tmp105_ = self->priv->font_btn;
	adw_action_row_add_suffix (_tmp104_, (GtkWidget*) _tmp105_);
	_tmp106_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	g_object_ref_sink (_tmp106_);
	font_reset_btn = _tmp106_;
	_tmp107_ = font_reset_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp107_, GTK_ALIGN_CENTER);
	_tmp108_ = font_reset_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp108_, "flat");
	_tmp109_ = font_reset_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp109_, "Reset font settings to defaults");
	_tmp110_ = font_reset_btn;
	g_signal_connect_object (_tmp110_, "clicked", (GCallback) ___lambda292__gtk_button_clicked, self, 0);
	_tmp111_ = self->priv->font_type_row;
	_tmp112_ = font_reset_btn;
	adw_action_row_add_suffix (_tmp111_, (GtkWidget*) _tmp112_);
	_tmp113_ = appearance_list;
	_tmp114_ = self->priv->font_type_row;
	gtk_list_box_append (_tmp113_, (GtkWidget*) _tmp114_);
	dc_settings_dialog_sync_font_controls (self);
	_tmp115_ = dc_settings_dialog_action_row ("Accent color", "Override the system accent color");
	accent_row = _tmp115_;
	_tmp116_ = gtk_color_dialog_new ();
	_tmp117_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp116_);
	g_object_ref_sink (_tmp117_);
	_data87_->accent_btn = _tmp117_;
	_tmp118_ = _data87_->accent_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp118_, GTK_ALIGN_CENTER);
	_tmp119_ = _data87_->accent_btn;
	_tmp120_ = self->priv->app_window;
	_tmp121_ = _tmp120_->settings;
	_tmp122_ = dc_settings_manager_get_accent_color (_tmp121_);
	_tmp123_ = _tmp122_;
	dc_settings_dialog_apply_hex_to_button (_tmp119_, _tmp123_);
	_tmp124_ = _data87_->accent_btn;
	g_signal_connect_data ((GObject*) _tmp124_, "notify::rgba", (GCallback) ___lambda293__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp125_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	g_object_ref_sink (_tmp125_);
	accent_reset_btn = _tmp125_;
	_tmp126_ = accent_reset_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp126_, GTK_ALIGN_CENTER);
	_tmp127_ = accent_reset_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp127_, "flat");
	_tmp128_ = accent_reset_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp128_, "Use system accent color");
	_tmp129_ = accent_reset_btn;
	g_signal_connect_data (_tmp129_, "clicked", (GCallback) ___lambda294__gtk_button_clicked, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp130_ = accent_row;
	_tmp131_ = _data87_->accent_btn;
	adw_action_row_add_suffix (_tmp130_, (GtkWidget*) _tmp131_);
	_tmp132_ = accent_row;
	_tmp133_ = accent_reset_btn;
	adw_action_row_add_suffix (_tmp132_, (GtkWidget*) _tmp133_);
	_tmp134_ = appearance_list;
	_tmp135_ = accent_row;
	gtk_list_box_append (_tmp134_, (GtkWidget*) _tmp135_);
	_tmp136_ = dc_settings_dialog_action_row ("Background color", "Tint the window background with a solid color or a gradient");
	bg_row = _tmp136_;
	_tmp137_ = g_strdup ("System");
	_tmp138_ = g_strdup ("Solid");
	_tmp139_ = g_strdup ("Gradient");
	_tmp140_ = g_new0 (gchar*, 3 + 1);
	_tmp140_[0] = _tmp137_;
	_tmp140_[1] = _tmp138_;
	_tmp140_[2] = _tmp139_;
	bg_mode_labels = _tmp140_;
	bg_mode_labels_length1 = 3;
	_bg_mode_labels_size_ = bg_mode_labels_length1;
	_tmp141_ = bg_row;
	_tmp142_ = bg_mode_labels;
	_tmp142__length1 = bg_mode_labels_length1;
	_tmp143_ = self->priv->app_window;
	_tmp144_ = _tmp143_->settings;
	_tmp145_ = dc_settings_manager_get_background_mode (_tmp144_);
	_tmp146_ = _tmp145_;
	_tmp147_ = dc_settings_dialog_row_dropdown (_tmp141_, _tmp142_, (gint) _tmp142__length1, (guint) _tmp146_);
	_data87_->bg_mode_combo = _tmp147_;
	_tmp148_ = gtk_color_dialog_new ();
	_tmp149_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp148_);
	g_object_ref_sink (_tmp149_);
	_data87_->bg_color_btn = _tmp149_;
	_tmp150_ = _data87_->bg_color_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp150_, GTK_ALIGN_CENTER);
	_tmp151_ = _data87_->bg_color_btn;
	_tmp152_ = self->priv->app_window;
	_tmp153_ = _tmp152_->settings;
	_tmp154_ = dc_settings_manager_get_background_color (_tmp153_);
	_tmp155_ = _tmp154_;
	dc_settings_dialog_apply_hex_to_button (_tmp151_, _tmp155_);
	_tmp156_ = _data87_->bg_color_btn;
	_tmp157_ = self->priv->app_window;
	_tmp158_ = _tmp157_->settings;
	_tmp159_ = dc_settings_manager_get_background_mode (_tmp158_);
	_tmp160_ = _tmp159_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp156_, _tmp160_ != DC_BACKGROUND_MODE_SYSTEM);
	_tmp161_ = _data87_->bg_mode_combo;
	g_signal_connect_data ((GObject*) _tmp161_, "notify::selected", (GCallback) ___lambda295__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp162_ = _data87_->bg_color_btn;
	g_signal_connect_data ((GObject*) _tmp162_, "notify::rgba", (GCallback) ___lambda296__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp163_ = bg_row;
	_tmp164_ = _data87_->bg_color_btn;
	adw_action_row_add_suffix (_tmp163_, (GtkWidget*) _tmp164_);
	_tmp165_ = appearance_list;
	_tmp166_ = bg_row;
	gtk_list_box_append (_tmp165_, (GtkWidget*) _tmp166_);
	_tmp167_ = dc_settings_dialog_settings_list (self, "Behavior");
	behavior_list = _tmp167_;
	_tmp168_ = dc_settings_dialog_action_row ("Double-click on message", "Action when a message is double-clicked");
	dblclick_row = _tmp168_;
	_tmp169_ = g_strdup ("Reply to message");
	_tmp170_ = g_strdup ("React with ❤️");
	_tmp171_ = g_strdup ("React with 👍");
	_tmp172_ = g_strdup ("Open user profile");
	_tmp173_ = g_strdup ("Open context menu");
	_tmp174_ = g_strdup ("Do nothing");
	_tmp175_ = g_new0 (gchar*, 6 + 1);
	_tmp175_[0] = _tmp169_;
	_tmp175_[1] = _tmp170_;
	_tmp175_[2] = _tmp171_;
	_tmp175_[3] = _tmp172_;
	_tmp175_[4] = _tmp173_;
	_tmp175_[5] = _tmp174_;
	dblclick_labels = _tmp175_;
	dblclick_labels_length1 = 6;
	_dblclick_labels_size_ = dblclick_labels_length1;
	_tmp176_ = self->priv->app_window;
	_tmp177_ = _tmp176_->settings;
	_tmp178_ = dc_settings_manager_get_double_click_action (_tmp177_);
	_tmp179_ = _tmp178_;
	dblclick_selected = (guint) _tmp179_;
	if (dblclick_selected == ((guint) 4)) {
		dblclick_selected = (guint) 5;
	} else {
		if (dblclick_selected == ((guint) 5)) {
			dblclick_selected = (guint) 4;
		}
	}
	_tmp180_ = dblclick_row;
	_tmp181_ = dblclick_labels;
	_tmp181__length1 = dblclick_labels_length1;
	_tmp182_ = dc_settings_dialog_row_dropdown (_tmp180_, _tmp181_, (gint) _tmp181__length1, dblclick_selected);
	_data87_->dblclick_combo = _tmp182_;
	_tmp183_ = _data87_->dblclick_combo;
	g_signal_connect_data ((GObject*) _tmp183_, "notify::selected", (GCallback) ___lambda297__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp184_ = behavior_list;
	_tmp185_ = dblclick_row;
	gtk_list_box_append (_tmp184_, (GtkWidget*) _tmp185_);
	_tmp186_ = dc_settings_dialog_action_row ("Markdown rendering", "Render, strip, or preserve markdown syntax");
	md_row = _tmp186_;
	_tmp187_ = g_strdup ("Enabled");
	_tmp188_ = g_strdup ("Stripped");
	_tmp189_ = g_strdup ("Disabled");
	_tmp190_ = g_new0 (gchar*, 3 + 1);
	_tmp190_[0] = _tmp187_;
	_tmp190_[1] = _tmp188_;
	_tmp190_[2] = _tmp189_;
	md_labels = _tmp190_;
	md_labels_length1 = 3;
	_md_labels_size_ = md_labels_length1;
	_tmp191_ = md_row;
	_tmp192_ = md_labels;
	_tmp192__length1 = md_labels_length1;
	_tmp193_ = self->priv->app_window;
	_tmp194_ = _tmp193_->settings;
	_tmp195_ = dc_settings_manager_get_markdown_mode (_tmp194_);
	_tmp196_ = _tmp195_;
	_tmp197_ = dc_settings_dialog_row_dropdown (_tmp191_, _tmp192_, (gint) _tmp192__length1, (guint) _tmp196_);
	_data87_->md_combo = _tmp197_;
	_tmp198_ = _data87_->md_combo;
	g_signal_connect_data ((GObject*) _tmp198_, "notify::selected", (GCallback) ___lambda298__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp199_ = dc_settings_dialog_action_row ("Shift+Return sends message", "When on, Return inserts a newline and Shift+Return sends");
	shift_row = _tmp199_;
	_tmp200_ = shift_row;
	_tmp201_ = self->priv->app_window;
	_tmp202_ = _tmp201_->settings;
	_tmp203_ = dc_settings_manager_get_shift_enter_sends (_tmp202_);
	_tmp204_ = _tmp203_;
	_tmp205_ = dc_settings_dialog_row_switch (_tmp200_, _tmp204_);
	_data87_->shift_switch = _tmp205_;
	_tmp206_ = _data87_->shift_switch;
	g_signal_connect_data ((GObject*) _tmp206_, "notify::active", (GCallback) ___lambda299__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp207_ = behavior_list;
	_tmp208_ = shift_row;
	gtk_list_box_append (_tmp207_, (GtkWidget*) _tmp208_);
	_tmp209_ = dc_settings_dialog_action_row ("System audio tools", "Prefer system programs for voice playback and recording " "instead of Parla's GTK/GStreamer media path");
	audio_row = _tmp209_;
	_tmp210_ = audio_row;
	_tmp211_ = self->priv->app_window;
	_tmp212_ = _tmp211_->settings;
	_tmp213_ = dc_settings_manager_get_system_audio_player (_tmp212_);
	_tmp214_ = _tmp213_;
	_tmp215_ = dc_settings_dialog_row_switch (_tmp210_, _tmp214_);
	_data87_->audio_switch = _tmp215_;
	_tmp216_ = _data87_->audio_switch;
	g_signal_connect_data ((GObject*) _tmp216_, "notify::active", (GCallback) ___lambda300__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	if (!dc_platform_is_macos ()) {
		Block88Data* _data88_;
		AdwActionRow* tray_row = NULL;
		AdwActionRow* _tmp217_;
		AdwActionRow* _tmp218_;
		DcWindow* _tmp219_;
		DcSettingsManager* _tmp220_;
		gboolean _tmp221_;
		gboolean _tmp222_;
		GtkSwitch* _tmp223_;
		GtkSwitch* _tmp224_;
		GtkListBox* _tmp225_;
		AdwActionRow* _tmp226_;
		_data88_ = g_slice_new0 (Block88Data);
		_data88_->_ref_count_ = 1;
		_data88_->_data87_ = block87_data_ref (_data87_);
		_tmp217_ = dc_settings_dialog_action_row ("Minimize to status bar", "Closing the window keeps Parla running in the status bar; " "notifications still appear");
		tray_row = _tmp217_;
		_tmp218_ = tray_row;
		_tmp219_ = self->priv->app_window;
		_tmp220_ = _tmp219_->settings;
		_tmp221_ = dc_settings_manager_get_minimize_to_tray (_tmp220_);
		_tmp222_ = _tmp221_;
		_tmp223_ = dc_settings_dialog_row_switch (_tmp218_, _tmp222_);
		_data88_->tray_switch = _tmp223_;
		_tmp224_ = _data88_->tray_switch;
		g_signal_connect_data ((GObject*) _tmp224_, "notify::active", (GCallback) ____lambda301__g_object_notify, block88_data_ref (_data88_), (GClosureNotify) block88_data_unref, 0);
		_tmp225_ = behavior_list;
		_tmp226_ = tray_row;
		gtk_list_box_append (_tmp225_, (GtkWidget*) _tmp226_);
		_g_object_unref0 (tray_row);
		block88_data_unref (_data88_);
		_data88_ = NULL;
	}
	_tmp227_ = dc_settings_dialog_settings_list (self, "Notifications");
	notifications_list = _tmp227_;
	_tmp228_ = dc_settings_dialog_action_row ("Desktop notifications", "Notify on incoming messages when the window is not focused");
	notif_row = _tmp228_;
	_tmp229_ = self->priv->app_window;
	_tmp230_ = _tmp229_->settings;
	_tmp231_ = dc_settings_manager_get_notifications_enabled (_tmp230_);
	_tmp232_ = _tmp231_;
	_tmp233_ = dc_settings_dialog_row_switch (notif_row, _tmp232_);
	_data87_->notif_switch = _tmp233_;
	g_signal_connect_data ((GObject*) _data87_->notif_switch, "notify::active", (GCallback) ___lambda302__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	gtk_list_box_append (notifications_list, (GtkWidget*) notif_row);
	_tmp234_ = dc_settings_dialog_action_row ("Show message contents in notifications", "Include sender text and attachment names in desktop notifications");
	notification_contents_row = _tmp234_;
	_tmp235_ = self->priv->app_window;
	_tmp236_ = _tmp235_->settings;
	_tmp237_ = dc_settings_manager_get_show_notification_contents (_tmp236_);
	_tmp238_ = _tmp237_;
	_tmp239_ = dc_settings_dialog_row_switch (notification_contents_row, _tmp238_);
	_data87_->notification_contents_switch = _tmp239_;
	g_signal_connect_data ((GObject*) _data87_->notification_contents_switch, "notify::active", (GCallback) ___lambda303__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	gtk_list_box_append (notifications_list, (GtkWidget*) notification_contents_row);
	_tmp240_ = dc_settings_dialog_settings_list (self, "Network");
	network_list = _tmp240_;
	_tmp241_ = dc_settings_dialog_action_row ("Use Proxy", "Route this profile through the configured proxy");
	_g_object_unref0 (self->priv->proxy_switch_row);
	self->priv->proxy_switch_row = _tmp241_;
	_tmp242_ = self->priv->proxy_switch_row;
	_tmp243_ = dc_settings_dialog_row_switch (_tmp242_, FALSE);
	_g_object_unref0 (self->priv->proxy_switch);
	self->priv->proxy_switch = _tmp243_;
	_tmp244_ = self->priv->proxy_switch;
	g_signal_connect_object ((GObject*) _tmp244_, "notify::active", (GCallback) ___lambda304__g_object_notify, self, 0);
	_tmp245_ = self->priv->proxy_switch_row;
	gtk_list_box_append (network_list, (GtkWidget*) _tmp245_);
	_tmp246_ = dc_settings_dialog_action_row ("Proxy URL", "socks5://, http://, https://, or ss://");
	_g_object_unref0 (self->priv->proxy_url_row);
	self->priv->proxy_url_row = _tmp246_;
	_tmp247_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp247_);
	_g_object_unref0 (self->priv->proxy_entry);
	self->priv->proxy_entry = _tmp247_;
	_tmp248_ = self->priv->proxy_entry;
	gtk_entry_set_placeholder_text (_tmp248_, "socks5://127.0.0.1:9050");
	_tmp249_ = self->priv->proxy_entry;
	gtk_entry_set_input_purpose (_tmp249_, GTK_INPUT_PURPOSE_URL);
	_tmp250_ = self->priv->proxy_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp250_, TRUE);
	_tmp251_ = self->priv->proxy_entry;
	gtk_widget_set_valign ((GtkWidget*) _tmp251_, GTK_ALIGN_CENTER);
	_tmp252_ = self->priv->proxy_entry;
	g_signal_connect_object (_tmp252_, "activate", (GCallback) ___lambda305__gtk_entry_activate, self, 0);
	_tmp253_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	proxy_focus = _tmp253_;
	g_signal_connect_object (proxy_focus, "leave", (GCallback) ___lambda306__gtk_event_controller_focus_leave, self, 0);
	_tmp254_ = self->priv->proxy_entry;
	_tmp255_ = _g_object_ref0 ((GtkEventController*) proxy_focus);
	gtk_widget_add_controller ((GtkWidget*) _tmp254_, _tmp255_);
	_tmp256_ = self->priv->proxy_url_row;
	_tmp257_ = self->priv->proxy_entry;
	adw_action_row_add_suffix (_tmp256_, (GtkWidget*) _tmp257_);
	_tmp258_ = self->priv->proxy_url_row;
	_tmp259_ = self->priv->proxy_entry;
	adw_action_row_set_activatable_widget (_tmp258_, (GtkWidget*) _tmp259_);
	_tmp260_ = self->priv->proxy_url_row;
	gtk_list_box_append (network_list, (GtkWidget*) _tmp260_);
	dc_settings_dialog_load_proxy_settings (self, NULL, NULL);
	_tmp261_ = dc_settings_dialog_action_row ("Sticker animations", "Auto-play GIF, WebP and WebM stickers; " "clicking a sticker toggles playback");
	sticker_row = _tmp261_;
	_tmp262_ = self->priv->app_window;
	_tmp263_ = _tmp262_->settings;
	_tmp264_ = dc_settings_manager_get_animate_stickers (_tmp263_);
	_tmp265_ = _tmp264_;
	_tmp266_ = dc_settings_dialog_row_switch (sticker_row, _tmp265_);
	_data87_->sticker_switch = _tmp266_;
	g_signal_connect_data ((GObject*) _data87_->sticker_switch, "notify::active", (GCallback) ___lambda307__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp267_ = dc_settings_dialog_action_row ("Auto-download attachments", "Larger attachments wait for approval; applies to all profiles");
	download_row = _tmp267_;
	_tmp268_ = g_strdup ("Never");
	_tmp269_ = g_strdup ("256 KB");
	_tmp270_ = g_strdup ("512 KB");
	_tmp271_ = g_strdup ("1 MB");
	_tmp272_ = g_strdup ("2 MB");
	_tmp273_ = g_strdup ("5 MB");
	_tmp274_ = g_strdup ("Unlimited");
	_tmp275_ = g_new0 (gchar*, 7 + 1);
	_tmp275_[0] = _tmp268_;
	_tmp275_[1] = _tmp269_;
	_tmp275_[2] = _tmp270_;
	_tmp275_[3] = _tmp271_;
	_tmp275_[4] = _tmp272_;
	_tmp275_[5] = _tmp273_;
	_tmp275_[6] = _tmp274_;
	download_labels = _tmp275_;
	download_labels_length1 = 7;
	_download_labels_size_ = download_labels_length1;
	_tmp276_ = self->priv->app_window;
	_tmp277_ = _tmp276_->settings;
	_tmp278_ = dc_settings_manager_get_auto_download_limit (_tmp277_);
	_tmp279_ = _tmp278_;
	_tmp280_ = dc_settings_dialog_row_dropdown (download_row, download_labels, (gint) download_labels_length1, dc_settings_dialog_auto_download_limit_index (_tmp279_));
	_data87_->download_combo = _tmp280_;
	g_signal_connect_data ((GObject*) _data87_->download_combo, "notify::selected", (GCallback) ___lambda308__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp281_ = dc_settings_dialog_settings_list (self, "Advanced");
	advanced_list = _tmp281_;
	_tmp282_ = md_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp282_);
	_tmp283_ = audio_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp283_);
	gtk_list_box_append (advanced_list, (GtkWidget*) sticker_row);
	gtk_list_box_append (advanced_list, (GtkWidget*) download_row);
	_tmp284_ = dc_settings_dialog_settings_list (self, "Chatmail");
	chatmail_list = _tmp284_;
	_tmp285_ = dc_settings_dialog_action_row ("Chatmail Server", NULL);
	_g_object_unref0 (self->priv->rpc_row);
	self->priv->rpc_row = _tmp285_;
	_tmp286_ = g_strdup ("Auto");
	_tmp287_ = g_strdup ("Custom");
	_tmp288_ = g_new0 (gchar*, 2 + 1);
	_tmp288_[0] = _tmp286_;
	_tmp288_[1] = _tmp287_;
	rpc_source_labels = _tmp288_;
	rpc_source_labels_length1 = 2;
	_rpc_source_labels_size_ = rpc_source_labels_length1;
	_tmp289_ = self->priv->rpc_row;
	_tmp290_ = self->priv->app_window;
	_tmp291_ = _tmp290_->settings;
	_tmp292_ = dc_settings_dialog_row_dropdown (_tmp289_, rpc_source_labels, (gint) rpc_source_labels_length1, (guint) dc_settings_manager_effective_rpc_server_source (_tmp291_));
	_g_object_unref0 (self->priv->rpc_source_dropdown);
	self->priv->rpc_source_dropdown = _tmp292_;
	_tmp293_ = self->priv->rpc_source_dropdown;
	g_signal_connect_object ((GObject*) _tmp293_, "notify::selected", (GCallback) _dc_settings_dialog_on_rpc_source_changed_g_object_notify, self, 0);
	_tmp294_ = (GtkButton*) gtk_button_new_with_label ("Choose");
	g_object_ref_sink (_tmp294_);
	_g_object_unref0 (self->priv->rpc_choose_btn);
	self->priv->rpc_choose_btn = _tmp294_;
	_tmp295_ = self->priv->rpc_choose_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp295_, GTK_ALIGN_CENTER);
	_tmp296_ = self->priv->rpc_choose_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp296_, "flat");
	_tmp297_ = self->priv->rpc_choose_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp297_, "Choose a deltachat-rpc-server binary");
	_tmp298_ = self->priv->rpc_choose_btn;
	g_signal_connect_object (_tmp298_, "clicked", (GCallback) ___lambda321__gtk_button_clicked, self, 0);
	_tmp299_ = self->priv->rpc_row;
	_tmp300_ = self->priv->rpc_choose_btn;
	adw_action_row_add_suffix (_tmp299_, (GtkWidget*) _tmp300_);
	_tmp301_ = (GtkButton*) gtk_button_new_with_label ("Install");
	g_object_ref_sink (_tmp301_);
	_g_object_unref0 (self->priv->rpc_download_btn);
	self->priv->rpc_download_btn = _tmp301_;
	_tmp302_ = self->priv->rpc_download_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp302_, GTK_ALIGN_CENTER);
	_tmp303_ = self->priv->rpc_download_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp303_, "flat");
	_tmp304_ = self->priv->rpc_download_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp304_, "Download the latest deltachat-rpc-server into Parla's data dir");
	_tmp305_ = self->priv->rpc_download_btn;
	g_signal_connect_object (_tmp305_, "clicked", (GCallback) ___lambda322__gtk_button_clicked, self, 0);
	_tmp306_ = self->priv->rpc_row;
	_tmp307_ = self->priv->rpc_download_btn;
	adw_action_row_add_suffix (_tmp306_, (GtkWidget*) _tmp307_);
	_tmp308_ = self->priv->rpc_row;
	gtk_list_box_append (chatmail_list, (GtkWidget*) _tmp308_);
	_tmp309_ = dc_settings_dialog_action_row ("Chatmail accounts path", NULL);
	_g_object_unref0 (self->priv->accounts_path_row);
	self->priv->accounts_path_row = _tmp309_;
	_tmp310_ = (GtkButton*) gtk_button_new_with_label ("Change");
	g_object_ref_sink (_tmp310_);
	accounts_path_change_btn = _tmp310_;
	gtk_widget_set_valign ((GtkWidget*) accounts_path_change_btn, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) accounts_path_change_btn, "flat");
	gtk_widget_set_tooltip_text ((GtkWidget*) accounts_path_change_btn, "Choose a different folder for Chatmail accounts");
	g_signal_connect_object (accounts_path_change_btn, "clicked", (GCallback) ___lambda324__gtk_button_clicked, self, 0);
	_tmp311_ = self->priv->accounts_path_row;
	adw_action_row_add_suffix (_tmp311_, (GtkWidget*) accounts_path_change_btn);
	_tmp312_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	g_object_ref_sink (_tmp312_);
	_g_object_unref0 (self->priv->accounts_path_reset_btn);
	self->priv->accounts_path_reset_btn = _tmp312_;
	_tmp313_ = self->priv->accounts_path_reset_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp313_, GTK_ALIGN_CENTER);
	_tmp314_ = self->priv->accounts_path_reset_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp314_, "flat");
	_tmp315_ = self->priv->accounts_path_reset_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp315_, "Use the default Chatmail accounts path");
	_tmp316_ = self->priv->accounts_path_reset_btn;
	g_signal_connect_object (_tmp316_, "clicked", (GCallback) ___lambda325__gtk_button_clicked, self, 0);
	_tmp317_ = self->priv->accounts_path_row;
	_tmp318_ = self->priv->accounts_path_reset_btn;
	adw_action_row_add_suffix (_tmp317_, (GtkWidget*) _tmp318_);
	_tmp319_ = self->priv->accounts_path_row;
	gtk_list_box_append (chatmail_list, (GtkWidget*) _tmp319_);
	dc_settings_dialog_sync_accounts_path_row (self);
	_tmp320_ = dc_settings_dialog_action_row ("Chatmail server version", "Checking...");
	_g_object_unref0 (self->priv->rpc_version_row);
	self->priv->rpc_version_row = _tmp320_;
	_tmp321_ = (GtkButton*) gtk_button_new_with_label ("Check");
	g_object_ref_sink (_tmp321_);
	_g_object_unref0 (self->priv->rpc_update_btn);
	self->priv->rpc_update_btn = _tmp321_;
	_tmp322_ = self->priv->rpc_update_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp322_, GTK_ALIGN_CENTER);
	_tmp323_ = self->priv->rpc_update_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp323_, "flat");
	_tmp324_ = self->priv->rpc_update_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp324_, "Check latest deltachat-rpc-server release");
	_tmp325_ = self->priv->rpc_update_btn;
	g_signal_connect_object (_tmp325_, "clicked", (GCallback) ___lambda326__gtk_button_clicked, self, 0);
	_tmp326_ = self->priv->rpc_version_row;
	_tmp327_ = self->priv->rpc_update_btn;
	adw_action_row_add_suffix (_tmp326_, (GtkWidget*) _tmp327_);
	_tmp328_ = self->priv->rpc_version_row;
	gtk_list_box_append (chatmail_list, (GtkWidget*) _tmp328_);
	_tmp329_ = dc_settings_dialog_action_row ("Check for chatmail updates on startup", "Notify when a newer deltachat-rpc-server is available");
	rpc_autocheck_row = _tmp329_;
	_tmp330_ = self->priv->app_window;
	_tmp331_ = _tmp330_->settings;
	_tmp332_ = dc_settings_manager_get_rpc_check_updates_on_startup (_tmp331_);
	_tmp333_ = _tmp332_;
	_tmp334_ = dc_settings_dialog_row_switch (rpc_autocheck_row, _tmp333_);
	_data87_->autocheck_switch = _tmp334_;
	g_signal_connect_data ((GObject*) _data87_->autocheck_switch, "notify::active", (GCallback) ___lambda327__g_object_notify, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	gtk_widget_set_visible ((GtkWidget*) rpc_autocheck_row, !dc_settings_manager_rpc_server_path_is_fixed ());
	gtk_list_box_append (chatmail_list, (GtkWidget*) rpc_autocheck_row);
	dc_settings_dialog_update_rpc_row (self);
	_tmp335_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp335_);
	reset_box = _tmp335_;
	gtk_widget_set_margin_top ((GtkWidget*) reset_box, 8);
	_tmp336_ = (GtkButton*) gtk_button_new_with_label ("Factory Reset");
	g_object_ref_sink (_tmp336_);
	reset_btn = _tmp336_;
	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);
	_tmp337_ = (GtkLabel*) gtk_label_new ("Remove all settings and close the app");
	g_object_ref_sink (_tmp337_);
	reset_label = _tmp337_;
	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);
	_tmp338_ = self->priv->content;
	gtk_box_append (_tmp338_, (GtkWidget*) reset_box);
	_tmp339_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp339_);
	scroll = _tmp339_;
	gtk_widget_set_vexpand ((GtkWidget*) scroll, TRUE);
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp340_ = self->priv->content;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp340_);
	_tmp341_ = box;
	gtk_box_append (_tmp341_, (GtkWidget*) scroll);
	_tmp342_ = box;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp342_);
	_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);
	_g_object_unref0 (accounts_path_change_btn);
	rpc_source_labels = (_vala_array_free (rpc_source_labels, rpc_source_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (chatmail_list);
	_g_object_unref0 (advanced_list);
	download_labels = (_vala_array_free (download_labels, download_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (download_row);
	_g_object_unref0 (sticker_row);
	_g_object_unref0 (proxy_focus);
	_g_object_unref0 (network_list);
	_g_object_unref0 (notification_contents_row);
	_g_object_unref0 (notif_row);
	_g_object_unref0 (notifications_list);
	_g_object_unref0 (audio_row);
	_g_object_unref0 (shift_row);
	md_labels = (_vala_array_free (md_labels, md_labels_length1, (GDestroyNotify) g_free), NULL);
	_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);
	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);
	_g_object_unref0 (font_reset_btn);
	_g_object_unref0 (font_dialog);
	_g_object_unref0 (direct_avatar_row);
	avatar_labels = (_vala_array_free (avatar_labels, avatar_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (avatar_row);
	style_labels = (_vala_array_free (style_labels, style_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (style_row);
	code_labels = (_vala_array_free (code_labels, code_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (code_row);
	theme_labels = (_vala_array_free (theme_labels, theme_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (theme_row);
	_g_object_unref0 (appearance_list);
	_g_object_unref0 (header);
	_g_object_unref0 (box);
	block87_data_unref (_data87_);
	_data87_ = NULL;
	return self;
}

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

static GtkListBox*
dc_settings_dialog_settings_list (DcSettingsDialog* self,
                                  const gchar* title)
{
	GtkLabel* label = NULL;
	GtkLabel* _tmp0_;
	GtkBox* _tmp1_;
	GtkListBox* list = NULL;
	GtkListBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkListBox* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (title);
	g_object_ref_sink (_tmp0_);
	label = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) label, GTK_ALIGN_START);
	_tmp1_ = self->priv->content;
	gtk_box_append (_tmp1_, (GtkWidget*) label);
	_tmp2_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp2_);
	list = _tmp2_;
	gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) list, "boxed-list");
	_tmp3_ = self->priv->content;
	gtk_box_append (_tmp3_, (GtkWidget*) list);
	result = list;
	_g_object_unref0 (label);
	return result;
}

static guint
dc_settings_dialog_auto_download_limit_index (gint bytes)
{
	guint result;
	switch (bytes) {
		case DC_AUTO_DOWNLOAD_NEVER:
		{
			result = (guint) 0;
			return result;
		}
		case 256 * 1024:
		{
			result = (guint) 1;
			return result;
		}
		case 512 * 1024:
		{
			result = (guint) 2;
			return result;
		}
		case 1024 * 1024:
		{
			result = (guint) 3;
			return result;
		}
		case (2 * 1024) * 1024:
		{
			result = (guint) 4;
			return result;
		}
		case (5 * 1024) * 1024:
		{
			result = (guint) 5;
			return result;
		}
		case 0:
		{
			result = (guint) 6;
			return result;
		}
		default:
		{
			result = (guint) 3;
			return result;
		}
	}
}

static gint
dc_settings_dialog_auto_download_limit_for_index (guint index)
{
	gint result;
	switch (index) {
		case 0:
		{
			result = DC_AUTO_DOWNLOAD_NEVER;
			return result;
		}
		case 1:
		{
			result = 256 * 1024;
			return result;
		}
		case 2:
		{
			result = 512 * 1024;
			return result;
		}
		case 3:
		{
			result = 1024 * 1024;
			return result;
		}
		case 4:
		{
			result = (2 * 1024) * 1024;
			return result;
		}
		case 5:
		{
			result = (5 * 1024) * 1024;
			return result;
		}
		case 6:
		{
			result = 0;
			return result;
		}
		default:
		{
			result = DC_AUTO_DOWNLOAD_DEFAULT;
			return result;
		}
	}
}

static AdwActionRow*
dc_settings_dialog_action_row (const gchar* title,
                               const gchar* subtitle)
{
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp0_;
	AdwActionRow* _tmp1_;
	AdwActionRow* result;
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	_tmp1_ = row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp1_, title);
	if (subtitle != NULL) {
		AdwActionRow* _tmp2_;
		_tmp2_ = row;
		adw_action_row_set_subtitle (_tmp2_, subtitle);
	}
	result = row;
	return result;
}

static GtkSwitch*
dc_settings_dialog_row_switch (AdwActionRow* row,
                               gboolean active)
{
	GtkSwitch* sw = NULL;
	GtkSwitch* _tmp0_;
	GtkSwitch* result;
	g_return_val_if_fail (row != NULL, NULL);
	_tmp0_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp0_);
	sw = _tmp0_;
	gtk_switch_set_active (sw, active);
	gtk_widget_set_valign ((GtkWidget*) sw, GTK_ALIGN_CENTER);
	adw_action_row_add_suffix (row, (GtkWidget*) sw);
	adw_action_row_set_activatable_widget (row, (GtkWidget*) sw);
	result = sw;
	return result;
}

static GtkDropDown*
dc_settings_dialog_row_dropdown (AdwActionRow* row,
                                 gchar** labels,
                                 gint labels_length1,
                                 guint selected)
{
	GtkDropDown* dropdown = NULL;
	GtkDropDown* _tmp0_;
	GtkDropDown* result;
	g_return_val_if_fail (row != NULL, NULL);
	_tmp0_ = (GtkDropDown*) gtk_drop_down_new_from_strings (labels);
	g_object_ref_sink (_tmp0_);
	dropdown = _tmp0_;
	gtk_drop_down_set_selected (dropdown, selected);
	gtk_widget_set_valign ((GtkWidget*) dropdown, GTK_ALIGN_CENTER);
	adw_action_row_add_suffix (row, (GtkWidget*) dropdown);
	adw_action_row_set_activatable_widget (row, (GtkWidget*) dropdown);
	result = dropdown;
	return result;
}

static void
dc_settings_dialog_sync_font_controls (DcSettingsDialog* self)
{
	gchar* family = NULL;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	AdwActionRow* _tmp10_;
	const gchar* _tmp11_ = NULL;
	const gchar* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	AdwActionRow* _tmp16_;
	GtkFontDialogButton* _tmp17_;
	DcWindow* _tmp18_;
	DcSettingsManager* _tmp19_;
	PangoFontDescription* _tmp20_;
	PangoFontDescription* _tmp21_;
	g_return_if_fail (self != NULL);
	self->priv->syncing_font_controls = TRUE;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = dc_settings_manager_get_font_family (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup (_tmp3_);
	family = _tmp4_;
	_tmp6_ = family;
	_tmp7_ = strlen (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_ > 0) {
		const gchar* _tmp9_;
		_tmp9_ = family;
		_tmp5_ = _tmp9_;
	} else {
		_tmp5_ = "System default";
	}
	_tmp10_ = self->priv->font_type_row;
	adw_action_row_set_subtitle (_tmp10_, _tmp5_);
	_tmp12_ = family;
	_tmp13_ = strlen (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_ > 0) {
		const gchar* _tmp15_;
		_tmp15_ = family;
		_tmp11_ = _tmp15_;
	} else {
		_tmp11_ = NULL;
	}
	_tmp16_ = self->priv->font_type_row;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp16_, _tmp11_);
	_tmp17_ = self->priv->font_btn;
	_tmp18_ = self->priv->app_window;
	_tmp19_ = _tmp18_->settings;
	_tmp20_ = dc_settings_manager_effective_font_description (_tmp19_);
	_tmp21_ = _tmp20_;
	gtk_font_dialog_button_set_font_desc (_tmp17_, _tmp21_);
	__vala_PangoFontDescription_free0 (_tmp21_);
	self->priv->syncing_font_controls = FALSE;
	_g_free0 (family);
}

static gchar*
dc_settings_dialog_hex_from_rgba (GdkRGBA* c)
{
	GdkRGBA _tmp0_;
	GdkRGBA _tmp1_;
	GdkRGBA _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (c != NULL, NULL);
	_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));
	result = _tmp3_;
	return result;
}

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*
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)
{
	gboolean pinned = FALSE;
	gchar* custom = NULL;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gchar* _tmp2_;
	DcRpcServerSource source = 0;
	DcWindow* _tmp3_;
	DcSettingsManager* _tmp4_;
	gchar* found = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	GtkDropDown* _tmp7_;
	gboolean _tmp8_ = FALSE;
	GtkButton* _tmp9_;
	gboolean _tmp10_ = FALSE;
	GtkButton* _tmp11_;
	gboolean _tmp12_ = FALSE;
	GtkButton* _tmp13_;
	gboolean _tmp14_ = FALSE;
	GtkButton* _tmp15_;
	const gchar* _tmp16_ = NULL;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gboolean _tmp20_;
	GtkButton* _tmp21_;
	GtkButton* _tmp22_;
	const gchar* _tmp40_;
	g_return_if_fail (self != NULL);
	dc_settings_dialog_sync_rpc_source_dropdown (self);
	pinned = dc_settings_manager_rpc_server_path_is_fixed ();
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = dc_settings_manager_effective_rpc_server_path (_tmp1_);
	custom = _tmp2_;
	_tmp3_ = self->priv->app_window;
	_tmp4_ = _tmp3_->settings;
	source = dc_settings_manager_effective_rpc_server_source (_tmp4_);
	_tmp5_ = custom;
	_tmp6_ = dc_account_finder_find_rpc_server (_tmp5_, source);
	found = _tmp6_;
	_tmp7_ = self->priv->rpc_source_dropdown;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp7_, !pinned);
	if (source == DC_RPC_SERVER_SOURCE_CUSTOM) {
		_tmp8_ = !pinned;
	} else {
		_tmp8_ = FALSE;
	}
	_tmp9_ = self->priv->rpc_choose_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp9_, _tmp8_);
	if (source == DC_RPC_SERVER_SOURCE_CUSTOM) {
		_tmp10_ = !pinned;
	} else {
		_tmp10_ = FALSE;
	}
	_tmp11_ = self->priv->rpc_choose_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp11_, _tmp10_);
	if (source == DC_RPC_SERVER_SOURCE_AUTO) {
		_tmp12_ = !pinned;
	} else {
		_tmp12_ = FALSE;
	}
	_tmp13_ = self->priv->rpc_download_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp13_, _tmp12_);
	if (dc_rpc_installer_can_auto_install ()) {
		_tmp14_ = !pinned;
	} else {
		_tmp14_ = FALSE;
	}
	_tmp15_ = self->priv->rpc_download_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, _tmp14_);
	_tmp17_ = found;
	_tmp18_ = dc_account_finder_get_managed_rpc_path ();
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strcmp0 (_tmp17_, _tmp19_) == 0;
	_g_free0 (_tmp19_);
	if (_tmp20_) {
		_tmp16_ = "Update";
	} else {
		_tmp16_ = "Install";
	}
	_tmp21_ = self->priv->rpc_download_btn;
	gtk_button_set_label (_tmp21_, _tmp16_);
	_tmp22_ = self->priv->rpc_update_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp22_, !pinned);
	switch (source) {
		case DC_RPC_SERVER_SOURCE_CUSTOM:
		{
			const gchar* _tmp23_;
			gint _tmp24_;
			gint _tmp25_;
			_tmp23_ = custom;
			_tmp24_ = strlen (_tmp23_);
			_tmp25_ = _tmp24_;
			if (_tmp25_ == 0) {
				AdwActionRow* _tmp26_;
				AdwActionRow* _tmp27_;
				_tmp26_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp26_, "No custom binary selected");
				_tmp27_ = self->priv->rpc_row;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp27_, "Choose a deltachat-rpc-server binary");
			} else {
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				AdwActionRow* _tmp31_;
				AdwActionRow* _tmp32_;
				const gchar* _tmp33_;
				_tmp29_ = found;
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_ = NULL;
					if (pinned) {
						_tmp30_ = "Using built-in server";
					} else {
						_tmp30_ = "Using custom binary";
					}
					_tmp28_ = _tmp30_;
				} else {
					_tmp28_ = "Custom path is not executable";
				}
				_tmp31_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp31_, _tmp28_);
				_tmp32_ = self->priv->rpc_row;
				_tmp33_ = custom;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp32_, _tmp33_);
			}
			break;
		}
		default:
		case DC_RPC_SERVER_SOURCE_AUTO:
		{
			const gchar* _tmp34_ = NULL;
			const gchar* _tmp35_;
			AdwActionRow* _tmp36_;
			const gchar* _tmp37_ = NULL;
			const gchar* _tmp38_;
			AdwActionRow* _tmp39_;
			_tmp35_ = found;
			if (_tmp35_ != NULL) {
				_tmp34_ = "Using Parla or system server";
			} else {
				_tmp34_ = "Standalone server not found";
			}
			_tmp36_ = self->priv->rpc_row;
			adw_action_row_set_subtitle (_tmp36_, _tmp34_);
			_tmp38_ = found;
			_tmp37_ = _tmp38_;
			if (_tmp37_ == NULL) {
				_tmp37_ = "Install deltachat-rpc-server or choose a custom binary";
			}
			_tmp39_ = self->priv->rpc_row;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp39_, _tmp37_);
			break;
		}
	}
	_tmp40_ = found;
	dc_settings_dialog_update_rpc_version_row (self, _tmp40_, 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)) {
			_g_free0 (_data_->stderr_buf);
			_g_free0 (_data_->stdout_buf);
			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_object_unref0 (_data_->process);
			_g_free0 (_data_->stderr_buf);
			_g_free0 (_data_->stdout_buf);
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = _data_->process;
		_data_->successful = g_subprocess_get_successful (_data_->_tmp14_);
		if (_data_->request_id != _data_->self->priv->rpc_version_request) {
			_g_object_unref0 (_data_->process);
			_g_free0 (_data_->stderr_buf);
			_g_free0 (_data_->stdout_buf);
			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_->_tmp17_ = _data_->stdout_buf;
		_data_->_tmp16_ = _data_->_tmp17_;
		if (_data_->_tmp16_ == NULL) {
			_data_->_tmp16_ = "";
		}
		_data_->_tmp18_ = string_strip (_data_->_tmp16_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = strlen (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = _data_->_tmp21_ > 0;
		_g_free0 (_data_->_tmp19_);
		if (_data_->_tmp22_) {
			_data_->_tmp24_ = _data_->stdout_buf;
			_data_->_tmp23_ = _data_->_tmp24_;
			if (_data_->_tmp23_ == NULL) {
				_data_->_tmp23_ = "";
			}
			_data_->_tmp25_ = string_strip (_data_->_tmp23_);
			_g_free0 (_data_->_tmp15_);
			_data_->_tmp15_ = _data_->_tmp25_;
		} else {
			_data_->_tmp27_ = _data_->stderr_buf;
			_data_->_tmp26_ = _data_->_tmp27_;
			if (_data_->_tmp26_ == NULL) {
				_data_->_tmp26_ = "";
			}
			_data_->_tmp28_ = string_strip (_data_->_tmp26_);
			_g_free0 (_data_->_tmp15_);
			_data_->_tmp15_ = _data_->_tmp28_;
		}
		_data_->_tmp29_ = _data_->_tmp15_;
		_data_->_tmp15_ = NULL;
		_data_->version = _data_->_tmp29_;
		if (_data_->successful) {
			_data_->_tmp31_ = _data_->version;
			_data_->_tmp32_ = strlen (_data_->_tmp31_);
			_data_->_tmp33_ = _data_->_tmp32_;
			_data_->_tmp30_ = _data_->_tmp33_ > 0;
		} else {
			_data_->_tmp30_ = FALSE;
		}
		if (_data_->_tmp30_) {
			_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 = !dc_settings_manager_rpc_server_path_is_fixed ();
			_data_->_tmp38_ = _data_->self->priv->rpc_update_btn;
			gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp38_, _data_->self->priv->rpc_update_check_available);
		} 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_->_tmp15_);
		_g_object_unref0 (_data_->process);
		_g_free0 (_data_->stderr_buf);
		_g_free0 (_data_->stdout_buf);
	}
	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_effective_rpc_server_path (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = _data_->self->priv->app_window;
		_data_->_tmp24_ = _data_->_tmp23_->settings;
		_data_->_tmp25_ = dc_account_finder_find_rpc_server (_data_->_tmp22_, dc_settings_manager_effective_rpc_server_source (_data_->_tmp24_));
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_tmp27_ = dc_account_finder_get_managed_rpc_path ();
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_tmp29_ = g_strcmp0 (_data_->_tmp26_, _data_->_tmp28_) == 0;
		_g_free0 (_data_->_tmp28_);
		_g_free0 (_data_->_tmp26_);
		_g_free0 (_data_->_tmp22_);
		_data_->managed_active = _data_->_tmp29_;
		_data_->_tmp30_ = _data_->self->priv->rpc_current_version;
		if (_data_->_tmp30_ == NULL) {
			_data_->_tmp31_ = _data_->self->priv->rpc_version_row;
			_data_->_tmp32_ = _data_->latest_version;
			_data_->_tmp33_ = g_strdup_printf ("Latest available: %s", _data_->_tmp32_);
			_data_->_tmp34_ = _data_->_tmp33_;
			adw_action_row_set_subtitle (_data_->_tmp31_, _data_->_tmp34_);
			_g_free0 (_data_->_tmp34_);
			_data_->_tmp35_ = _data_->self->priv->app_window;
			_data_->_tmp36_ = _data_->latest_version;
			_data_->_tmp37_ = g_strconcat ("Latest RPC server: ", _data_->_tmp36_, NULL);
			_data_->_tmp38_ = _data_->_tmp37_;
			dc_window_show_toast (_data_->_tmp35_, _data_->_tmp38_);
			_g_free0 (_data_->_tmp38_);
		} else {
			_data_->_tmp39_ = _data_->self->priv->rpc_current_version;
			_data_->_tmp40_ = _data_->latest_version;
			if (g_strcmp0 (_data_->_tmp39_, _data_->_tmp40_) != 0) {
				_data_->_tmp41_ = _data_->self->priv->rpc_version_row;
				_data_->_tmp42_ = _data_->latest_version;
				_data_->_tmp43_ = _data_->self->priv->rpc_current_version;
				_data_->_tmp44_ = g_strdup_printf ("Latest: %s (installed %s)", _data_->_tmp42_, _data_->_tmp43_);
				_data_->_tmp45_ = _data_->_tmp44_;
				adw_action_row_set_subtitle (_data_->_tmp41_, _data_->_tmp45_);
				_g_free0 (_data_->_tmp45_);
				if (_data_->managed_active) {
					_data_->_tmp46_ = _data_->self->priv->app_window;
					_data_->_tmp47_ = _data_->latest_version;
					_data_->_tmp48_ = g_strdup_printf ("Update available: %s — press Install to update", _data_->_tmp47_);
					_data_->_tmp49_ = _data_->_tmp48_;
					dc_window_show_toast (_data_->_tmp46_, _data_->_tmp49_);
					_g_free0 (_data_->_tmp49_);
				} else {
					_data_->_tmp50_ = _data_->self->priv->app_window;
					_data_->_tmp51_ = _data_->latest_version;
					_data_->_tmp52_ = g_strconcat ("Chatmail server version differs: ", _data_->_tmp51_, NULL);
					_data_->_tmp53_ = _data_->_tmp52_;
					dc_window_show_toast (_data_->_tmp50_, _data_->_tmp53_);
					_g_free0 (_data_->_tmp53_);
				}
			} else {
				_data_->_tmp54_ = _data_->self->priv->rpc_version_row;
				_data_->_tmp55_ = _data_->self->priv->rpc_current_version;
				_data_->_tmp56_ = g_strdup_printf ("Up to date: %s", _data_->_tmp55_);
				_data_->_tmp57_ = _data_->_tmp56_;
				adw_action_row_set_subtitle (_data_->_tmp54_, _data_->_tmp57_);
				_g_free0 (_data_->_tmp57_);
				_data_->_tmp58_ = _data_->self->priv->app_window;
				dc_window_show_toast (_data_->_tmp58_, "Chatmail server is up to date");
			}
		}
		_data_->_tmp59_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp60_ = _data_->latest_tag;
		_data_->_tmp61_ = g_strdup_printf ("Latest release: https://github.com/chatmail/core/releases/tag/%s", _data_->_tmp60_);
		_data_->_tmp62_ = _data_->_tmp61_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp59_, _data_->_tmp62_);
		_g_free0 (_data_->_tmp62_);
		_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_->_tmp63_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp64_ = _data_->previous_subtitle;
		adw_action_row_set_subtitle (_data_->_tmp63_, _data_->_tmp64_);
		_data_->_tmp65_ = _data_->self->priv->app_window;
		_data_->_tmp66_ = _data_->e;
		_data_->_tmp67_ = _data_->_tmp66_->message;
		_data_->_tmp68_ = g_strconcat ("Update check failed: ", _data_->_tmp67_, NULL);
		_data_->_tmp69_ = _data_->_tmp68_;
		dc_window_show_toast (_data_->_tmp65_, _data_->_tmp69_);
		_g_free0 (_data_->_tmp69_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		_data_->_tmp70_ = _data_->self->priv->rpc_update_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp70_, _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_;
	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;
	gtk_drop_down_set_selected (_tmp0_, (guint) dc_settings_manager_effective_rpc_server_source (_tmp2_));
	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_, "Chatmail 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_, "Chatmail 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_->_tmp37_ = _data_->e;
		if (!dc_is_dialog_dismissal (_data_->_tmp37_)) {
			_data_->_tmp38_ = _data_->self->priv->app_window;
			_data_->_tmp39_ = _data_->e;
			_data_->_tmp40_ = _data_->_tmp39_->message;
			dc_show_error ((GtkWidget*) _data_->_tmp38_, _data_->_tmp40_);
		}
		_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_sync_accounts_path_row (DcSettingsDialog* self)
{
	gchar* path = NULL;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gchar* _tmp2_;
	AdwActionRow* _tmp3_;
	AdwActionRow* _tmp4_;
	GtkButton* _tmp5_;
	DcWindow* _tmp6_;
	DcSettingsManager* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = dc_settings_manager_effective_accounts_path (_tmp1_);
	path = _tmp2_;
	_tmp3_ = self->priv->accounts_path_row;
	adw_action_row_set_subtitle (_tmp3_, path);
	_tmp4_ = self->priv->accounts_path_row;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp4_, path);
	_tmp5_ = self->priv->accounts_path_reset_btn;
	_tmp6_ = self->priv->app_window;
	_tmp7_ = _tmp6_->settings;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, !dc_settings_manager_uses_default_accounts_path (_tmp7_));
	_g_free0 (path);
}

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

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

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

static void
dc_settings_dialog_on_browse_accounts_path_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	DcSettingsDialogOnBrowseAccountsPathData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_on_browse_accounts_path_co (_data_);
}

static gboolean
dc_settings_dialog_on_browse_accounts_path_co (DcSettingsDialogOnBrowseAccountsPathData* _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_, "Choose Chatmail accounts folder");
	_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_effective_accounts_path (_data_->_tmp4_);
	_data_->path = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->path;
	if (g_file_test (_data_->_tmp6_, G_FILE_TEST_IS_DIR)) {
		_data_->_tmp7_ = _data_->dlg;
		_data_->_tmp8_ = _data_->path;
		_data_->_tmp9_ = g_file_new_for_path (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		gtk_file_dialog_set_initial_folder (_data_->_tmp7_, _data_->_tmp10_);
		_g_object_unref0 (_data_->_tmp10_);
	}
	{
		_data_->_tmp11_ = _data_->dlg;
		_data_->_tmp12_ = _data_->self->priv->app_window;
		_data_->_state_ = 1;
		gtk_file_dialog_select_folder (_data_->_tmp11_, (GtkWindow*) _data_->_tmp12_, NULL, dc_settings_dialog_on_browse_accounts_path_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp13_ = gtk_file_dialog_select_folder_finish (_data_->_tmp11_, _data_->_res_, &_data_->_inner_error0_);
		_data_->folder = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->folder != NULL) {
			_data_->_tmp14_ = g_file_get_path (_data_->folder);
			_data_->selected_path = _data_->_tmp14_;
			_data_->_tmp15_ = _data_->selected_path;
			if (_data_->_tmp15_ != NULL) {
				_data_->_tmp16_ = _data_->self->priv->app_window;
				_data_->_tmp17_ = _data_->_tmp16_->settings;
				_data_->_tmp18_ = _data_->selected_path;
				dc_settings_manager_save_accounts_path (_data_->_tmp17_, _data_->_tmp18_);
				dc_settings_dialog_sync_accounts_path_row (_data_->self);
				_data_->_tmp19_ = _data_->self->priv->app_window;
				dc_window_show_toast (_data_->_tmp19_, "Chatmail accounts path saved");
				_data_->_tmp20_ = _data_->self->priv->app_window;
				dc_window_reconnect_rpc_server (_data_->_tmp20_, NULL, NULL);
			}
			_g_free0 (_data_->selected_path);
		}
		_g_object_unref0 (_data_->folder);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp21_ = _data_->e;
		if (!dc_is_dialog_dismissal (_data_->_tmp21_)) {
			_data_->_tmp22_ = _data_->self->priv->app_window;
			_data_->_tmp23_ = _data_->e;
			_data_->_tmp24_ = _data_->_tmp23_->message;
			dc_show_error ((GtkWidget*) _data_->_tmp22_, _data_->_tmp24_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->path);
		_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;
	}
	_g_free0 (_data_->path);
	_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
__lambda323_ (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
___lambda323__dc_rpc_installer_progress (DcRpcInstaller* _sender,
                                         gint64 received,
                                         gint64 total,
                                         gpointer self)
{
	__lambda323_ ((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) ___lambda323__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_, "Chatmail 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
__lambda328_ (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	dc_settings_dialog_delete_parla_config ();
	_tmp0_ = self->priv->app_window;
	dc_window_quit_application (_tmp0_);
}

static void
___lambda328__dc_void_func (gpointer self)
{
	__lambda328_ ((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", ___lambda328__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_theme_override (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	GtkApplication* _tmp1_;
	GtkApplication* _tmp2_;
	DcWindow* _tmp3_;
	DcSettingsManager* _tmp4_;
	DcThemeOverride _tmp5_;
	DcThemeOverride _tmp6_;
	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_theme_override (_tmp4_);
	_tmp6_ = _tmp5_;
	dc_application_apply_theme_override (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, DC_TYPE_APPLICATION, DcApplication), _tmp6_);
}

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->syncing_font_controls = 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_object_unref0 (self->priv->accounts_path_row);
	_g_object_unref0 (self->priv->accounts_path_reset_btn);
	_g_free0 (self->priv->saved_proxy_url);
	_g_object_unref0 (self->priv->font_type_row);
	_g_object_unref0 (self->priv->font_btn);
	_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;
}

