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

#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <adwaita.h>
#include <glib-object.h>
#include <gio/gio.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" \
"            /* Incoming message that mentions you: half-accent tint pl" \
"us an\n" \
"               accent edge. Declared after .incoming so it wins on equ" \
"al\n" \
"               specificity. */\n" \
"            .message-bubble.incoming.mentions-me {\n" \
"                background-color: alpha(@accent_bg_color, 0.22);\n" \
"                box-shadow: inset 2px 0 0 0 @accent_bg_color;\n" \
"            }\n" \
"            .message-irc.mentions-me,\n" \
"            .message-workspace.mentions-me {\n" \
"                background-color: alpha(@accent_bg_color, 0.16);\n" \
"                box-shadow: inset 2px 0 0 0 @accent_bg_color;\n" \
"                border-radius: 4px;\n" \
"            }\n" \
"            .message-avatar {\n" \
"                margin-bottom: 1px;\n" \
"            }\n" \
"            .presence-avatar-ring {\n" \
"                padding: 2px;\n" \
"                border-radius: 9999px;\n" \
"                border: 2px solid #2ec27e;\n" \
"                background-color: alpha(#2ec27e, 0.16);\n" \
"                box-shadow:\n" \
"                    0 0 0 2px alpha(#2ec27e, 0.14),\n" \
"                    0 0 10px alpha(#2ec27e, 0.48);\n" \
"            }\n" \
"            .presence-avatar-ring-small {\n" \
"                padding: 1px;\n" \
"                border-width: 1px;\n" \
"                box-shadow:\n" \
"                    0 0 0 1px alpha(#2ec27e, 0.18),\n" \
"                    0 0 8px alpha(#2ec27e, 0.52);\n" \
"            }\n" \
"            .list-presence-avatar-ring {\n" \
"                margin-left: -4px;\n" \
"            }\n" \
"            .message-sender {\n" \
"                font-weight: bold;\n" \
"                font-size: small;\n" \
"                color: @view_fg_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-medium-emoji {\n" \
"                font-size: 300%;\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-workspace {\n" \
"                padding: 3px 6px;\n" \
"                border-radius: 6px;\n" \
"            }\n" \
"            .message-workspace:hover {\n" \
"                background-color: alpha(@view_fg_color, 0.06);\n" \
"            }\n" \
"            .message-workspace .message-sender {\n" \
"                font-size: inherit;\n" \
"            }\n" \
"            .message-workspace .message-time {\n" \
"                margin-top: 0;\n" \
"            }\n" \
"            /* Quick actions floated over a hovered Workspace row. Kep" \
"t\n" \
"               compact so the bar fits even a grouped one-line row. */" \
"\n" \
"            .message-actions-bar {\n" \
"                padding: 0 1px;\n" \
"                border-radius: 8px;\n" \
"                background-color: @view_bg_color;\n" \
"                box-shadow: 0 1px 4px alpha(black, 0.3);\n" \
"            }\n" \
"            .message-actions-bar > button {\n" \
"                min-width: 20px;\n" \
"                min-height: 20px;\n" \
"                padding: 2px 5px;\n" \
"            }\n" \
"            .message-attachment { padding: 4px 0; }\n" \
"            .webxdc-card {\n" \
"                background: alpha(@accent_bg_color, 0.12);\n" \
"                border: 1px solid alpha(@accent_bg_color, 0.4);\n" \
"                border-radius: 12px;\n" \
"                padding: 10px 14px;\n" \
"            }\n" \
"            .webxdc-card:hover {\n" \
"                background: alpha(@accent_bg_color, 0.22);\n" \
"            }\n" \
"            .webxdc-card-icon {\n" \
"                border-radius: 10px;\n" \
"                color: @accent_bg_color;\n" \
"            }\n" \
"            .webxdc-card-title { font-weight: bold; font-size: 1.05em;" \
" }\n" \
"            .webxdc-card-subtitle { font-size: 0.85em; opacity: 0.75; " \
"}\n" \
"            .message-transcription {\n" \
"                /* Relative so it tracks the conversation font-size se" \
"tting;\n" \
"                   absolute keywords like \"small\" ignore the inherit" \
"ed size. */\n" \
"                font-size: 85%;\n" \
"                opacity: 0.85;\n" \
"            }\n" \
"            .message-transcribe-button {\n" \
"                min-width: 20px;\n" \
"                min-height: 20px;\n" \
"                padding: 2px 6px;\n" \
"                font-weight: bold;\n" \
"            }\n" \
"            .message-full-text-button {\n" \
"                font-size: small;\n" \
"                padding: 2px 0;\n" \
"            }\n" \
"            .message-full-text-status {\n" \
"                font-size: small;\n" \
"                opacity: 0.65;\n" \
"            }\n" \
"            .markdown-table {\n" \
"                margin-top: 4px;\n" \
"                margin-bottom: 4px;\n" \
"                border-radius: 6px;\n" \
"                background-color: alpha(@view_fg_color, 0.04);\n" \
"            }\n" \
"            .markdown-table-cell {\n" \
"                padding: 4px 6px;\n" \
"                border-bottom: 1px solid alpha(@view_fg_color, 0.12);\n" \
"                border-right: 1px solid alpha(@view_fg_color, 0.10);\n" \
"            }\n" \
"            .markdown-table-header {\n" \
"                font-weight: bold;\n" \
"                background-color: alpha(@view_fg_color, 0.06);\n" \
"            }\n" \
"            .markdown-task-line {\n" \
"                margin-top: 1px;\n" \
"                margin-bottom: 1px;\n" \
"            }\n" \
"            .markdown-task-toggle {\n" \
"                min-width: 20px;\n" \
"                min-height: 20px;\n" \
"                padding: 0;\n" \
"                margin: 0;\n" \
"                font-size: inherit;\n" \
"            }\n" \
"            .markdown-task-glyph {\n" \
"                min-width: 20px;\n" \
"                opacity: 0.9;\n" \
"            }\n" \
"            .message-image { border-radius: 12px; margin-top: 4px; }\n" \
"            .message-sticker { margin-top: 4px; }\n" \
"            .message-bubble.sticker.incoming,\n" \
"            .message-bubble.sticker.outgoing {\n" \
"                background-color: transparent;\n" \
"                padding: 4px 0;\n" \
"            }\n" \
"            .message-video-frame {\n" \
"                border-radius: 12px;\n" \
"                margin-top: 4px;\n" \
"                background-color: alpha(black, 0.72);\n" \
"            }\n" \
"            .message-video-bg {\n" \
"                background-color: alpha(black, 0.72);\n" \
"            }\n" \
"            .message-video-play {\n" \
"                min-width: 36px;\n" \
"                min-height: 36px;\n" \
"                border-radius: 9999px;\n" \
"                background-color: alpha(black, 0.48);\n" \
"                color: white;\n" \
"            }\n" \
"            .message-video-name {\n" \
"                color: white;\n" \
"                font-size: small;\n" \
"                padding: 2px 6px;\n" \
"                border-radius: 6px;\n" \
"                background-color: alpha(black, 0.45);\n" \
"                text-shadow: 0 1px alpha(black, 0.55);\n" \
"            }\n" \
"            .image-viewer-overlay {\n" \
"                background-color: alpha(black, 0.75);\n" \
"            }\n" \
"            .gallery-grid {\n" \
"                padding: 6px;\n" \
"            }\n" \
"            .gallery-grid > child {\n" \
"                margin: 2px;\n" \
"            }\n" \
"            .gallery-thumb {\n" \
"                border-radius: 10px;\n" \
"                background-color: alpha(currentColor, 0.08);\n" \
"            }\n" \
"            .gallery-thumb-checker {\n" \
"                background-image:\n" \
"                    linear-gradient(45deg, alpha(currentColor, 0.10) 2" \
"5%,\n" \
"                        transparent 25%, transparent 75%,\n" \
"                        alpha(currentColor, 0.10) 75%),\n" \
"                    linear-gradient(45deg, alpha(currentColor, 0.10) 2" \
"5%,\n" \
"                        transparent 25%, transparent 75%,\n" \
"                        alpha(currentColor, 0.10) 75%);\n" \
"                background-size: 16px 16px;\n" \
"                background-position: 0 0, 8px 8px;\n" \
"            }\n" \
"            .gallery-list > row {\n" \
"                border-radius: 8px;\n" \
"            }\n" \
"            /* Remove spare width so the gallery tabs fit narrow dialo" \
"gs. */\n" \
"            .gallery-tabs button {\n" \
"                min-width: 0;\n" \
"                padding-left: 3px;\n" \
"                padding-right: 3px;\n" \
"            }\n" \
"            /* Match the \"More\" button to the adjacent view-switcher" \
" tabs. */\n" \
"            .gallery-more > button {\n" \
"                min-height: 0;\n" \
"                padding: 4px 6px;\n" \
"                border-radius: 9px;\n" \
"            }\n" \
"            .gallery-more-active > button {\n" \
"                background: alpha(currentColor, 0.1);\n" \
"            }\n" \
"            .compose-bar { border-top: none; }\n" \
"            .selection-action-bar {\n" \
"                padding: 4px 8px;\n" \
"            }\n" \
"            .compose-entry {\n" \
"                border-radius: 18px;\n" \
"                transition: background-color 120ms ease-out, box-shado" \
"w 120ms ease-out;\n" \
"            }\n" \
"            .compose-entry-active {\n" \
"                background-color: alpha(@accent_bg_color, 0.10);\n" \
"                box-shadow: inset 0 0 0 2px alpha(@accent_bg_color, 0." \
"70);\n" \
"            }\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-mention {\n" \
"                background-color: alpha(@accent_bg_color, 0.16);\n" \
"            }\n" \
"            .mention-marker {\n" \
"                color: @accent_bg_color;\n" \
"                font-weight: bold;\n" \
"            }\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-select-check {\n" \
"                margin-left: 2px;\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: 0.85em;\n" \
"                font-weight: bold;\n" \
"                color: @accent_color;\n" \
"            }\n" \
"            .quote-text {\n" \
"                font-size: 0.85em;\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: 0.85em;\n" \
"                opacity: 0.8;\n" \
"            }\n" \
"            .compose-entry-scroll scrollbar slider {\n" \
"                min-height: 16px;\n" \
"            }\n" \
"            .long-message-bar {\n" \
"                padding: 4px 8px;\n" \
"                margin-bottom: 4px;\n" \
"                border-left: 3px solid @warning_bg_color;\n" \
"                background-color: alpha(@warning_bg_color, 0.12);\n" \
"                border-radius: 4px;\n" \
"            }\n" \
"            .long-message-label {\n" \
"                font-size: 0.85em;\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" \
"            .webxdc-bar {\n" \
"                background-color: alpha(@accent_bg_color, 0.08);\n" \
"                border-bottom: 1px solid alpha(@view_fg_color, 0.12);\n" \
"            }\n" \
"            .conversation-media-bar {\n" \
"                background-color: alpha(@accent_bg_color, 0.14);\n" \
"                border-bottom: 1px solid alpha(@view_fg_color, 0.16);\n" \
"            }\n" \
"            .conversation-media-sender {\n" \
"                font-weight: bold;\n" \
"                font-size: small;\n" \
"            }\n" \
"            .conversation-media-sent {\n" \
"                font-size: x-small;\n" \
"                opacity: 0.62;\n" \
"            }\n" \
"            .conversation-media-time {\n" \
"                font-family: monospace;\n" \
"                font-size: small;\n" \
"                opacity: 0.78;\n" \
"            }\n" \
"            dropdown.conversation-media-speed button {\n" \
"                min-height: 24px;\n" \
"                padding: 2px 6px;\n" \
"            }\n" \
"            scale.conversation-media-progress {\n" \
"                padding: 0;\n" \
"                margin: 0;\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" \
"            }\n" \
"            .message-tick-failed {\n" \
"                font-size: small;\n" \
"                color: @error_color;\n" \
"                opacity: 1;\n" \
"                margin-left: 2px;\n" \
"            }\n" \
"            .message-pin {\n" \
"                font-size: small;\n" \
"                margin-left: 2px;\n" \
"            }\n" \
"            .reaction-bar {\n" \
"                margin-top: 2px;\n" \
"            }\n" \
"            button.reaction-badge {\n" \
"                min-height: 22px;\n" \
"                min-width: 0;\n" \
"                padding: 1px 8px;\n" \
"                border-radius: 9999px;\n" \
"                background-color: alpha(@view_fg_color, 0.10);\n" \
"                color: @view_fg_color;\n" \
"            }\n" \
"            button.reaction-badge:hover {\n" \
"                background-color: alpha(@accent_bg_color, 0.22);\n" \
"            }\n" \
"            .reaction-users-pill {\n" \
"                padding: 7px 10px;\n" \
"                border-radius: 18px;\n" \
"                background-color: alpha(@view_fg_color, 0.88);\n" \
"                color: @view_bg_color;\n" \
"                box-shadow: 0 2px 8px alpha(@view_fg_color, 0.25);\n" \
"            }\n" \
"            .reaction-user-row {\n" \
"                min-height: 24px;\n" \
"            }\n" \
"            .reaction-user-name {\n" \
"                font-size: small;\n" \
"            }\n" \
"            .message-details-sender {\n" \
"                padding: 8px;\n" \
"                border-radius: 8px;\n" \
"            }\n" \
"            .message-details-edit-view {\n" \
"                background-color: alpha(@view_fg_color, 0.04);\n" \
"                border-radius: 8px;\n" \
"            }\n" \
"            .message-details-reaction-emoji {\n" \
"                font-size: 1.4em;\n" \
"                min-width: 36px;\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" \
"            /* Destructive entry in a flat popover menu. Uses the red " \
"text\n" \
"               color (not @destructive_fg_color, which is white and me" \
"ant for\n" \
"               a solid red button \342\200\224 on a flat item that lea" \
"ves white text). */\n" \
"            .menu-destructive {\n" \
"                color: @destructive_color;\n" \
"            }\n" \
"        "
#define DC_FONT_SIZE_SYSTEM 0
#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;
typedef enum  {
	DC_BACKGROUND_MODE_SYSTEM = 0,
	DC_BACKGROUND_MODE_SOLID = 1,
	DC_BACKGROUND_MODE_GRADIENT = 2
} DcBackgroundMode;

#define DC_TYPE_BACKGROUND_MODE (dc_background_mode_get_type ())
typedef enum  {
	DC_THEME_OVERRIDE_SYSTEM = 0,
	DC_THEME_OVERRIDE_LIGHT = 1,
	DC_THEME_OVERRIDE_DARK = 2
} DcThemeOverride;

#define DC_TYPE_THEME_OVERRIDE (dc_theme_override_get_type ())
enum  {
	DC_APPLICATION_0_PROPERTY,
	DC_APPLICATION_RPC_PROPERTY,
	DC_APPLICATION_BACKGROUND_MODE_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_FONT_ATTRIBUTE_REGULAR = 0,
	DC_FONT_ATTRIBUTE_ITALIC = 1,
	DC_FONT_ATTRIBUTE_BOLD = 2,
	DC_FONT_ATTRIBUTE_BOLD_ITALIC = 3
} DcFontAttribute;

#define DC_TYPE_FONT_ATTRIBUTE (dc_font_attribute_get_type ())
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#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 _g_variant_dict_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_dict_unref (var), NULL)))

#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;
	gboolean _background_mode;
	GtkCssProvider* accent_provider;
	GtkCssProvider* link_provider;
	gchar* current_accent_hex;
	gboolean accent_applied;
	GtkCssProvider* background_provider;
	gboolean background_applied;
	DcBackgroundMode current_background_mode;
	gchar* current_background_hex;
	GtkCssProvider* font_provider;
	gboolean font_applied;
	gchar* current_font_css;
	gboolean theme_override_applied;
	DcThemeOverride current_theme_override;
};

static gint DcApplication_private_offset;
static gpointer dc_application_parent_class = NULL;

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 GType dc_background_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType dc_theme_override_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcApplication* dc_application_new (void);
VALA_EXTERN DcApplication* dc_application_construct (GType object_type);
VALA_EXTERN void dc_application_apply_theme_override (DcApplication* self,
                                          DcThemeOverride theme);
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 void dc_mentions_set_accent (const gchar* hex);
VALA_EXTERN void dc_application_apply_link_colors (DcApplication* self);
static gdouble dc_application_rgba_luma (GdkRGBA* c);
VALA_EXTERN void dc_application_apply_background (DcApplication* self,
                                      DcBackgroundMode mode,
                                      const gchar* hex);
VALA_EXTERN GType dc_font_attribute_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void dc_application_apply_font (DcApplication* self,
                                const gchar* family,
                                DcFontAttribute attr,
                                gint size);
VALA_EXTERN gint dc_settings_manager_clamp_font_size (gint size);
static gchar* dc_application_css_string (const gchar* value);
VALA_EXTERN gchar* dc_font_attribute_css_style (DcFontAttribute self);
VALA_EXTERN gchar* dc_font_attribute_css_weight (DcFontAttribute self);
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 gboolean dc_platform_supports_background_mode (void);
static void dc_application_enter_background_mode (DcApplication* self);
VALA_EXTERN void dc_window_handle_invite_uri (DcWindow* self,
                                  const gchar* uri);
VALA_EXTERN gboolean dc_application_get_background_mode (DcApplication* self);
static void dc_application_set_background_mode (DcApplication* self,
                                         gboolean value);
static void dc_application_real_open (GApplication* base,
                               GFile** files,
                               gint files_length1,
                               const gchar* hint);
static gchar* dc_application_repair_dbus_open_uri (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 DcThemeOverride dc_settings_manager_get_theme_override (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_accent_color (DcSettingsManager* self);
static void __lambda440_ (DcApplication* self);
static void ___lambda440__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN DcBackgroundMode dc_settings_manager_get_background_mode (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_background_color (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_font_family (DcSettingsManager* self);
VALA_EXTERN DcFontAttribute dc_settings_manager_get_font_attribute (DcSettingsManager* self);
VALA_EXTERN gint dc_settings_manager_get_font_size (DcSettingsManager* self);
static void dc_application_register_icons (DcApplication* self);
static void __lambda441_ (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 ___lambda441__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);
VALA_EXTERN void dc_icon_fallback_install (GtkIconTheme* theme);
VALA_EXTERN gboolean dc_platform_is_macos (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 | G_APPLICATION_HANDLES_OPEN, NULL);
	return self;
}

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

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

void
dc_application_apply_theme_override (DcApplication* self,
                                     DcThemeOverride theme)
{
	gboolean _tmp0_ = FALSE;
	AdwStyleManager* style = NULL;
	AdwStyleManager* _tmp1_;
	AdwStyleManager* _tmp2_;
	g_return_if_fail (self != NULL);
	if (self->priv->theme_override_applied) {
		_tmp0_ = self->priv->current_theme_override == theme;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	_tmp1_ = adw_style_manager_get_default ();
	_tmp2_ = _g_object_ref0 (_tmp1_);
	style = _tmp2_;
	switch (theme) {
		case DC_THEME_OVERRIDE_LIGHT:
		{
			AdwStyleManager* _tmp3_;
			_tmp3_ = style;
			adw_style_manager_set_color_scheme (_tmp3_, ADW_COLOR_SCHEME_FORCE_LIGHT);
			break;
		}
		case DC_THEME_OVERRIDE_DARK:
		{
			AdwStyleManager* _tmp4_;
			_tmp4_ = style;
			adw_style_manager_set_color_scheme (_tmp4_, ADW_COLOR_SCHEME_FORCE_DARK);
			break;
		}
		default:
		case DC_THEME_OVERRIDE_SYSTEM:
		{
			AdwStyleManager* _tmp5_;
			_tmp5_ = style;
			adw_style_manager_set_color_scheme (_tmp5_, ADW_COLOR_SCHEME_DEFAULT);
			break;
		}
	}
	self->priv->current_theme_override = theme;
	self->priv->theme_override_applied = TRUE;
	_g_object_unref0 (style);
}

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

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

static gdouble
dc_application_rgba_luma (GdkRGBA* c)
{
	GdkRGBA _tmp0_;
	GdkRGBA _tmp1_;
	GdkRGBA _tmp2_;
	gdouble result;
	g_return_val_if_fail (c != NULL, -1.0);
	_tmp0_ = *c;
	_tmp1_ = *c;
	_tmp2_ = *c;
	result = ((0.299 * _tmp0_.red) + (0.587 * _tmp1_.green)) + (0.114 * _tmp2_.blue);
	return result;
}

void
dc_application_apply_link_colors (DcApplication* self)
{
	GdkDisplay* display = NULL;
	GdkDisplay* _tmp0_;
	GdkDisplay* _tmp1_;
	GdkDisplay* _tmp2_;
	AdwStyleManager* style = NULL;
	AdwStyleManager* _tmp3_;
	AdwStyleManager* _tmp4_;
	gboolean dark = FALSE;
	AdwStyleManager* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	GdkRGBA accent = {0};
	gboolean _tmp8_ = FALSE;
	const gchar* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gdouble _tmp13_ = 0.0;
	gdouble bg = 0.0;
	GdkRGBA out_bubble = {0};
	GdkRGBA _tmp14_;
	GdkRGBA _tmp15_;
	GdkRGBA _tmp16_;
	const gchar* _tmp17_ = NULL;
	gchar* incoming = NULL;
	gchar* _tmp18_;
	const gchar* _tmp19_ = NULL;
	GdkRGBA _tmp20_;
	gchar* outgoing = NULL;
	gchar* _tmp21_;
	GtkCssProvider* _tmp22_;
	gchar* css = NULL;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	GtkCssProvider* _tmp47_;
	GtkCssProvider* _tmp48_;
	const gchar* _tmp49_;
	GdkDisplay* _tmp50_;
	GtkCssProvider* _tmp51_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	display = _tmp1_;
	_tmp2_ = display;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (display);
		return;
	}
	_tmp3_ = adw_style_manager_get_default ();
	_tmp4_ = _g_object_ref0 (_tmp3_);
	style = _tmp4_;
	_tmp5_ = style;
	_tmp6_ = adw_style_manager_get_dark (_tmp5_);
	_tmp7_ = _tmp6_;
	dark = _tmp7_;
	memset (&accent, 0, sizeof (GdkRGBA));
	_tmp9_ = self->priv->current_accent_hex;
	_tmp10_ = strlen (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_ == 0) {
		_tmp8_ = TRUE;
	} else {
		const gchar* _tmp12_;
		_tmp12_ = self->priv->current_accent_hex;
		_tmp8_ = !gdk_rgba_parse (&accent, _tmp12_);
	}
	if (_tmp8_) {
		gdk_rgba_parse (&accent, "#3584e4");
	}
	if (dark) {
		_tmp13_ = 0.118;
	} else {
		_tmp13_ = 1.0;
	}
	bg = _tmp13_;
	memset (&out_bubble, 0, sizeof (GdkRGBA));
	_tmp14_ = accent;
	out_bubble.red = (gfloat) ((0.5 * _tmp14_.red) + (0.5 * bg));
	_tmp15_ = accent;
	out_bubble.green = (gfloat) ((0.5 * _tmp15_.green) + (0.5 * bg));
	_tmp16_ = accent;
	out_bubble.blue = (gfloat) ((0.5 * _tmp16_.blue) + (0.5 * bg));
	out_bubble.alpha = 1.0f;
	if (dark) {
		_tmp17_ = "#78aeed";
	} else {
		_tmp17_ = "#1c71d8";
	}
	_tmp18_ = g_strdup (_tmp17_);
	incoming = _tmp18_;
	_tmp20_ = out_bubble;
	if (dc_application_rgba_luma (&_tmp20_) > 0.5) {
		_tmp19_ = "#0b3f7e";
	} else {
		_tmp19_ = "#b8d4ff";
	}
	_tmp21_ = g_strdup (_tmp19_);
	outgoing = _tmp21_;
	_tmp22_ = self->priv->link_provider;
	if (_tmp22_ != NULL) {
		GdkDisplay* _tmp23_;
		GtkCssProvider* _tmp24_;
		_tmp23_ = display;
		_tmp24_ = self->priv->link_provider;
		gtk_style_context_remove_provider_for_display (_tmp23_, (GtkStyleProvider*) _tmp24_);
		_g_object_unref0 (self->priv->link_provider);
		self->priv->link_provider = NULL;
	}
	_tmp25_ = incoming;
	_tmp26_ = g_strconcat ("@define-color parla_link_in_color ", _tmp25_, NULL);
	_tmp27_ = _tmp26_;
	_tmp28_ = g_strconcat (_tmp27_, ";\n", NULL);
	_tmp29_ = _tmp28_;
	_tmp30_ = g_strconcat (_tmp29_, "@define-color parla_link_out_color ", NULL);
	_tmp31_ = _tmp30_;
	_tmp32_ = outgoing;
	_tmp33_ = g_strconcat (_tmp31_, _tmp32_, NULL);
	_tmp34_ = _tmp33_;
	_tmp35_ = g_strconcat (_tmp34_, ";\n", NULL);
	_tmp36_ = _tmp35_;
	_tmp37_ = g_strconcat (_tmp36_, ".message-bubble label link,\n", NULL);
	_tmp38_ = _tmp37_;
	_tmp39_ = g_strconcat (_tmp38_, ".message-workspace label link,\n", NULL);
	_tmp40_ = _tmp39_;
	_tmp41_ = g_strconcat (_tmp40_, ".message-irc label link { color: @parla_link_in_color; }\n", NULL);
	_tmp42_ = _tmp41_;
	_tmp43_ = g_strconcat (_tmp42_, ".message-bubble.outgoing label link {", NULL);
	_tmp44_ = _tmp43_;
	_tmp45_ = g_strconcat (_tmp44_, " color: @parla_link_out_color; }\n", NULL);
	_tmp46_ = _tmp45_;
	_g_free0 (_tmp44_);
	_g_free0 (_tmp42_);
	_g_free0 (_tmp40_);
	_g_free0 (_tmp38_);
	_g_free0 (_tmp36_);
	_g_free0 (_tmp34_);
	_g_free0 (_tmp31_);
	_g_free0 (_tmp29_);
	_g_free0 (_tmp27_);
	css = _tmp46_;
	_tmp47_ = gtk_css_provider_new ();
	_g_object_unref0 (self->priv->link_provider);
	self->priv->link_provider = _tmp47_;
	_tmp48_ = self->priv->link_provider;
	_tmp49_ = css;
	gtk_css_provider_load_from_string (_tmp48_, _tmp49_);
	_tmp50_ = display;
	_tmp51_ = self->priv->link_provider;
	gtk_style_context_add_provider_for_display (_tmp50_, (GtkStyleProvider*) _tmp51_, (guint) (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1));
	_g_free0 (css);
	_g_free0 (outgoing);
	_g_free0 (incoming);
	_g_object_unref0 (style);
	_g_object_unref0 (display);
}

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

void
dc_application_apply_font (DcApplication* self,
                           const gchar* family,
                           DcFontAttribute attr,
                           gint size)
{
	gchar* clean_family = NULL;
	gchar* _tmp0_;
	gint clean_size = 0;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gboolean use_default = FALSE;
	gchar* css = NULL;
	gchar* _tmp6_;
	gboolean _tmp31_ = FALSE;
	GdkDisplay* display = NULL;
	GdkDisplay* _tmp34_;
	GdkDisplay* _tmp35_;
	GdkDisplay* _tmp36_;
	const gchar* _tmp48_;
	gchar* _tmp49_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (family != NULL);
	_tmp0_ = string_strip (family);
	clean_family = _tmp0_;
	clean_size = dc_settings_manager_clamp_font_size (size);
	_tmp3_ = clean_family;
	_tmp4_ = strlen (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == 0) {
		_tmp2_ = attr == DC_FONT_ATTRIBUTE_REGULAR;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = clean_size == DC_FONT_SIZE_SYSTEM;
	} else {
		_tmp1_ = FALSE;
	}
	use_default = _tmp1_;
	_tmp6_ = g_strdup ("");
	css = _tmp6_;
	if (!use_default) {
		GString* builder = NULL;
		GString* _tmp7_;
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		GString* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		GString* _tmp27_;
		GString* _tmp28_;
		const gchar* _tmp29_;
		gchar* _tmp30_;
		_tmp7_ = g_string_new (".conversation-view {");
		builder = _tmp7_;
		_tmp8_ = clean_family;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ > 0) {
			GString* _tmp11_;
			const gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			_tmp11_ = builder;
			_tmp12_ = clean_family;
			_tmp13_ = dc_application_css_string (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = g_strdup_printf (" font-family: \"%s\";", _tmp14_);
			_tmp16_ = _tmp15_;
			g_string_append (_tmp11_, _tmp16_);
			_g_free0 (_tmp16_);
			_g_free0 (_tmp14_);
		}
		_tmp17_ = builder;
		_tmp18_ = dc_font_attribute_css_style (attr);
		_tmp19_ = _tmp18_;
		_tmp20_ = dc_font_attribute_css_weight (attr);
		_tmp21_ = _tmp20_;
		_tmp22_ = g_strdup_printf (" font-style: %s; font-weight: %s;", _tmp19_, _tmp21_);
		_tmp23_ = _tmp22_;
		g_string_append (_tmp17_, _tmp23_);
		_g_free0 (_tmp23_);
		_g_free0 (_tmp21_);
		_g_free0 (_tmp19_);
		if (clean_size > DC_FONT_SIZE_SYSTEM) {
			GString* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			_tmp24_ = builder;
			_tmp25_ = g_strdup_printf (" font-size: %dpt;", clean_size);
			_tmp26_ = _tmp25_;
			g_string_append (_tmp24_, _tmp26_);
			_g_free0 (_tmp26_);
		}
		_tmp27_ = builder;
		g_string_append (_tmp27_, " }\n");
		_tmp28_ = builder;
		_tmp29_ = _tmp28_->str;
		_tmp30_ = g_strdup (_tmp29_);
		_g_free0 (css);
		css = _tmp30_;
		_g_string_free0 (builder);
	}
	if (self->priv->font_applied) {
		const gchar* _tmp32_;
		const gchar* _tmp33_;
		_tmp32_ = self->priv->current_font_css;
		_tmp33_ = css;
		_tmp31_ = g_strcmp0 (_tmp32_, _tmp33_) == 0;
	} else {
		_tmp31_ = FALSE;
	}
	if (_tmp31_) {
		_g_free0 (css);
		_g_free0 (clean_family);
		return;
	}
	_tmp34_ = gdk_display_get_default ();
	_tmp35_ = _g_object_ref0 (_tmp34_);
	display = _tmp35_;
	_tmp36_ = display;
	if (_tmp36_ == NULL) {
		_g_object_unref0 (display);
		_g_free0 (css);
		_g_free0 (clean_family);
		return;
	}
	if (use_default) {
		GtkCssProvider* _tmp37_;
		_tmp37_ = self->priv->font_provider;
		if (_tmp37_ != NULL) {
			GdkDisplay* _tmp38_;
			GtkCssProvider* _tmp39_;
			_tmp38_ = display;
			_tmp39_ = self->priv->font_provider;
			gtk_style_context_remove_provider_for_display (_tmp38_, (GtkStyleProvider*) _tmp39_);
			_g_object_unref0 (self->priv->font_provider);
			self->priv->font_provider = NULL;
		}
	} else {
		GtkCssProvider* _tmp40_;
		_tmp40_ = self->priv->font_provider;
		if (_tmp40_ == NULL) {
			GtkCssProvider* _tmp41_;
			GtkCssProvider* _tmp42_;
			const gchar* _tmp43_;
			GdkDisplay* _tmp44_;
			GtkCssProvider* _tmp45_;
			_tmp41_ = gtk_css_provider_new ();
			_g_object_unref0 (self->priv->font_provider);
			self->priv->font_provider = _tmp41_;
			_tmp42_ = self->priv->font_provider;
			_tmp43_ = css;
			gtk_css_provider_load_from_string (_tmp42_, _tmp43_);
			_tmp44_ = display;
			_tmp45_ = self->priv->font_provider;
			gtk_style_context_add_provider_for_display (_tmp44_, (GtkStyleProvider*) _tmp45_, (guint) (GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1));
		} else {
			GtkCssProvider* _tmp46_;
			const gchar* _tmp47_;
			_tmp46_ = self->priv->font_provider;
			_tmp47_ = css;
			gtk_css_provider_load_from_string (_tmp46_, _tmp47_);
		}
	}
	_tmp48_ = css;
	_tmp49_ = g_strdup (_tmp48_);
	_g_free0 (self->priv->current_font_css);
	self->priv->current_font_css = _tmp49_;
	self->priv->font_applied = TRUE;
	_g_object_unref0 (display);
	_g_free0 (css);
	_g_free0 (clean_family);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__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 gchar*
dc_application_css_string (const gchar* value)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = string_replace (value, "\\", "\\\\");
	_tmp1_ = _tmp0_;
	_tmp2_ = string_replace (_tmp1_, "\"", "\\\"");
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

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 gpointer
_g_variant_dict_ref0 (gpointer self)
{
	return self ? g_variant_dict_ref (self) : NULL;
}

static gint
dc_application_real_command_line (GApplication* base,
                                  GApplicationCommandLine* cmd)
{
	DcApplication * self;
	gchar* invite_uri = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_;
	GVariantDict* options = NULL;
	GVariantDict* _tmp5_;
	GVariantDict* _tmp6_;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	GVariantDict* _tmp10_;
	DcWindow* window = NULL;
	DcWindow* _tmp13_;
	DcWindow* _tmp14_;
	const gchar* _tmp15_;
	gint result;
	self = (DcApplication*) base;
	g_return_val_if_fail (cmd != NULL, -1);
	invite_uri = NULL;
	_tmp1_ = g_application_command_line_get_arguments (cmd, &_tmp0_);
	{
		gchar** arg_collection = NULL;
		gint arg_collection_length1 = 0;
		gint _arg_collection_size_ = 0;
		gint arg_it = 0;
		arg_collection = _tmp1_;
		arg_collection_length1 = _tmp0_;
		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* _tmp2_;
				_tmp2_ = arg;
				if (dc_is_delta_invite_uri (_tmp2_)) {
					const gchar* _tmp3_;
					gchar* _tmp4_;
					_tmp3_ = arg;
					_tmp4_ = g_strdup (_tmp3_);
					_g_free0 (invite_uri);
					invite_uri = _tmp4_;
					break;
				}
			}
		}
		arg_collection = (_vala_array_free (arg_collection, arg_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp5_ = g_application_command_line_get_options_dict (cmd);
	_tmp6_ = _g_variant_dict_ref0 (_tmp5_);
	options = _tmp6_;
	_tmp10_ = options;
	if (g_variant_dict_contains (_tmp10_, "background")) {
		GVariantDict* _tmp11_;
		_tmp11_ = options;
		_tmp9_ = !g_variant_dict_contains (_tmp11_, "show");
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		const gchar* _tmp12_;
		_tmp12_ = invite_uri;
		_tmp8_ = _tmp12_ == NULL;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		_tmp7_ = dc_platform_supports_background_mode ();
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		if (!g_application_command_line_get_is_remote (cmd)) {
			dc_application_enter_background_mode (self);
		}
		result = 0;
		_g_variant_dict_unref0 (options);
		_g_free0 (invite_uri);
		return result;
	}
	_tmp13_ = dc_application_get_or_create_window (self);
	window = _tmp13_;
	_tmp14_ = window;
	dc_window_restore_from_tray (_tmp14_);
	_tmp15_ = invite_uri;
	if (_tmp15_ != NULL) {
		DcWindow* _tmp16_;
		const gchar* _tmp17_;
		_tmp16_ = window;
		_tmp17_ = invite_uri;
		dc_window_handle_invite_uri (_tmp16_, _tmp17_);
	}
	result = 0;
	_g_object_unref0 (window);
	_g_variant_dict_unref0 (options);
	_g_free0 (invite_uri);
	return result;
}

static void
dc_application_enter_background_mode (DcApplication* self)
{
	gboolean _tmp0_;
	DcWindow* _tmp1_;
	DcWindow* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_background_mode;
	if (_tmp0_) {
		return;
	}
	dc_application_set_background_mode (self, TRUE);
	g_application_hold ((GApplication*) self);
	_tmp1_ = dc_application_get_or_create_window (self);
	_tmp2_ = _tmp1_;
	_g_object_unref0 (_tmp2_);
}

static void
dc_application_real_open (GApplication* base,
                          GFile** files,
                          gint files_length1,
                          const gchar* hint)
{
	DcApplication * self;
	DcWindow* window = NULL;
	DcWindow* _tmp0_;
	DcWindow* _tmp1_;
	self = (DcApplication*) base;
	g_return_if_fail (hint != NULL);
	_tmp0_ = dc_application_get_or_create_window (self);
	window = _tmp0_;
	_tmp1_ = window;
	dc_window_restore_from_tray (_tmp1_);
	{
		GFile** file_collection = NULL;
		gint file_collection_length1 = 0;
		gint _file_collection_size_ = 0;
		gint file_it = 0;
		file_collection = files;
		file_collection_length1 = files_length1;
		for (file_it = 0; file_it < file_collection_length1; file_it = file_it + 1) {
			GFile* _tmp2_;
			GFile* file = NULL;
			_tmp2_ = _g_object_ref0 (file_collection[file_it]);
			file = _tmp2_;
			{
				gchar* uri = NULL;
				GFile* _tmp3_;
				gchar* _tmp4_;
				gchar* _tmp5_;
				gchar* _tmp6_;
				gchar* _tmp7_;
				const gchar* _tmp8_;
				_tmp3_ = file;
				_tmp4_ = g_file_get_uri (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = dc_application_repair_dbus_open_uri (_tmp5_);
				_tmp7_ = _tmp6_;
				_g_free0 (_tmp5_);
				uri = _tmp7_;
				_tmp8_ = uri;
				if (dc_is_delta_invite_uri (_tmp8_)) {
					DcWindow* _tmp9_;
					const gchar* _tmp10_;
					_tmp9_ = window;
					_tmp10_ = uri;
					dc_window_handle_invite_uri (_tmp9_, _tmp10_);
					_g_free0 (uri);
					_g_object_unref0 (file);
					break;
				}
				_g_free0 (uri);
				_g_object_unref0 (file);
			}
		}
	}
	_g_object_unref0 (window);
}

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 gchar*
dc_application_repair_dbus_open_uri (const gchar* uri)
{
	gchar* rest = NULL;
	gint _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (uri != NULL, NULL);
	if (!g_str_has_prefix (uri, "openpgp4fpr:")) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (uri);
		result = _tmp0_;
		return result;
	}
	_tmp1_ = strlen ("openpgp4fpr:");
	_tmp2_ = _tmp1_;
	_tmp3_ = string_substring (uri, (glong) _tmp2_, (glong) -1);
	rest = _tmp3_;
	while (TRUE) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = rest;
		if (!g_str_has_prefix (_tmp4_, "/")) {
			break;
		}
		_tmp5_ = rest;
		_tmp6_ = string_substring (_tmp5_, (glong) 1, (glong) -1);
		_g_free0 (rest);
		rest = _tmp6_;
	}
	_tmp7_ = rest;
	_tmp8_ = string_replace (_tmp7_, "%23", "#");
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strconcat ("openpgp4fpr:", _tmp9_, NULL);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	result = _tmp11_;
	_g_free0 (rest);
	return result;
}

static void
__lambda440_ (DcApplication* self)
{
	dc_application_apply_link_colors (self);
}

static void
___lambda440__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda440_ ((DcApplication*) self);
}

static void
__lambda441_ (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
___lambda441__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda441_ ((DcApplication*) self, parameter);
}

static void
dc_application_real_startup (GApplication* base)
{
	DcApplication * self;
	DcSettingsManager* settings = NULL;
	DcSettingsManager* _tmp0_;
	DcThemeOverride _tmp1_;
	DcThemeOverride _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	AdwStyleManager* _tmp5_;
	DcBackgroundMode _tmp6_;
	DcBackgroundMode _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	DcFontAttribute _tmp12_;
	DcFontAttribute _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	GSimpleAction* open_chat = NULL;
	GVariantType* _tmp16_;
	GVariantType* _tmp17_;
	GSimpleAction* _tmp18_;
	GSimpleAction* _tmp19_;
	gchar* primary = NULL;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar** _tmp22_;
	gchar** _tmp23_;
	gint _tmp23__length1;
	gchar* _tmp24_;
	gchar** _tmp25_;
	gchar** _tmp26_;
	gint _tmp26__length1;
	gchar* _tmp27_;
	gchar** _tmp28_;
	gchar** _tmp29_;
	gint _tmp29__length1;
	gchar* _tmp30_;
	gchar** _tmp31_;
	gchar** _tmp32_;
	gint _tmp32__length1;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gchar** _tmp36_;
	gchar** _tmp37_;
	gint _tmp37__length1;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar** _tmp40_;
	gchar** _tmp41_;
	gint _tmp41__length1;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar** _tmp44_;
	gchar** _tmp45_;
	gint _tmp45__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_theme_override (settings);
	_tmp2_ = _tmp1_;
	dc_application_apply_theme_override (self, _tmp2_);
	_tmp3_ = dc_settings_manager_get_accent_color (settings);
	_tmp4_ = _tmp3_;
	dc_application_apply_accent_color (self, _tmp4_);
	_tmp5_ = adw_style_manager_get_default ();
	g_signal_connect_object ((GObject*) _tmp5_, "notify::dark", (GCallback) ___lambda440__g_object_notify, self, 0);
	_tmp6_ = dc_settings_manager_get_background_mode (settings);
	_tmp7_ = _tmp6_;
	_tmp8_ = dc_settings_manager_get_background_color (settings);
	_tmp9_ = _tmp8_;
	dc_application_apply_background (self, _tmp7_, _tmp9_);
	_tmp10_ = dc_settings_manager_get_font_family (settings);
	_tmp11_ = _tmp10_;
	_tmp12_ = dc_settings_manager_get_font_attribute (settings);
	_tmp13_ = _tmp12_;
	_tmp14_ = dc_settings_manager_get_font_size (settings);
	_tmp15_ = _tmp14_;
	dc_application_apply_font (self, _tmp11_, _tmp13_, _tmp15_);
	dc_application_register_icons (self);
	gtk_window_set_default_icon_name ("io.github.trufae.Parla");
	_tmp16_ = g_variant_type_new ("(ii)");
	_tmp17_ = _tmp16_;
	_tmp18_ = g_simple_action_new ("open-chat", _tmp17_);
	_tmp19_ = _tmp18_;
	_g_variant_type_free0 (_tmp17_);
	open_chat = _tmp19_;
	g_signal_connect_object (open_chat, "activate", (GCallback) ___lambda441__g_simple_action_activate, self, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) open_chat);
	_tmp20_ = dc_platform_primary_accelerator_prefix ();
	primary = _tmp20_;
	_tmp21_ = g_strconcat (primary, "n", NULL);
	_tmp22_ = g_new0 (gchar*, 1 + 1);
	_tmp22_[0] = _tmp21_;
	_tmp23_ = _tmp22_;
	_tmp23__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.new-chat", (const char * const *) _tmp23_);
	_tmp23_ = (_vala_array_free (_tmp23_, _tmp23__length1, (GDestroyNotify) g_free), NULL);
	_tmp24_ = g_strconcat (primary, "r", NULL);
	_tmp25_ = g_new0 (gchar*, 1 + 1);
	_tmp25_[0] = _tmp24_;
	_tmp26_ = _tmp25_;
	_tmp26__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.refresh", (const char * const *) _tmp26_);
	_tmp26_ = (_vala_array_free (_tmp26_, _tmp26__length1, (GDestroyNotify) g_free), NULL);
	_tmp27_ = g_strconcat (primary, "comma", NULL);
	_tmp28_ = g_new0 (gchar*, 1 + 1);
	_tmp28_[0] = _tmp27_;
	_tmp29_ = _tmp28_;
	_tmp29__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.settings", (const char * const *) _tmp29_);
	_tmp29_ = (_vala_array_free (_tmp29_, _tmp29__length1, (GDestroyNotify) g_free), NULL);
	_tmp30_ = g_strconcat (primary, "q", NULL);
	_tmp31_ = g_new0 (gchar*, 1 + 1);
	_tmp31_[0] = _tmp30_;
	_tmp32_ = _tmp31_;
	_tmp32__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.quit", (const char * const *) _tmp32_);
	_tmp32_ = (_vala_array_free (_tmp32_, _tmp32__length1, (GDestroyNotify) g_free), NULL);
	_tmp33_ = g_strconcat (primary, "plus", NULL);
	_tmp34_ = g_strconcat (primary, "equal", NULL);
	_tmp35_ = g_strconcat (primary, "KP_Add", NULL);
	_tmp36_ = g_new0 (gchar*, 3 + 1);
	_tmp36_[0] = _tmp33_;
	_tmp36_[1] = _tmp34_;
	_tmp36_[2] = _tmp35_;
	_tmp37_ = _tmp36_;
	_tmp37__length1 = 3;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.font-increase", (const char * const *) _tmp37_);
	_tmp37_ = (_vala_array_free (_tmp37_, _tmp37__length1, (GDestroyNotify) g_free), NULL);
	_tmp38_ = g_strconcat (primary, "minus", NULL);
	_tmp39_ = g_strconcat (primary, "KP_Subtract", NULL);
	_tmp40_ = g_new0 (gchar*, 2 + 1);
	_tmp40_[0] = _tmp38_;
	_tmp40_[1] = _tmp39_;
	_tmp41_ = _tmp40_;
	_tmp41__length1 = 2;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.font-decrease", (const char * const *) _tmp41_);
	_tmp41_ = (_vala_array_free (_tmp41_, _tmp41__length1, (GDestroyNotify) g_free), NULL);
	_tmp42_ = g_strconcat (primary, "0", NULL);
	_tmp43_ = g_strconcat (primary, "KP_0", NULL);
	_tmp44_ = g_new0 (gchar*, 2 + 1);
	_tmp44_[0] = _tmp42_;
	_tmp44_[1] = _tmp43_;
	_tmp45_ = _tmp44_;
	_tmp45__length1 = 2;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.font-reset", (const char * const *) _tmp45_);
	_tmp45_ = (_vala_array_free (_tmp45_, _tmp45__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_;
	GtkIconTheme* _tmp23_;
	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);
	}
	_tmp23_ = theme;
	dc_icon_fallback_install (_tmp23_);
	_g_free0 (exe_path);
	_g_object_unref0 (theme);
}

static void
dc_application_load_css (DcApplication* self)
{
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp0_;
	GtkCssProvider* _tmp1_;
	GdkDisplay* _tmp2_;
	GtkCssProvider* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_css_provider_new ();
	provider = _tmp0_;
	_tmp1_ = provider;
	gtk_css_provider_load_from_string (_tmp1_, DC_APPLICATION_CSS);
	_tmp2_ = gdk_display_get_default ();
	_tmp3_ = provider;
	gtk_style_context_add_provider_for_display (_tmp2_, (GtkStyleProvider*) _tmp3_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	if (dc_platform_is_macos ()) {
		GtkCssProvider* mac = NULL;
		GtkCssProvider* _tmp4_;
		GtkCssProvider* _tmp5_;
		GdkDisplay* _tmp6_;
		GtkCssProvider* _tmp7_;
		_tmp4_ = gtk_css_provider_new ();
		mac = _tmp4_;
		_tmp5_ = mac;
		gtk_css_provider_load_from_string (_tmp5_, ".message-big-emoji, .message-medium-emoji" " { padding-right: 0.26em; }");
		_tmp6_ = gdk_display_get_default ();
		_tmp7_ = mac;
		gtk_style_context_add_provider_for_display (_tmp6_, (GtkStyleProvider*) _tmp7_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
		_g_object_unref0 (mac);
	}
	_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]);
	}
}

gboolean
dc_application_get_background_mode (DcApplication* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_background_mode;
	return result;
}

static void
dc_application_set_background_mode (DcApplication* self,
                                    gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_application_get_background_mode (self);
	if (old_value != value) {
		self->priv->_background_mode = value;
		g_object_notify_by_pspec ((GObject *) self, dc_application_properties[DC_APPLICATION_BACKGROUND_MODE_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_);
	g_application_add_main_option ((GApplication*) self, "background", 'b', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, "Start in the background without opening a window", NULL);
	g_application_add_main_option ((GApplication*) self, "show", 's', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, "Present the main window of the running instance", NULL);
	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)->open = (void (*) (GApplication*, GFile**, gint, const gchar*)) dc_application_real_open;
	((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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_APPLICATION_BACKGROUND_MODE_PROPERTY, dc_application_properties[DC_APPLICATION_BACKGROUND_MODE_PROPERTY] = g_param_spec_boolean ("background-mode", "background-mode", "background-mode", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dc_application_instance_init (DcApplication * self,
                              gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	self->priv = dc_application_get_instance_private (self);
	self->priv->_background_mode = FALSE;
	self->priv->accent_provider = NULL;
	self->priv->link_provider = NULL;
	_tmp0_ = g_strdup ("");
	self->priv->current_accent_hex = _tmp0_;
	self->priv->accent_applied = FALSE;
	self->priv->background_provider = NULL;
	self->priv->background_applied = FALSE;
	self->priv->current_background_mode = DC_BACKGROUND_MODE_SYSTEM;
	_tmp1_ = g_strdup ("");
	self->priv->current_background_hex = _tmp1_;
	self->priv->font_provider = NULL;
	self->priv->font_applied = FALSE;
	_tmp2_ = g_strdup ("");
	self->priv->current_font_css = _tmp2_;
	self->priv->theme_override_applied = FALSE;
	self->priv->current_theme_override = DC_THEME_OVERRIDE_SYSTEM;
}

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->link_provider);
	_g_free0 (self->priv->current_accent_hex);
	_g_object_unref0 (self->priv->background_provider);
	_g_free0 (self->priv->current_background_hex);
	_g_object_unref0 (self->priv->font_provider);
	_g_free0 (self->priv->current_font_css);
	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;
		case DC_APPLICATION_BACKGROUND_MODE_PROPERTY:
		g_value_set_boolean (value, dc_application_get_background_mode (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;
		case DC_APPLICATION_BACKGROUND_MODE_PROPERTY:
		dc_application_set_background_mode (self, g_value_get_boolean (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);
}

