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

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

#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 ())

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

typedef struct _DcSettingsManager DcSettingsManager;
typedef struct _DcSettingsManagerClass DcSettingsManagerClass;
typedef struct _DcSettingsManagerPrivate DcSettingsManagerPrivate;
typedef enum  {
	DC_RPC_SERVER_SOURCE_AUTO = 0,
	DC_RPC_SERVER_SOURCE_CUSTOM = 1,
	DC_RPC_SERVER_SOURCE_DESKTOP = 2
} DcRpcServerSource;

#define DC_TYPE_RPC_SERVER_SOURCE (dc_rpc_server_source_get_type ())
enum  {
	DC_SETTINGS_MANAGER_0_PROPERTY,
	DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY,
	DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY,
	DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY,
	DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY,
	DC_SETTINGS_MANAGER_RPC_SERVER_SOURCE_PROPERTY,
	DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY,
	DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY,
	DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY,
	DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY,
	DC_SETTINGS_MANAGER_NUM_PROPERTIES
};
static GParamSpec* dc_settings_manager_properties[DC_SETTINGS_MANAGER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
typedef struct _Block27Data Block27Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block28Data Block28Data;
typedef struct _Block29Data Block29Data;
typedef struct _Block30Data Block30Data;
typedef struct _Block31Data Block31Data;
typedef struct _Block32Data Block32Data;
typedef struct _Block33Data Block33Data;
typedef struct _Block34Data Block34Data;
typedef struct _Block35Data Block35Data;
typedef struct _Block36Data Block36Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL,
	DC_SETTINGS_MANAGER_NUM_SIGNALS
};
static guint dc_settings_manager_signals[DC_SETTINGS_MANAGER_NUM_SIGNALS] = {0};

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

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

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

typedef struct _DcWindow DcWindow;
typedef struct _DcWindowClass DcWindowClass;
enum  {
	DC_SETTINGS_DIALOG_0_PROPERTY,
	DC_SETTINGS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* dc_settings_dialog_properties[DC_SETTINGS_DIALOG_NUM_PROPERTIES];
typedef struct _Block37Data Block37Data;
typedef struct _DcWindowPrivate DcWindowPrivate;
typedef struct _DcSettingsDialogUpdateRpcVersionRowData DcSettingsDialogUpdateRpcVersionRowData;
typedef struct _DcSettingsDialogCheckRpcUpdatesData DcSettingsDialogCheckRpcUpdatesData;
typedef struct _DcSettingsDialogFetchLatestRpcReleaseTagData DcSettingsDialogFetchLatestRpcReleaseTagData;
typedef struct _DcSettingsDialogOnBrowseRpcServerData DcSettingsDialogOnBrowseRpcServerData;
typedef struct _DcSettingsDialogOpenRpcDownloadPageData DcSettingsDialogOpenRpcDownloadPageData;
typedef void (*DcVoidFunc) (gpointer user_data);

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

struct _DcSettingsManagerClass {
	GObjectClass parent_class;
};

struct _DcSettingsManagerPrivate {
	gint _double_click_action;
	gboolean _markdown_rendering;
	gboolean _shift_enter_sends;
	gboolean _notifications_enabled;
	gchar* _rpc_server_path;
	DcRpcServerSource _rpc_server_source;
	DcSidebarMode _sidebar_mode;
	gchar* _default_account_addr;
	DcMessageStyle _message_style;
	gchar* _accent_color;
};

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

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

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

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

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

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

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

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

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

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

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

struct _DcSettingsDialogClass {
	AdwDialogClass parent_class;
};

struct _DcSettingsDialogPrivate {
	GtkBox* content;
	DcWindow* app_window;
	AdwActionRow* rpc_row;
	AdwActionRow* rpc_version_row;
	GtkDropDown* rpc_source_dropdown;
	GtkButton* rpc_choose_btn;
	GtkButton* rpc_update_btn;
	gboolean syncing_rpc_source;
	guint rpc_version_request;
	gchar* rpc_current_version;
	gboolean rpc_update_check_available;
};

struct _Block37Data {
	int _ref_count_;
	DcSettingsDialog* self;
	GtkDropDown* dblclick_combo;
	GtkSwitch* md_switch;
	GtkSwitch* shift_switch;
	GtkSwitch* notif_switch;
	GtkDropDown* style_combo;
	GtkColorDialogButton* accent_btn;
};

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

struct _DcWindowClass {
	AdwApplicationWindowClass parent_class;
};

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_;
	const gchar* _tmp19_;
	AdwActionRow* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	DcWindow* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	AdwActionRow* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	DcWindow* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	AdwActionRow* _tmp39_;
	const gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	DcWindow* _tmp43_;
	AdwActionRow* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	GError* e;
	AdwActionRow* _tmp48_;
	const gchar* _tmp49_;
	DcWindow* _tmp50_;
	GError* _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	GError* _inner_error1_;
	GtkButton* _tmp55_;
	GError* _inner_error0_;
};

struct _DcSettingsDialogFetchLatestRpcReleaseTagData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcSettingsDialog* self;
	gchar* result;
	GSocketClient* client;
	GSocketClient* _tmp0_;
	GSocketClient* _tmp1_;
	GSocketConnection* tcp;
	GSocketClient* _tmp2_;
	GSocketConnection* _tmp3_;
	GNetworkAddress* identity;
	GNetworkAddress* _tmp4_;
	GTlsClientConnection* tls;
	GSocketConnection* _tmp5_;
	GNetworkAddress* _tmp6_;
	GTlsClientConnection* _tmp7_;
	GTlsClientConnection* _tmp8_;
	GError* _tmp9_;
	GTlsClientConnection* _tmp10_;
	gchar* request;
	gchar* _tmp11_;
	gsize written;
	GTlsClientConnection* _tmp12_;
	GOutputStream* _tmp13_;
	GOutputStream* _tmp14_;
	const gchar* _tmp15_;
	guint8* _tmp16_;
	gint _tmp16__length1;
	gint _tmp17_;
	guint8* _tmp18_;
	gint _tmp18__length1;
	gsize _tmp19_;
	GDataInputStream* reader;
	GTlsClientConnection* _tmp20_;
	GInputStream* _tmp21_;
	GInputStream* _tmp22_;
	GDataInputStream* _tmp23_;
	GDataInputStream* _tmp24_;
	gsize len;
	gchar* status_line;
	GDataInputStream* _tmp25_;
	gsize _tmp26_;
	gchar* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	gint status;
	gchar* location;
	gchar* line;
	gchar* _tmp30_;
	GDataInputStream* _tmp31_;
	gsize _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	const gchar* _tmp35_;
	gchar* stripped;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	gint _tmp39_;
	gint _tmp40_;
	const gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gboolean _tmp44_;
	const gchar* _tmp45_;
	gint _tmp46_;
	gint _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	gchar* _tmp50_;
	GTlsClientConnection* _tmp51_;
	gboolean _tmp52_;
	gboolean _tmp53_;
	const gchar* _tmp54_;
	gchar* _tmp55_;
	gchar* _tmp56_;
	GError* _tmp57_;
	GError* _tmp58_;
	gchar* tag;
	const gchar* _tmp59_;
	gchar* _tmp60_;
	const gchar* _tmp61_;
	GError* _tmp62_;
	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_;
	GError* e;
	gboolean _tmp36_;
	GError* _tmp37_;
	GError* _tmp38_;
	DcWindow* _tmp39_;
	GError* _tmp40_;
	const gchar* _tmp41_;
	GError* _inner_error0_;
};

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

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

VALA_EXTERN GType dc_sidebar_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcSidebarMode dc_sidebar_mode_next (DcSidebarMode self);
VALA_EXTERN GType dc_message_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_settings_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsManager, g_object_unref)
VALA_EXTERN GType dc_rpc_server_source_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gchar* dc_settings_manager_get_config_path (void);
VALA_EXTERN void dc_settings_manager_load (DcSettingsManager* self);
static gint dc_settings_manager_kf_int (GKeyFile* kf,
                                 const gchar* k,
                                 gint d);
VALA_EXTERN void dc_settings_manager_set_double_click_action (DcSettingsManager* self,
                                                  gint value);
static gboolean dc_settings_manager_kf_bool (GKeyFile* kf,
                                      const gchar* k,
                                      gboolean d);
VALA_EXTERN void dc_settings_manager_set_markdown_rendering (DcSettingsManager* self,
                                                 gboolean value);
VALA_EXTERN gboolean dc_settings_manager_get_markdown_rendering (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_set_shift_enter_sends (DcSettingsManager* self,
                                                gboolean value);
VALA_EXTERN void dc_settings_manager_set_notifications_enabled (DcSettingsManager* self,
                                                    gboolean value);
static gchar* dc_settings_manager_kf_str (GKeyFile* kf,
                                   const gchar* k,
                                   const gchar* d);
VALA_EXTERN void dc_settings_manager_set_rpc_server_path (DcSettingsManager* self,
                                              const gchar* value);
VALA_EXTERN const gchar* dc_settings_manager_get_rpc_server_path (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_set_rpc_server_source (DcSettingsManager* self,
                                                DcRpcServerSource value);
VALA_EXTERN void dc_settings_manager_set_sidebar_mode (DcSettingsManager* self,
                                           DcSidebarMode value);
VALA_EXTERN void dc_settings_manager_set_default_account_addr (DcSettingsManager* self,
                                                   const gchar* value);
VALA_EXTERN void dc_settings_manager_set_message_style (DcSettingsManager* self,
                                            DcMessageStyle value);
VALA_EXTERN void dc_settings_manager_set_accent_color (DcSettingsManager* self,
                                           const gchar* value);
VALA_EXTERN void dc_settings_manager_save_double_click_action (DcSettingsManager* self,
                                                   gint v);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
VALA_EXTERN void dc_settings_manager_save_to_file (DcSettingsManager* self,
                                       DcSettingWriter writer,
                                       gpointer writer_target);
static void __lambda8_ (Block27Data* _data27_,
                 GKeyFile* kf);
static void ___lambda8__dc_setting_writer (GKeyFile* kf,
                                    gpointer self);
VALA_EXTERN void dc_settings_manager_save_markdown_rendering (DcSettingsManager* self,
                                                  gboolean v);
static Block28Data* block28_data_ref (Block28Data* _data28_);
static void block28_data_unref (void * _userdata_);
static void __lambda9_ (Block28Data* _data28_,
                 GKeyFile* kf);
static void ___lambda9__dc_setting_writer (GKeyFile* kf,
                                    gpointer self);
VALA_EXTERN void dc_settings_manager_save_shift_enter_sends (DcSettingsManager* self,
                                                 gboolean v);
static Block29Data* block29_data_ref (Block29Data* _data29_);
static void block29_data_unref (void * _userdata_);
static void __lambda10_ (Block29Data* _data29_,
                  GKeyFile* kf);
static void ___lambda10__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                     gboolean v);
static Block30Data* block30_data_ref (Block30Data* _data30_);
static void block30_data_unref (void * _userdata_);
static void __lambda11_ (Block30Data* _data30_,
                  GKeyFile* kf);
static void ___lambda11__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                               const gchar* v);
static Block31Data* block31_data_ref (Block31Data* _data31_);
static void block31_data_unref (void * _userdata_);
static void __lambda12_ (Block31Data* _data31_,
                  GKeyFile* kf);
static void ___lambda12__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_source (DcSettingsManager* self,
                                                 DcRpcServerSource v);
static Block32Data* block32_data_ref (Block32Data* _data32_);
static void block32_data_unref (void * _userdata_);
static void __lambda13_ (Block32Data* _data32_,
                  GKeyFile* kf);
static void ___lambda13__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_sidebar_mode (DcSettingsManager* self,
                                            DcSidebarMode v);
static Block33Data* block33_data_ref (Block33Data* _data33_);
static void block33_data_unref (void * _userdata_);
static void __lambda14_ (Block33Data* _data33_,
                  GKeyFile* kf);
static void ___lambda14__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_default_account_addr (DcSettingsManager* self,
                                                    const gchar* v);
static Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_data_unref (void * _userdata_);
static void __lambda15_ (Block34Data* _data34_,
                  GKeyFile* kf);
static void ___lambda15__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_message_style (DcSettingsManager* self,
                                             DcMessageStyle v);
static Block35Data* block35_data_ref (Block35Data* _data35_);
static void block35_data_unref (void * _userdata_);
static void __lambda16_ (Block35Data* _data35_,
                  GKeyFile* kf);
static void ___lambda16__dc_setting_writer (GKeyFile* kf,
                                     gpointer self);
VALA_EXTERN void dc_settings_manager_save_accent_color (DcSettingsManager* self,
                                            const gchar* v);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static void __lambda17_ (Block36Data* _data36_,
                  GKeyFile* kf);
static void ___lambda17__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 DcRpcServerSource dc_settings_manager_get_rpc_server_source (DcSettingsManager* self);
VALA_EXTERN DcSidebarMode dc_settings_manager_get_sidebar_mode (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_default_account_addr (DcSettingsManager* self);
VALA_EXTERN DcMessageStyle dc_settings_manager_get_message_style (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_accent_color (DcSettingsManager* self);
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 DcSettingsDialog* dc_settings_dialog_new (DcWindow* window);
VALA_EXTERN DcSettingsDialog* dc_settings_dialog_construct (GType object_type,
                                                DcWindow* window);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
static void __lambda162_ (Block37Data* _data37_);
static void ___lambda162__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda163_ (Block37Data* _data37_);
static void ___lambda163__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda164_ (Block37Data* _data37_);
static void ___lambda164__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda165_ (Block37Data* _data37_);
static void ___lambda165__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda166_ (Block37Data* _data37_);
static void ___lambda166__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void dc_settings_dialog_apply_accent_to_button (GtkColorDialogButton* btn,
                                                const gchar* hex);
static void __lambda167_ (Block37Data* _data37_);
static void ___lambda167__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda168_ (Block37Data* _data37_);
static void ___lambda168__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dc_settings_dialog_on_rpc_source_changed (DcSettingsDialog* self);
static void _dc_settings_dialog_on_rpc_source_changed_g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self);
static void __lambda169_ (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 ___lambda169__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda170_ (DcSettingsDialog* self);
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 ___lambda170__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda171_ (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 ___lambda171__gtk_button_clicked (GtkButton* _sender,
                                       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_sync_rpc_source_dropdown (DcSettingsDialog* self);
VALA_EXTERN gchar* dc_account_finder_find_rpc_server (const gchar* custom_path,
                                          DcRpcServerSource source);
VALA_EXTERN gchar* dc_account_finder_find_desktop_data_dir (void);
static void dc_settings_dialog_update_rpc_version_row (DcSettingsDialog* self,
                                                const gchar* rpc_path,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_settings_dialog_update_rpc_version_row_finish (DcSettingsDialog* self,
                                                       GAsyncResult* _res_);
static void dc_settings_dialog_update_rpc_version_row_data_free (gpointer _data);
static gboolean dc_settings_dialog_update_rpc_version_row_co (DcSettingsDialogUpdateRpcVersionRowData* _data_);
static void dc_settings_dialog_update_rpc_version_row_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
static gchar* dc_settings_dialog_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_);
static void dc_settings_dialog_fetch_latest_rpc_release_tag (DcSettingsDialog* self,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static gchar* dc_settings_dialog_fetch_latest_rpc_release_tag_finish (DcSettingsDialog* self,
                                                               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_show_toast (DcWindow* self,
                           const gchar* message);
static void dc_settings_dialog_fetch_latest_rpc_release_tag_data_free (gpointer _data);
static gboolean dc_settings_dialog_fetch_latest_rpc_release_tag_co (DcSettingsDialogFetchLatestRpcReleaseTagData* _data_);
static void dc_settings_dialog_fetch_latest_rpc_release_tag_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static gint dc_settings_dialog_parse_http_status (const gchar* status_line);
static gchar* dc_settings_dialog_extract_release_tag (const gchar* location);
static void dc_settings_dialog_on_browse_rpc_server_data_free (gpointer _data);
static gboolean dc_settings_dialog_on_browse_rpc_server_co (DcSettingsDialogOnBrowseRpcServerData* _data_);
static void dc_settings_dialog_on_browse_rpc_server_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
VALA_EXTERN void dc_show_error (GtkWidget* parent,
                    const gchar* message);
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 __lambda172_ (DcSettingsDialog* self);
static void dc_settings_dialog_delete_parla_config (void);
static void ___lambda172__dc_void_func (gpointer self);
static void dc_settings_dialog_finalize (GObject * obj);
static GType dc_settings_dialog_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

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

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

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

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

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

static inline gpointer
dc_settings_manager_get_instance_private (DcSettingsManager* self)
{
	return G_STRUCT_MEMBER_P (self, DcSettingsManager_private_offset);
}

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

void
dc_settings_manager_load (DcSettingsManager* self)
{
	GKeyFile* kf = NULL;
	GKeyFile* _tmp0_;
	gboolean _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_ = 0;
	const gchar* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint default_source = 0;
	gint source = 0;
	gboolean _tmp10_ = FALSE;
	gint sb = 0;
	gboolean _tmp11_ = FALSE;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gint ms = 0;
	gboolean _tmp14_ = FALSE;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_key_file_new ();
	kf = _tmp0_;
	{
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = dc_settings_manager_get_config_path ();
		_tmp2_ = _tmp1_;
		g_key_file_load_from_file (kf, _tmp2_, G_KEY_FILE_NONE, &_inner_error0_);
		_g_free0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	dc_settings_manager_set_double_click_action (self, dc_settings_manager_kf_int (kf, "double_click_action", 0));
	dc_settings_manager_set_markdown_rendering (self, dc_settings_manager_kf_bool (kf, "markdown_rendering", FALSE));
	_tmp3_ = self->priv->_markdown_rendering;
	dc_markdown_enabled = _tmp3_;
	dc_settings_manager_set_shift_enter_sends (self, dc_settings_manager_kf_bool (kf, "shift_enter_sends", FALSE));
	dc_settings_manager_set_notifications_enabled (self, dc_settings_manager_kf_bool (kf, "notifications_enabled", TRUE));
	_tmp4_ = dc_settings_manager_kf_str (kf, "rpc_server_path", "");
	_tmp5_ = _tmp4_;
	dc_settings_manager_set_rpc_server_path (self, _tmp5_);
	_g_free0 (_tmp5_);
	_tmp7_ = self->priv->_rpc_server_path;
	_tmp8_ = strlen (_tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ > 0) {
		_tmp6_ = (gint) DC_RPC_SERVER_SOURCE_CUSTOM;
	} else {
		_tmp6_ = (gint) DC_RPC_SERVER_SOURCE_AUTO;
	}
	default_source = _tmp6_;
	source = dc_settings_manager_kf_int (kf, "rpc_server_source", default_source);
	if (source < 0) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = source > 2;
	}
	if (_tmp10_) {
		source = default_source;
	}
	dc_settings_manager_set_rpc_server_source (self, (DcRpcServerSource) source);
	sb = dc_settings_manager_kf_int (kf, "sidebar_mode", (gint) DC_SIDEBAR_MODE_FULL);
	if (sb < 0) {
		_tmp11_ = TRUE;
	} else {
		_tmp11_ = sb > 2;
	}
	if (_tmp11_) {
		sb = (gint) DC_SIDEBAR_MODE_FULL;
	}
	dc_settings_manager_set_sidebar_mode (self, (DcSidebarMode) sb);
	_tmp12_ = dc_settings_manager_kf_str (kf, "default_account_addr", "");
	_tmp13_ = _tmp12_;
	dc_settings_manager_set_default_account_addr (self, _tmp13_);
	_g_free0 (_tmp13_);
	ms = dc_settings_manager_kf_int (kf, "message_style", (gint) DC_MESSAGE_STYLE_BUBBLES);
	if (ms < 0) {
		_tmp14_ = TRUE;
	} else {
		_tmp14_ = ms > 1;
	}
	if (_tmp14_) {
		ms = (gint) DC_MESSAGE_STYLE_BUBBLES;
	}
	dc_settings_manager_set_message_style (self, (DcMessageStyle) ms);
	_tmp15_ = dc_settings_manager_kf_str (kf, "accent_color", "");
	_tmp16_ = _tmp15_;
	dc_settings_manager_set_accent_color (self, _tmp16_);
	_g_free0 (_tmp16_);
	_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 Block27Data*
block27_data_ref (Block27Data* _data27_)
{
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}

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

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

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

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

static Block28Data*
block28_data_ref (Block28Data* _data28_)
{
	g_atomic_int_inc (&_data28_->_ref_count_);
	return _data28_;
}

static void
block28_data_unref (void * _userdata_)
{
	Block28Data* _data28_;
	_data28_ = (Block28Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data28_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data28_->self;
		_g_object_unref0 (self);
		g_slice_free (Block28Data, _data28_);
	}
}

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

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

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

static Block29Data*
block29_data_ref (Block29Data* _data29_)
{
	g_atomic_int_inc (&_data29_->_ref_count_);
	return _data29_;
}

static void
block29_data_unref (void * _userdata_)
{
	Block29Data* _data29_;
	_data29_ = (Block29Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data29_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data29_->self;
		_g_object_unref0 (self);
		g_slice_free (Block29Data, _data29_);
	}
}

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

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

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

static Block30Data*
block30_data_ref (Block30Data* _data30_)
{
	g_atomic_int_inc (&_data30_->_ref_count_);
	return _data30_;
}

static void
block30_data_unref (void * _userdata_)
{
	Block30Data* _data30_;
	_data30_ = (Block30Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data30_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data30_->self;
		_g_object_unref0 (self);
		g_slice_free (Block30Data, _data30_);
	}
}

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

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

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

static Block31Data*
block31_data_ref (Block31Data* _data31_)
{
	g_atomic_int_inc (&_data31_->_ref_count_);
	return _data31_;
}

static void
block31_data_unref (void * _userdata_)
{
	Block31Data* _data31_;
	_data31_ = (Block31Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data31_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data31_->self;
		_g_free0 (_data31_->v);
		_g_object_unref0 (self);
		g_slice_free (Block31Data, _data31_);
	}
}

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

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

void
dc_settings_manager_save_rpc_server_path (DcSettingsManager* self,
                                          const gchar* v)
{
	Block31Data* _data31_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data31_ = g_slice_new0 (Block31Data);
	_data31_->_ref_count_ = 1;
	_data31_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data31_->v);
	_data31_->v = _tmp0_;
	dc_settings_manager_set_rpc_server_path (self, _data31_->v);
	dc_settings_manager_save_to_file (self, ___lambda12__dc_setting_writer, _data31_);
	block31_data_unref (_data31_);
	_data31_ = NULL;
}

static Block32Data*
block32_data_ref (Block32Data* _data32_)
{
	g_atomic_int_inc (&_data32_->_ref_count_);
	return _data32_;
}

static void
block32_data_unref (void * _userdata_)
{
	Block32Data* _data32_;
	_data32_ = (Block32Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data32_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data32_->self;
		_g_object_unref0 (self);
		g_slice_free (Block32Data, _data32_);
	}
}

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

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

void
dc_settings_manager_save_rpc_server_source (DcSettingsManager* self,
                                            DcRpcServerSource v)
{
	Block32Data* _data32_;
	g_return_if_fail (self != NULL);
	_data32_ = g_slice_new0 (Block32Data);
	_data32_->_ref_count_ = 1;
	_data32_->self = g_object_ref (self);
	_data32_->v = v;
	dc_settings_manager_set_rpc_server_source (self, _data32_->v);
	dc_settings_manager_save_to_file (self, ___lambda13__dc_setting_writer, _data32_);
	block32_data_unref (_data32_);
	_data32_ = NULL;
}

static Block33Data*
block33_data_ref (Block33Data* _data33_)
{
	g_atomic_int_inc (&_data33_->_ref_count_);
	return _data33_;
}

static void
block33_data_unref (void * _userdata_)
{
	Block33Data* _data33_;
	_data33_ = (Block33Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data33_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data33_->self;
		_g_object_unref0 (self);
		g_slice_free (Block33Data, _data33_);
	}
}

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

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

void
dc_settings_manager_save_sidebar_mode (DcSettingsManager* self,
                                       DcSidebarMode v)
{
	Block33Data* _data33_;
	g_return_if_fail (self != NULL);
	_data33_ = g_slice_new0 (Block33Data);
	_data33_->_ref_count_ = 1;
	_data33_->self = g_object_ref (self);
	_data33_->v = v;
	dc_settings_manager_set_sidebar_mode (self, _data33_->v);
	dc_settings_manager_save_to_file (self, ___lambda14__dc_setting_writer, _data33_);
	block33_data_unref (_data33_);
	_data33_ = NULL;
}

static Block34Data*
block34_data_ref (Block34Data* _data34_)
{
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}

static void
block34_data_unref (void * _userdata_)
{
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data34_->self;
		_g_free0 (_data34_->v);
		_g_object_unref0 (self);
		g_slice_free (Block34Data, _data34_);
	}
}

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

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

void
dc_settings_manager_save_default_account_addr (DcSettingsManager* self,
                                               const gchar* v)
{
	Block34Data* _data34_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data34_ = g_slice_new0 (Block34Data);
	_data34_->_ref_count_ = 1;
	_data34_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data34_->v);
	_data34_->v = _tmp0_;
	dc_settings_manager_set_default_account_addr (self, _data34_->v);
	dc_settings_manager_save_to_file (self, ___lambda15__dc_setting_writer, _data34_);
	block34_data_unref (_data34_);
	_data34_ = NULL;
}

static Block35Data*
block35_data_ref (Block35Data* _data35_)
{
	g_atomic_int_inc (&_data35_->_ref_count_);
	return _data35_;
}

static void
block35_data_unref (void * _userdata_)
{
	Block35Data* _data35_;
	_data35_ = (Block35Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data35_->_ref_count_)) {
		DcSettingsManager* self;
		self = _data35_->self;
		_g_object_unref0 (self);
		g_slice_free (Block35Data, _data35_);
	}
}

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

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

void
dc_settings_manager_save_message_style (DcSettingsManager* self,
                                        DcMessageStyle v)
{
	Block35Data* _data35_;
	g_return_if_fail (self != NULL);
	_data35_ = g_slice_new0 (Block35Data);
	_data35_->_ref_count_ = 1;
	_data35_->self = g_object_ref (self);
	_data35_->v = v;
	dc_settings_manager_set_message_style (self, _data35_->v);
	dc_settings_manager_save_to_file (self, ___lambda16__dc_setting_writer, _data35_);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
	block35_data_unref (_data35_);
	_data35_ = NULL;
}

static Block36Data*
block36_data_ref (Block36Data* _data36_)
{
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}

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

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

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

void
dc_settings_manager_save_accent_color (DcSettingsManager* self,
                                       const gchar* v)
{
	Block36Data* _data36_;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (v != NULL);
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	_data36_->self = g_object_ref (self);
	_tmp0_ = g_strdup (v);
	_g_free0 (_data36_->v);
	_data36_->v = _tmp0_;
	dc_settings_manager_set_accent_color (self, _data36_->v);
	dc_settings_manager_save_to_file (self, ___lambda17__dc_setting_writer, _data36_);
	g_signal_emit (self, dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL], 0);
	block36_data_unref (_data36_);
	_data36_ = 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:156: Failed to save settings: %s", _tmp10_);
		_g_error_free0 (e);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_key_file_unref0 (kf);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static void
dc_settings_manager_class_init (DcSettingsManagerClass * klass,
                                gpointer klass_data)
{
	dc_settings_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcSettingsManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_settings_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_settings_manager_set_property;
	G_OBJECT_CLASS (klass)->finalize = dc_settings_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY] = g_param_spec_int ("double-click-action", "double-click-action", "double-click-action", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY] = g_param_spec_boolean ("markdown-rendering", "markdown-rendering", "markdown-rendering", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY] = g_param_spec_boolean ("shift-enter-sends", "shift-enter-sends", "shift-enter-sends", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY] = g_param_spec_boolean ("notifications-enabled", "notifications-enabled", "notifications-enabled", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY] = g_param_spec_string ("rpc-server-path", "rpc-server-path", "rpc-server-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	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_SIDEBAR_MODE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_SIDEBAR_MODE_PROPERTY] = g_param_spec_enum ("sidebar-mode", "sidebar-mode", "sidebar-mode", DC_TYPE_SIDEBAR_MODE, DC_SIDEBAR_MODE_FULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY] = g_param_spec_string ("default-account-addr", "default-account-addr", "default-account-addr", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY] = g_param_spec_enum ("message-style", "message-style", "message-style", DC_TYPE_MESSAGE_STYLE, DC_MESSAGE_STYLE_BUBBLES, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY, dc_settings_manager_properties[DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY] = g_param_spec_string ("accent-color", "accent-color", "accent-color", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	dc_settings_manager_signals[DC_SETTINGS_MANAGER_APPEARANCE_CHANGED_SIGNAL] = g_signal_new ("appearance-changed", DC_TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dc_settings_manager_instance_init (DcSettingsManager * self,
                                   gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	self->priv = dc_settings_manager_get_instance_private (self);
	self->priv->_double_click_action = 0;
	self->priv->_markdown_rendering = FALSE;
	self->priv->_shift_enter_sends = FALSE;
	self->priv->_notifications_enabled = TRUE;
	_tmp0_ = g_strdup ("");
	self->priv->_rpc_server_path = _tmp0_;
	self->priv->_rpc_server_source = DC_RPC_SERVER_SOURCE_AUTO;
	self->priv->_sidebar_mode = DC_SIDEBAR_MODE_FULL;
	_tmp1_ = g_strdup ("");
	self->priv->_default_account_addr = _tmp1_;
	self->priv->_message_style = DC_MESSAGE_STYLE_BUBBLES;
	_tmp2_ = g_strdup ("");
	self->priv->_accent_color = _tmp2_;
}

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_OBJECT_CLASS (dc_settings_manager_parent_class)->finalize (obj);
}

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

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

static void
_vala_dc_settings_manager_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	DcSettingsManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_SETTINGS_MANAGER, DcSettingsManager);
	switch (property_id) {
		case DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY:
		g_value_set_int (value, dc_settings_manager_get_double_click_action (self));
		break;
		case DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_markdown_rendering (self));
		break;
		case DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_shift_enter_sends (self));
		break;
		case DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY:
		g_value_set_boolean (value, dc_settings_manager_get_notifications_enabled (self));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_rpc_server_path (self));
		break;
		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_SIDEBAR_MODE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_sidebar_mode (self));
		break;
		case DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_default_account_addr (self));
		break;
		case DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY:
		g_value_set_enum (value, dc_settings_manager_get_message_style (self));
		break;
		case DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY:
		g_value_set_string (value, dc_settings_manager_get_accent_color (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_settings_manager_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	DcSettingsManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_SETTINGS_MANAGER, DcSettingsManager);
	switch (property_id) {
		case DC_SETTINGS_MANAGER_DOUBLE_CLICK_ACTION_PROPERTY:
		dc_settings_manager_set_double_click_action (self, g_value_get_int (value));
		break;
		case DC_SETTINGS_MANAGER_MARKDOWN_RENDERING_PROPERTY:
		dc_settings_manager_set_markdown_rendering (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_SHIFT_ENTER_SENDS_PROPERTY:
		dc_settings_manager_set_shift_enter_sends (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_NOTIFICATIONS_ENABLED_PROPERTY:
		dc_settings_manager_set_notifications_enabled (self, g_value_get_boolean (value));
		break;
		case DC_SETTINGS_MANAGER_RPC_SERVER_PATH_PROPERTY:
		dc_settings_manager_set_rpc_server_path (self, g_value_get_string (value));
		break;
		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_SIDEBAR_MODE_PROPERTY:
		dc_settings_manager_set_sidebar_mode (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_DEFAULT_ACCOUNT_ADDR_PROPERTY:
		dc_settings_manager_set_default_account_addr (self, g_value_get_string (value));
		break;
		case DC_SETTINGS_MANAGER_MESSAGE_STYLE_PROPERTY:
		dc_settings_manager_set_message_style (self, g_value_get_enum (value));
		break;
		case DC_SETTINGS_MANAGER_ACCENT_COLOR_PROPERTY:
		dc_settings_manager_set_accent_color (self, g_value_get_string (value));
		break;
		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 Block37Data*
block37_data_ref (Block37Data* _data37_)
{
	g_atomic_int_inc (&_data37_->_ref_count_);
	return _data37_;
}

static void
block37_data_unref (void * _userdata_)
{
	Block37Data* _data37_;
	_data37_ = (Block37Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data37_->_ref_count_)) {
		DcSettingsDialog* self;
		self = _data37_->self;
		_g_object_unref0 (_data37_->accent_btn);
		_g_object_unref0 (_data37_->style_combo);
		_g_object_unref0 (_data37_->notif_switch);
		_g_object_unref0 (_data37_->shift_switch);
		_g_object_unref0 (_data37_->md_switch);
		_g_object_unref0 (_data37_->dblclick_combo);
		_g_object_unref0 (self);
		g_slice_free (Block37Data, _data37_);
	}
}

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

static void
___lambda162__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda162_ (self);
}

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

static void
___lambda163__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda163_ (self);
}

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

static void
___lambda164__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda164_ (self);
}

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

static void
___lambda165__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda165_ (self);
}

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

static void
___lambda166__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda166_ (self);
}

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

static void
___lambda167__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda167_ (self);
}

static void
__lambda168_ (Block37Data* _data37_)
{
	DcSettingsDialog* self;
	DcWindow* _tmp0_;
	DcSettingsManager* _tmp1_;
	self = _data37_->self;
	_tmp0_ = self->priv->app_window;
	_tmp1_ = _tmp0_->settings;
	dc_settings_manager_save_accent_color (_tmp1_, "");
	dc_settings_dialog_apply_accent_to_button (_data37_->accent_btn, "");
}

static void
___lambda168__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda168_ (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
__lambda169_ (DcSettingsDialog* self)
{
	dc_settings_dialog_on_browse_rpc_server (self, NULL, NULL);
}

static void
___lambda169__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda169_ ((DcSettingsDialog*) self);
}

static void
__lambda170_ (DcSettingsDialog* self)
{
	dc_settings_dialog_open_rpc_download_page (self, NULL, NULL);
}

static void
___lambda170__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda170_ ((DcSettingsDialog*) self);
}

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

static void
___lambda171__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda171_ ((DcSettingsDialog*) self);
}

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

DcSettingsDialog*
dc_settings_dialog_construct (GType object_type,
                              DcWindow* window)
{
	DcSettingsDialog * self = NULL;
	Block37Data* _data37_;
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	AdwHeaderBar* header = NULL;
	AdwHeaderBar* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	GtkLabel* behavior_label = NULL;
	GtkLabel* _tmp7_;
	GtkBox* _tmp8_;
	GtkListBox* behavior_list = NULL;
	GtkListBox* _tmp9_;
	AdwActionRow* dblclick_row = NULL;
	AdwActionRow* _tmp10_;
	gchar** dblclick_labels = NULL;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar** _tmp16_;
	gint dblclick_labels_length1;
	gint _dblclick_labels_size_;
	GtkDropDown* _tmp17_;
	DcWindow* _tmp18_;
	DcSettingsManager* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	AdwActionRow* md_row = NULL;
	AdwActionRow* _tmp22_;
	GtkSwitch* _tmp23_;
	AdwActionRow* shift_row = NULL;
	AdwActionRow* _tmp24_;
	GtkSwitch* _tmp25_;
	DcWindow* _tmp26_;
	DcSettingsManager* _tmp27_;
	gboolean _tmp28_;
	gboolean _tmp29_;
	AdwActionRow* notif_row = NULL;
	AdwActionRow* _tmp30_;
	GtkSwitch* _tmp31_;
	DcWindow* _tmp32_;
	DcSettingsManager* _tmp33_;
	gboolean _tmp34_;
	gboolean _tmp35_;
	GtkBox* _tmp36_;
	GtkLabel* appearance_label = NULL;
	GtkLabel* _tmp37_;
	GtkBox* _tmp38_;
	GtkListBox* appearance_list = NULL;
	GtkListBox* _tmp39_;
	AdwActionRow* style_row = NULL;
	AdwActionRow* _tmp40_;
	gchar** style_labels = NULL;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gchar** _tmp43_;
	gint style_labels_length1;
	gint _style_labels_size_;
	GtkDropDown* _tmp44_;
	DcWindow* _tmp45_;
	DcSettingsManager* _tmp46_;
	DcMessageStyle _tmp47_;
	DcMessageStyle _tmp48_;
	AdwActionRow* accent_row = NULL;
	AdwActionRow* _tmp49_;
	GtkColorDialog* _tmp50_;
	GtkColorDialogButton* _tmp51_;
	DcWindow* _tmp52_;
	DcSettingsManager* _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	GtkButton* accent_reset_btn = NULL;
	GtkButton* _tmp56_;
	GtkBox* _tmp57_;
	GtkLabel* advanced_label = NULL;
	GtkLabel* _tmp58_;
	GtkBox* _tmp59_;
	GtkListBox* advanced_list = NULL;
	GtkListBox* _tmp60_;
	AdwActionRow* _tmp61_;
	AdwActionRow* _tmp62_;
	gchar** rpc_source_labels = NULL;
	gchar* _tmp63_;
	gchar* _tmp64_;
	gchar* _tmp65_;
	gchar** _tmp66_;
	gint rpc_source_labels_length1;
	gint _rpc_source_labels_size_;
	GtkDropDown* _tmp67_;
	GtkDropDown* _tmp68_;
	DcWindow* _tmp69_;
	DcSettingsManager* _tmp70_;
	DcRpcServerSource _tmp71_;
	DcRpcServerSource _tmp72_;
	GtkDropDown* _tmp73_;
	GtkDropDown* _tmp74_;
	AdwActionRow* _tmp75_;
	GtkDropDown* _tmp76_;
	AdwActionRow* _tmp77_;
	GtkDropDown* _tmp78_;
	GtkButton* _tmp79_;
	GtkButton* _tmp80_;
	GtkButton* _tmp81_;
	GtkButton* _tmp82_;
	GtkButton* _tmp83_;
	AdwActionRow* _tmp84_;
	GtkButton* _tmp85_;
	GtkButton* rpc_download_btn = NULL;
	GtkButton* _tmp86_;
	AdwActionRow* _tmp87_;
	AdwActionRow* _tmp88_;
	AdwActionRow* _tmp89_;
	AdwActionRow* _tmp90_;
	AdwActionRow* _tmp91_;
	GtkButton* _tmp92_;
	GtkButton* _tmp93_;
	GtkButton* _tmp94_;
	GtkButton* _tmp95_;
	GtkButton* _tmp96_;
	AdwActionRow* _tmp97_;
	GtkButton* _tmp98_;
	AdwActionRow* _tmp99_;
	GtkBox* _tmp100_;
	GtkBox* reset_box = NULL;
	GtkBox* _tmp101_;
	GtkButton* reset_btn = NULL;
	GtkButton* _tmp102_;
	GtkLabel* reset_label = NULL;
	GtkLabel* _tmp103_;
	GtkBox* _tmp104_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp105_;
	GtkBox* _tmp106_;
	g_return_val_if_fail (window != NULL, NULL);
	_data37_ = g_slice_new0 (Block37Data);
	_data37_->_ref_count_ = 1;
	self = (DcSettingsDialog*) g_object_new (object_type, NULL);
	_data37_->self = g_object_ref (self);
	self->priv->app_window = window;
	adw_dialog_set_title ((AdwDialog*) self, "Settings");
	adw_dialog_set_content_width ((AdwDialog*) self, 400);
	adw_dialog_set_content_height ((AdwDialog*) self, 480);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp1_);
	header = _tmp1_;
	adw_header_bar_set_show_end_title_buttons (header, TRUE);
	gtk_box_append (box, (GtkWidget*) header);
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 16);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->content);
	self->priv->content = _tmp2_;
	_tmp3_ = self->priv->content;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 16);
	_tmp4_ = self->priv->content;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp4_, 16);
	_tmp5_ = self->priv->content;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp5_, 12);
	_tmp6_ = self->priv->content;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp6_, 16);
	_tmp7_ = (GtkLabel*) gtk_label_new ("Behavior");
	g_object_ref_sink (_tmp7_);
	behavior_label = _tmp7_;
	gtk_widget_add_css_class ((GtkWidget*) behavior_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) behavior_label, GTK_ALIGN_START);
	_tmp8_ = self->priv->content;
	gtk_box_append (_tmp8_, (GtkWidget*) behavior_label);
	_tmp9_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp9_);
	behavior_list = _tmp9_;
	gtk_list_box_set_selection_mode (behavior_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) behavior_list, "boxed-list");
	_tmp10_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp10_);
	dblclick_row = _tmp10_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) dblclick_row, "Double-click on message");
	adw_action_row_set_subtitle (dblclick_row, "Action when a message is double-clicked");
	_tmp11_ = g_strdup ("Reply to message");
	_tmp12_ = g_strdup ("React with ❤️");
	_tmp13_ = g_strdup ("React with 👍");
	_tmp14_ = g_strdup ("Open user profile");
	_tmp15_ = g_strdup ("Do nothing");
	_tmp16_ = g_new0 (gchar*, 5 + 1);
	_tmp16_[0] = _tmp11_;
	_tmp16_[1] = _tmp12_;
	_tmp16_[2] = _tmp13_;
	_tmp16_[3] = _tmp14_;
	_tmp16_[4] = _tmp15_;
	dblclick_labels = _tmp16_;
	dblclick_labels_length1 = 5;
	_dblclick_labels_size_ = dblclick_labels_length1;
	_tmp17_ = (GtkDropDown*) gtk_drop_down_new_from_strings (dblclick_labels);
	g_object_ref_sink (_tmp17_);
	_data37_->dblclick_combo = _tmp17_;
	_tmp18_ = self->priv->app_window;
	_tmp19_ = _tmp18_->settings;
	_tmp20_ = dc_settings_manager_get_double_click_action (_tmp19_);
	_tmp21_ = _tmp20_;
	gtk_drop_down_set_selected (_data37_->dblclick_combo, (guint) _tmp21_);
	gtk_widget_set_valign ((GtkWidget*) _data37_->dblclick_combo, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data37_->dblclick_combo, "notify::selected", (GCallback) ___lambda162__g_object_notify, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	adw_action_row_add_suffix (dblclick_row, (GtkWidget*) _data37_->dblclick_combo);
	adw_action_row_set_activatable_widget (dblclick_row, (GtkWidget*) _data37_->dblclick_combo);
	gtk_list_box_append (behavior_list, (GtkWidget*) dblclick_row);
	_tmp22_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp22_);
	md_row = _tmp22_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) md_row, "Markdown rendering");
	adw_action_row_set_subtitle (md_row, "Format bold, italic, code and headings");
	_tmp23_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp23_);
	_data37_->md_switch = _tmp23_;
	gtk_switch_set_active (_data37_->md_switch, dc_markdown_enabled);
	gtk_widget_set_valign ((GtkWidget*) _data37_->md_switch, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data37_->md_switch, "notify::active", (GCallback) ___lambda163__g_object_notify, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	adw_action_row_add_suffix (md_row, (GtkWidget*) _data37_->md_switch);
	adw_action_row_set_activatable_widget (md_row, (GtkWidget*) _data37_->md_switch);
	gtk_list_box_append (behavior_list, (GtkWidget*) md_row);
	_tmp24_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp24_);
	shift_row = _tmp24_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) shift_row, "Shift+Return sends message");
	adw_action_row_set_subtitle (shift_row, "When on, Return inserts a newline and Shift+Return sends");
	_tmp25_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp25_);
	_data37_->shift_switch = _tmp25_;
	_tmp26_ = self->priv->app_window;
	_tmp27_ = _tmp26_->settings;
	_tmp28_ = dc_settings_manager_get_shift_enter_sends (_tmp27_);
	_tmp29_ = _tmp28_;
	gtk_switch_set_active (_data37_->shift_switch, _tmp29_);
	gtk_widget_set_valign ((GtkWidget*) _data37_->shift_switch, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data37_->shift_switch, "notify::active", (GCallback) ___lambda164__g_object_notify, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	adw_action_row_add_suffix (shift_row, (GtkWidget*) _data37_->shift_switch);
	adw_action_row_set_activatable_widget (shift_row, (GtkWidget*) _data37_->shift_switch);
	gtk_list_box_append (behavior_list, (GtkWidget*) shift_row);
	_tmp30_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp30_);
	notif_row = _tmp30_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) notif_row, "Desktop notifications");
	adw_action_row_set_subtitle (notif_row, "Notify on incoming messages when the window is not focused");
	_tmp31_ = (GtkSwitch*) gtk_switch_new ();
	g_object_ref_sink (_tmp31_);
	_data37_->notif_switch = _tmp31_;
	_tmp32_ = self->priv->app_window;
	_tmp33_ = _tmp32_->settings;
	_tmp34_ = dc_settings_manager_get_notifications_enabled (_tmp33_);
	_tmp35_ = _tmp34_;
	gtk_switch_set_active (_data37_->notif_switch, _tmp35_);
	gtk_widget_set_valign ((GtkWidget*) _data37_->notif_switch, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data37_->notif_switch, "notify::active", (GCallback) ___lambda165__g_object_notify, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	adw_action_row_add_suffix (notif_row, (GtkWidget*) _data37_->notif_switch);
	adw_action_row_set_activatable_widget (notif_row, (GtkWidget*) _data37_->notif_switch);
	gtk_list_box_append (behavior_list, (GtkWidget*) notif_row);
	_tmp36_ = self->priv->content;
	gtk_box_append (_tmp36_, (GtkWidget*) behavior_list);
	_tmp37_ = (GtkLabel*) gtk_label_new ("Appearance");
	g_object_ref_sink (_tmp37_);
	appearance_label = _tmp37_;
	gtk_widget_add_css_class ((GtkWidget*) appearance_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) appearance_label, GTK_ALIGN_START);
	_tmp38_ = self->priv->content;
	gtk_box_append (_tmp38_, (GtkWidget*) appearance_label);
	_tmp39_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp39_);
	appearance_list = _tmp39_;
	gtk_list_box_set_selection_mode (appearance_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) appearance_list, "boxed-list");
	_tmp40_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp40_);
	style_row = _tmp40_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) style_row, "Message style");
	adw_action_row_set_subtitle (style_row, "Use chat bubbles or compact IRC-style lines");
	_tmp41_ = g_strdup ("Bubbles");
	_tmp42_ = g_strdup ("IRC");
	_tmp43_ = g_new0 (gchar*, 2 + 1);
	_tmp43_[0] = _tmp41_;
	_tmp43_[1] = _tmp42_;
	style_labels = _tmp43_;
	style_labels_length1 = 2;
	_style_labels_size_ = style_labels_length1;
	_tmp44_ = (GtkDropDown*) gtk_drop_down_new_from_strings (style_labels);
	g_object_ref_sink (_tmp44_);
	_data37_->style_combo = _tmp44_;
	_tmp45_ = self->priv->app_window;
	_tmp46_ = _tmp45_->settings;
	_tmp47_ = dc_settings_manager_get_message_style (_tmp46_);
	_tmp48_ = _tmp47_;
	gtk_drop_down_set_selected (_data37_->style_combo, (guint) _tmp48_);
	gtk_widget_set_valign ((GtkWidget*) _data37_->style_combo, GTK_ALIGN_CENTER);
	g_signal_connect_data ((GObject*) _data37_->style_combo, "notify::selected", (GCallback) ___lambda166__g_object_notify, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	adw_action_row_add_suffix (style_row, (GtkWidget*) _data37_->style_combo);
	adw_action_row_set_activatable_widget (style_row, (GtkWidget*) _data37_->style_combo);
	gtk_list_box_append (appearance_list, (GtkWidget*) style_row);
	_tmp49_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp49_);
	accent_row = _tmp49_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) accent_row, "Accent color");
	adw_action_row_set_subtitle (accent_row, "Override the system accent color");
	_tmp50_ = gtk_color_dialog_new ();
	_tmp51_ = (GtkColorDialogButton*) gtk_color_dialog_button_new (_tmp50_);
	g_object_ref_sink (_tmp51_);
	_data37_->accent_btn = _tmp51_;
	gtk_widget_set_valign ((GtkWidget*) _data37_->accent_btn, GTK_ALIGN_CENTER);
	_tmp52_ = self->priv->app_window;
	_tmp53_ = _tmp52_->settings;
	_tmp54_ = dc_settings_manager_get_accent_color (_tmp53_);
	_tmp55_ = _tmp54_;
	dc_settings_dialog_apply_accent_to_button (_data37_->accent_btn, _tmp55_);
	g_signal_connect_data ((GObject*) _data37_->accent_btn, "notify::rgba", (GCallback) ___lambda167__g_object_notify, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	_tmp56_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-undo-symbolic");
	g_object_ref_sink (_tmp56_);
	accent_reset_btn = _tmp56_;
	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) ___lambda168__gtk_button_clicked, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	adw_action_row_add_suffix (accent_row, (GtkWidget*) _data37_->accent_btn);
	adw_action_row_add_suffix (accent_row, (GtkWidget*) accent_reset_btn);
	gtk_list_box_append (appearance_list, (GtkWidget*) accent_row);
	_tmp57_ = self->priv->content;
	gtk_box_append (_tmp57_, (GtkWidget*) appearance_list);
	_tmp58_ = (GtkLabel*) gtk_label_new ("Advanced");
	g_object_ref_sink (_tmp58_);
	advanced_label = _tmp58_;
	gtk_widget_add_css_class ((GtkWidget*) advanced_label, "title-3");
	gtk_widget_set_halign ((GtkWidget*) advanced_label, GTK_ALIGN_START);
	_tmp59_ = self->priv->content;
	gtk_box_append (_tmp59_, (GtkWidget*) advanced_label);
	_tmp60_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp60_);
	advanced_list = _tmp60_;
	gtk_list_box_set_selection_mode (advanced_list, GTK_SELECTION_NONE);
	gtk_widget_add_css_class ((GtkWidget*) advanced_list, "boxed-list");
	_tmp61_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp61_);
	_g_object_unref0 (self->priv->rpc_row);
	self->priv->rpc_row = _tmp61_;
	_tmp62_ = self->priv->rpc_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp62_, "RPC server");
	_tmp63_ = g_strdup ("Auto");
	_tmp64_ = g_strdup ("Custom");
	_tmp65_ = g_strdup ("Desktop");
	_tmp66_ = g_new0 (gchar*, 3 + 1);
	_tmp66_[0] = _tmp63_;
	_tmp66_[1] = _tmp64_;
	_tmp66_[2] = _tmp65_;
	rpc_source_labels = _tmp66_;
	rpc_source_labels_length1 = 3;
	_rpc_source_labels_size_ = rpc_source_labels_length1;
	_tmp67_ = (GtkDropDown*) gtk_drop_down_new_from_strings (rpc_source_labels);
	g_object_ref_sink (_tmp67_);
	_g_object_unref0 (self->priv->rpc_source_dropdown);
	self->priv->rpc_source_dropdown = _tmp67_;
	_tmp68_ = self->priv->rpc_source_dropdown;
	_tmp69_ = self->priv->app_window;
	_tmp70_ = _tmp69_->settings;
	_tmp71_ = dc_settings_manager_get_rpc_server_source (_tmp70_);
	_tmp72_ = _tmp71_;
	gtk_drop_down_set_selected (_tmp68_, (guint) _tmp72_);
	_tmp73_ = self->priv->rpc_source_dropdown;
	gtk_widget_set_valign ((GtkWidget*) _tmp73_, GTK_ALIGN_CENTER);
	_tmp74_ = self->priv->rpc_source_dropdown;
	g_signal_connect_object ((GObject*) _tmp74_, "notify::selected", (GCallback) _dc_settings_dialog_on_rpc_source_changed_g_object_notify, self, 0);
	_tmp75_ = self->priv->rpc_row;
	_tmp76_ = self->priv->rpc_source_dropdown;
	adw_action_row_add_suffix (_tmp75_, (GtkWidget*) _tmp76_);
	_tmp77_ = self->priv->rpc_row;
	_tmp78_ = self->priv->rpc_source_dropdown;
	adw_action_row_set_activatable_widget (_tmp77_, (GtkWidget*) _tmp78_);
	_tmp79_ = (GtkButton*) gtk_button_new_with_label ("Pick");
	g_object_ref_sink (_tmp79_);
	_g_object_unref0 (self->priv->rpc_choose_btn);
	self->priv->rpc_choose_btn = _tmp79_;
	_tmp80_ = self->priv->rpc_choose_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp80_, GTK_ALIGN_CENTER);
	_tmp81_ = self->priv->rpc_choose_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp81_, "flat");
	_tmp82_ = self->priv->rpc_choose_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp82_, "Pick a deltachat-rpc-server binary");
	_tmp83_ = self->priv->rpc_choose_btn;
	g_signal_connect_object (_tmp83_, "clicked", (GCallback) ___lambda169__gtk_button_clicked, self, 0);
	_tmp84_ = self->priv->rpc_row;
	_tmp85_ = self->priv->rpc_choose_btn;
	adw_action_row_add_suffix (_tmp84_, (GtkWidget*) _tmp85_);
	_tmp86_ = (GtkButton*) gtk_button_new_with_label ("Get");
	g_object_ref_sink (_tmp86_);
	rpc_download_btn = _tmp86_;
	gtk_widget_set_valign ((GtkWidget*) rpc_download_btn, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) rpc_download_btn, "flat");
	gtk_widget_set_tooltip_text ((GtkWidget*) rpc_download_btn, "Open standalone deltachat-rpc-server releases");
	g_signal_connect_object (rpc_download_btn, "clicked", (GCallback) ___lambda170__gtk_button_clicked, self, 0);
	_tmp87_ = self->priv->rpc_row;
	adw_action_row_add_suffix (_tmp87_, (GtkWidget*) rpc_download_btn);
	_tmp88_ = self->priv->rpc_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp88_);
	_tmp89_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp89_);
	_g_object_unref0 (self->priv->rpc_version_row);
	self->priv->rpc_version_row = _tmp89_;
	_tmp90_ = self->priv->rpc_version_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp90_, "RPC server version");
	_tmp91_ = self->priv->rpc_version_row;
	adw_action_row_set_subtitle (_tmp91_, "Checking...");
	_tmp92_ = (GtkButton*) gtk_button_new_with_label ("Check");
	g_object_ref_sink (_tmp92_);
	_g_object_unref0 (self->priv->rpc_update_btn);
	self->priv->rpc_update_btn = _tmp92_;
	_tmp93_ = self->priv->rpc_update_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp93_, GTK_ALIGN_CENTER);
	_tmp94_ = self->priv->rpc_update_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp94_, "flat");
	_tmp95_ = self->priv->rpc_update_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp95_, "Check latest deltachat-rpc-server release");
	_tmp96_ = self->priv->rpc_update_btn;
	g_signal_connect_object (_tmp96_, "clicked", (GCallback) ___lambda171__gtk_button_clicked, self, 0);
	_tmp97_ = self->priv->rpc_version_row;
	_tmp98_ = self->priv->rpc_update_btn;
	adw_action_row_add_suffix (_tmp97_, (GtkWidget*) _tmp98_);
	_tmp99_ = self->priv->rpc_version_row;
	gtk_list_box_append (advanced_list, (GtkWidget*) _tmp99_);
	_tmp100_ = self->priv->content;
	gtk_box_append (_tmp100_, (GtkWidget*) advanced_list);
	dc_settings_dialog_update_rpc_row (self);
	_tmp101_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp101_);
	reset_box = _tmp101_;
	gtk_widget_set_margin_top ((GtkWidget*) reset_box, 8);
	_tmp102_ = (GtkButton*) gtk_button_new_with_label ("Factory Reset");
	g_object_ref_sink (_tmp102_);
	reset_btn = _tmp102_;
	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);
	_tmp103_ = (GtkLabel*) gtk_label_new ("Remove all settings and close the app");
	g_object_ref_sink (_tmp103_);
	reset_label = _tmp103_;
	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);
	_tmp104_ = self->priv->content;
	gtk_box_append (_tmp104_, (GtkWidget*) reset_box);
	_tmp105_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp105_);
	scroll = _tmp105_;
	gtk_widget_set_vexpand ((GtkWidget*) scroll, TRUE);
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp106_ = self->priv->content;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp106_);
	gtk_box_append (box, (GtkWidget*) scroll);
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) box);
	_g_object_unref0 (scroll);
	_g_object_unref0 (reset_label);
	_g_object_unref0 (reset_btn);
	_g_object_unref0 (reset_box);
	_g_object_unref0 (rpc_download_btn);
	rpc_source_labels = (_vala_array_free (rpc_source_labels, rpc_source_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (advanced_list);
	_g_object_unref0 (advanced_label);
	_g_object_unref0 (accent_reset_btn);
	_g_object_unref0 (accent_row);
	style_labels = (_vala_array_free (style_labels, style_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (style_row);
	_g_object_unref0 (appearance_list);
	_g_object_unref0 (appearance_label);
	_g_object_unref0 (notif_row);
	_g_object_unref0 (shift_row);
	_g_object_unref0 (md_row);
	dblclick_labels = (_vala_array_free (dblclick_labels, dblclick_labels_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (dblclick_row);
	_g_object_unref0 (behavior_list);
	_g_object_unref0 (behavior_label);
	_g_object_unref0 (header);
	_g_object_unref0 (box);
	block37_data_unref (_data37_);
	_data37_ = NULL;
	return self;
}

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

static void
dc_settings_dialog_update_rpc_row (DcSettingsDialog* self)
{
	GtkButton* _tmp0_;
	DcWindow* _tmp1_;
	DcSettingsManager* _tmp2_;
	DcRpcServerSource _tmp3_;
	DcRpcServerSource _tmp4_;
	gchar* custom = NULL;
	DcWindow* _tmp5_;
	DcSettingsManager* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	DcRpcServerSource source = 0;
	DcWindow* _tmp10_;
	DcSettingsManager* _tmp11_;
	DcRpcServerSource _tmp12_;
	DcRpcServerSource _tmp13_;
	gchar* found = NULL;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp45_;
	g_return_if_fail (self != NULL);
	dc_settings_dialog_sync_rpc_source_dropdown (self);
	_tmp0_ = self->priv->rpc_choose_btn;
	_tmp1_ = self->priv->app_window;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = dc_settings_manager_get_rpc_server_source (_tmp2_);
	_tmp4_ = _tmp3_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, _tmp4_ == DC_RPC_SERVER_SOURCE_CUSTOM);
	_tmp5_ = self->priv->app_window;
	_tmp6_ = _tmp5_->settings;
	_tmp7_ = dc_settings_manager_get_rpc_server_path (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strdup (_tmp8_);
	custom = _tmp9_;
	_tmp10_ = self->priv->app_window;
	_tmp11_ = _tmp10_->settings;
	_tmp12_ = dc_settings_manager_get_rpc_server_source (_tmp11_);
	_tmp13_ = _tmp12_;
	source = _tmp13_;
	_tmp14_ = custom;
	_tmp15_ = dc_account_finder_find_rpc_server (_tmp14_, source);
	found = _tmp15_;
	switch (source) {
		case DC_RPC_SERVER_SOURCE_CUSTOM:
		{
			const gchar* _tmp16_;
			gint _tmp17_;
			gint _tmp18_;
			_tmp16_ = custom;
			_tmp17_ = strlen (_tmp16_);
			_tmp18_ = _tmp17_;
			if (_tmp18_ == 0) {
				AdwActionRow* _tmp19_;
				AdwActionRow* _tmp20_;
				_tmp19_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp19_, "No custom binary selected");
				_tmp20_ = self->priv->rpc_row;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp20_, "Choose a deltachat-rpc-server binary");
			} else {
				const gchar* _tmp21_ = NULL;
				const gchar* _tmp22_;
				AdwActionRow* _tmp23_;
				AdwActionRow* _tmp24_;
				const gchar* _tmp25_;
				_tmp22_ = found;
				if (_tmp22_ != NULL) {
					_tmp21_ = "Using custom binary";
				} else {
					_tmp21_ = "Custom path is not executable";
				}
				_tmp23_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp23_, _tmp21_);
				_tmp24_ = self->priv->rpc_row;
				_tmp25_ = custom;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp24_, _tmp25_);
			}
			break;
		}
		case DC_RPC_SERVER_SOURCE_DESKTOP:
		{
			gchar* desktop_dir = NULL;
			gchar* _tmp26_;
			const gchar* _tmp27_;
			_tmp26_ = dc_account_finder_find_desktop_data_dir ();
			desktop_dir = _tmp26_;
			_tmp27_ = found;
			if (_tmp27_ == NULL) {
				AdwActionRow* _tmp28_;
				AdwActionRow* _tmp29_;
				_tmp28_ = self->priv->rpc_row;
				adw_action_row_set_subtitle (_tmp28_, "Delta Chat Desktop server not found");
				_tmp29_ = self->priv->rpc_row;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp29_, "Install Delta Chat Desktop or choose another server source");
			} else {
				const gchar* _tmp30_;
				_tmp30_ = desktop_dir;
				if (_tmp30_ == NULL) {
					AdwActionRow* _tmp31_;
					AdwActionRow* _tmp32_;
					_tmp31_ = self->priv->rpc_row;
					adw_action_row_set_subtitle (_tmp31_, "Desktop account store not found");
					_tmp32_ = self->priv->rpc_row;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp32_, "Sign in to Delta Chat Desktop or choose another server source");
				} else {
					AdwActionRow* _tmp33_;
					AdwActionRow* _tmp34_;
					const gchar* _tmp35_;
					const gchar* _tmp36_;
					gchar* _tmp37_;
					gchar* _tmp38_;
					_tmp33_ = self->priv->rpc_row;
					adw_action_row_set_subtitle (_tmp33_, "Using Delta Chat Desktop server and accounts");
					_tmp34_ = self->priv->rpc_row;
					_tmp35_ = found;
					_tmp36_ = desktop_dir;
					_tmp37_ = g_strdup_printf ("%s\n%s", _tmp35_, _tmp36_);
					_tmp38_ = _tmp37_;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp34_, _tmp38_);
					_g_free0 (_tmp38_);
				}
			}
			_g_free0 (desktop_dir);
			break;
		}
		default:
		case DC_RPC_SERVER_SOURCE_AUTO:
		{
			const gchar* _tmp39_ = NULL;
			const gchar* _tmp40_;
			AdwActionRow* _tmp41_;
			const gchar* _tmp42_ = NULL;
			const gchar* _tmp43_;
			AdwActionRow* _tmp44_;
			_tmp40_ = found;
			if (_tmp40_ != NULL) {
				_tmp39_ = "Using Parla or system server";
			} else {
				_tmp39_ = "Standalone server not found";
			}
			_tmp41_ = self->priv->rpc_row;
			adw_action_row_set_subtitle (_tmp41_, _tmp39_);
			_tmp43_ = found;
			_tmp42_ = _tmp43_;
			if (_tmp42_ == NULL) {
				_tmp42_ = "Install deltachat-rpc-server or choose a custom binary";
			}
			_tmp44_ = self->priv->rpc_row;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp44_, _tmp42_);
			break;
		}
	}
	_tmp45_ = found;
	dc_settings_dialog_update_rpc_version_row (self, _tmp45_, 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 gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

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 gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gboolean
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_settings_dialog_extract_version (_data_->_tmp36_);
			_g_free0 (_data_->self->priv->rpc_current_version);
			_data_->self->priv->rpc_current_version = _data_->_tmp37_;
			_data_->self->priv->rpc_update_check_available = TRUE;
			_data_->_tmp38_ = _data_->self->priv->rpc_update_btn;
			gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp38_, TRUE);
		} else {
			_data_->_tmp39_ = _data_->self->priv->rpc_version_row;
			adw_action_row_set_subtitle (_data_->_tmp39_, "Unable to read version");
			_g_free0 (_data_->self->priv->rpc_current_version);
			_data_->self->priv->rpc_current_version = NULL;
			_data_->self->priv->rpc_update_check_available = FALSE;
			_data_->_tmp40_ = _data_->self->priv->rpc_update_btn;
			gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp40_, FALSE);
		}
		_g_free0 (_data_->version);
		_g_free0 (_data_->_tmp14_);
		_g_free0 (_data_->stderr_buf);
		_g_free0 (_data_->stdout_buf);
		_g_object_unref0 (_data_->process);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		if (_data_->request_id != _data_->self->priv->rpc_version_request) {
			_g_error_free0 (_data_->e);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp41_ = _data_->self->priv->rpc_version_row;
		adw_action_row_set_subtitle (_data_->_tmp41_, "Unable to read version");
		_data_->_tmp42_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp43_ = _data_->e;
		_data_->_tmp44_ = _data_->_tmp43_->message;
		_data_->_tmp45_ = g_strdup_printf ("%s\n%s", _data_->rpc_path, _data_->_tmp44_);
		_data_->_tmp46_ = _data_->_tmp45_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp42_, _data_->_tmp46_);
		_g_free0 (_data_->_tmp46_);
		_g_free0 (_data_->self->priv->rpc_current_version);
		_data_->self->priv->rpc_current_version = NULL;
		_data_->self->priv->rpc_update_check_available = FALSE;
		_data_->_tmp47_ = _data_->self->priv->rpc_update_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp47_, FALSE);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

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

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

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

static gboolean
dc_settings_dialog_check_rpc_updates_co (DcSettingsDialogCheckRpcUpdatesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->rpc_update_btn;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->rpc_update_btn;
		_data_->_tmp3_ = gtk_widget_get_sensitive ((GtkWidget*) _data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp0_ = !_data_->_tmp4_;
	}
	if (_data_->_tmp0_) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = _data_->self->priv->rpc_update_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp5_, FALSE);
	_data_->_tmp6_ = _data_->self->priv->rpc_version_row;
	_data_->_tmp7_ = adw_action_row_get_subtitle (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = g_strdup (_data_->_tmp8_);
	_data_->previous_subtitle = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->self->priv->rpc_version_row;
	adw_action_row_set_subtitle (_data_->_tmp10_, "Checking for updates...");
	{
		_data_->_state_ = 1;
		dc_settings_dialog_fetch_latest_rpc_release_tag (_data_->self, dc_settings_dialog_check_rpc_updates_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = dc_settings_dialog_fetch_latest_rpc_release_tag_finish (_data_->self, _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_settings_dialog_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->rpc_current_version;
		if (_data_->_tmp19_ == NULL) {
			_data_->_tmp20_ = _data_->self->priv->rpc_version_row;
			_data_->_tmp21_ = _data_->latest_version;
			_data_->_tmp22_ = g_strdup_printf ("Latest available: %s", _data_->_tmp21_);
			_data_->_tmp23_ = _data_->_tmp22_;
			adw_action_row_set_subtitle (_data_->_tmp20_, _data_->_tmp23_);
			_g_free0 (_data_->_tmp23_);
			_data_->_tmp24_ = _data_->self->priv->app_window;
			_data_->_tmp25_ = _data_->latest_version;
			_data_->_tmp26_ = g_strconcat ("Latest RPC server: ", _data_->_tmp25_, NULL);
			_data_->_tmp27_ = _data_->_tmp26_;
			dc_window_show_toast (_data_->_tmp24_, _data_->_tmp27_);
			_g_free0 (_data_->_tmp27_);
		} else {
			_data_->_tmp28_ = _data_->self->priv->rpc_current_version;
			_data_->_tmp29_ = _data_->latest_version;
			if (g_strcmp0 (_data_->_tmp28_, _data_->_tmp29_) != 0) {
				_data_->_tmp30_ = _data_->self->priv->rpc_version_row;
				_data_->_tmp31_ = _data_->latest_version;
				_data_->_tmp32_ = _data_->self->priv->rpc_current_version;
				_data_->_tmp33_ = g_strdup_printf ("Latest: %s (installed %s)", _data_->_tmp31_, _data_->_tmp32_);
				_data_->_tmp34_ = _data_->_tmp33_;
				adw_action_row_set_subtitle (_data_->_tmp30_, _data_->_tmp34_);
				_g_free0 (_data_->_tmp34_);
				_data_->_tmp35_ = _data_->self->priv->app_window;
				_data_->_tmp36_ = _data_->latest_version;
				_data_->_tmp37_ = g_strconcat ("RPC server version differs: ", _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_version_row;
				_data_->_tmp40_ = _data_->self->priv->rpc_current_version;
				_data_->_tmp41_ = g_strdup_printf ("Up to date: %s", _data_->_tmp40_);
				_data_->_tmp42_ = _data_->_tmp41_;
				adw_action_row_set_subtitle (_data_->_tmp39_, _data_->_tmp42_);
				_g_free0 (_data_->_tmp42_);
				_data_->_tmp43_ = _data_->self->priv->app_window;
				dc_window_show_toast (_data_->_tmp43_, "RPC server is up to date");
			}
		}
		_data_->_tmp44_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp45_ = _data_->latest_tag;
		_data_->_tmp46_ = g_strdup_printf ("Latest release: https://github.com/chatmail/core/releases/tag/%s", _data_->_tmp45_);
		_data_->_tmp47_ = _data_->_tmp46_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _data_->_tmp44_, _data_->_tmp47_);
		_g_free0 (_data_->_tmp47_);
		_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_->_tmp48_ = _data_->self->priv->rpc_version_row;
		_data_->_tmp49_ = _data_->previous_subtitle;
		adw_action_row_set_subtitle (_data_->_tmp48_, _data_->_tmp49_);
		_data_->_tmp50_ = _data_->self->priv->app_window;
		_data_->_tmp51_ = _data_->e;
		_data_->_tmp52_ = _data_->_tmp51_->message;
		_data_->_tmp53_ = g_strconcat ("Update check failed: ", _data_->_tmp52_, NULL);
		_data_->_tmp54_ = _data_->_tmp53_;
		dc_window_show_toast (_data_->_tmp50_, _data_->_tmp54_);
		_g_free0 (_data_->_tmp54_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		_data_->_tmp55_ = _data_->self->priv->rpc_update_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _data_->_tmp55_, _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_fetch_latest_rpc_release_tag_data_free (gpointer _data)
{
	DcSettingsDialogFetchLatestRpcReleaseTagData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcSettingsDialogFetchLatestRpcReleaseTagData, _data_);
}

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

static gchar*
dc_settings_dialog_fetch_latest_rpc_release_tag_finish (DcSettingsDialog* self,
                                                        GAsyncResult* _res_,
                                                        GError** error)
{
	gchar* result;
	DcSettingsDialogFetchLatestRpcReleaseTagData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_settings_dialog_fetch_latest_rpc_release_tag_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	DcSettingsDialogFetchLatestRpcReleaseTagData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_settings_dialog_fetch_latest_rpc_release_tag_co (_data_);
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

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

static gboolean
dc_settings_dialog_fetch_latest_rpc_release_tag_co (DcSettingsDialogFetchLatestRpcReleaseTagData* _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;
		case 6:
		goto _state_6;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_socket_client_new ();
	_data_->client = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->client;
	g_socket_client_set_timeout (_data_->_tmp1_, (guint) 15);
	_data_->_tmp2_ = _data_->client;
	_data_->_state_ = 1;
	g_socket_client_connect_to_host_async (_data_->_tmp2_, "github.com", (guint16) 443, NULL, dc_settings_dialog_fetch_latest_rpc_release_tag_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = g_socket_client_connect_to_host_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
	_data_->tcp = _data_->_tmp3_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = (GNetworkAddress*) g_network_address_new ("github.com", (guint16) 443);
	_data_->identity = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->tcp;
	_data_->_tmp6_ = _data_->identity;
	_data_->_tmp7_ = g_tls_client_connection_new ((GIOStream*) _data_->_tmp5_, (GSocketConnectable*) _data_->_tmp6_, &_data_->_inner_error0_);
	_data_->tls = _data_->_tmp7_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = _data_->tls;
	if (_data_->_tmp8_ == NULL) {
		_data_->_tmp9_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Unable to create TLS connection");
		_data_->_inner_error0_ = _data_->_tmp9_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->tls);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp10_ = _data_->tls;
	_data_->_state_ = 2;
	g_tls_connection_handshake_async ((GTlsConnection*) _data_->_tmp10_, G_PRIORITY_DEFAULT, NULL, dc_settings_dialog_fetch_latest_rpc_release_tag_ready, _data_);
	return FALSE;
	_state_2:
	g_tls_connection_handshake_finish ((GTlsConnection*) _data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->tls);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = g_strdup ("HEAD /chatmail/core/releases/latest HTTP/1.1\r\n" "Host: github.com\r\n" "User-Agent: Parla\r\n" "Accept: */*\r\n" "Connection: close\r\n\r\n");
	_data_->request = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->tls;
	_data_->_tmp13_ = g_io_stream_get_output_stream ((GIOStream*) _data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_tmp15_ = _data_->request;
	_data_->_tmp17_ = 0;
	_data_->_tmp16_ = string_get_data (_data_->_tmp15_, &_data_->_tmp17_);
	_data_->_tmp16__length1 = _data_->_tmp17_;
	_data_->_tmp18_ = _data_->_tmp16_;
	_data_->_tmp18__length1 = _data_->_tmp16__length1;
	_data_->_tmp19_ = 0UL;
	_data_->_state_ = 3;
	g_output_stream_write_all_async (_data_->_tmp14_, _data_->_tmp18_, (gsize) _data_->_tmp18__length1, G_PRIORITY_DEFAULT, NULL, dc_settings_dialog_fetch_latest_rpc_release_tag_ready, _data_);
	return FALSE;
	_state_3:
	g_output_stream_write_all_finish (_data_->_tmp14_, _data_->_res_, &_data_->_tmp19_, &_data_->_inner_error0_);
	_data_->written = _data_->_tmp19_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->request);
		_g_object_unref0 (_data_->tls);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp20_ = _data_->tls;
	_data_->_tmp21_ = g_io_stream_get_input_stream ((GIOStream*) _data_->_tmp20_);
	_data_->_tmp22_ = _data_->_tmp21_;
	_data_->_tmp23_ = g_data_input_stream_new (_data_->_tmp22_);
	_data_->reader = _data_->_tmp23_;
	_data_->_tmp24_ = _data_->reader;
	g_data_input_stream_set_newline_type (_data_->_tmp24_, G_DATA_STREAM_NEWLINE_TYPE_LF);
	_data_->_tmp25_ = _data_->reader;
	_data_->_tmp26_ = 0UL;
	_data_->_state_ = 4;
	g_data_input_stream_read_line_async (_data_->_tmp25_, G_PRIORITY_DEFAULT, NULL, dc_settings_dialog_fetch_latest_rpc_release_tag_ready, _data_);
	return FALSE;
	_state_4:
	_data_->_tmp27_ = g_data_input_stream_read_line_finish_utf8 (_data_->_tmp25_, _data_->_res_, &_data_->_tmp26_, &_data_->_inner_error0_);
	_data_->len = _data_->_tmp26_;
	_data_->status_line = _data_->_tmp27_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->reader);
		_g_free0 (_data_->request);
		_g_object_unref0 (_data_->tls);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp29_ = _data_->status_line;
	_data_->_tmp28_ = _data_->_tmp29_;
	if (_data_->_tmp28_ == NULL) {
		_data_->_tmp28_ = "";
	}
	_data_->status = dc_settings_dialog_parse_http_status (_data_->_tmp28_);
	_data_->location = NULL;
	while (TRUE) {
		_data_->_tmp31_ = _data_->reader;
		_data_->_tmp32_ = 0UL;
		_data_->_state_ = 5;
		g_data_input_stream_read_line_async (_data_->_tmp31_, G_PRIORITY_DEFAULT, NULL, dc_settings_dialog_fetch_latest_rpc_release_tag_ready, _data_);
		return FALSE;
		_state_5:
		_data_->_tmp33_ = g_data_input_stream_read_line_finish_utf8 (_data_->_tmp31_, _data_->_res_, &_data_->_tmp32_, &_data_->_inner_error0_);
		_data_->len = _data_->_tmp32_;
		_data_->_tmp30_ = _data_->_tmp33_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->line);
			_g_free0 (_data_->location);
			_g_free0 (_data_->status_line);
			_g_object_unref0 (_data_->reader);
			_g_free0 (_data_->request);
			_g_object_unref0 (_data_->tls);
			_g_object_unref0 (_data_->identity);
			_g_object_unref0 (_data_->tcp);
			_g_object_unref0 (_data_->client);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp34_ = _data_->_tmp30_;
		_data_->_tmp30_ = NULL;
		_g_free0 (_data_->line);
		_data_->line = _data_->_tmp34_;
		_data_->_tmp35_ = _data_->line;
		if (!(_data_->_tmp35_ != NULL)) {
			_g_free0 (_data_->_tmp30_);
			break;
		}
		_data_->_tmp36_ = _data_->line;
		_data_->_tmp37_ = string_strip (_data_->_tmp36_);
		_data_->stripped = _data_->_tmp37_;
		_data_->_tmp38_ = _data_->stripped;
		_data_->_tmp39_ = strlen (_data_->_tmp38_);
		_data_->_tmp40_ = _data_->_tmp39_;
		if (_data_->_tmp40_ == 0) {
			_g_free0 (_data_->stripped);
			_g_free0 (_data_->_tmp30_);
			break;
		}
		_data_->_tmp41_ = _data_->stripped;
		_data_->_tmp42_ = g_utf8_strdown (_data_->_tmp41_, (gssize) -1);
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_tmp44_ = g_str_has_prefix (_data_->_tmp43_, "location:");
		_g_free0 (_data_->_tmp43_);
		if (_data_->_tmp44_) {
			_data_->_tmp45_ = _data_->stripped;
			_data_->_tmp46_ = strlen ("location:");
			_data_->_tmp47_ = _data_->_tmp46_;
			_data_->_tmp48_ = string_substring (_data_->_tmp45_, (glong) _data_->_tmp47_, (glong) -1);
			_data_->_tmp49_ = _data_->_tmp48_;
			_data_->_tmp50_ = string_strip (_data_->_tmp49_);
			_g_free0 (_data_->location);
			_data_->location = _data_->_tmp50_;
			_g_free0 (_data_->_tmp49_);
		}
		_g_free0 (_data_->stripped);
		_g_free0 (_data_->_tmp30_);
	}
	{
		_data_->_tmp51_ = _data_->tls;
		_data_->_state_ = 6;
		g_io_stream_close_async ((GIOStream*) _data_->_tmp51_, G_PRIORITY_DEFAULT, NULL, dc_settings_dialog_fetch_latest_rpc_release_tag_ready, _data_);
		return FALSE;
		_state_6:
		g_io_stream_close_finish ((GIOStream*) _data_->_tmp51_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->line);
		_g_free0 (_data_->location);
		_g_free0 (_data_->status_line);
		_g_object_unref0 (_data_->reader);
		_g_free0 (_data_->request);
		_g_object_unref0 (_data_->tls);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (_data_->status < 300) {
		_data_->_tmp53_ = TRUE;
	} else {
		_data_->_tmp53_ = _data_->status >= 400;
	}
	if (_data_->_tmp53_) {
		_data_->_tmp52_ = TRUE;
	} else {
		_data_->_tmp54_ = _data_->location;
		_data_->_tmp52_ = _data_->_tmp54_ == NULL;
	}
	if (_data_->_tmp52_) {
		_data_->_tmp55_ = g_strdup_printf ("GitHub returned HTTP status %d", _data_->status);
		_data_->_tmp56_ = _data_->_tmp55_;
		_data_->_tmp57_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _data_->_tmp56_);
		_data_->_tmp58_ = _data_->_tmp57_;
		_g_free0 (_data_->_tmp56_);
		_data_->_inner_error0_ = _data_->_tmp58_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->line);
		_g_free0 (_data_->location);
		_g_free0 (_data_->status_line);
		_g_object_unref0 (_data_->reader);
		_g_free0 (_data_->request);
		_g_object_unref0 (_data_->tls);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp59_ = _data_->location;
	_data_->_tmp60_ = dc_settings_dialog_extract_release_tag (_data_->_tmp59_);
	_data_->tag = _data_->_tmp60_;
	_data_->_tmp61_ = _data_->tag;
	if (_data_->_tmp61_ == NULL) {
		_data_->_tmp62_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "GitHub response did not include a release tag");
		_data_->_inner_error0_ = _data_->_tmp62_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->tag);
		_g_free0 (_data_->line);
		_g_free0 (_data_->location);
		_g_free0 (_data_->status_line);
		_g_object_unref0 (_data_->reader);
		_g_free0 (_data_->request);
		_g_object_unref0 (_data_->tls);
		_g_object_unref0 (_data_->identity);
		_g_object_unref0 (_data_->tcp);
		_g_object_unref0 (_data_->client);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->tag;
	_g_free0 (_data_->line);
	_g_free0 (_data_->location);
	_g_free0 (_data_->status_line);
	_g_object_unref0 (_data_->reader);
	_g_free0 (_data_->request);
	_g_object_unref0 (_data_->tls);
	_g_object_unref0 (_data_->identity);
	_g_object_unref0 (_data_->tcp);
	_g_object_unref0 (_data_->client);
	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 gint
dc_settings_dialog_parse_http_status (const gchar* status_line)
{
	gchar** parts = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint parts_length1;
	gint _parts_size_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	gint result;
	g_return_val_if_fail (status_line != NULL, -1);
	_tmp1_ = _tmp0_ = g_strsplit (status_line, " ", 0);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = parts_length1;
	_tmp2_ = parts;
	_tmp2__length1 = parts_length1;
	if (_tmp2__length1 < 2) {
		result = 0;
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp3_ = parts;
	_tmp3__length1 = parts_length1;
	_tmp4_ = _tmp3_[1];
	result = atoi (_tmp4_);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static gint
string_last_index_of (const gchar* self,
                      const gchar* needle,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = g_strrstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gchar*
dc_settings_dialog_extract_release_tag (const gchar* location)
{
	gint idx = 0;
	gchar* tag = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gchar* _tmp2_;
	gint q = 0;
	const gchar* _tmp3_;
	gint hash = 0;
	const gchar* _tmp6_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_ = NULL;
	const gchar* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	gchar* _tmp16_;
	gchar* result;
	g_return_val_if_fail (location != NULL, NULL);
	idx = string_last_index_of (location, "/tag/", 0);
	if (idx < 0) {
		result = NULL;
		return result;
	}
	_tmp0_ = strlen ("/tag/");
	_tmp1_ = _tmp0_;
	_tmp2_ = string_substring (location, (glong) (idx + _tmp1_), (glong) -1);
	tag = _tmp2_;
	_tmp3_ = tag;
	q = string_index_of (_tmp3_, "?", 0);
	if (q >= 0) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp4_ = tag;
		_tmp5_ = string_substring (_tmp4_, (glong) 0, (glong) q);
		_g_free0 (tag);
		tag = _tmp5_;
	}
	_tmp6_ = tag;
	hash = string_index_of (_tmp6_, "#", 0);
	if (hash >= 0) {
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp7_ = tag;
		_tmp8_ = string_substring (_tmp7_, (glong) 0, (glong) hash);
		_g_free0 (tag);
		tag = _tmp8_;
	}
	_tmp9_ = tag;
	_tmp10_ = string_strip (_tmp9_);
	_g_free0 (tag);
	tag = _tmp10_;
	_tmp12_ = tag;
	_tmp13_ = strlen (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_ > 0) {
		const gchar* _tmp15_;
		_tmp15_ = tag;
		_tmp11_ = _tmp15_;
	} else {
		_tmp11_ = NULL;
	}
	_tmp16_ = g_strdup (_tmp11_);
	result = _tmp16_;
	_g_free0 (tag);
	return result;
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static gchar*
dc_settings_dialog_extract_version (const gchar* text)
{
	gint start = 0;
	gint end = 0;
	gboolean _tmp7_ = FALSE;
	gchar* version = NULL;
	gchar* _tmp8_;
	const gchar* _tmp15_ = NULL;
	const gchar* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gchar* _tmp20_;
	gchar* result;
	g_return_val_if_fail (text != NULL, NULL);
	start = -1;
	end = -1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp2_;
				gint _tmp3_;
				gchar c = '\0';
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = strlen (text);
				_tmp3_ = _tmp2_;
				if (!(i < _tmp3_)) {
					break;
				}
				c = string_get (text, (glong) i);
				if (start < 0) {
					gboolean _tmp4_ = FALSE;
					if (c >= '0') {
						_tmp4_ = c <= '9';
					} else {
						_tmp4_ = FALSE;
					}
					if (_tmp4_) {
						start = i;
						end = i + 1;
					}
				} else {
					gboolean _tmp5_ = FALSE;
					gboolean _tmp6_ = FALSE;
					if (c >= '0') {
						_tmp6_ = c <= '9';
					} else {
						_tmp6_ = FALSE;
					}
					if (_tmp6_) {
						_tmp5_ = TRUE;
					} else {
						_tmp5_ = c == '.';
					}
					if (_tmp5_) {
						end = i + 1;
					} else {
						break;
					}
				}
			}
		}
	}
	if (start < 0) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = end <= start;
	}
	if (_tmp7_) {
		result = NULL;
		return result;
	}
	_tmp8_ = string_substring (text, (glong) start, (glong) (end - start));
	version = _tmp8_;
	while (TRUE) {
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		gchar* _tmp14_;
		_tmp9_ = version;
		if (!g_str_has_suffix (_tmp9_, ".")) {
			break;
		}
		_tmp10_ = version;
		_tmp11_ = version;
		_tmp12_ = strlen (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = string_substring (_tmp10_, (glong) 0, (glong) (_tmp13_ - 1));
		_g_free0 (version);
		version = _tmp14_;
	}
	_tmp16_ = version;
	_tmp17_ = strlen (_tmp16_);
	_tmp18_ = _tmp17_;
	if (_tmp18_ > 0) {
		const gchar* _tmp19_;
		_tmp19_ = version;
		_tmp15_ = _tmp19_;
	} else {
		_tmp15_ = NULL;
	}
	_tmp20_ = g_strdup (_tmp15_);
	result = _tmp20_;
	_g_free0 (version);
	return result;
}

static void
dc_settings_dialog_sync_rpc_source_dropdown (DcSettingsDialog* self)
{
	GtkDropDown* _tmp0_;
	DcWindow* _tmp1_;
	DcSettingsManager* _tmp2_;
	DcRpcServerSource _tmp3_;
	DcRpcServerSource _tmp4_;
	g_return_if_fail (self != NULL);
	self->priv->syncing_rpc_source = TRUE;
	_tmp0_ = self->priv->rpc_source_dropdown;
	_tmp1_ = self->priv->app_window;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = dc_settings_manager_get_rpc_server_source (_tmp2_);
	_tmp4_ = _tmp3_;
	gtk_drop_down_set_selected (_tmp0_, (guint) _tmp4_);
	self->priv->syncing_rpc_source = FALSE;
}

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

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

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

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

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

static gboolean
dc_settings_dialog_on_browse_rpc_server_co (DcSettingsDialogOnBrowseRpcServerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gtk_file_dialog_new ();
	_data_->dlg = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->dlg;
	gtk_file_dialog_set_title (_data_->_tmp1_, "Locate deltachat-rpc-server");
	_data_->_tmp2_ = _data_->dlg;
	gtk_file_dialog_set_modal (_data_->_tmp2_, TRUE);
	_data_->_tmp3_ = _data_->self->priv->app_window;
	_data_->_tmp4_ = _data_->_tmp3_->settings;
	_data_->_tmp5_ = dc_settings_manager_get_rpc_server_path (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
	_data_->start = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->start;
	_data_->_tmp9_ = strlen (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	if (_data_->_tmp10_ == 0) {
		_data_->_tmp12_ = dc_account_finder_find_rpc_server (NULL, 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);
				_data_->_tmp34_ = _data_->self->priv->app_window;
				dc_window_show_toast (_data_->_tmp34_, "RPC server path saved. Restart to apply.");
			} else {
				_data_->_tmp35_ = _data_->self->priv->app_window;
				dc_show_error ((GtkWidget*) _data_->_tmp35_, "Selected file is not an executable binary.");
			}
			_g_free0 (_data_->path);
		}
		_g_object_unref0 (_data_->file);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp37_ = _data_->e;
		if (!(_data_->_tmp37_->domain == GTK_DIALOG_ERROR)) {
			_data_->_tmp38_ = _data_->e;
			_data_->_tmp36_ = !g_error_matches (_data_->_tmp38_, G_IO_ERROR, G_IO_ERROR_CANCELLED);
		} else {
			_data_->_tmp36_ = FALSE;
		}
		if (_data_->_tmp36_) {
			_data_->_tmp39_ = _data_->self->priv->app_window;
			_data_->_tmp40_ = _data_->e;
			_data_->_tmp41_ = _data_->_tmp40_->message;
			dc_show_error ((GtkWidget*) _data_->_tmp39_, _data_->_tmp41_);
		}
		_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_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
__lambda172_ (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
___lambda172__dc_void_func (gpointer self)
{
	__lambda172_ ((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", ___lambda172__dc_void_func, g_object_ref (self), g_object_unref);
}

static void
dc_settings_dialog_apply_accent_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)
{
	self->priv = dc_settings_dialog_get_instance_private (self);
	self->priv->syncing_rpc_source = FALSE;
	self->priv->rpc_version_request = (guint) 0;
	self->priv->rpc_current_version = NULL;
	self->priv->rpc_update_check_available = FALSE;
}

static void
dc_settings_dialog_finalize (GObject * obj)
{
	DcSettingsDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_SETTINGS_DIALOG, DcSettingsDialog);
	_g_object_unref0 (self->priv->content);
	_g_object_unref0 (self->priv->rpc_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_update_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;
}

