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

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

#define DC_APPLICATION_CSS "\n" \
"            .message-bubble {\n" \
"                padding: 8px 12px;\n" \
"                border-radius: 16px;\n" \
"                min-width: 60px;\n" \
"            }\n" \
"            .message-bubble.incoming {\n" \
"                background-color: alpha(@view_fg_color, 0.08);\n" \
"                border-top-left-radius: 4px;\n" \
"            }\n" \
"            .message-bubble.outgoing {\n" \
"                background-color: alpha(@accent_bg_color, 0.5);\n" \
"                border-bottom-right-radius: 4px;\n" \
"            }\n" \
"            .message-sender {\n" \
"                font-weight: bold;\n" \
"                font-size: small;\n" \
"                color: @accent_color;\n" \
"            }\n" \
"            .message-time {\n" \
"                font-size: x-small;\n" \
"                opacity: 0.55;\n" \
"                margin-top: 2px;\n" \
"            }\n" \
"            .message-forwarded {\n" \
"                font-size: small;\n" \
"                font-style: italic;\n" \
"                opacity: 0.7;\n" \
"            }\n" \
"            .message-edited {\n" \
"                font-size: x-small;\n" \
"                font-style: italic;\n" \
"                opacity: 0.55;\n" \
"                margin-top: 2px;\n" \
"            }\n" \
"            .message-big-emoji {\n" \
"                font-size: 500%;\n" \
"            }\n" \
"            .message-irc {\n" \
"                padding: 1px 0;\n" \
"            }\n" \
"            .message-irc .message-sender {\n" \
"                font-weight: bold;\n" \
"                font-size: inherit;\n" \
"            }\n" \
"            .message-irc .message-sender-other {\n" \
"                color: @accent_color;\n" \
"            }\n" \
"            .message-irc .message-sender-self {\n" \
"                color: @view_fg_color;\n" \
"            }\n" \
"            .message-irc .irc-time {\n" \
"                font-size: x-small;\n" \
"                opacity: 0.55;\n" \
"                margin-top: 0;\n" \
"                min-width: 40px;\n" \
"            }\n" \
"            .message-image-irc {\n" \
"                border-radius: 8px;\n" \
"                margin-top: 2px;\n" \
"                margin-bottom: 2px;\n" \
"            }\n" \
"            .message-attachment { padding: 4px 0; }\n" \
"            .message-image { border-radius: 12px; margin-top: 4px; }\n" \
"            .image-viewer-overlay {\n" \
"                background-color: alpha(black, 0.75);\n" \
"            }\n" \
"            .compose-bar { border-top: none; }\n" \
"            .compose-entry { min-height: 36px; border-radius: 18px; }\n" \
"            .attachment-bar {\n" \
"                padding: 6px 10px;\n" \
"                margin-bottom: 6px;\n" \
"                border-left: 3px solid @accent_bg_color;\n" \
"                background-color: alpha(@view_fg_color, 0.05);\n" \
"                border-radius: 4px;\n" \
"                min-height: 56px;\n" \
"            }\n" \
"            .attachment-preview-image {\n" \
"                border-radius: 6px;\n" \
"                background-color: alpha(@view_fg_color, 0.08);\n" \
"            }\n" \
"            .attachment-preview-icon {\n" \
"                color: @accent_color;\n" \
"            }\n" \
"            .attachment-preview-name {\n" \
"                font-weight: bold;\n" \
"            }\n" \
"            .attachment-preview-meta {\n" \
"                font-size: x-small;\n" \
"                opacity: 0.65;\n" \
"            }\n" \
"            .chat-drop-active {\n" \
"                background-color: alpha(@accent_bg_color, 0.08);\n" \
"                box-shadow: inset 0 0 0 2px alpha(@accent_bg_color, 0." \
"45);\n" \
"            }\n" \
"            .chat-row { border-radius: 8px; padding: 4px; }\n" \
"            .chat-row-compact {\n" \
"                margin-left: 0;\n" \
"                margin-right: 0;\n" \
"                padding: 2px;\n" \
"            }\n" \
"            .sidebar-compact .chat-row {\n" \
"                margin-left: 0;\n" \
"                margin-right: 0;\n" \
"            }\n" \
"            .compact-unread-badge {\n" \
"                background-color: @accent_bg_color;\n" \
"                color: @accent_fg_color;\n" \
"                border-radius: 9px;\n" \
"                padding: 0 5px;\n" \
"                min-width: 16px;\n" \
"                min-height: 16px;\n" \
"                font-size: 9pt;\n" \
"                font-weight: bold;\n" \
"                margin-top: -2px;\n" \
"                margin-right: -4px;\n" \
"                box-shadow: 0 0 0 2px @view_bg_color;\n" \
"            }\n" \
"            .compact-unread-badge-muted {\n" \
"                background-color: alpha(@view_fg_color, 0.55);\n" \
"                color: @view_bg_color;\n" \
"                border-radius: 9px;\n" \
"                padding: 0 5px;\n" \
"                min-width: 16px;\n" \
"                min-height: 16px;\n" \
"                font-size: 9pt;\n" \
"                font-weight: bold;\n" \
"                margin-top: -2px;\n" \
"                margin-right: -4px;\n" \
"                box-shadow: 0 0 0 2px @view_bg_color;\n" \
"            }\n" \
"            .compact-request-marker {\n" \
"                background-color: @warning_color;\n" \
"                color: @view_bg_color;\n" \
"                border-radius: 9px;\n" \
"                padding: 0 5px;\n" \
"                min-width: 16px;\n" \
"                min-height: 16px;\n" \
"                font-size: 9pt;\n" \
"                font-weight: bold;\n" \
"                margin-top: -2px;\n" \
"                margin-right: -4px;\n" \
"                box-shadow: 0 0 0 2px @view_bg_color;\n" \
"            }\n" \
"            .compact-pin-marker {\n" \
"                background-color: @view_bg_color;\n" \
"                color: alpha(@view_fg_color, 0.7);\n" \
"                border-radius: 8px;\n" \
"                padding: 1px;\n" \
"                margin-bottom: -2px;\n" \
"                margin-right: -2px;\n" \
"                box-shadow: 0 0 0 1px alpha(@view_fg_color, 0.15);\n" \
"            }\n" \
"            .current-account-row {\n" \
"                background-color: alpha(@accent_bg_color, 0.10);\n" \
"                border-radius: 8px;\n" \
"            }\n" \
"            .account-unread-dot {\n" \
"                background-color: @error_bg_color;\n" \
"                border-radius: 9999px;\n" \
"                min-width: 14px;\n" \
"                min-height: 14px;\n" \
"                margin-bottom: -2px;\n" \
"                margin-right: -2px;\n" \
"                box-shadow: 0 0 0 2px @headerbar_bg_color;\n" \
"            }\n" \
"            .account-unread-badge {\n" \
"                background-color: @error_bg_color;\n" \
"                color: @error_fg_color;\n" \
"                border-radius: 9px;\n" \
"                padding: 0 4px;\n" \
"                min-width: 16px;\n" \
"                min-height: 16px;\n" \
"                font-size: 8pt;\n" \
"                font-weight: bold;\n" \
"                margin-bottom: -3px;\n" \
"                margin-right: -3px;\n" \
"                box-shadow: 0 0 0 2px @view_bg_color;\n" \
"            }\n" \
"            .unread-dot {\n" \
"                color: @accent_bg_color;\n" \
"                font-size: 12px;\n" \
"            }\n" \
"            .unread-dot-muted {\n" \
"                color: alpha(@view_fg_color, 0.4);\n" \
"                font-size: 12px;\n" \
"            }\n" \
"            .unread-name {\n" \
"                font-weight: 800;\n" \
"            }\n" \
"            .unread-badge {\n" \
"                background-color: @accent_bg_color;\n" \
"                color: @accent_fg_color;\n" \
"                border-radius: 10px;\n" \
"                padding: 0 6px;\n" \
"                min-width: 20px; min-height: 20px;\n" \
"                font-size: small; font-weight: bold;\n" \
"            }\n" \
"            .unread-badge-muted {\n" \
"                background-color: alpha(@view_fg_color, 0.35);\n" \
"                color: @view_bg_color;\n" \
"                border-radius: 10px;\n" \
"                padding: 0 6px;\n" \
"                min-width: 20px; min-height: 20px;\n" \
"                font-size: small; font-weight: bold;\n" \
"            }\n" \
"            .contact-request-badge {\n" \
"                background-color: @warning_bg_color;\n" \
"                color: @warning_fg_color;\n" \
"                border-radius: 10px;\n" \
"                padding: 0 6px;\n" \
"                min-width: 20px; min-height: 20px;\n" \
"                font-size: small; font-weight: bold;\n" \
"            }\n" \
"            .contact-request-bar {\n" \
"                padding: 4px 8px;\n" \
"            }\n" \
"            .message-new {\n" \
"                background-color: alpha(@accent_bg_color, 0.15);\n" \
"                transition: background-color 2s ease-out;\n" \
"            }\n" \
"            .quote-block {\n" \
"                border-left: 3px solid @accent_bg_color;\n" \
"                padding: 4px 8px;\n" \
"                margin-bottom: 4px;\n" \
"                background-color: alpha(@view_fg_color, 0.05);\n" \
"                border-radius: 4px;\n" \
"            }\n" \
"            .quote-sender {\n" \
"                font-size: small;\n" \
"                font-weight: bold;\n" \
"                color: @accent_color;\n" \
"            }\n" \
"            .quote-text {\n" \
"                font-size: small;\n" \
"                opacity: 0.75;\n" \
"            }\n" \
"            .reply-bar {\n" \
"                padding: 4px 8px;\n" \
"                margin-bottom: 4px;\n" \
"                border-left: 3px solid @accent_bg_color;\n" \
"                background-color: alpha(@view_fg_color, 0.05);\n" \
"                border-radius: 4px;\n" \
"            }\n" \
"            .reply-label {\n" \
"                font-size: small;\n" \
"                opacity: 0.8;\n" \
"            }\n" \
"            .pinned-bar {\n" \
"                background-color: alpha(@accent_bg_color, 0.08);\n" \
"                border-bottom: 1px solid alpha(@view_fg_color, 0.12);\n" \
"            }\n" \
"            /* Delivery / read ticks next to the timestamp. */\n" \
"            .message-tick {\n" \
"                font-size: small;\n" \
"                opacity: 0.60;\n" \
"                margin-left: 2px;\n" \
"                letter-spacing: -3px;\n" \
"            }\n" \
"            .message-tick-read {\n" \
"                font-size: small;\n" \
"                color: @success_color;\n" \
"                opacity: 1;\n" \
"                margin-left: 2px;\n" \
"                letter-spacing: -3px;\n" \
"            }\n" \
"            .message-tick-failed {\n" \
"                font-size: small;\n" \
"                color: @error_color;\n" \
"                opacity: 1;\n" \
"                margin-left: 2px;\n" \
"            }\n" \
"            /* Floating \"disconnected\" pill over the chat area. */\n" \
"            .connection-banner {\n" \
"                background-color: alpha(@view_fg_color, 0.80);\n" \
"                color: @view_bg_color;\n" \
"                padding: 6px 14px;\n" \
"                border-radius: 18px;\n" \
"                box-shadow: 0 2px 8px alpha(@view_fg_color, 0.25);\n" \
"            }\n" \
"            .connection-banner-label {\n" \
"                font-size: small;\n" \
"            }\n" \
"            /* Floating \"Loading\342\200\246\" pill shown while older" \
" messages are\n" \
"               fetched from the JSON-RPC server. */\n" \
"            .loading-pill {\n" \
"                padding: 5px 14px;\n" \
"                border-radius: 16px;\n" \
"                opacity: 0.95;\n" \
"            }\n" \
"        "
#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

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

typedef struct _DcApplication DcApplication;
typedef struct _DcApplicationClass DcApplicationClass;
typedef struct _DcApplicationPrivate DcApplicationPrivate;

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

typedef struct _DcRpcClient DcRpcClient;
typedef struct _DcRpcClientClass DcRpcClientClass;
enum  {
	DC_APPLICATION_0_PROPERTY,
	DC_APPLICATION_RPC_PROPERTY,
	DC_APPLICATION_NUM_PROPERTIES
};
static GParamSpec* dc_application_properties[DC_APPLICATION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef enum  {
	DC_BACKGROUND_MODE_SYSTEM = 0,
	DC_BACKGROUND_MODE_SOLID = 1,
	DC_BACKGROUND_MODE_GRADIENT = 2
} DcBackgroundMode;

#define DC_TYPE_BACKGROUND_MODE (dc_background_mode_get_type ())

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

typedef struct _DcWindow DcWindow;
typedef struct _DcWindowClass DcWindowClass;

#define DC_TYPE_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;
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))

struct _DcApplication {
	AdwApplication parent_instance;
	DcApplicationPrivate * priv;
};

struct _DcApplicationClass {
	AdwApplicationClass parent_class;
};

struct _DcApplicationPrivate {
	DcRpcClient* _rpc;
	GtkCssProvider* accent_provider;
	GtkCssProvider* background_provider;
};

static gint DcApplication_private_offset;
static gpointer dc_application_parent_class = NULL;

void gtk_style_context_add_provider_for_display (GdkDisplay* display,
                                                 GtkStyleProvider* provider,
                                                 guint priority);
void gtk_style_context_remove_provider_for_display (GdkDisplay* display,
                                                    GtkStyleProvider* provider);
VALA_EXTERN GType dc_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcApplication, g_object_unref)
VALA_EXTERN GType dc_rpc_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcClient, g_object_unref)
VALA_EXTERN DcApplication* dc_application_new (void);
VALA_EXTERN DcApplication* dc_application_construct (GType object_type);
VALA_EXTERN void dc_application_reset_rpc_client (DcApplication* self);
VALA_EXTERN DcRpcClient* dc_application_get_rpc (DcApplication* self);
VALA_EXTERN void dc_rpc_client_stop (DcRpcClient* self);
VALA_EXTERN DcRpcClient* dc_rpc_client_new (void);
VALA_EXTERN DcRpcClient* dc_rpc_client_construct (GType object_type);
static void dc_application_set_rpc (DcApplication* self,
                             DcRpcClient* value);
VALA_EXTERN void dc_application_apply_accent_color (DcApplication* self,
                                        const gchar* hex);
VALA_EXTERN GType dc_background_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void dc_application_apply_background (DcApplication* self,
                                      DcBackgroundMode mode,
                                      const gchar* hex);
static void dc_application_real_activate (GApplication* base);
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
static DcWindow* dc_application_get_or_create_window (DcApplication* self);
VALA_EXTERN void dc_window_restore_from_tray (DcWindow* self);
VALA_EXTERN DcWindow* dc_window_new (DcApplication* app);
VALA_EXTERN DcWindow* dc_window_construct (GType object_type,
                               DcApplication* app);
static gint dc_application_real_command_line (GApplication* base,
                                       GApplicationCommandLine* cmd);
VALA_EXTERN gboolean dc_is_delta_invite_uri (const gchar* uri);
VALA_EXTERN void dc_window_handle_invite_uri (DcWindow* self,
                                  const gchar* uri);
static void dc_application_real_startup (GApplication* base);
static void dc_application_load_css (DcApplication* self);
VALA_EXTERN GType dc_settings_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsManager, g_object_unref)
VALA_EXTERN DcSettingsManager* dc_settings_manager_new (void);
VALA_EXTERN DcSettingsManager* dc_settings_manager_construct (GType object_type);
VALA_EXTERN void dc_settings_manager_load (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_accent_color (DcSettingsManager* self);
VALA_EXTERN DcBackgroundMode dc_settings_manager_get_background_mode (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_background_color (DcSettingsManager* self);
static void dc_application_register_icons (DcApplication* self);
static void __lambda247_ (DcApplication* self,
                   GVariant* param);
VALA_EXTERN void dc_window_open_chat_from_notification (DcWindow* self,
                                            gint acct_id,
                                            gint chat_id,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN void dc_window_open_chat_from_notification_finish (DcWindow* self,
                                                   GAsyncResult* _res_);
static void ___lambda247__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
VALA_EXTERN gchar* dc_platform_primary_accelerator_prefix (void);
VALA_EXTERN gchar* dc_platform_get_executable_path (void);
static GObject * dc_application_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
static void dc_application_finalize (GObject * obj);
static GType dc_application_get_type_once (void);
static void _vala_dc_application_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_dc_application_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
dc_application_get_instance_private (DcApplication* self)
{
	return G_STRUCT_MEMBER_P (self, DcApplication_private_offset);
}

DcApplication*
dc_application_construct (GType object_type)
{
	DcApplication * self = NULL;
	self = (DcApplication*) g_object_new (object_type, "application-id", "io.github.trufae.Parla", "flags", G_APPLICATION_HANDLES_COMMAND_LINE, NULL);
	return self;
}

DcApplication*
dc_application_new (void)
{
	return dc_application_construct (DC_TYPE_APPLICATION);
}

void
dc_application_reset_rpc_client (DcApplication* self)
{
	DcRpcClient* _tmp0_;
	DcRpcClient* _tmp1_;
	DcRpcClient* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_rpc;
	dc_rpc_client_stop (_tmp0_);
	_tmp1_ = dc_rpc_client_new ();
	_tmp2_ = _tmp1_;
	dc_application_set_rpc (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
}

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

void
dc_application_apply_accent_color (DcApplication* self,
                                   const gchar* hex)
{
	GdkDisplay* display = NULL;
	GdkDisplay* _tmp0_;
	GdkDisplay* _tmp1_;
	GdkDisplay* _tmp2_;
	GtkCssProvider* _tmp3_;
	gint _tmp6_;
	gint _tmp7_;
	GdkRGBA rgba = {0};
	gdouble y = 0.0;
	GdkRGBA _tmp8_;
	GdkRGBA _tmp9_;
	GdkRGBA _tmp10_;
	const gchar* _tmp11_ = NULL;
	gchar* fg = NULL;
	gchar* _tmp12_;
	gchar* css = NULL;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	GtkCssProvider* _tmp43_;
	GtkCssProvider* _tmp44_;
	const gchar* _tmp45_;
	GdkDisplay* _tmp46_;
	GtkCssProvider* _tmp47_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (hex != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	display = _tmp1_;
	_tmp2_ = display;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (display);
		return;
	}
	_tmp3_ = self->priv->accent_provider;
	if (_tmp3_ != NULL) {
		GdkDisplay* _tmp4_;
		GtkCssProvider* _tmp5_;
		_tmp4_ = display;
		_tmp5_ = self->priv->accent_provider;
		gtk_style_context_remove_provider_for_display (_tmp4_, (GtkStyleProvider*) _tmp5_);
		_g_object_unref0 (self->priv->accent_provider);
		self->priv->accent_provider = NULL;
	}
	_tmp6_ = strlen (hex);
	_tmp7_ = _tmp6_;
	if (_tmp7_ == 0) {
		_g_object_unref0 (display);
		return;
	}
	memset (&rgba, 0, sizeof (GdkRGBA));
	if (!gdk_rgba_parse (&rgba, hex)) {
		_g_object_unref0 (display);
		return;
	}
	_tmp8_ = rgba;
	_tmp9_ = rgba;
	_tmp10_ = rgba;
	y = ((0.299 * _tmp8_.red) + (0.587 * _tmp9_.green)) + (0.114 * _tmp10_.blue);
	if (y > 0.6) {
		_tmp11_ = "rgb(0,0,0)";
	} else {
		_tmp11_ = "rgb(255,255,255)";
	}
	_tmp12_ = g_strdup (_tmp11_);
	fg = _tmp12_;
	_tmp13_ = g_strconcat ("@define-color accent_bg_color ", hex, NULL);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strconcat (_tmp14_, ";\n", NULL);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strconcat (_tmp16_, "@define-color accent_color ", NULL);
	_tmp18_ = _tmp17_;
	_tmp19_ = g_strconcat (_tmp18_, hex, NULL);
	_tmp20_ = _tmp19_;
	_tmp21_ = g_strconcat (_tmp20_, ";\n", NULL);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_strconcat (_tmp22_, "@define-color accent_fg_color ", NULL);
	_tmp24_ = _tmp23_;
	_tmp25_ = fg;
	_tmp26_ = g_strconcat (_tmp24_, _tmp25_, NULL);
	_tmp27_ = _tmp26_;
	_tmp28_ = g_strconcat (_tmp27_, ";\n", NULL);
	_tmp29_ = _tmp28_;
	_tmp30_ = g_strconcat (_tmp29_, "@define-color theme_selected_bg_color ", NULL);
	_tmp31_ = _tmp30_;
	_tmp32_ = g_strconcat (_tmp31_, hex, NULL);
	_tmp33_ = _tmp32_;
	_tmp34_ = g_strconcat (_tmp33_, ";\n", NULL);
	_tmp35_ = _tmp34_;
	_tmp36_ = g_strconcat (_tmp35_, "@define-color theme_selected_fg_color ", NULL);
	_tmp37_ = _tmp36_;
	_tmp38_ = fg;
	_tmp39_ = g_strconcat (_tmp37_, _tmp38_, NULL);
	_tmp40_ = _tmp39_;
	_tmp41_ = g_strconcat (_tmp40_, ";\n", NULL);
	_tmp42_ = _tmp41_;
	_g_free0 (_tmp40_);
	_g_free0 (_tmp37_);
	_g_free0 (_tmp35_);
	_g_free0 (_tmp33_);
	_g_free0 (_tmp31_);
	_g_free0 (_tmp29_);
	_g_free0 (_tmp27_);
	_g_free0 (_tmp24_);
	_g_free0 (_tmp22_);
	_g_free0 (_tmp20_);
	_g_free0 (_tmp18_);
	_g_free0 (_tmp16_);
	_g_free0 (_tmp14_);
	css = _tmp42_;
	_tmp43_ = gtk_css_provider_new ();
	_g_object_unref0 (self->priv->accent_provider);
	self->priv->accent_provider = _tmp43_;
	_tmp44_ = self->priv->accent_provider;
	_tmp45_ = css;
	gtk_css_provider_load_from_string (_tmp44_, _tmp45_);
	_tmp46_ = display;
	_tmp47_ = self->priv->accent_provider;
	gtk_style_context_add_provider_for_display (_tmp46_, (GtkStyleProvider*) _tmp47_, (guint) (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1));
	_g_free0 (css);
	_g_free0 (fg);
	_g_object_unref0 (display);
}

void
dc_application_apply_background (DcApplication* self,
                                 DcBackgroundMode mode,
                                 const gchar* hex)
{
	GdkDisplay* display = NULL;
	GdkDisplay* _tmp0_;
	GdkDisplay* _tmp1_;
	GdkDisplay* _tmp2_;
	GtkCssProvider* _tmp3_;
	const gchar* _tmp6_ = NULL;
	gint _tmp7_;
	gint _tmp8_;
	gchar* color = NULL;
	gchar* _tmp9_;
	GdkRGBA rgba = {0};
	const gchar* _tmp10_;
	gchar* rule = NULL;
	gchar* css = NULL;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	GtkCssProvider* _tmp32_;
	GtkCssProvider* _tmp33_;
	const gchar* _tmp34_;
	GdkDisplay* _tmp35_;
	GtkCssProvider* _tmp36_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (hex != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	display = _tmp1_;
	_tmp2_ = display;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (display);
		return;
	}
	_tmp3_ = self->priv->background_provider;
	if (_tmp3_ != NULL) {
		GdkDisplay* _tmp4_;
		GtkCssProvider* _tmp5_;
		_tmp4_ = display;
		_tmp5_ = self->priv->background_provider;
		gtk_style_context_remove_provider_for_display (_tmp4_, (GtkStyleProvider*) _tmp5_);
		_g_object_unref0 (self->priv->background_provider);
		self->priv->background_provider = NULL;
	}
	if (mode == DC_BACKGROUND_MODE_SYSTEM) {
		_g_object_unref0 (display);
		return;
	}
	_tmp7_ = strlen (hex);
	_tmp8_ = _tmp7_;
	if (_tmp8_ > 0) {
		_tmp6_ = hex;
	} else {
		_tmp6_ = "#3584e4";
	}
	_tmp9_ = g_strdup (_tmp6_);
	color = _tmp9_;
	memset (&rgba, 0, sizeof (GdkRGBA));
	_tmp10_ = color;
	if (!gdk_rgba_parse (&rgba, _tmp10_)) {
		_g_free0 (color);
		_g_object_unref0 (display);
		return;
	}
	if (mode == DC_BACKGROUND_MODE_GRADIENT) {
		const gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		_tmp11_ = color;
		_tmp12_ = g_strconcat ("background-image: linear-gradient(to bottom, ", _tmp11_, NULL);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_strconcat (_tmp13_, ", @window_bg_color);", NULL);
		_g_free0 (rule);
		rule = _tmp14_;
		_g_free0 (_tmp13_);
	} else {
		const gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		_tmp15_ = color;
		_tmp16_ = g_strconcat ("background-color: ", _tmp15_, NULL);
		_tmp17_ = _tmp16_;
		_tmp18_ = g_strconcat (_tmp17_, ";", NULL);
		_tmp19_ = _tmp18_;
		_tmp20_ = g_strconcat (_tmp19_, " background-image: none;", NULL);
		_g_free0 (rule);
		rule = _tmp20_;
		_g_free0 (_tmp19_);
		_g_free0 (_tmp17_);
	}
	_tmp21_ = rule;
	_tmp22_ = g_strconcat ("window.parla-custom-bg { ", _tmp21_, NULL);
	_tmp23_ = _tmp22_;
	_tmp24_ = g_strconcat (_tmp23_, " }\n", NULL);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_strconcat (_tmp25_, "window.parla-custom-bg .conversation-view scrolledwindow,\n", NULL);
	_tmp27_ = _tmp26_;
	_tmp28_ = g_strconcat (_tmp27_, "window.parla-custom-bg .conversation-view listview {", NULL);
	_tmp29_ = _tmp28_;
	_tmp30_ = g_strconcat (_tmp29_, " background-color: transparent; background-image: none; }\n", NULL);
	_tmp31_ = _tmp30_;
	_g_free0 (_tmp29_);
	_g_free0 (_tmp27_);
	_g_free0 (_tmp25_);
	_g_free0 (_tmp23_);
	css = _tmp31_;
	_tmp32_ = gtk_css_provider_new ();
	_g_object_unref0 (self->priv->background_provider);
	self->priv->background_provider = _tmp32_;
	_tmp33_ = self->priv->background_provider;
	_tmp34_ = css;
	gtk_css_provider_load_from_string (_tmp33_, _tmp34_);
	_tmp35_ = display;
	_tmp36_ = self->priv->background_provider;
	gtk_style_context_add_provider_for_display (_tmp35_, (GtkStyleProvider*) _tmp36_, (guint) (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1));
	_g_free0 (css);
	_g_free0 (rule);
	_g_free0 (color);
	_g_object_unref0 (display);
}

static void
dc_application_real_activate (GApplication* base)
{
	DcApplication * self;
	DcWindow* _tmp0_;
	DcWindow* _tmp1_;
	self = (DcApplication*) base;
	_tmp0_ = dc_application_get_or_create_window (self);
	_tmp1_ = _tmp0_;
	dc_window_restore_from_tray (_tmp1_);
	_g_object_unref0 (_tmp1_);
}

static DcWindow*
dc_application_get_or_create_window (DcApplication* self)
{
	GList* _tmp0_;
	DcWindow* _tmp5_;
	DcWindow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_application_get_windows ((GtkApplication*) self);
	{
		GList* win_collection = NULL;
		GList* win_it = NULL;
		win_collection = _tmp0_;
		for (win_it = win_collection; win_it != NULL; win_it = win_it->next) {
			GtkWindow* _tmp1_;
			GtkWindow* win = NULL;
			_tmp1_ = _g_object_ref0 ((GtkWindow*) win_it->data);
			win = _tmp1_;
			{
				GtkWindow* _tmp2_;
				_tmp2_ = win;
				if (DC_IS_WINDOW (_tmp2_)) {
					GtkWindow* _tmp3_;
					DcWindow* _tmp4_;
					_tmp3_ = win;
					_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, DC_TYPE_WINDOW, DcWindow));
					result = _tmp4_;
					_g_object_unref0 (win);
					return result;
				}
				_g_object_unref0 (win);
			}
		}
	}
	_tmp5_ = dc_window_new (self);
	g_object_ref_sink (_tmp5_);
	result = _tmp5_;
	return result;
}

static gint
dc_application_real_command_line (GApplication* base,
                                  GApplicationCommandLine* cmd)
{
	DcApplication * self;
	DcWindow* window = NULL;
	DcWindow* _tmp0_;
	DcWindow* _tmp1_;
	gint _tmp2_ = 0;
	gchar** _tmp3_;
	gint result;
	self = (DcApplication*) base;
	g_return_val_if_fail (cmd != NULL, -1);
	_tmp0_ = dc_application_get_or_create_window (self);
	window = _tmp0_;
	_tmp1_ = window;
	dc_window_restore_from_tray (_tmp1_);
	_tmp3_ = g_application_command_line_get_arguments (cmd, &_tmp2_);
	{
		gchar** arg_collection = NULL;
		gint arg_collection_length1 = 0;
		gint _arg_collection_size_ = 0;
		gint arg_it = 0;
		arg_collection = _tmp3_;
		arg_collection_length1 = _tmp2_;
		for (arg_it = 0; arg_it < arg_collection_length1; arg_it = arg_it + 1) {
			const gchar* arg = NULL;
			arg = arg_collection[arg_it];
			{
				const gchar* _tmp4_;
				_tmp4_ = arg;
				if (dc_is_delta_invite_uri (_tmp4_)) {
					DcWindow* _tmp5_;
					const gchar* _tmp6_;
					_tmp5_ = window;
					_tmp6_ = arg;
					dc_window_handle_invite_uri (_tmp5_, _tmp6_);
					break;
				}
			}
		}
		arg_collection = (_vala_array_free (arg_collection, arg_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	result = 0;
	_g_object_unref0 (window);
	return result;
}

static void
__lambda247_ (DcApplication* self,
              GVariant* param)
{
	gint acct_id = 0;
	gint chat_id = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	DcWindow* window = NULL;
	DcWindow* _tmp2_;
	DcWindow* _tmp3_;
	DcWindow* _tmp4_;
	if (param == NULL) {
		return;
	}
	acct_id = 0;
	chat_id = 0;
	g_variant_get (param, "(ii)", &_tmp0_, &_tmp1_, NULL);
	acct_id = _tmp0_;
	chat_id = _tmp1_;
	_tmp2_ = dc_application_get_or_create_window (self);
	window = _tmp2_;
	_tmp3_ = window;
	dc_window_restore_from_tray (_tmp3_);
	_tmp4_ = window;
	dc_window_open_chat_from_notification (_tmp4_, acct_id, chat_id, NULL, NULL);
	_g_object_unref0 (window);
}

static void
___lambda247__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda247_ ((DcApplication*) self, parameter);
}

static void
dc_application_real_startup (GApplication* base)
{
	DcApplication * self;
	DcSettingsManager* settings = NULL;
	DcSettingsManager* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	DcBackgroundMode _tmp3_;
	DcBackgroundMode _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	GSimpleAction* open_chat = NULL;
	GVariantType* _tmp7_;
	GVariantType* _tmp8_;
	GSimpleAction* _tmp9_;
	GSimpleAction* _tmp10_;
	gchar* primary = NULL;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar** _tmp13_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	gchar* _tmp15_;
	gchar** _tmp16_;
	gchar** _tmp17_;
	gint _tmp17__length1;
	gchar* _tmp18_;
	gchar** _tmp19_;
	gchar** _tmp20_;
	gint _tmp20__length1;
	gchar* _tmp21_;
	gchar** _tmp22_;
	gchar** _tmp23_;
	gint _tmp23__length1;
	self = (DcApplication*) base;
	G_APPLICATION_CLASS (dc_application_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_get_type (), AdwApplication));
	dc_application_load_css (self);
	_tmp0_ = dc_settings_manager_new ();
	settings = _tmp0_;
	dc_settings_manager_load (settings);
	_tmp1_ = dc_settings_manager_get_accent_color (settings);
	_tmp2_ = _tmp1_;
	dc_application_apply_accent_color (self, _tmp2_);
	_tmp3_ = dc_settings_manager_get_background_mode (settings);
	_tmp4_ = _tmp3_;
	_tmp5_ = dc_settings_manager_get_background_color (settings);
	_tmp6_ = _tmp5_;
	dc_application_apply_background (self, _tmp4_, _tmp6_);
	dc_application_register_icons (self);
	gtk_window_set_default_icon_name ("io.github.trufae.Parla");
	_tmp7_ = g_variant_type_new ("(ii)");
	_tmp8_ = _tmp7_;
	_tmp9_ = g_simple_action_new ("open-chat", _tmp8_);
	_tmp10_ = _tmp9_;
	_g_variant_type_free0 (_tmp8_);
	open_chat = _tmp10_;
	g_signal_connect_object (open_chat, "activate", (GCallback) ___lambda247__g_simple_action_activate, self, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) open_chat);
	_tmp11_ = dc_platform_primary_accelerator_prefix ();
	primary = _tmp11_;
	_tmp12_ = g_strconcat (primary, "n", NULL);
	_tmp13_ = g_new0 (gchar*, 1 + 1);
	_tmp13_[0] = _tmp12_;
	_tmp14_ = _tmp13_;
	_tmp14__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.new-chat", _tmp14_);
	_tmp14_ = (_vala_array_free (_tmp14_, _tmp14__length1, (GDestroyNotify) g_free), NULL);
	_tmp15_ = g_strconcat (primary, "r", NULL);
	_tmp16_ = g_new0 (gchar*, 1 + 1);
	_tmp16_[0] = _tmp15_;
	_tmp17_ = _tmp16_;
	_tmp17__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.refresh", _tmp17_);
	_tmp17_ = (_vala_array_free (_tmp17_, _tmp17__length1, (GDestroyNotify) g_free), NULL);
	_tmp18_ = g_strconcat (primary, "comma", NULL);
	_tmp19_ = g_new0 (gchar*, 1 + 1);
	_tmp19_[0] = _tmp18_;
	_tmp20_ = _tmp19_;
	_tmp20__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.settings", _tmp20_);
	_tmp20_ = (_vala_array_free (_tmp20_, _tmp20__length1, (GDestroyNotify) g_free), NULL);
	_tmp21_ = g_strconcat (primary, "q", NULL);
	_tmp22_ = g_new0 (gchar*, 1 + 1);
	_tmp22_[0] = _tmp21_;
	_tmp23_ = _tmp22_;
	_tmp23__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.quit", _tmp23_);
	_tmp23_ = (_vala_array_free (_tmp23_, _tmp23__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (primary);
	_g_object_unref0 (open_chat);
	_g_object_unref0 (settings);
}

static void
dc_application_register_icons (DcApplication* self)
{
	GtkIconTheme* theme = NULL;
	GdkDisplay* _tmp0_;
	GtkIconTheme* _tmp1_;
	GtkIconTheme* _tmp2_;
	GtkIconTheme* _tmp3_;
	gchar* exe_path = NULL;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gtk_icon_theme_get_for_display (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	theme = _tmp2_;
	_tmp3_ = theme;
	gtk_icon_theme_add_resource_path (_tmp3_, "/io/github/trufae/Parla/icons");
	_tmp4_ = dc_platform_get_executable_path ();
	exe_path = _tmp4_;
	_tmp5_ = exe_path;
	if (_tmp5_ != NULL) {
		GFile* exe_dir = NULL;
		const gchar* _tmp6_;
		GFile* _tmp7_;
		GFile* _tmp8_;
		GFile* _tmp9_;
		GFile* _tmp10_;
		GFile* project_icons = NULL;
		GFile* _tmp11_;
		GFile* _tmp12_;
		GFile* _tmp13_;
		GFile* _tmp14_;
		GFile* _tmp15_;
		GFile* _tmp16_;
		GFile* _tmp17_;
		GFile* _tmp18_;
		_tmp6_ = exe_path;
		_tmp7_ = g_file_new_for_path (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_file_get_parent (_tmp8_);
		_tmp10_ = _tmp9_;
		_g_object_unref0 (_tmp8_);
		exe_dir = _tmp10_;
		_tmp11_ = exe_dir;
		_tmp12_ = g_file_get_parent (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_file_get_child (_tmp13_, "data");
		_tmp15_ = _tmp14_;
		_tmp16_ = g_file_get_child (_tmp15_, "icons");
		_tmp17_ = _tmp16_;
		_g_object_unref0 (_tmp15_);
		_g_object_unref0 (_tmp13_);
		project_icons = _tmp17_;
		_tmp18_ = project_icons;
		if (g_file_query_exists (_tmp18_, NULL)) {
			GtkIconTheme* _tmp19_;
			GFile* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			_tmp19_ = theme;
			_tmp20_ = project_icons;
			_tmp21_ = g_file_get_path (_tmp20_);
			_tmp22_ = _tmp21_;
			gtk_icon_theme_add_search_path (_tmp19_, _tmp22_);
			_g_free0 (_tmp22_);
		}
		_g_object_unref0 (project_icons);
		_g_object_unref0 (exe_dir);
	}
	_g_free0 (exe_path);
	_g_object_unref0 (theme);
}

static void
dc_application_load_css (DcApplication* self)
{
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp0_;
	GdkDisplay* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_css_provider_new ();
	provider = _tmp0_;
	gtk_css_provider_load_from_string (provider, DC_APPLICATION_CSS);
	_tmp1_ = gdk_display_get_default ();
	gtk_style_context_add_provider_for_display (_tmp1_, (GtkStyleProvider*) provider, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_g_object_unref0 (provider);
}

DcRpcClient*
dc_application_get_rpc (DcApplication* self)
{
	DcRpcClient* result;
	DcRpcClient* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_rpc;
	result = _tmp0_;
	return result;
}

static void
dc_application_set_rpc (DcApplication* self,
                        DcRpcClient* value)
{
	DcRpcClient* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_application_get_rpc (self);
	if (old_value != value) {
		DcRpcClient* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_rpc);
		self->priv->_rpc = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_application_properties[DC_APPLICATION_RPC_PROPERTY]);
	}
}

static GObject *
dc_application_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DcApplication * self;
	DcRpcClient* _tmp0_;
	DcRpcClient* _tmp1_;
	parent_class = G_OBJECT_CLASS (dc_application_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_APPLICATION, DcApplication);
	_tmp0_ = dc_rpc_client_new ();
	_tmp1_ = _tmp0_;
	dc_application_set_rpc (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	return obj;
}

static void
dc_application_class_init (DcApplicationClass * klass,
                           gpointer klass_data)
{
	dc_application_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcApplication_private_offset);
	((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) dc_application_real_activate;
	((GApplicationClass *) klass)->command_line = (gint (*) (GApplication*, GApplicationCommandLine*)) dc_application_real_command_line;
	((GApplicationClass *) klass)->startup = (void (*) (GApplication*)) dc_application_real_startup;
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_application_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_application_set_property;
	G_OBJECT_CLASS (klass)->constructor = dc_application_constructor;
	G_OBJECT_CLASS (klass)->finalize = dc_application_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_APPLICATION_RPC_PROPERTY, dc_application_properties[DC_APPLICATION_RPC_PROPERTY] = g_param_spec_object ("rpc", "rpc", "rpc", DC_TYPE_RPC_CLIENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dc_application_instance_init (DcApplication * self,
                              gpointer klass)
{
	self->priv = dc_application_get_instance_private (self);
	self->priv->accent_provider = NULL;
	self->priv->background_provider = NULL;
}

static void
dc_application_finalize (GObject * obj)
{
	DcApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_APPLICATION, DcApplication);
	_g_object_unref0 (self->priv->_rpc);
	_g_object_unref0 (self->priv->accent_provider);
	_g_object_unref0 (self->priv->background_provider);
	G_OBJECT_CLASS (dc_application_parent_class)->finalize (obj);
}

static GType
dc_application_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcApplication), 0, (GInstanceInitFunc) dc_application_instance_init, NULL };
	GType dc_application_type_id;
	dc_application_type_id = g_type_register_static (adw_application_get_type (), "DcApplication", &g_define_type_info, 0);
	DcApplication_private_offset = g_type_add_instance_private (dc_application_type_id, sizeof (DcApplicationPrivate));
	return dc_application_type_id;
}

GType
dc_application_get_type (void)
{
	static volatile gsize dc_application_type_id__once = 0;
	if (g_once_init_enter (&dc_application_type_id__once)) {
		GType dc_application_type_id;
		dc_application_type_id = dc_application_get_type_once ();
		g_once_init_leave (&dc_application_type_id__once, dc_application_type_id);
	}
	return dc_application_type_id__once;
}

static void
_vala_dc_application_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	DcApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_APPLICATION, DcApplication);
	switch (property_id) {
		case DC_APPLICATION_RPC_PROPERTY:
		g_value_set_object (value, dc_application_get_rpc (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_application_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	DcApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_APPLICATION, DcApplication);
	switch (property_id) {
		case DC_APPLICATION_RPC_PROPERTY:
		dc_application_set_rpc (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

