/* 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 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_MESSAGE_STYLE_BUBBLES = 0,
	DC_MESSAGE_STYLE_IRC = 1
} 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_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_RENDERING_PROPERTY,
	DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY,
	DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY,
	DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY,
	DC_SETTINGS_MANAGER_SYSTEM_AUDIO_PLAYER_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY,
	DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY,
	DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY,
	DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY,
	DC_SETTINGS_MANAGER_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 _Block45Data Block45Data;
typedef struct _Block46Data Block46Data;
typedef struct _Block47Data Block47Data;
#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 _Block48Data Block48Data;
typedef struct _DcWindowPrivate DcWindowPrivate;
typedef struct _Block49Data Block49Data;
typedef struct _DcSettingsDialogLoadProxySettingsData DcSettingsDialogLoadProxySettingsData;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
typedef struct _DcSettingsDialogNormalizeProxyUrlData DcSettingsDialogNormalizeProxyUrlData;
typedef struct _DcSettingsDialogSaveProxySettingsData DcSettingsDialogSaveProxySettingsData;
typedef struct _DcSettingsDialogUpdateRpcVersionRowData DcSettingsDialogUpdateRpcVersionRowData;
typedef struct _DcSettingsDialogCheckRpcUpdatesData DcSettingsDialogCheckRpcUpdatesData;
typedef struct _DcSettingsDialogOnBrowseRpcServerData DcSettingsDialogOnBrowseRpcServerData;

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

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

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

typedef struct _DcApplication DcApplication;
typedef struct _DcApplicationClass DcApplicationClass;

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

struct _DcSettingsManagerClass {
	GObjectClass parent_class;
};

struct _DcSettingsManagerPrivate {
	gint _double_click_action;
	gboolean _markdown_rendering;
	gboolean _shift_enter_sends;
	gboolean _notifications_enabled;
	gboolean _minimize_to_tray;
	gboolean _system_audio_player;
	gchar* _rpc_server_path;
	DcRpcServerSource _rpc_server_source;
	gboolean _rpc_check_updates_on_startup;
	DcSidebarMode _sidebar_mode;
	gchar* _default_account_addr;
	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 _Block45Data {
	int _ref_count_;
	DcSettingsManager* self;
	gchar* key;
	gint value;
};

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

struct _Block47Data {
	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;
	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 _Block48Data {
	int _ref_count_;
	DcSettingsDialog* self;
	GtkDropDown* dblclick_combo;
	GtkSwitch* md_switch;
	GtkSwitch* shift_switch;
	GtkSwitch* notif_switch;
	GtkSwitch* audio_switch;
	GtkDropDown* style_combo;
	GtkDropDown* avatar_combo;
	GtkCheckButton* direct_avatar_check;
	GtkColorDialogButton* accent_btn;
	GtkDropDown* bg_mode_combo;
	GtkColorDialogButton* bg_color_btn;
	GtkSwitch* autocheck_switch;
};

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

struct _DcWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _Block49Data {
	int _ref_count_;
	Block48Data * _data48_;
	GtkSwitch* tray_switch;
};

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

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

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

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

struct _DcSettingsDialogCheckRpcUpdatesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gboolean _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GtkButton* _tmp5_;
	gchar* previous_subtitle;
	AdwActionRow* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	AdwActionRow* _tmp10_;
	gchar* latest_tag;
	gchar* _tmp11_;
	gchar* latest_version;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	AdwActionRow* _tmp15_;
	const gchar* _tmp16_;
	DcWindow* _tmp17_;
	GtkButton* _tmp18_;
	gboolean managed_active;
	DcWindow* _tmp19_;
	DcSettingsManager* _tmp20_;
	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;
	gboolean _tmp37_;
	GError* _tmp38_;
	GError* _tmp39_;
	DcWindow* _tmp40_;
	GError* _tmp41_;
	const gchar* _tmp42_;
	GError* _inner_error0_;
};

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

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

static gint DcSettingsManager_private_offset;
static gpointer dc_settings_manager_parent_class = NULL;
VALA_EXTERN gboolean dc_markdown_enabled;
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_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_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 void dc_settings_manager_load (DcSettingsManager* self);
static gint dc_settings_manager_kf_int (GKeyFile* kf,
                                 const gchar* k,
                                 gint d);
VALA_EXTERN void dc_settings_manager_set_double_click_action (DcSettingsManager* self,
                                                  gint value);
static gboolean dc_settings_manager_kf_bool (GKeyFile* kf,
                                      const gchar* k,
                                      gboolean d);
VALA_EXTERN void dc_settings_manager_set_markdown_rendering (DcSettingsManager* self,
                                                 gboolean value);
VALA_EXTERN gboolean dc_settings_manager_get_markdown_rendering (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_set_shift_enter_sends (DcSettingsManager* self,
                                                gboolean value);
VALA_EXTERN void dc_settings_manager_set_notifications_enabled (DcSettingsManager* self,
                                                    gboolean value);
VALA_EXTERN void dc_settings_manager_set_minimize_to_tray (DcSettingsManager* self,
                                               gboolean value);
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);
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);
static gint dc_settings_manager_kf_enum (GKeyFile* kf,
                                  const gchar* k,
                                  gint d,
                                  gint max);
VALA_EXTERN void dc_settings_manager_set_rpc_server_source (DcSettingsManager* self,
                                                DcRpcServerSource value);
VALA_EXTERN void dc_settings_manager_set_rpc_check_updates_on_startup (DcSettingsManager* self,
                                                           gboolean value);
VALA_EXTERN void dc_settings_manager_set_sidebar_mode (DcSettingsManager* self,
                                           DcSidebarMode value);
VALA_EXTERN void dc_settings_manager_set_default_account_addr (DcSettingsManager* self,
                                                   const gchar* value);
VALA_EXTERN void dc_settings_manager_set_message_style (DcSettingsManager* self,
                                            DcMessageStyle value);
VALA_EXTERN void dc_settings_manager_set_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_rendering (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_shift_enter_sends (DcSettingsManager* self,
                                                 gboolean v);
VALA_EXTERN void dc_settings_manager_save_notifications_enabled (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_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_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_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 __lambda14_ (DcSettingsManager* self,
                  GKeyFile* kf);
static void ___lambda14__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 Block45Data* block45_data_ref (Block45Data* _data45_);
static void block45_data_unref (void * _userdata_);
static void __lambda11_ (Block45Data* _data45_,
                  GKeyFile* kf);
static void ___lambda11__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
static Block46Data* block46_data_ref (Block46Data* _data46_);
static void block46_data_unref (void * _userdata_);
static void __lambda12_ (Block46Data* _data46_,
                  GKeyFile* kf);
static void ___lambda12__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
static Block47Data* block47_data_ref (Block47Data* _data47_);
static void block47_data_unref (void * _userdata_);
static void __lambda13_ (Block47Data* _data47_,
                  GKeyFile* kf);
static void ___lambda13__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN DcSettingsManager* dc_settings_manager_new (void);
VALA_EXTERN DcSettingsManager* dc_settings_manager_construct (GType object_type);
VALA_EXTERN gint dc_settings_manager_get_double_click_action (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_shift_enter_sends (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_notifications_enabled (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_minimize_to_tray (DcSettingsManager* self);
VALA_EXTERN DcSidebarMode dc_settings_manager_get_sidebar_mode (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_default_account_addr (DcSettingsManager* self);
VALA_EXTERN DcMessageStyle dc_settings_manager_get_message_style (DcSettingsManager* self);
VALA_EXTERN 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 Block48Data* block48_data_ref (Block48Data* _data48_);
static void block48_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 __lambda188_ (Block48Data* _data48_);
static void ___lambda188__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static GtkSwitch* dc_settings_dialog_row_switch (AdwActionRow* row,
                                          gboolean active);
static void __lambda189_ (Block48Data* _data48_);
static void ___lambda189__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda190_ (Block48Data* _data48_);
static void ___lambda190__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda191_ (Block48Data* _data48_);
VALA_EXTERN void dc_window_set_notifications_enabled (DcWindow* self,
                                          gboolean enabled);
static void ___lambda191__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda192_ (Block48Data* _data48_);
static void ___lambda192__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN gboolean dc_platform_is_macos (void);
static Block49Data* block49_data_ref (Block49Data* _data49_);
static void block49_data_unref (void * _userdata_);
static void ___lambda193_ (Block49Data* _data49_);
static void ____lambda193__g_object_notify (GObject* _sender,
                                     GParamSpec* pspec,
                                     gpointer self);
static void __lambda194_ (Block48Data* _data48_);
static void ___lambda194__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda195_ (Block48Data* _data48_);
static void ___lambda195__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda196_ (Block48Data* _data48_);
static void ___lambda196__gtk_check_button_toggled (GtkCheckButton* _sender,
                                             gpointer self);
static void __lambda197_ (DcSettingsDialog* self);
static PangoFontDescription* _vala_PangoFontDescription_copy (PangoFontDescription* self);
static void dc_settings_dialog_sync_font_controls (DcSettingsDialog* self);
static void ___lambda197__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda198_ (DcSettingsDialog* self);
static void ___lambda198__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dc_settings_dialog_apply_hex_to_button (GtkColorDialogButton* btn,
                                             const gchar* hex);
static void __lambda199_ (Block48Data* _data48_);
static gchar* dc_settings_dialog_hex_from_rgba (GdkRGBA* c);
static void ___lambda199__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda200_ (Block48Data* _data48_);
static void ___lambda200__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda201_ (Block48Data* _data48_);
static void dc_settings_dialog_apply_background (DcSettingsDialog* self);
static void ___lambda201__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda202_ (Block48Data* _data48_);
static void ___lambda202__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda203_ (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 ___lambda203__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda204_ (DcSettingsDialog* self);
static void ___lambda204__gtk_entry_activate (GtkEntry* _sender,
                                       gpointer self);
static void __lambda205_ (DcSettingsDialog* self);
static void ___lambda205__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                     gpointer self);
static void dc_settings_dialog_load_proxy_settings (DcSettingsDialog* self,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void dc_settings_dialog_load_proxy_settings_finish (DcSettingsDialog* self,
                                                    GAsyncResult* _res_);
static void dc_settings_dialog_on_rpc_source_changed (DcSettingsDialog* self);
static void _dc_settings_dialog_on_rpc_source_changed_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self);
static void __lambda214_ (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 ___lambda214__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda215_ (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 ___lambda215__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda217_ (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 ___lambda217__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda218_ (Block48Data* _data48_);
static void ___lambda218__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_);
VALA_EXTERN void dc_window_reconnect_rpc_server (DcWindow* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_window_reconnect_rpc_server_finish (DcWindow* self,
                                            GAsyncResult* _res_);
static void dc_settings_dialog_on_browse_rpc_server_data_free (gpointer _data);
static gboolean dc_settings_dialog_on_browse_rpc_server_co (DcSettingsDialogOnBrowseRpcServerData* _data_);
static void dc_settings_dialog_on_browse_rpc_server_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void dc_settings_dialog_install_managed_server_data_free (gpointer _data);
static gboolean dc_settings_dialog_install_managed_server_co (DcSettingsDialogInstallManagedServerData* _data_);
static void dc_settings_dialog_open_rpc_download_page (DcSettingsDialog* self,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_settings_dialog_open_rpc_download_page_finish (DcSettingsDialog* self,
                                                       GAsyncResult* _res_);
static void dc_settings_dialog_install_managed_server_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
VALA_EXTERN GType dc_rpc_installer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcInstaller, g_object_unref)
VALA_EXTERN DcRpcInstaller* dc_rpc_installer_new (void);
VALA_EXTERN DcRpcInstaller* dc_rpc_installer_construct (GType object_type);
static void __lambda216_ (DcSettingsDialog* self,
                   gint64 received,
                   gint64 total);
static void ___lambda216__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 __lambda219_ (DcSettingsDialog* self);
static void dc_settings_dialog_delete_parla_config (void);
static void ___lambda219__dc_void_func (gpointer self);
VALA_EXTERN GType dc_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcApplication, g_object_unref)
VALA_EXTERN void dc_application_apply_background (DcApplication* self,
                                      DcBackgroundMode mode,
                                      const gchar* hex);
static void dc_settings_dialog_finalize (GObject * obj);
static GType dc_settings_dialog_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

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

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

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

static GType
dc_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;
}

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

void
dc_settings_manager_load (DcSettingsManager* self)
{
	GKeyFile* kf = NULL;
	GKeyFile* _tmp0_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gint source = 0;
	gint sb = 0;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gint ms = 0;
	gint bad = 0;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gint bm = 0;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	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_int (kf, "double_click_action", 0));
	dc_settings_manager_set_markdown_rendering (self, dc_settings_manager_kf_bool (kf, "markdown_rendering", FALSE));
	_tmp3_ = self->priv->_markdown_rendering;
	dc_markdown_enabled = _tmp3_;
	dc_settings_manager_set_shift_enter_sends (self, dc_settings_manager_kf_bool (kf, "shift_enter_sends", FALSE));
	dc_settings_manager_set_notifications_enabled (self, dc_settings_manager_kf_bool (kf, "notifications_enabled", TRUE));
	dc_settings_manager_set_minimize_to_tray (self, dc_settings_manager_kf_bool (kf, "minimize_to_tray", FALSE));
	dc_settings_manager_set_system_audio_player (self, dc_settings_manager_kf_bool (kf, "system_audio_player", FALSE));
	_tmp4_ = self->priv->_system_audio_player;
	dc_audio_player_prefer_system = _tmp4_;
	_tmp5_ = dc_settings_manager_kf_str (kf, "rpc_server_path", "");
	_tmp6_ = _tmp5_;
	dc_settings_manager_set_rpc_server_path (self, _tmp6_);
	_g_free0 (_tmp6_);
	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);
	_tmp7_ = dc_settings_manager_kf_str (kf, "default_account_addr", "");
	_tmp8_ = _tmp7_;
	dc_settings_manager_set_default_account_addr (self, _tmp8_);
	_g_free0 (_tmp8_);
	ms = dc_settings_manager_kf_enum (kf, "message_style", (gint) DC_MESSAGE_STYLE_BUBBLES, 1);
	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));
	_tmp9_ = dc_settings_manager_kf_str (kf, "accent_color", "");
	_tmp10_ = _tmp9_;
	dc_settings_manager_set_accent_color (self, _tmp10_);
	_g_free0 (_tmp10_);
	bm = dc_settings_manager_kf_enum (kf, "background_mode", (gint) DC_BACKGROUND_MODE_SYSTEM, 2);
	dc_settings_manager_set_background_mode (self, (DcBackgroundMode) bm);
	_tmp11_ = dc_settings_manager_kf_str (kf, "background_color", "");
	_tmp12_ = _tmp11_;
	dc_settings_manager_set_background_color (self, _tmp12_);
	_g_free0 (_tmp12_);
	_tmp13_ = dc_settings_manager_kf_str (kf, "font_family", "");
	_tmp14_ = _tmp13_;
	_tmp15_ = string_strip (_tmp14_);
	_tmp16_ = _tmp15_;
	dc_settings_manager_set_font_family (self, _tmp16_);
	_g_free0 (_tmp16_);
	_g_free0 (_tmp14_);
	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;
}

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_rendering (DcSettingsManager* self,
                                             gboolean v)
{
	g_return_if_fail (self != NULL);
	dc_settings_manager_set_markdown_rendering (self, v);
	dc_markdown_enabled = v;
	dc_settings_manager_save_bool (self, "markdown_rendering", v);
}

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_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_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_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_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
__lambda14_ (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
___lambda14__dc_setting_writer (GKeyFile* kf,
                                gpointer self)
{
	__lambda14_ ((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, ___lambda14__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 Block45Data*
block45_data_ref (Block45Data* _data45_)
{
	g_atomic_int_inc (&_data45_->_ref_count_);
	return _data45_;
}

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

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

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

static void
dc_settings_manager_save_int (DcSettingsManager* self,
                              const gchar* key,
                              gint value)
{
	Block45Data* _data45_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_data45_ = g_slice_new0 (Block45Data);
	_data45_->_ref_count_ = 1;
	_data45_->self = g_object_ref (self);
	_tmp0_ = g_strdup (key);
	_g_free0 (_data45_->key);
	_data45_->key = _tmp0_;
	_data45_->value = value;
	dc_settings_manager_save_to_file (self, ___lambda11__dc_setting_writer, _data45_);
	block45_data_unref (_data45_);
	_data45_ = NULL;
}

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

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

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

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

static void
dc_settings_manager_save_bool (DcSettingsManager* self,
                               const gchar* key,
                               gboolean value)
{
	Block46Data* _data46_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_data46_ = g_slice_new0 (Block46Data);
	_data46_->_ref_count_ = 1;
	_data46_->self = g_object_ref (self);
	_tmp0_ = g_strdup (key);
	_g_free0 (_data46_->key);
	_data46_->key = _tmp0_;
	_data46_->value = value;
	dc_settings_manager_save_to_file (self, ___lambda12__dc_setting_writer, _data46_);
	block46_data_unref (_data46_);
	_data46_ = NULL;
}

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

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

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

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

static void
dc_settings_manager_save_string (DcSettingsManager* self,
                                 const gchar* key,
                                 const gchar* value)
{
	Block47Data* _data47_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	g_return_if_fail (value != NULL);
	_data47_ = g_slice_new0 (Block47Data);
	_data47_->_ref_count_ = 1;
	_data47_->self = g_object_ref (self);
	_tmp0_ = g_strdup (key);
	_g_free0 (_data47_->key);
	_data47_->key = _tmp0_;
	_tmp1_ = g_strdup (value);
	_g_free0 (_data47_->value);
	_data47_->value = _tmp1_;
	dc_settings_manager_save_to_file (self, ___lambda13__dc_setting_writer, _data47_);
	block47_data_unref (_data47_);
	_data47_ = 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:383: Failed to save settings: %s", _tmp10_);
		_g_error_free0 (e);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_key_file_unref0 (kf);
}

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

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

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

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

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

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

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

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

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

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

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

void
dc_settings_manager_set_minimize_to_tray (DcSettingsManager* self,
                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_settings_manager_get_minimize_to_tray (self);
	if (old_value != value) {
		self->priv->_minimize_to_tray = value;
		g_object_notify_by_pspec ((GObject *) self, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY]);
	}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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_RENDERING_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY] = g_param_spec_boolean ("markdown-rendering", "markdown-rendering", "markdown-rendering", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY] = g_param_spec_boolean ("shift-enter-sends", "shift-enter-sends", "shift-enter-sends", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY] = g_param_spec_boolean ("notifications-enabled", "notifications-enabled", "notifications-enabled", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY] = g_param_spec_boolean ("minimize-to-tray", "minimize-to-tray", "minimize-to-tray", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_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_RPC_SERVER_PATH_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY] = g_param_spec_string ("rpc-server-path", "rpc-server-path", "rpc-server-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY] = g_param_spec_enum ("rpc-server-source", "rpc-server-source", "rpc-server-source", DC_TYPE_RPC_SERVER_SOURCE, DC_RPC_SERVER_SOURCE_AUTO, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY] = g_param_spec_boolean ("rpc-check-updates-on-startup", "rpc-check-updates-on-startup", "rpc-check-updates-on-startup", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY] = g_param_spec_enum ("sidebar-mode", "sidebar-mode", "sidebar-mode", DC_TYPE_SIDEBAR_MODE, DC_SIDEBAR_MODE_FULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY] = g_param_spec_string ("default-account-addr", "default-account-addr", "default-account-addr", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY] = g_param_spec_enum ("message-style", "message-style", "message-style", DC_TYPE_MESSAGE_STYLE, DC_MESSAGE_STYLE_BUBBLES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_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_;
	self->priv = dc_settings_manager_get_instance_private (self);
	self->priv->_double_click_action = 0;
	self->priv->_markdown_rendering = FALSE;
	self->priv->_shift_enter_sends = FALSE;
	self->priv->_notifications_enabled = TRUE;
	self->priv->_minimize_to_tray = FALSE;
	self->priv->_system_audio_player = FALSE;
	_tmp0_ = g_strdup ("");
	self->priv->_rpc_server_path = _tmp0_;
	self->priv->_rpc_server_source = DC_RPC_SERVER_SOURCE_AUTO;
	self->priv->_rpc_check_updates_on_startup = TRUE;
	self->priv->_sidebar_mode = DC_SIDEBAR_MODE_FULL;
	_tmp1_ = g_strdup ("");
	self->priv->_default_account_addr = _tmp1_;
	self->priv->_message_style = DC_MESSAGE_STYLE_BUBBLES;
	self->priv->_bubble_avatar_display = DC_BUBBLE_AVATAR_DISPLAY_NONE;
	self->priv->_bubble_avatars_in_direct_chats = FALSE;
	_tmp2_ = g_strdup ("");
	self->priv->_accent_color = _tmp2_;
	self->priv->_background_mode = DC_BACKGROUND_MODE_SYSTEM;
	_tmp3_ = g_strdup ("");
	self->priv->_background_color = _tmp3_;
	_tmp4_ = g_strdup ("");
	self->priv->_font_family = _tmp4_;
	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->_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_RENDERING_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_markdown_rendering (self));
		break;
		case DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_shift_enter_sends (self));
		break;
		case DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_notifications_enabled (self));
		break;
		case DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_minimize_to_tray (self));
		break;
		case DC_SETTINGS_MANAGER_SYSTEM_AUDIO_PLAYER_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_system_audio_player (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_rpc_server_path (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_rpc_server_source (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_rpc_check_updates_on_startup (self));
		break;
		case DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_sidebar_mode (self));
		break;
		case DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_default_account_addr (self));
		break;
		case DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_message_style (self));
		break;
		case DC_SETTINGS_MANAGER_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_RENDERING_PROPERTY:
		dc_settings_manager_set_markdown_rendering (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY:
		dc_settings_manager_set_shift_enter_sends (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY:
		dc_settings_manager_set_notifications_enabled (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_MINIMIZE_TO_TRAY_PROPERTY:
		dc_settings_manager_set_minimize_to_tray (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_SYSTEM_AUDIO_PLAYER_PROPERTY:
		dc_settings_manager_set_system_audio_player (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY:
		dc_settings_manager_set_rpc_server_path (self, g_value_get_string (value));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY:
		dc_settings_manager_set_rpc_server_source (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_RPC_CHECK_UPDATES_ON_STARTUP_PROPERTY:
		dc_settings_manager_set_rpc_check_updates_on_startup (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY:
		dc_settings_manager_set_sidebar_mode (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY:
		dc_settings_manager_set_default_account_addr (self, g_value_get_string (value));
		break;
		case DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY:
		dc_settings_manager_set_message_style (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_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 Block48Data*
block48_data_ref (Block48Data* _data48_)
{
	g_atomic_int_inc (&_data48_->_ref_count_);
	return _data48_;
}

static void
block48_data_unref (void * _userdata_)
{
	Block48Data* _data48_;
	_data48_ = (Block48Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data48_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data48_->self;
		_g_object_unref0 (_data48_->autocheck_switch);
		_g_object_unref0 (_data48_->bg_color_btn);
		_g_object_unref0 (_data48_->bg_mode_combo);
		_g_object_unref0 (_data48_->accent_btn);
		_g_object_unref0 (_data48_->direct_avatar_check);
		_g_object_unref0 (_data48_->avatar_combo);
		_g_object_unref0 (_data48_->style_combo);
		_g_object_unref0 (_data48_->audio_switch);
		_g_object_unref0 (_data48_->notif_switch);
		_g_object_unref0 (_data48_->shift_switch);
		_g_object_unref0 (_data48_->md_switch);
		_g_object_unref0 (_data48_->dblclick_combo);
		_g_object_unref0 (self);
		g_slice_free (Block48Data, _data48_);
	}
}

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

static void
___lambda188__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda188_ (self);
}

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

static void
___lambda189__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda189_ (self);
}

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

static void
___lambda190__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda190_ (self);
}

static void
__lambda191_ (Block48Data* _data48_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	GtkSwitch* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data48_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _data48_->notif_switch;
	_tmp2_ = gtk_switch_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	dc_window_set_notifications_enabled (_tmp0_, _tmp3_);
}

static void
___lambda191__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda191_ (self);
}

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

static void
___lambda192__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda192_ (self);
}

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

static void
block49_data_unref (void * _userdata_)
{
	Block49Data* _data49_;
	_data49_ = (Block49Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data49_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data49_->_data48_->self;
		_g_object_unref0 (_data49_->tray_switch);
		block48_data_unref (_data49_->_data48_);
		_data49_->_data48_ = NULL;
		g_slice_free (Block49Data, _data49_);
	}
}

static void
___lambda193_ (Block49Data* _data49_)
{
	Block48Data* _data48_;
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	GtkSwitch* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	_data48_ = _data49_->_data48_;
	self = _data48_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = _data49_->tray_switch;
	_tmp3_ = gtk_switch_get_active (_tmp2_);
	_tmp4_ = _tmp3_;
	dc_settings_manager_save_minimize_to_tray (_tmp1_, _tmp4_);
}

static void
____lambda193__g_object_notify (GObject* _sender,
                                GParamSpec* pspec,
                                gpointer self)
{
	___lambda193_ (self);
}

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

static void
___lambda194__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda194_ (self);
}

static void
__lambda195_ (Block48Data* _data48_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	self = _data48_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_drop_down_get_selected (_data48_->avatar_combo);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_bubble_avatar_display (_tmp1_, (DcBubbleAvatarDisplay) _tmp3_);
}

static void
___lambda195__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda195_ (self);
}

static void
__lambda196_ (Block48Data* _data48_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data48_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	_tmp2_ = gtk_check_button_get_active (_data48_->direct_avatar_check);
	_tmp3_ = _tmp2_;
	dc_settings_manager_save_bubble_avatars_in_direct_chats (_tmp1_, _tmp3_);
}

static void
___lambda196__gtk_check_button_toggled (GtkCheckButton* _sender,
                                        gpointer self)
{
	__lambda196_ (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
__lambda197_ (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
___lambda197__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda197_ ((DcSettingsDialog*) self);
}

static void
__lambda198_ (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
___lambda198__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda198_ ((DcSettingsDialog*) self);
}

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

static void
___lambda199__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda199_ (self);
}

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

static void
___lambda200__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda200_ (self);
}

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

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

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

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

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

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

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

static void
___lambda204__gtk_entry_activate (GtkEntry* _sender,
                                  gpointer self)
{
	__lambda204_ ((DcSettingsDialog*) self);
}

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

static void
___lambda205__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                gpointer self)
{
	__lambda205_ ((DcSettingsDialog*) self);
}

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

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

static void
___lambda214__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda214_ ((DcSettingsDialog*) self);
}

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

static void
___lambda215__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda215_ ((DcSettingsDialog*) self);
}

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

static void
___lambda217__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda217_ ((DcSettingsDialog*) self);
}

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

static void
___lambda218__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda218_ (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;
	Block48Data* _data48_;
	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* behavior_list = NULL;
	GtkListBox* _tmp11_;
	AdwActionRow* dblclick_row = NULL;
	AdwActionRow* _tmp12_;
	gchar** dblclick_labels = NULL;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar** _tmp18_;
	gint dblclick_labels_length1;
	gint _dblclick_labels_size_;
	AdwActionRow* _tmp19_;
	gchar** _tmp20_;
	gint _tmp20__length1;
	DcWindow* _tmp21_;
	DcSettingsManager* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	GtkDropDown* _tmp25_;
	GtkDropDown* _tmp26_;
	GtkListBox* _tmp27_;
	AdwActionRow* _tmp28_;
	AdwActionRow* md_row = NULL;
	AdwActionRow* _tmp29_;
	AdwActionRow* _tmp30_;
	GtkSwitch* _tmp31_;
	GtkSwitch* _tmp32_;
	GtkListBox* _tmp33_;
	AdwActionRow* _tmp34_;
	AdwActionRow* shift_row = NULL;
	AdwActionRow* _tmp35_;
	AdwActionRow* _tmp36_;
	DcWindow* _tmp37_;
	DcSettingsManager* _tmp38_;
	gboolean _tmp39_;
	gboolean _tmp40_;
	GtkSwitch* _tmp41_;
	GtkSwitch* _tmp42_;
	GtkListBox* _tmp43_;
	AdwActionRow* _tmp44_;
	AdwActionRow* notif_row = NULL;
	AdwActionRow* _tmp45_;
	AdwActionRow* _tmp46_;
	DcWindow* _tmp47_;
	DcSettingsManager* _tmp48_;
	gboolean _tmp49_;
	gboolean _tmp50_;
	GtkSwitch* _tmp51_;
	GtkSwitch* _tmp52_;
	GtkListBox* _tmp53_;
	AdwActionRow* _tmp54_;
	AdwActionRow* audio_row = NULL;
	AdwActionRow* _tmp55_;
	AdwActionRow* _tmp56_;
	DcWindow* _tmp57_;
	DcSettingsManager* _tmp58_;
	gboolean _tmp59_;
	gboolean _tmp60_;
	GtkSwitch* _tmp61_;
	GtkSwitch* _tmp62_;
	GtkListBox* _tmp63_;
	AdwActionRow* _tmp64_;
	GtkListBox* appearance_list = NULL;
	GtkListBox* _tmp75_;
	AdwActionRow* style_row = NULL;
	AdwActionRow* _tmp76_;
	gchar** style_labels = NULL;
	gchar* _tmp77_;
	gchar* _tmp78_;
	gchar** _tmp79_;
	gint style_labels_length1;
	gint _style_labels_size_;
	DcWindow* _tmp80_;
	DcSettingsManager* _tmp81_;
	DcMessageStyle _tmp82_;
	DcMessageStyle _tmp83_;
	GtkDropDown* _tmp84_;
	AdwActionRow* avatar_row = NULL;
	AdwActionRow* _tmp85_;
	gchar** avatar_labels = NULL;
	gchar* _tmp86_;
	gchar* _tmp87_;
	gchar* _tmp88_;
	gchar** _tmp89_;
	gint avatar_labels_length1;
	gint _avatar_labels_size_;
	DcWindow* _tmp90_;
	DcSettingsManager* _tmp91_;
	DcBubbleAvatarDisplay _tmp92_;
	DcBubbleAvatarDisplay _tmp93_;
	GtkDropDown* _tmp94_;
	AdwActionRow* direct_avatar_row = NULL;
	AdwActionRow* _tmp95_;
	GtkCheckButton* _tmp96_;
	DcWindow* _tmp97_;
	DcSettingsManager* _tmp98_;
	gboolean _tmp99_;
	gboolean _tmp100_;
	AdwActionRow* _tmp101_;
	GtkFontDialog* font_dialog = NULL;
	GtkFontDialog* _tmp102_;
	GtkFontDialog* _tmp103_;
	GtkFontDialogButton* _tmp104_;
	GtkFontDialogButton* _tmp105_;
	GtkFontDialogButton* _tmp106_;
	GtkFontDialogButton* _tmp107_;
	GtkFontDialogButton* _tmp108_;
	DcWindow* _tmp109_;
	DcSettingsManager* _tmp110_;
	PangoFontDescription* _tmp111_;
	PangoFontDescription* _tmp112_;
	GtkFontDialogButton* _tmp113_;
	AdwActionRow* _tmp114_;
	GtkFontDialogButton* _tmp115_;
	GtkButton* font_reset_btn = NULL;
	GtkButton* _tmp116_;
	AdwActionRow* _tmp117_;
	AdwActionRow* _tmp118_;
	AdwActionRow* accent_row = NULL;
	AdwActionRow* _tmp119_;
	GtkColorDialog* _tmp120_;
	GtkColorDialogButton* _tmp121_;
	DcWindow* _tmp122_;
	DcSettingsManager* _tmp123_;
	const gchar* _tmp124_;
	const gchar* _tmp125_;
	GtkButton* accent_reset_btn = NULL;
	GtkButton* _tmp126_;
	AdwActionRow* bg_row = NULL;
	AdwActionRow* _tmp127_;
	gchar** bg_mode_labels = NULL;
	gchar* _tmp128_;
	gchar* _tmp129_;
	gchar* _tmp130_;
	gchar** _tmp131_;
	gint bg_mode_labels_length1;
	gint _bg_mode_labels_size_;
	DcWindow* _tmp132_;
	DcSettingsManager* _tmp133_;
	DcBackgroundMode _tmp134_;
	DcBackgroundMode _tmp135_;
	GtkDropDown* _tmp136_;
	GtkColorDialog* _tmp137_;
	GtkColorDialogButton* _tmp138_;
	DcWindow* _tmp139_;
	DcSettingsManager* _tmp140_;
	const gchar* _tmp141_;
	const gchar* _tmp142_;
	DcWindow* _tmp143_;
	DcSettingsManager* _tmp144_;
	DcBackgroundMode _tmp145_;
	DcBackgroundMode _tmp146_;
	GtkListBox* network_list = NULL;
	GtkListBox* _tmp147_;
	AdwActionRow* _tmp148_;
	AdwActionRow* _tmp149_;
	GtkSwitch* _tmp150_;
	GtkSwitch* _tmp151_;
	AdwActionRow* _tmp152_;
	AdwActionRow* _tmp153_;
	GtkEntry* _tmp154_;
	GtkEntry* _tmp155_;
	GtkEntry* _tmp156_;
	GtkEntry* _tmp157_;
	GtkEntry* _tmp158_;
	GtkEntry* _tmp159_;
	GtkEventControllerFocus* proxy_focus = NULL;
	GtkEventControllerFocus* _tmp160_;
	GtkEntry* _tmp161_;
	GtkEventController* _tmp162_;
	AdwActionRow* _tmp163_;
	GtkEntry* _tmp164_;
	AdwActionRow* _tmp165_;
	GtkEntry* _tmp166_;
	AdwActionRow* _tmp167_;
	GtkListBox* advanced_list = NULL;
	GtkListBox* _tmp168_;
	AdwActionRow* _tmp169_;
	gchar** rpc_source_labels = NULL;
	gchar* _tmp170_;
	gchar* _tmp171_;
	gchar** _tmp172_;
	gint rpc_source_labels_length1;
	gint _rpc_source_labels_size_;
	AdwActionRow* _tmp173_;
	DcWindow* _tmp174_;
	DcSettingsManager* _tmp175_;
	GtkDropDown* _tmp176_;
	GtkDropDown* _tmp177_;
	GtkButton* _tmp178_;
	GtkButton* _tmp179_;
	GtkButton* _tmp180_;
	GtkButton* _tmp181_;
	GtkButton* _tmp182_;
	AdwActionRow* _tmp183_;
	GtkButton* _tmp184_;
	GtkButton* _tmp185_;
	GtkButton* _tmp186_;
	GtkButton* _tmp187_;
	GtkButton* _tmp188_;
	GtkButton* _tmp189_;
	AdwActionRow* _tmp190_;
	GtkButton* _tmp191_;
	AdwActionRow* _tmp192_;
	AdwActionRow* _tmp193_;
	GtkButton* _tmp194_;
	GtkButton* _tmp195_;
	GtkButton* _tmp196_;
	GtkButton* _tmp197_;
	GtkButton* _tmp198_;
	AdwActionRow* _tmp199_;
	GtkButton* _tmp200_;
	AdwActionRow* _tmp201_;
	AdwActionRow* rpc_autocheck_row = NULL;
	AdwActionRow* _tmp202_;
	DcWindow* _tmp203_;
	DcSettingsManager* _tmp204_;
	gboolean _tmp205_;
	gboolean _tmp206_;
	GtkSwitch* _tmp207_;
	GtkBox* reset_box = NULL;
	GtkBox* _tmp208_;
	GtkButton* reset_btn = NULL;
	GtkButton* _tmp209_;
	GtkLabel* reset_label = NULL;
	GtkLabel* _tmp210_;
	GtkBox* _tmp211_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp212_;
	GtkBox* _tmp213_;
	GtkBox* _tmp214_;
	GtkBox* _tmp215_;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	_data48_ = g_slice_new0 (Block48Data);
	_data48_->_ref_count_ = 1;
	self = (DcSettingsDialog*) g_object_new (object_type, NULL);
	_data48_->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, "Behavior");
	behavior_list = _tmp11_;
	_tmp12_ = dc_settings_dialog_action_row ("Double-click on message", "Action when a message is double-clicked");
	dblclick_row = _tmp12_;
	_tmp13_ = g_strdup ("Reply to message");
	_tmp14_ = g_strdup ("React with ❤️");
	_tmp15_ = g_strdup ("React with 👍");
	_tmp16_ = g_strdup ("Open user profile");
	_tmp17_ = g_strdup ("Do nothing");
	_tmp18_ = g_new0 (gchar*, 5 + 1);
	_tmp18_[0] = _tmp13_;
	_tmp18_[1] = _tmp14_;
	_tmp18_[2] = _tmp15_;
	_tmp18_[3] = _tmp16_;
	_tmp18_[4] = _tmp17_;
	dblclick_labels = _tmp18_;
	dblclick_labels_length1 = 5;
	_dblclick_labels_size_ = dblclick_labels_length1;
	_tmp19_ = dblclick_row;
	_tmp20_ = dblclick_labels;
	_tmp20__length1 = dblclick_labels_length1;
	_tmp21_ = self->priv->app_window;
	_tmp22_ = _tmp21_->settings;
	_tmp23_ = dc_settings_manager_get_double_click_action (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = dc_settings_dialog_row_dropdown (_tmp19_, _tmp20_, (gint) _tmp20__length1, (guint) _tmp24_);
	_data48_->dblclick_combo = _tmp25_;
	_tmp26_ = _data48_->dblclick_combo;
	g_signal_connect_data ((GObject*) _tmp26_, "notify::selected", (GCallback) ___lambda188__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	_tmp27_ = behavior_list;
	_tmp28_ = dblclick_row;
	gtk_list_box_append (_tmp27_, (GtkWidget*) _tmp28_);
	_tmp29_ = dc_settings_dialog_action_row ("Markdown rendering", "Format bold, italic, code and headings");
	md_row = _tmp29_;
	_tmp30_ = md_row;
	_tmp31_ = dc_settings_dialog_row_switch (_tmp30_, dc_markdown_enabled);
	_data48_->md_switch = _tmp31_;
	_tmp32_ = _data48_->md_switch;
	g_signal_connect_data ((GObject*) _tmp32_, "notify::active", (GCallback) ___lambda189__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	_tmp33_ = behavior_list;
	_tmp34_ = md_row;
	gtk_list_box_append (_tmp33_, (GtkWidget*) _tmp34_);
	_tmp35_ = dc_settings_dialog_action_row ("Shift+Return sends message", "When on, Return inserts a newline and Shift+Return sends");
	shift_row = _tmp35_;
	_tmp36_ = shift_row;
	_tmp37_ = self->priv->app_window;
	_tmp38_ = _tmp37_->settings;
	_tmp39_ = dc_settings_manager_get_shift_enter_sends (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = dc_settings_dialog_row_switch (_tmp36_, _tmp40_);
	_data48_->shift_switch = _tmp41_;
	_tmp42_ = _data48_->shift_switch;
	g_signal_connect_data ((GObject*) _tmp42_, "notify::active", (GCallback) ___lambda190__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	_tmp43_ = behavior_list;
	_tmp44_ = shift_row;
	gtk_list_box_append (_tmp43_, (GtkWidget*) _tmp44_);
	_tmp45_ = dc_settings_dialog_action_row ("Desktop notifications", "Notify on incoming messages when the window is not focused");
	notif_row = _tmp45_;
	_tmp46_ = notif_row;
	_tmp47_ = self->priv->app_window;
	_tmp48_ = _tmp47_->settings;
	_tmp49_ = dc_settings_manager_get_notifications_enabled (_tmp48_);
	_tmp50_ = _tmp49_;
	_tmp51_ = dc_settings_dialog_row_switch (_tmp46_, _tmp50_);
	_data48_->notif_switch = _tmp51_;
	_tmp52_ = _data48_->notif_switch;
	g_signal_connect_data ((GObject*) _tmp52_, "notify::active", (GCallback) ___lambda191__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	_tmp53_ = behavior_list;
	_tmp54_ = notif_row;
	gtk_list_box_append (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = dc_settings_dialog_action_row ("System audio player", "Spawn afplay/gst-play/mpv to play voice messages instead of " "the built-in GTK media backend");
	audio_row = _tmp55_;
	_tmp56_ = audio_row;
	_tmp57_ = self->priv->app_window;
	_tmp58_ = _tmp57_->settings;
	_tmp59_ = dc_settings_manager_get_system_audio_player (_tmp58_);
	_tmp60_ = _tmp59_;
	_tmp61_ = dc_settings_dialog_row_switch (_tmp56_, _tmp60_);
	_data48_->audio_switch = _tmp61_;
	_tmp62_ = _data48_->audio_switch;
	g_signal_connect_data ((GObject*) _tmp62_, "notify::active", (GCallback) ___lambda192__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	_tmp63_ = behavior_list;
	_tmp64_ = audio_row;
	gtk_list_box_append (_tmp63_, (GtkWidget*) _tmp64_);
	if (!dc_platform_is_macos ()) {
		Block49Data* _data49_;
		AdwActionRow* tray_row = NULL;
		AdwActionRow* _tmp65_;
		AdwActionRow* _tmp66_;
		DcWindow* _tmp67_;
		DcSettingsManager* _tmp68_;
		gboolean _tmp69_;
		gboolean _tmp70_;
		GtkSwitch* _tmp71_;
		GtkSwitch* _tmp72_;
		GtkListBox* _tmp73_;
		AdwActionRow* _tmp74_;
		_data49_ = g_slice_new0 (Block49Data);
		_data49_->_ref_count_ = 1;
		_data49_->_data48_ = block48_data_ref (_data48_);
		_tmp65_ = dc_settings_dialog_action_row ("Minimize to status bar", "Closing the window keeps Parla running in the status bar; " "notifications still appear");
		tray_row = _tmp65_;
		_tmp66_ = tray_row;
		_tmp67_ = self->priv->app_window;
		_tmp68_ = _tmp67_->settings;
		_tmp69_ = dc_settings_manager_get_minimize_to_tray (_tmp68_);
		_tmp70_ = _tmp69_;
		_tmp71_ = dc_settings_dialog_row_switch (_tmp66_, _tmp70_);
		_data49_->tray_switch = _tmp71_;
		_tmp72_ = _data49_->tray_switch;
		g_signal_connect_data ((GObject*) _tmp72_, "notify::active", (GCallback) ____lambda193__g_object_notify, block49_data_ref (_data49_), (GClosureNotify) block49_data_unref, 0);
		_tmp73_ = behavior_list;
		_tmp74_ = tray_row;
		gtk_list_box_append (_tmp73_, (GtkWidget*) _tmp74_);
		_g_object_unref0 (tray_row);
		block49_data_unref (_data49_);
		_data49_ = NULL;
	}
	_tmp75_ = dc_settings_dialog_settings_list (self, "Appearance");
	appearance_list = _tmp75_;
	_tmp76_ = dc_settings_dialog_action_row ("Message style", "Use chat bubbles or compact IRC-style lines");
	style_row = _tmp76_;
	_tmp77_ = g_strdup ("Bubbles");
	_tmp78_ = g_strdup ("IRC");
	_tmp79_ = g_new0 (gchar*, 2 + 1);
	_tmp79_[0] = _tmp77_;
	_tmp79_[1] = _tmp78_;
	style_labels = _tmp79_;
	style_labels_length1 = 2;
	_style_labels_size_ = style_labels_length1;
	_tmp80_ = self->priv->app_window;
	_tmp81_ = _tmp80_->settings;
	_tmp82_ = dc_settings_manager_get_message_style (_tmp81_);
	_tmp83_ = _tmp82_;
	_tmp84_ = dc_settings_dialog_row_dropdown (style_row, style_labels, (gint) style_labels_length1, (guint) _tmp83_);
	_data48_->style_combo = _tmp84_;
	g_signal_connect_data ((GObject*) _data48_->style_combo, "notify::selected", (GCallback) ___lambda194__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	gtk_list_box_append (appearance_list, (GtkWidget*) style_row);
	_tmp85_ = dc_settings_dialog_action_row ("Bubble avatars", "Show small avatars beside message bubbles");
	avatar_row = _tmp85_;
	_tmp86_ = g_strdup ("none");
	_tmp87_ = g_strdup ("other");
	_tmp88_ = g_strdup ("both");
	_tmp89_ = g_new0 (gchar*, 3 + 1);
	_tmp89_[0] = _tmp86_;
	_tmp89_[1] = _tmp87_;
	_tmp89_[2] = _tmp88_;
	avatar_labels = _tmp89_;
	avatar_labels_length1 = 3;
	_avatar_labels_size_ = avatar_labels_length1;
	_tmp90_ = self->priv->app_window;
	_tmp91_ = _tmp90_->settings;
	_tmp92_ = dc_settings_manager_get_bubble_avatar_display (_tmp91_);
	_tmp93_ = _tmp92_;
	_tmp94_ = dc_settings_dialog_row_dropdown (avatar_row, avatar_labels, (gint) avatar_labels_length1, (guint) _tmp93_);
	_data48_->avatar_combo = _tmp94_;
	g_signal_connect_data ((GObject*) _data48_->avatar_combo, "notify::selected", (GCallback) ___lambda195__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	gtk_list_box_append (appearance_list, (GtkWidget*) avatar_row);
	_tmp95_ = dc_settings_dialog_action_row ("Use avatars in 1:1 chats", "Use the bubble avatar setting in direct conversations");
	direct_avatar_row = _tmp95_;
	_tmp96_ = (GtkCheckButton*) gtk_check_button_new ();
	g_object_ref_sink (_tmp96_);
	_data48_->direct_avatar_check = _tmp96_;
	_tmp97_ = self->priv->app_window;
	_tmp98_ = _tmp97_->settings;
	_tmp99_ = dc_settings_manager_get_bubble_avatars_in_direct_chats (_tmp98_);
	_tmp100_ = _tmp99_;
	gtk_check_button_set_active (_data48_->direct_avatar_check, _tmp100_);
	g_signal_connect_data (_data48_->direct_avatar_check, "toggled", (GCallback) ___lambda196__gtk_check_button_toggled, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	adw_action_row_add_suffix (direct_avatar_row, (GtkWidget*) _data48_->direct_avatar_check);
	adw_action_row_set_activatable_widget (direct_avatar_row, (GtkWidget*) _data48_->direct_avatar_check);
	gtk_list_box_append (appearance_list, (GtkWidget*) direct_avatar_row);
	_tmp101_ = 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 = _tmp101_;
	_tmp102_ = gtk_font_dialog_new ();
	font_dialog = _tmp102_;
	gtk_font_dialog_set_title (font_dialog, "Choose Font");
	gtk_font_dialog_set_modal (font_dialog, TRUE);
	_tmp103_ = _g_object_ref0 (font_dialog);
	_tmp104_ = (GtkFontDialogButton*) gtk_font_dialog_button_new (_tmp103_);
	g_object_ref_sink (_tmp104_);
	_g_object_unref0 (self->priv->font_btn);
	self->priv->font_btn = _tmp104_;
	_tmp105_ = self->priv->font_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp105_, GTK_ALIGN_CENTER);
	_tmp106_ = self->priv->font_btn;
	gtk_font_dialog_button_set_use_font (_tmp106_, TRUE);
	_tmp107_ = self->priv->font_btn;
	gtk_font_dialog_button_set_use_size (_tmp107_, TRUE);
	_tmp108_ = self->priv->font_btn;
	_tmp109_ = self->priv->app_window;
	_tmp110_ = _tmp109_->settings;
	_tmp111_ = dc_settings_manager_effective_font_description (_tmp110_);
	_tmp112_ = _tmp111_;
	gtk_font_dialog_button_set_font_desc (_tmp108_, _tmp112_);
	__vala_PangoFontDescription_free0 (_tmp112_);
	_tmp113_ = self->priv->font_btn;
	g_signal_connect_object ((GObject*) _tmp113_, "notify::font-desc", (GCallback) ___lambda197__g_object_notify, self, 0);
	_tmp114_ = self->priv->font_type_row;
	_tmp115_ = self->priv->font_btn;
	adw_action_row_add_suffix (_tmp114_, (GtkWidget*) _tmp115_);
	_tmp116_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	g_object_ref_sink (_tmp116_);
	font_reset_btn = _tmp116_;
	gtk_widget_set_valign ((GtkWidget*) font_reset_btn, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) font_reset_btn, "flat");
	gtk_widget_set_tooltip_text ((GtkWidget*) font_reset_btn, "Reset font settings to defaults");
	g_signal_connect_object (font_reset_btn, "clicked", (GCallback) ___lambda198__gtk_button_clicked, self, 0);
	_tmp117_ = self->priv->font_type_row;
	adw_action_row_add_suffix (_tmp117_, (GtkWidget*) font_reset_btn);
	_tmp118_ = self->priv->font_type_row;
	gtk_list_box_append (appearance_list, (GtkWidget*) _tmp118_);
	dc_settings_dialog_sync_font_controls (self);
	_tmp119_ = dc_settings_dialog_action_row ("Accent color", "Override the system accent color");
	accent_row = _tmp119_;
	_tmp120_ = gtk_color_dialog_new ();
	_tmp121_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp120_);
	g_object_ref_sink (_tmp121_);
	_data48_->accent_btn = _tmp121_;
	gtk_widget_set_valign ((GtkWidget*) _data48_->accent_btn, GTK_ALIGN_CENTER);
	_tmp122_ = self->priv->app_window;
	_tmp123_ = _tmp122_->settings;
	_tmp124_ = dc_settings_manager_get_accent_color (_tmp123_);
	_tmp125_ = _tmp124_;
	dc_settings_dialog_apply_hex_to_button (_data48_->accent_btn, _tmp125_);
	g_signal_connect_data ((GObject*) _data48_->accent_btn, "notify::rgba", (GCallback) ___lambda199__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	_tmp126_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	g_object_ref_sink (_tmp126_);
	accent_reset_btn = _tmp126_;
	gtk_widget_set_valign ((GtkWidget*) accent_reset_btn, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) accent_reset_btn, "flat");
	gtk_widget_set_tooltip_text ((GtkWidget*) accent_reset_btn, "Use system accent color");
	g_signal_connect_data (accent_reset_btn, "clicked", (GCallback) ___lambda200__gtk_button_clicked, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	adw_action_row_add_suffix (accent_row, (GtkWidget*) _data48_->accent_btn);
	adw_action_row_add_suffix (accent_row, (GtkWidget*) accent_reset_btn);
	gtk_list_box_append (appearance_list, (GtkWidget*) accent_row);
	_tmp127_ = dc_settings_dialog_action_row ("Background color", "Tint the window background with a solid color or a gradient");
	bg_row = _tmp127_;
	_tmp128_ = g_strdup ("System");
	_tmp129_ = g_strdup ("Solid");
	_tmp130_ = g_strdup ("Gradient");
	_tmp131_ = g_new0 (gchar*, 3 + 1);
	_tmp131_[0] = _tmp128_;
	_tmp131_[1] = _tmp129_;
	_tmp131_[2] = _tmp130_;
	bg_mode_labels = _tmp131_;
	bg_mode_labels_length1 = 3;
	_bg_mode_labels_size_ = bg_mode_labels_length1;
	_tmp132_ = self->priv->app_window;
	_tmp133_ = _tmp132_->settings;
	_tmp134_ = dc_settings_manager_get_background_mode (_tmp133_);
	_tmp135_ = _tmp134_;
	_tmp136_ = dc_settings_dialog_row_dropdown (bg_row, bg_mode_labels, (gint) bg_mode_labels_length1, (guint) _tmp135_);
	_data48_->bg_mode_combo = _tmp136_;
	_tmp137_ = gtk_color_dialog_new ();
	_tmp138_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp137_);
	g_object_ref_sink (_tmp138_);
	_data48_->bg_color_btn = _tmp138_;
	gtk_widget_set_valign ((GtkWidget*) _data48_->bg_color_btn, GTK_ALIGN_CENTER);
	_tmp139_ = self->priv->app_window;
	_tmp140_ = _tmp139_->settings;
	_tmp141_ = dc_settings_manager_get_background_color (_tmp140_);
	_tmp142_ = _tmp141_;
	dc_settings_dialog_apply_hex_to_button (_data48_->bg_color_btn, _tmp142_);
	_tmp143_ = self->priv->app_window;
	_tmp144_ = _tmp143_->settings;
	_tmp145_ = dc_settings_manager_get_background_mode (_tmp144_);
	_tmp146_ = _tmp145_;
	gtk_widget_set_sensitive ((GtkWidget*) _data48_->bg_color_btn, _tmp146_ != DC_BACKGROUND_MODE_SYSTEM);
	g_signal_connect_data ((GObject*) _data48_->bg_mode_combo, "notify::selected", (GCallback) ___lambda201__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	g_signal_connect_data ((GObject*) _data48_->bg_color_btn, "notify::rgba", (GCallback) ___lambda202__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	adw_action_row_add_suffix (bg_row, (GtkWidget*) _data48_->bg_color_btn);
	gtk_list_box_append (appearance_list, (GtkWidget*) bg_row);
	_tmp147_ = dc_settings_dialog_settings_list (self, "Network");
	network_list = _tmp147_;
	_tmp148_ = 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 = _tmp148_;
	_tmp149_ = self->priv->proxy_switch_row;
	_tmp150_ = dc_settings_dialog_row_switch (_tmp149_, FALSE);
	_g_object_unref0 (self->priv->proxy_switch);
	self->priv->proxy_switch = _tmp150_;
	_tmp151_ = self->priv->proxy_switch;
	g_signal_connect_object ((GObject*) _tmp151_, "notify::active", (GCallback) ___lambda203__g_object_notify, self, 0);
	_tmp152_ = self->priv->proxy_switch_row;
	gtk_list_box_append (network_list, (GtkWidget*) _tmp152_);
	_tmp153_ = 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 = _tmp153_;
	_tmp154_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp154_);
	_g_object_unref0 (self->priv->proxy_entry);
	self->priv->proxy_entry = _tmp154_;
	_tmp155_ = self->priv->proxy_entry;
	gtk_entry_set_placeholder_text (_tmp155_, "socks5://127.0.0.1:9050");
	_tmp156_ = self->priv->proxy_entry;
	gtk_entry_set_input_purpose (_tmp156_, GTK_INPUT_PURPOSE_URL);
	_tmp157_ = self->priv->proxy_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp157_, TRUE);
	_tmp158_ = self->priv->proxy_entry;
	gtk_widget_set_valign ((GtkWidget*) _tmp158_, GTK_ALIGN_CENTER);
	_tmp159_ = self->priv->proxy_entry;
	g_signal_connect_object (_tmp159_, "activate", (GCallback) ___lambda204__gtk_entry_activate, self, 0);
	_tmp160_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	proxy_focus = _tmp160_;
	g_signal_connect_object (proxy_focus, "leave", (GCallback) ___lambda205__gtk_event_controller_focus_leave, self, 0);
	_tmp161_ = self->priv->proxy_entry;
	_tmp162_ = _g_object_ref0 ((GtkEventController*) proxy_focus);
	gtk_widget_add_controller ((GtkWidget*) _tmp161_, _tmp162_);
	_tmp163_ = self->priv->proxy_url_row;
	_tmp164_ = self->priv->proxy_entry;
	adw_action_row_add_suffix (_tmp163_, (GtkWidget*) _tmp164_);
	_tmp165_ = self->priv->proxy_url_row;
	_tmp166_ = self->priv->proxy_entry;
	adw_action_row_set_activatable_widget (_tmp165_, (GtkWidget*) _tmp166_);
	_tmp167_ = self->priv->proxy_url_row;
	gtk_list_box_append (network_list, (GtkWidget*) _tmp167_);
	dc_settings_dialog_load_proxy_settings (self, NULL, NULL);
	_tmp168_ = dc_settings_dialog_settings_list (self, "Advanced");
	advanced_list = _tmp168_;
	_tmp169_ = dc_settings_dialog_action_row ("Chatmail Server", NULL);
	_g_object_unref0 (self->priv->rpc_row);
	self->priv->rpc_row = _tmp169_;
	_tmp170_ = g_strdup ("Auto");
	_tmp171_ = g_strdup ("Custom");
	_tmp172_ = g_new0 (gchar*, 2 + 1);
	_tmp172_[0] = _tmp170_;
	_tmp172_[1] = _tmp171_;
	rpc_source_labels = _tmp172_;
	rpc_source_labels_length1 = 2;
	_rpc_source_labels_size_ = rpc_source_labels_length1;
	_tmp173_ = self->priv->rpc_row;
	_tmp174_ = self->priv->app_window;
	_tmp175_ = _tmp174_->settings;
	_tmp176_ = dc_settings_dialog_row_dropdown (_tmp173_, rpc_source_labels, (gint) rpc_source_labels_length1, (guint) dc_settings_manager_effective_rpc_server_source (_tmp175_));
	_g_object_unref0 (self->priv->rpc_source_dropdown);
	self->priv->rpc_source_dropdown = _tmp176_;
	_tmp177_ = self->priv->rpc_source_dropdown;
	g_signal_connect_object ((GObject*) _tmp177_, "notify::selected", (GCallback) _dc_settings_dialog_on_rpc_source_changed_g_object_notify, self, 0);
	_tmp178_ = (GtkButton*) gtk_button_new_with_label ("Choose");
	g_object_ref_sink (_tmp178_);
	_g_object_unref0 (self->priv->rpc_choose_btn);
	self->priv->rpc_choose_btn = _tmp178_;
	_tmp179_ = self->priv->rpc_choose_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp179_, GTK_ALIGN_CENTER);
	_tmp180_ = self->priv->rpc_choose_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp180_, "flat");
	_tmp181_ = self->priv->rpc_choose_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp181_, "Choose a deltachat-rpc-server binary");
	_tmp182_ = self->priv->rpc_choose_btn;
	g_signal_connect_object (_tmp182_, "clicked", (GCallback) ___lambda214__gtk_button_clicked, self, 0);
	_tmp183_ = self->priv->rpc_row;
	_tmp184_ = self->priv->rpc_choose_btn;
	adw_action_row_add_suffix (_tmp183_, (GtkWidget*) _tmp184_);
	_tmp185_ = (GtkButton*) gtk_button_new_with_label ("Install");
	g_object_ref_sink (_tmp185_);
	_g_object_unref0 (self->priv->rpc_download_btn);
	self->priv->rpc_download_btn = _tmp185_;
	_tmp186_ = self->priv->rpc_download_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp186_, GTK_ALIGN_CENTER);
	_tmp187_ = self->priv->rpc_download_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp187_, "flat");
	_tmp188_ = self->priv->rpc_download_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp188_, "Download the latest deltachat-rpc-server into Parla's data dir");
	_tmp189_ = self->priv->rpc_download_btn;
	g_signal_connect_object (_tmp189_, "clicked", (GCallback) ___lambda215__gtk_button_clicked, self, 0);
	_tmp190_ = self->priv->rpc_row;
	_tmp191_ = self->priv->rpc_download_btn;
	adw_action_row_add_suffix (_tmp190_, (GtkWidget*) _tmp191_);
	_tmp192_ = self->priv->rpc_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp192_);
	_tmp193_ = dc_settings_dialog_action_row ("Chatmail server version", "Checking...");
	_g_object_unref0 (self->priv->rpc_version_row);
	self->priv->rpc_version_row = _tmp193_;
	_tmp194_ = (GtkButton*) gtk_button_new_with_label ("Check");
	g_object_ref_sink (_tmp194_);
	_g_object_unref0 (self->priv->rpc_update_btn);
	self->priv->rpc_update_btn = _tmp194_;
	_tmp195_ = self->priv->rpc_update_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp195_, GTK_ALIGN_CENTER);
	_tmp196_ = self->priv->rpc_update_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp196_, "flat");
	_tmp197_ = self->priv->rpc_update_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp197_, "Check latest deltachat-rpc-server release");
	_tmp198_ = self->priv->rpc_update_btn;
	g_signal_connect_object (_tmp198_, "clicked", (GCallback) ___lambda217__gtk_button_clicked, self, 0);
	_tmp199_ = self->priv->rpc_version_row;
	_tmp200_ = self->priv->rpc_update_btn;
	adw_action_row_add_suffix (_tmp199_, (GtkWidget*) _tmp200_);
	_tmp201_ = self->priv->rpc_version_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp201_);
	_tmp202_ = dc_settings_dialog_action_row ("Check for chatmail updates on startup", "Notify when a newer deltachat-rpc-server is available");
	rpc_autocheck_row = _tmp202_;
	_tmp203_ = self->priv->app_window;
	_tmp204_ = _tmp203_->settings;
	_tmp205_ = dc_settings_manager_get_rpc_check_updates_on_startup (_tmp204_);
	_tmp206_ = _tmp205_;
	_tmp207_ = dc_settings_dialog_row_switch (rpc_autocheck_row, _tmp206_);
	_data48_->autocheck_switch = _tmp207_;
	g_signal_connect_data ((GObject*) _data48_->autocheck_switch, "notify::active", (GCallback) ___lambda218__g_object_notify, block48_data_ref (_data48_), (GClosureNotify) block48_data_unref, 0);
	gtk_widget_set_visible ((GtkWidget*) rpc_autocheck_row, !dc_settings_manager_rpc_server_path_is_fixed ());
	gtk_list_box_append (advanced_list, (GtkWidget*) rpc_autocheck_row);
	dc_settings_dialog_update_rpc_row (self);
	_tmp208_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp208_);
	reset_box = _tmp208_;
	gtk_widget_set_margin_top ((GtkWidget*) reset_box, 8);
	_tmp209_ = (GtkButton*) gtk_button_new_with_label ("Factory Reset");
	g_object_ref_sink (_tmp209_);
	reset_btn = _tmp209_;
	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);
	_tmp210_ = (GtkLabel*) gtk_label_new ("Remove all settings and close the app");
	g_object_ref_sink (_tmp210_);
	reset_label = _tmp210_;
	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);
	_tmp211_ = self->priv->content;
	gtk_box_append (_tmp211_, (GtkWidget*) reset_box);
	_tmp212_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp212_);
	scroll = _tmp212_;
	gtk_widget_set_vexpand ((GtkWidget*) scroll, TRUE);
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp213_ = self->priv->content;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp213_);
	_tmp214_ = box;
	gtk_box_append (_tmp214_, (GtkWidget*) scroll);
	_tmp215_ = box;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp215_);
	_g_object_unref0 (scroll);
	_g_object_unref0 (reset_label);
	_g_object_unref0 (reset_btn);
	_g_object_unref0 (reset_box);
	_g_object_unref0 (rpc_autocheck_row);
	rpc_source_labels = (_vala_array_free (rpc_source_labels, rpc_source_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (advanced_list);
	_g_object_unref0 (proxy_focus);
	_g_object_unref0 (network_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);
	_g_object_unref0 (appearance_list);
	_g_object_unref0 (audio_row);
	_g_object_unref0 (notif_row);
	_g_object_unref0 (shift_row);
	_g_object_unref0 (md_row);
	dblclick_labels = (_vala_array_free (dblclick_labels, dblclick_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (dblclick_row);
	_g_object_unref0 (behavior_list);
	_g_object_unref0 (header);
	_g_object_unref0 (box);
	block48_data_unref (_data48_);
	_data48_ = 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 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)) {
			goto __catch0_g_error;
		}
		_data_->_tmp11_ = _data_->process;
		_data_->_tmp12_ = NULL;
		_data_->_tmp13_ = NULL;
		_data_->_state_ = 1;
		g_subprocess_communicate_utf8_async (_data_->_tmp11_, NULL, NULL, dc_settings_dialog_update_rpc_version_row_ready, _data_);
		return FALSE;
		_state_1:
		g_subprocess_communicate_utf8_finish (_data_->_tmp11_, _data_->_res_, &_data_->_tmp12_, &_data_->_tmp13_, &_data_->_inner_error0_);
		_g_free0 (_data_->stdout_buf);
		_data_->stdout_buf = _data_->_tmp12_;
		_g_free0 (_data_->stderr_buf);
		_data_->stderr_buf = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->stderr_buf);
			_g_free0 (_data_->stdout_buf);
			_g_object_unref0 (_data_->process);
			goto __catch0_g_error;
		}
		if (_data_->request_id != _data_->self->priv->rpc_version_request) {
			_g_free0 (_data_->stderr_buf);
			_g_free0 (_data_->stdout_buf);
			_g_object_unref0 (_data_->process);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp16_ = _data_->stdout_buf;
		_data_->_tmp15_ = _data_->_tmp16_;
		if (_data_->_tmp15_ == NULL) {
			_data_->_tmp15_ = "";
		}
		_data_->_tmp17_ = string_strip (_data_->_tmp15_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp19_ = strlen (_data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp21_ = _data_->_tmp20_ > 0;
		_g_free0 (_data_->_tmp18_);
		if (_data_->_tmp21_) {
			_data_->_tmp23_ = _data_->stdout_buf;
			_data_->_tmp22_ = _data_->_tmp23_;
			if (_data_->_tmp22_ == NULL) {
				_data_->_tmp22_ = "";
			}
			_data_->_tmp24_ = string_strip (_data_->_tmp22_);
			_g_free0 (_data_->_tmp14_);
			_data_->_tmp14_ = _data_->_tmp24_;
		} else {
			_data_->_tmp26_ = _data_->stderr_buf;
			_data_->_tmp25_ = _data_->_tmp26_;
			if (_data_->_tmp25_ == NULL) {
				_data_->_tmp25_ = "";
			}
			_data_->_tmp27_ = string_strip (_data_->_tmp25_);
			_g_free0 (_data_->_tmp14_);
			_data_->_tmp14_ = _data_->_tmp27_;
		}
		_data_->_tmp28_ = _data_->_tmp14_;
		_data_->_tmp14_ = NULL;
		_data_->version = _data_->_tmp28_;
		_data_->_tmp30_ = _data_->process;
		if (g_subprocess_get_successful (_data_->_tmp30_)) {
			_data_->_tmp31_ = _data_->version;
			_data_->_tmp32_ = strlen (_data_->_tmp31_);
			_data_->_tmp33_ = _data_->_tmp32_;
			_data_->_tmp29_ = _data_->_tmp33_ > 0;
		} else {
			_data_->_tmp29_ = FALSE;
		}
		if (_data_->_tmp29_) {
			_data_->_tmp34_ = _data_->self->priv->rpc_version_row;
			_data_->_tmp35_ = _data_->version;
			adw_action_row_set_subtitle (_data_->_tmp34_, _data_->_tmp35_);
			_data_->_tmp36_ = _data_->version;
			_data_->_tmp37_ = dc_rpc_installer_extract_version (_data_->_tmp36_);
			_g_free0 (_data_->self->priv->rpc_current_version);
			_data_->self->priv->rpc_current_version = _data_->_tmp37_;
			_data_->self->priv->rpc_update_check_available = !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_->_tmp14_);
		_g_free0 (_data_->stderr_buf);
		_g_free0 (_data_->stdout_buf);
		_g_object_unref0 (_data_->process);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		if (_data_->request_id != _data_->self->priv->rpc_version_request) {
			_g_error_free0 (_data_->e);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp41_ = _data_->self->priv->rpc_version_row;
		adw_action_row_set_subtitle (_data_->_tmp41_, "Unable to read version");
		_data_->_tmp42_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp43_ = _data_->e;
		_data_->_tmp44_ = _data_->_tmp43_->message;
		_data_->_tmp45_ = g_strdup_printf ("%s\n%s", _data_->rpc_path, _data_->_tmp44_);
		_data_->_tmp46_ = _data_->_tmp45_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp42_, _data_->_tmp46_);
		_g_free0 (_data_->_tmp46_);
		_g_free0 (_data_->self->priv->rpc_current_version);
		_data_->self->priv->rpc_current_version = NULL;
		_data_->self->priv->rpc_update_check_available = FALSE;
		_data_->_tmp47_ = _data_->self->priv->rpc_update_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp47_, FALSE);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_settings_dialog_check_rpc_updates (DcSettingsDialog* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcSettingsDialogCheckRpcUpdatesData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogCheckRpcUpdatesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_check_rpc_updates_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_check_rpc_updates_co (_data_);
}

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

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

static gboolean
dc_settings_dialog_check_rpc_updates_co (DcSettingsDialogCheckRpcUpdatesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->rpc_update_btn;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->rpc_update_btn;
		_data_->_tmp3_ = gtk_widget_get_sensitive ((GtkWidget*) _data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp0_ = !_data_->_tmp4_;
	}
	if (_data_->_tmp0_) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = _data_->self->priv->rpc_update_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp5_, FALSE);
	_data_->_tmp6_ = _data_->self->priv->rpc_version_row;
	_data_->_tmp7_ = adw_action_row_get_subtitle (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = g_strdup (_data_->_tmp8_);
	_data_->previous_subtitle = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->self->priv->rpc_version_row;
	adw_action_row_set_subtitle (_data_->_tmp10_, "Checking for updates...");
	{
		_data_->_state_ = 1;
		dc_rpc_installer_fetch_latest_tag (dc_settings_dialog_check_rpc_updates_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = dc_rpc_installer_fetch_latest_tag_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->latest_tag = _data_->_tmp11_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp12_ = _data_->latest_tag;
		_data_->_tmp13_ = dc_rpc_installer_extract_version (_data_->_tmp12_);
		_data_->latest_version = _data_->_tmp13_;
		_data_->_tmp14_ = _data_->latest_version;
		if (_data_->_tmp14_ == NULL) {
			_data_->_tmp15_ = _data_->self->priv->rpc_version_row;
			_data_->_tmp16_ = _data_->previous_subtitle;
			adw_action_row_set_subtitle (_data_->_tmp15_, _data_->_tmp16_);
			_data_->_tmp17_ = _data_->self->priv->app_window;
			dc_window_show_toast (_data_->_tmp17_, "Could not parse latest RPC server version");
			_g_free0 (_data_->latest_version);
			_g_free0 (_data_->latest_tag);
			{
				_data_->_tmp18_ = _data_->self->priv->rpc_update_btn;
				gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp18_, _data_->self->priv->rpc_update_check_available);
			}
			_g_free0 (_data_->previous_subtitle);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp19_ = _data_->self->priv->app_window;
		_data_->_tmp20_ = _data_->_tmp19_->settings;
		_data_->_tmp21_ = dc_settings_manager_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_->_tmp38_ = _data_->e;
		if (!(_data_->_tmp38_->domain == GTK_DIALOG_ERROR)) {
			_data_->_tmp39_ = _data_->e;
			_data_->_tmp37_ = !g_error_matches (_data_->_tmp39_, G_IO_ERROR, G_IO_ERROR_CANCELLED);
		} else {
			_data_->_tmp37_ = FALSE;
		}
		if (_data_->_tmp37_) {
			_data_->_tmp40_ = _data_->self->priv->app_window;
			_data_->_tmp41_ = _data_->e;
			_data_->_tmp42_ = _data_->_tmp41_->message;
			dc_show_error ((GtkWidget*) _data_->_tmp40_, _data_->_tmp42_);
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->start);
		_g_object_unref0 (_data_->dlg);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	dc_settings_dialog_update_rpc_row (_data_->self);
	_g_free0 (_data_->start);
	_g_object_unref0 (_data_->dlg);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_settings_dialog_install_managed_server (DcSettingsDialog* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcSettingsDialogInstallManagedServerData* _data_;
	DcSettingsDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcSettingsDialogInstallManagedServerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_settings_dialog_install_managed_server_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_settings_dialog_install_managed_server_co (_data_);
}

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

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

static void
__lambda216_ (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
___lambda216__dc_rpc_installer_progress (DcRpcInstaller* _sender,
                                         gint64 received,
                                         gint64 total,
                                         gpointer self)
{
	__lambda216_ ((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) ___lambda216__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
__lambda219_ (DcSettingsDialog* self)
{
	DcWindow* _tmp0_;
	GtkApplication* _tmp1_;
	GtkApplication* _tmp2_;
	dc_settings_dialog_delete_parla_config ();
	_tmp0_ = self->priv->app_window;
	_tmp1_ = gtk_window_get_application ((GtkWindow*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_application_quit ((GApplication*) _tmp2_);
}

static void
___lambda219__dc_void_func (gpointer self)
{
	__lambda219_ ((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", ___lambda219__dc_void_func, g_object_ref (self), g_object_unref);
}

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

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

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

static void
dc_settings_dialog_class_init (DcSettingsDialogClass * klass,
                               gpointer klass_data)
{
	dc_settings_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcSettingsDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dc_settings_dialog_finalize;
}

static void
dc_settings_dialog_instance_init (DcSettingsDialog * self,
                                  gpointer klass)
{
	gchar* _tmp0_;
	self->priv = dc_settings_dialog_get_instance_private (self);
	self->priv->loading_proxy = FALSE;
	self->priv->saving_proxy = FALSE;
	self->priv->saved_proxy_enabled = FALSE;
	_tmp0_ = g_strdup ("");
	self->priv->saved_proxy_url = _tmp0_;
	self->priv->syncing_rpc_source = FALSE;
	self->priv->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_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;
}

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

