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

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

#define DC_WINDOW_FULL_SIDEBAR_MIN_WIDTH ((gdouble) 260)
#define DC_WINDOW_FULL_SIDEBAR_MAX_WIDTH ((gdouble) 340)
#define DC_WINDOW_COLLAPSED_SIDEBAR_MIN_WIDTH ((gdouble) 220)
#define DC_WINDOW_COLLAPSED_SIDEBAR_MAX_WIDTH ((gdouble) 10000)
#define DC_WINDOW_COMPACT_SIDEBAR_WIDTH ((gdouble) 48)
#define DC_WINDOW_FONT_UPDATE_INTERVAL_MS ((guint) 16)
#define DC_WINDOW_MAX_CACHED_CONVERSATION_VIEWS ((guint) 3)
#define DC_RPC_CLIENT_GCL_ARCHIVED_ONLY 0x01
#define DC_RPC_CLIENT_GCL_NO_SPECIALS 0x02
#define DC_WEBXDC_AVAILABLE TRUE
#define DC_FONT_SIZE_SYSTEM 0
#define PARLA_APP_DATA_NAME "Parla"
#define PARLA_APP_DATA_ID "io.github.trufae.Parla"
#define PARLA_VERSION "0.8.2"
#define PARLA_APP_DATA_DEVELOPER "pancake"
#define PARLA_APP_DATA_WEBSITE "https://github.com/trufae/parla"
#define PARLA_APP_DATA_ISSUE_URL "https://github.com/trufae/parla/issues"
#define PARLA_APP_DATA_COMMENTS "A Delta Chat client for GNOME"
#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 _g_free0(var) (var = (g_free (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;
typedef struct _DcWindowPrivate DcWindowPrivate;

#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 DC_TYPE_CONVERSATION_VIEW (dc_conversation_view_get_type ())
#define DC_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONVERSATION_VIEW, DcConversationView))
#define DC_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONVERSATION_VIEW, DcConversationViewClass))
#define DC_IS_CONVERSATION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONVERSATION_VIEW))
#define DC_IS_CONVERSATION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONVERSATION_VIEW))
#define DC_CONVERSATION_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONVERSATION_VIEW, DcConversationViewClass))

typedef struct _DcConversationView DcConversationView;
typedef struct _DcConversationViewClass DcConversationViewClass;

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

#define DC_TYPE_IMAGE_VIEWER (dc_image_viewer_get_type ())
#define DC_IMAGE_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_IMAGE_VIEWER, DcImageViewer))
#define DC_IMAGE_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_IMAGE_VIEWER, DcImageViewerClass))
#define DC_IS_IMAGE_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_IMAGE_VIEWER))
#define DC_IS_IMAGE_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_IMAGE_VIEWER))
#define DC_IMAGE_VIEWER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_IMAGE_VIEWER, DcImageViewerClass))

typedef struct _DcImageViewer DcImageViewer;
typedef struct _DcImageViewerClass DcImageViewerClass;

#define DC_TYPE_VIDEO_PLAYER (dc_video_player_get_type ())
#define DC_VIDEO_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_VIDEO_PLAYER, DcVideoPlayer))
#define DC_VIDEO_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_VIDEO_PLAYER, DcVideoPlayerClass))
#define DC_IS_VIDEO_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_VIDEO_PLAYER))
#define DC_IS_VIDEO_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_VIDEO_PLAYER))
#define DC_VIDEO_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_VIDEO_PLAYER, DcVideoPlayerClass))

typedef struct _DcVideoPlayer DcVideoPlayer;
typedef struct _DcVideoPlayerClass DcVideoPlayerClass;

#define DC_TYPE_EVENT_HANDLER (dc_event_handler_get_type ())
#define DC_EVENT_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_EVENT_HANDLER, DcEventHandler))
#define DC_EVENT_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_EVENT_HANDLER, DcEventHandlerClass))
#define DC_IS_EVENT_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_EVENT_HANDLER))
#define DC_IS_EVENT_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_EVENT_HANDLER))
#define DC_EVENT_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_EVENT_HANDLER, DcEventHandlerClass))

typedef struct _DcEventHandler DcEventHandler;
typedef struct _DcEventHandlerClass DcEventHandlerClass;

#define DC_TYPE_CHAT_CONTEXT_MENU (dc_chat_context_menu_get_type ())
#define DC_CHAT_CONTEXT_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CHAT_CONTEXT_MENU, DcChatContextMenu))
#define DC_CHAT_CONTEXT_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CHAT_CONTEXT_MENU, DcChatContextMenuClass))
#define DC_IS_CHAT_CONTEXT_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CHAT_CONTEXT_MENU))
#define DC_IS_CHAT_CONTEXT_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CHAT_CONTEXT_MENU))
#define DC_CHAT_CONTEXT_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CHAT_CONTEXT_MENU, DcChatContextMenuClass))

typedef struct _DcChatContextMenu DcChatContextMenu;
typedef struct _DcChatContextMenuClass DcChatContextMenuClass;

#define DC_WINDOW_TYPE_PENDING_NOTIFICATION (dc_window_pending_notification_get_type ())
#define DC_WINDOW_PENDING_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_WINDOW_TYPE_PENDING_NOTIFICATION, DcWindowPendingNotification))
#define DC_WINDOW_PENDING_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_WINDOW_TYPE_PENDING_NOTIFICATION, DcWindowPendingNotificationClass))
#define DC_WINDOW_IS_PENDING_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_WINDOW_TYPE_PENDING_NOTIFICATION))
#define DC_WINDOW_IS_PENDING_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_WINDOW_TYPE_PENDING_NOTIFICATION))
#define DC_WINDOW_PENDING_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_WINDOW_TYPE_PENDING_NOTIFICATION, DcWindowPendingNotificationClass))

typedef struct _DcWindowPendingNotification DcWindowPendingNotification;
typedef struct _DcWindowPendingNotificationClass DcWindowPendingNotificationClass;

#define DC_TYPE_TRAY_ICON (dc_tray_icon_get_type ())
#define DC_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_TRAY_ICON, DcTrayIcon))
#define DC_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_TRAY_ICON, DcTrayIconClass))
#define DC_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_TRAY_ICON))
#define DC_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_TRAY_ICON))
#define DC_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_TRAY_ICON, DcTrayIconClass))

typedef struct _DcTrayIcon DcTrayIcon;
typedef struct _DcTrayIconClass DcTrayIconClass;

#define DC_TYPE_NATIVE_FILE_DROP_TARGET (dc_native_file_drop_target_get_type ())
#define DC_NATIVE_FILE_DROP_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_NATIVE_FILE_DROP_TARGET, DcNativeFileDropTarget))
#define DC_NATIVE_FILE_DROP_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_NATIVE_FILE_DROP_TARGET, DcNativeFileDropTargetClass))
#define DC_IS_NATIVE_FILE_DROP_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_NATIVE_FILE_DROP_TARGET))
#define DC_IS_NATIVE_FILE_DROP_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_NATIVE_FILE_DROP_TARGET))
#define DC_NATIVE_FILE_DROP_TARGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_NATIVE_FILE_DROP_TARGET, DcNativeFileDropTargetClass))

typedef struct _DcNativeFileDropTarget DcNativeFileDropTarget;
typedef struct _DcNativeFileDropTargetClass DcNativeFileDropTargetClass;
enum  {
	DC_WINDOW_0_PROPERTY,
	DC_WINDOW_CHAT_STORE_PROPERTY,
	DC_WINDOW_CURRENT_CHAT_ID_PROPERTY,
	DC_WINDOW_NUM_PROPERTIES
};
static GParamSpec* dc_window_properties[DC_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))

#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 enum  {
	DC_THEME_OVERRIDE_SYSTEM = 0,
	DC_THEME_OVERRIDE_LIGHT = 1,
	DC_THEME_OVERRIDE_DARK = 2
} DcThemeOverride;

#define DC_TYPE_THEME_OVERRIDE (dc_theme_override_get_type ())
typedef enum  {
	DC_BACKGROUND_MODE_SYSTEM = 0,
	DC_BACKGROUND_MODE_SOLID = 1,
	DC_BACKGROUND_MODE_GRADIENT = 2
} DcBackgroundMode;

#define DC_TYPE_BACKGROUND_MODE (dc_background_mode_get_type ())
typedef enum  {
	DC_FONT_ATTRIBUTE_REGULAR = 0,
	DC_FONT_ATTRIBUTE_ITALIC = 1,
	DC_FONT_ATTRIBUTE_BOLD = 2,
	DC_FONT_ATTRIBUTE_BOLD_ITALIC = 3
} DcFontAttribute;

#define DC_TYPE_FONT_ATTRIBUTE (dc_font_attribute_get_type ())
typedef struct _Block1Data Block1Data;

#define DC_TYPE_CHAT_ROW (dc_chat_row_get_type ())
#define DC_CHAT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CHAT_ROW, DcChatRow))
#define DC_CHAT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CHAT_ROW, DcChatRowClass))
#define DC_IS_CHAT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CHAT_ROW))
#define DC_IS_CHAT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CHAT_ROW))
#define DC_CHAT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CHAT_ROW, DcChatRowClass))

typedef struct _DcChatRow DcChatRow;
typedef struct _DcChatRowClass DcChatRowClass;
typedef struct _Block2Data Block2Data;
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
typedef struct _Block3Data Block3Data;
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
typedef enum  {
	DC_SIDEBAR_MODE_FULL = 0,
	DC_SIDEBAR_MODE_COMPACT = 1,
	DC_SIDEBAR_MODE_HIDDEN = 2
} DcSidebarMode;

#define DC_TYPE_SIDEBAR_MODE (dc_sidebar_mode_get_type ())
typedef enum  {
	DC_RPC_SERVER_SOURCE_AUTO = 0,
	DC_RPC_SERVER_SOURCE_CUSTOM = 1
} DcRpcServerSource;

#define DC_TYPE_RPC_SERVER_SOURCE (dc_rpc_server_source_get_type ())
typedef struct _DcWindowTryConnectData DcWindowTryConnectData;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _DcWindowRefreshSelfMentionKeysData DcWindowRefreshSelfMentionKeysData;

#define DC_TYPE_MESSAGE (dc_message_get_type ())
#define DC_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_MESSAGE, DcMessage))
#define DC_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_MESSAGE, DcMessageClass))
#define DC_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_MESSAGE))
#define DC_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_MESSAGE))
#define DC_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_MESSAGE, DcMessageClass))

typedef struct _DcMessage DcMessage;
typedef struct _DcMessageClass DcMessageClass;
typedef struct _DcWindowCheckMentionData DcWindowCheckMentionData;
typedef struct _DcWindowBackgroundSelfKeysData DcWindowBackgroundSelfKeysData;
typedef struct _DcWindowOpenMentionContactData DcWindowOpenMentionContactData;
typedef struct _DcWindowOpenMentionAddressData DcWindowOpenMentionAddressData;
typedef struct _DcWindowLoadSelfIdentityData DcWindowLoadSelfIdentityData;
typedef struct _Block4Data Block4Data;

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

typedef struct _DcRpcInstaller DcRpcInstaller;
typedef struct _DcRpcInstallerClass DcRpcInstallerClass;
typedef struct _DcWindowInstallAndConnectData DcWindowInstallAndConnectData;

#define DC_TYPE_REMOVE_PARAM_FILTER (dc_remove_param_filter_get_type ())
#define DC_REMOVE_PARAM_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_REMOVE_PARAM_FILTER, DcRemoveParamFilter))
#define DC_REMOVE_PARAM_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_REMOVE_PARAM_FILTER, DcRemoveParamFilterClass))
#define DC_IS_REMOVE_PARAM_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_REMOVE_PARAM_FILTER))
#define DC_IS_REMOVE_PARAM_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_REMOVE_PARAM_FILTER))
#define DC_REMOVE_PARAM_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_REMOVE_PARAM_FILTER, DcRemoveParamFilterClass))

typedef struct _DcRemoveParamFilter DcRemoveParamFilter;
typedef struct _DcRemoveParamFilterClass DcRemoveParamFilterClass;
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _DcWindowRefreshTrackingFilterData DcWindowRefreshTrackingFilterData;
typedef struct _DcWindowCheckManagedUpdateData DcWindowCheckManagedUpdateData;
typedef struct _DcWindowUpdateManagedServerData DcWindowUpdateManagedServerData;
typedef struct _DcWindowReconnectRpcServerData DcWindowReconnectRpcServerData;
typedef enum  {
	DC_CHAT_KIND_UNKNOWN = 0,
	DC_CHAT_KIND_DIRECT = 1,
	DC_CHAT_KIND_GROUP = 2
} DcChatKind;

#define DC_TYPE_CHAT_KIND (dc_chat_kind_get_type ())

#define DC_TYPE_CHAT_ENTRY (dc_chat_entry_get_type ())
#define DC_CHAT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CHAT_ENTRY, DcChatEntry))
#define DC_CHAT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CHAT_ENTRY, DcChatEntryClass))
#define DC_IS_CHAT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CHAT_ENTRY))
#define DC_IS_CHAT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CHAT_ENTRY))
#define DC_CHAT_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CHAT_ENTRY, DcChatEntryClass))

typedef struct _DcChatEntry DcChatEntry;
typedef struct _DcChatEntryClass DcChatEntryClass;
typedef struct _Block5Data Block5Data;
typedef struct _DcWindowLoadChatsData DcWindowLoadChatsData;
typedef struct _DcWindowHydrateChatTextPreviewsData DcWindowHydrateChatTextPreviewsData;
typedef struct _DcWindowNoticeChatData DcWindowNoticeChatData;

#define DC_TYPE_GALLERY_DIALOG (dc_gallery_dialog_get_type ())
#define DC_GALLERY_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_GALLERY_DIALOG, DcGalleryDialog))
#define DC_GALLERY_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_GALLERY_DIALOG, DcGalleryDialogClass))
#define DC_IS_GALLERY_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_GALLERY_DIALOG))
#define DC_IS_GALLERY_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_GALLERY_DIALOG))
#define DC_GALLERY_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_GALLERY_DIALOG, DcGalleryDialogClass))

typedef struct _DcGalleryDialog DcGalleryDialog;
typedef struct _DcGalleryDialogClass DcGalleryDialogClass;
typedef struct _DcWindowSaveAttachmentData DcWindowSaveAttachmentData;
typedef struct _DcWindowPromptWebxdcAppData DcWindowPromptWebxdcAppData;
typedef struct _DcWindowRunWebxdcInstanceData DcWindowRunWebxdcInstanceData;
typedef struct _DcWindowEnsureWebxdcFileData DcWindowEnsureWebxdcFileData;
typedef struct _DcWindowPendingNotificationPrivate DcWindowPendingNotificationPrivate;
#define _dc_window_pending_notification_unref0(var) ((var == NULL) ? NULL : (var = (dc_window_pending_notification_unref (var), NULL)))
typedef struct _DcWindowFlushChatNotificationsData DcWindowFlushChatNotificationsData;
typedef struct _DcWindowNotifyAccountItemsData DcWindowNotifyAccountItemsData;
typedef struct _DcWindowNotifyChatGroupData DcWindowNotifyChatGroupData;
typedef struct _DcWindowPrefixBackgroundAccountData DcWindowPrefixBackgroundAccountData;
typedef struct _DcWindowOnIncomingMsgData DcWindowOnIncomingMsgData;
typedef struct _DcWindowLoadAccountMenuData DcWindowLoadAccountMenuData;
typedef struct _DcWindowBuildAccountMenuRowForIdData DcWindowBuildAccountMenuRowForIdData;
typedef struct _Block6Data Block6Data;
typedef struct _Block7Data Block7Data;

#define DC_TYPE_CREATE_PROFILE_DIALOG (dc_create_profile_dialog_get_type ())
#define DC_CREATE_PROFILE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CREATE_PROFILE_DIALOG, DcCreateProfileDialog))
#define DC_CREATE_PROFILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CREATE_PROFILE_DIALOG, DcCreateProfileDialogClass))
#define DC_IS_CREATE_PROFILE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CREATE_PROFILE_DIALOG))
#define DC_IS_CREATE_PROFILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CREATE_PROFILE_DIALOG))
#define DC_CREATE_PROFILE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CREATE_PROFILE_DIALOG, DcCreateProfileDialogClass))

typedef struct _DcCreateProfileDialog DcCreateProfileDialog;
typedef struct _DcCreateProfileDialogClass DcCreateProfileDialogClass;
typedef struct _DcWindowAfterProfileCreatedData DcWindowAfterProfileCreatedData;

#define DC_TYPE_INVITATION_CODE_PROFILE_DIALOG (dc_invitation_code_profile_dialog_get_type ())
#define DC_INVITATION_CODE_PROFILE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_INVITATION_CODE_PROFILE_DIALOG, DcInvitationCodeProfileDialog))
#define DC_INVITATION_CODE_PROFILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_INVITATION_CODE_PROFILE_DIALOG, DcInvitationCodeProfileDialogClass))
#define DC_IS_INVITATION_CODE_PROFILE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_INVITATION_CODE_PROFILE_DIALOG))
#define DC_IS_INVITATION_CODE_PROFILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_INVITATION_CODE_PROFILE_DIALOG))
#define DC_INVITATION_CODE_PROFILE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_INVITATION_CODE_PROFILE_DIALOG, DcInvitationCodeProfileDialogClass))

typedef struct _DcInvitationCodeProfileDialog DcInvitationCodeProfileDialog;
typedef struct _DcInvitationCodeProfileDialogClass DcInvitationCodeProfileDialogClass;
typedef struct _DcWindowAfterInvitationProfileCreatedData DcWindowAfterInvitationProfileCreatedData;

#define DC_TYPE_RECEIVE_BACKUP_DIALOG (dc_receive_backup_dialog_get_type ())
#define DC_RECEIVE_BACKUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_RECEIVE_BACKUP_DIALOG, DcReceiveBackupDialog))
#define DC_RECEIVE_BACKUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_RECEIVE_BACKUP_DIALOG, DcReceiveBackupDialogClass))
#define DC_IS_RECEIVE_BACKUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_RECEIVE_BACKUP_DIALOG))
#define DC_IS_RECEIVE_BACKUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_RECEIVE_BACKUP_DIALOG))
#define DC_RECEIVE_BACKUP_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_RECEIVE_BACKUP_DIALOG, DcReceiveBackupDialogClass))

typedef struct _DcReceiveBackupDialog DcReceiveBackupDialog;
typedef struct _DcReceiveBackupDialogClass DcReceiveBackupDialogClass;
typedef struct _DcWindowAfterSecondaryDeviceImportedData DcWindowAfterSecondaryDeviceImportedData;

#define DC_TYPE_CLASSIC_EMAIL_DIALOG (dc_classic_email_dialog_get_type ())
#define DC_CLASSIC_EMAIL_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CLASSIC_EMAIL_DIALOG, DcClassicEmailDialog))
#define DC_CLASSIC_EMAIL_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CLASSIC_EMAIL_DIALOG, DcClassicEmailDialogClass))
#define DC_IS_CLASSIC_EMAIL_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CLASSIC_EMAIL_DIALOG))
#define DC_IS_CLASSIC_EMAIL_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CLASSIC_EMAIL_DIALOG))
#define DC_CLASSIC_EMAIL_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CLASSIC_EMAIL_DIALOG, DcClassicEmailDialogClass))

typedef struct _DcClassicEmailDialog DcClassicEmailDialog;
typedef struct _DcClassicEmailDialogClass DcClassicEmailDialogClass;
typedef struct _DcWindowSetAutoDownloadLimitData DcWindowSetAutoDownloadLimitData;
typedef struct _DcWindowApplyAutoDownloadLimitData DcWindowApplyAutoDownloadLimitData;
typedef struct _DcWindowSwitchAccountData DcWindowSwitchAccountData;
typedef struct _Block8Data Block8Data;

#define DC_TYPE_PROFILE_DIALOG (dc_profile_dialog_get_type ())
#define DC_PROFILE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_PROFILE_DIALOG, DcProfileDialog))
#define DC_PROFILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_PROFILE_DIALOG, DcProfileDialogClass))
#define DC_IS_PROFILE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_PROFILE_DIALOG))
#define DC_IS_PROFILE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_PROFILE_DIALOG))
#define DC_PROFILE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_PROFILE_DIALOG, DcProfileDialogClass))

typedef struct _DcProfileDialog DcProfileDialog;
typedef struct _DcProfileDialogClass DcProfileDialogClass;
typedef struct _DcWindowAfterProfileDeletedData DcWindowAfterProfileDeletedData;
typedef struct _DcWindowSwitchToFirstConfiguredAccountData DcWindowSwitchToFirstConfiguredAccountData;
typedef struct _DcWindowLoadProfileAvatarData DcWindowLoadProfileAvatarData;
typedef struct _DcWindowUpdateUnreadIndicatorsData DcWindowUpdateUnreadIndicatorsData;

#define DC_TYPE_CONTACT_PICKER_DIALOG (dc_contact_picker_dialog_get_type ())
#define DC_CONTACT_PICKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONTACT_PICKER_DIALOG, DcContactPickerDialog))
#define DC_CONTACT_PICKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONTACT_PICKER_DIALOG, DcContactPickerDialogClass))
#define DC_IS_CONTACT_PICKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONTACT_PICKER_DIALOG))
#define DC_IS_CONTACT_PICKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONTACT_PICKER_DIALOG))
#define DC_CONTACT_PICKER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONTACT_PICKER_DIALOG, DcContactPickerDialogClass))

typedef struct _DcContactPickerDialog DcContactPickerDialog;
typedef struct _DcContactPickerDialogClass DcContactPickerDialogClass;
typedef struct _DcWindowCreateChatByEmailData DcWindowCreateChatByEmailData;
typedef struct _Block9Data Block9Data;

#define DC_TYPE_NEW_GROUP_DIALOG (dc_new_group_dialog_get_type ())
#define DC_NEW_GROUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_NEW_GROUP_DIALOG, DcNewGroupDialog))
#define DC_NEW_GROUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_NEW_GROUP_DIALOG, DcNewGroupDialogClass))
#define DC_IS_NEW_GROUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_NEW_GROUP_DIALOG))
#define DC_IS_NEW_GROUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_NEW_GROUP_DIALOG))
#define DC_NEW_GROUP_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_NEW_GROUP_DIALOG, DcNewGroupDialogClass))

typedef struct _DcNewGroupDialog DcNewGroupDialog;
typedef struct _DcNewGroupDialogClass DcNewGroupDialogClass;
typedef struct _DcWindowAfterGroupCreatedData DcWindowAfterGroupCreatedData;
typedef struct _DcWindowOpenMediaMessageData DcWindowOpenMediaMessageData;

#define DC_TYPE_AUDIO_PLAYBACK_ITEM (dc_audio_playback_item_get_type ())
#define DC_AUDIO_PLAYBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItem))
#define DC_AUDIO_PLAYBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItemClass))
#define DC_IS_AUDIO_PLAYBACK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM))
#define DC_IS_AUDIO_PLAYBACK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_PLAYBACK_ITEM))
#define DC_AUDIO_PLAYBACK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_PLAYBACK_ITEM, DcAudioPlaybackItemClass))

typedef struct _DcAudioPlaybackItem DcAudioPlaybackItem;
typedef struct _DcAudioPlaybackItemClass DcAudioPlaybackItemClass;

#define DC_TYPE_AUDIO_PLAYBACK (dc_audio_playback_get_type ())
#define DC_AUDIO_PLAYBACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlayback))
#define DC_AUDIO_PLAYBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlaybackClass))
#define DC_IS_AUDIO_PLAYBACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_AUDIO_PLAYBACK))
#define DC_IS_AUDIO_PLAYBACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_AUDIO_PLAYBACK))
#define DC_AUDIO_PLAYBACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_AUDIO_PLAYBACK, DcAudioPlaybackClass))

typedef struct _DcAudioPlayback DcAudioPlayback;
typedef struct _DcAudioPlaybackClass DcAudioPlaybackClass;
typedef struct _DcWindowNavigateVoiceAfterOpenData DcWindowNavigateVoiceAfterOpenData;
typedef struct _DcWindowOpenChatFromNotificationData DcWindowOpenChatFromNotificationData;
typedef struct _Block10Data Block10Data;
typedef struct _DcWindowUseInviteLinkData DcWindowUseInviteLinkData;

#define DC_TYPE_STICKER_MANAGER_DIALOG (dc_sticker_manager_dialog_get_type ())
#define DC_STICKER_MANAGER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_STICKER_MANAGER_DIALOG, DcStickerManagerDialog))
#define DC_STICKER_MANAGER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_STICKER_MANAGER_DIALOG, DcStickerManagerDialogClass))
#define DC_IS_STICKER_MANAGER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_STICKER_MANAGER_DIALOG))
#define DC_IS_STICKER_MANAGER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_STICKER_MANAGER_DIALOG))
#define DC_STICKER_MANAGER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_STICKER_MANAGER_DIALOG, DcStickerManagerDialogClass))

typedef struct _DcStickerManagerDialog DcStickerManagerDialog;
typedef struct _DcStickerManagerDialogClass DcStickerManagerDialogClass;

#define DC_TYPE_WEBXDC_MANAGER_DIALOG (dc_webxdc_manager_dialog_get_type ())
#define DC_WEBXDC_MANAGER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_WEBXDC_MANAGER_DIALOG, DcWebxdcManagerDialog))
#define DC_WEBXDC_MANAGER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_WEBXDC_MANAGER_DIALOG, DcWebxdcManagerDialogClass))
#define DC_IS_WEBXDC_MANAGER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_WEBXDC_MANAGER_DIALOG))
#define DC_IS_WEBXDC_MANAGER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_WEBXDC_MANAGER_DIALOG))
#define DC_WEBXDC_MANAGER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_WEBXDC_MANAGER_DIALOG, DcWebxdcManagerDialogClass))

typedef struct _DcWebxdcManagerDialog DcWebxdcManagerDialog;
typedef struct _DcWebxdcManagerDialogClass DcWebxdcManagerDialogClass;

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

typedef struct _DcSettingsDialog DcSettingsDialog;
typedef struct _DcSettingsDialogClass DcSettingsDialogClass;
typedef struct _DcWindowReloadActiveAccountData DcWindowReloadActiveAccountData;

#define DC_TYPE_QUICK_SWITCH_DIALOG (dc_quick_switch_dialog_get_type ())
#define DC_QUICK_SWITCH_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_QUICK_SWITCH_DIALOG, DcQuickSwitchDialog))
#define DC_QUICK_SWITCH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_QUICK_SWITCH_DIALOG, DcQuickSwitchDialogClass))
#define DC_IS_QUICK_SWITCH_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_QUICK_SWITCH_DIALOG))
#define DC_IS_QUICK_SWITCH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_QUICK_SWITCH_DIALOG))
#define DC_QUICK_SWITCH_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_QUICK_SWITCH_DIALOG, DcQuickSwitchDialogClass))

typedef struct _DcQuickSwitchDialog DcQuickSwitchDialog;
typedef struct _DcQuickSwitchDialogClass DcQuickSwitchDialogClass;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _DcWindowParamSpecPendingNotification DcWindowParamSpecPendingNotification;
typedef struct _Block11Data Block11Data;
typedef enum  {
	DC_MESSAGE_STYLE_BUBBLES = 0,
	DC_MESSAGE_STYLE_IRC = 1,
	DC_MESSAGE_STYLE_WORKSPACE = 2
} DcMessageStyle;

#define DC_TYPE_MESSAGE_STYLE (dc_message_style_get_type ())

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

struct _DcWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _DcWindowPrivate {
	AdwToastOverlay* toast_overlay;
	AdwOverlaySplitView* split_view;
	AdwHeaderBar* sidebar_header;
	AdwHeaderBar* content_header;
	GtkLabel* content_title_label;
	GtkImage* content_mute_icon;
	GtkSearchEntry* search_entry;
	GtkBox* sidebar_box;
	GtkButton* sidebar_toggle_btn;
	GtkButton* message_search_btn;
	GtkButton* gallery_btn;
	GtkMenuButton* sidebar_menu_button;
	AdwWindowTitle* sidebar_title;
	GtkListBox* chat_listbox;
	GListStore* _chat_store;
	GtkButton* archived_toggle_btn;
	AdwButtonContent* archived_btn_content;
	gboolean showing_archived;
	gint archived_count;
	GHashTable* views;
	gint* view_recency;
	gint view_recency_length1;
	gint _view_recency_size_;
	AdwStatusPage* empty_status;
	GtkStack* content_stack;
	GtkRevealer* connection_banner;
	GtkLabel* connection_banner_label;
	GtkMenuButton* account_menu_button;
	AdwAvatar* profile_avatar;
	GtkBox* profile_unread_badge;
	GtkPopover* account_popover;
	GtkListBox* account_menu_list;
	gchar* account_menu_state;
	gint account_menu_load_gen;
	gboolean focus_current_account_on_menu_load;
	gchar** self_mention_keys_cache;
	gint self_mention_keys_cache_length1;
	gint _self_mention_keys_cache_size_;
	GHashTable* mentioned_chats;
	DcRpcClient* rpc;
	gint _current_chat_id;
	gboolean suppress_reselect_scroll;
	gboolean suppress_chat_selection;
	DcImageViewer* image_viewer;
	DcVideoPlayer* video_player;
	DcEventHandler* events;
	DcChatContextMenu* chat_menu;
	gboolean reconnecting_rpc;
	GPtrArray* pending_notifications;
	guint notification_flush_timer;
	guint font_update_source;
	AdwDialog* active_modal;
	gchar* pending_invite_uri;
	DcTrayIcon* tray;
	gboolean held_in_background;
	gboolean quit_requested;
	DcNativeFileDropTarget* native_file_drop_target;
	gboolean escape_armed;
};

struct _Block1Data {
	int _ref_count_;
	GWeakRef window_ref;
};

struct _Block2Data {
	int _ref_count_;
	DcWindow* self;
	GDBusConnection* conn;
};

struct _Block3Data {
	int _ref_count_;
	DcWindow* self;
	GtkGestureClick* right_click;
};

struct _DcWindowTryConnectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	DcRpcClient* _tmp2_;
	DcRpcClient* _tmp3_;
	gchar* rpc_path;
	DcSettingsManager* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	DcSettingsManager* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* data_dir;
	gchar* _tmp11_;
	gchar* accounts_path;
	DcSettingsManager* _tmp12_;
	gchar* _tmp13_;
	DcRpcClient* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar** _tmp17_;
	gchar** _tmp18_;
	gint _tmp18__length1;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	GError* e;
	gchar* msg;
	GError* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gboolean _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gboolean _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	AdwStatusPage* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	AdwStatusPage* _tmp36_;
	const gchar* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	DcRpcClient* _tmp42_;
	gboolean _tmp43_;
	DcSettingsManager* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gchar* acct_desc;
	gchar* acct_toast;
	DcRpcClient* _tmp48_;
	DcSettingsManager* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	AdwStatusPage* _tmp57_;
	const gchar* _tmp58_;
	DcRpcClient* _tmp59_;
	gint _tmp60_;
	gint _tmp61_;
	DcRpcClient* _tmp62_;
	GError* _vala1_e;
	GError* _tmp63_;
	const gchar* _tmp64_;
	gchar* _tmp65_;
	gchar* _tmp66_;
	DcRpcClient* _tmp67_;
	DcEventHandler* _tmp68_;
	DcRpcClient* _tmp69_;
	DcSettingsManager* _tmp70_;
	DcEventHandler* _tmp71_;
	GtkApplication* _tmp72_;
	GtkApplication* _tmp73_;
	DcEventHandler* _tmp74_;
	DcEventHandler* _tmp75_;
	DcEventHandler* _tmp76_;
	DcEventHandler* _tmp77_;
	DcEventHandler* _tmp78_;
	DcEventHandler* _tmp79_;
	DcEventHandler* _tmp80_;
	DcRpcClient* _tmp81_;
	GListStore* _tmp82_;
	DcChatContextMenu* _tmp83_;
	DcRpcClient* _tmp84_;
	gint _tmp85_;
	gint _tmp86_;
	DcEventHandler* _tmp87_;
	DcEventHandler* _tmp88_;
	const gchar* _tmp89_;
	gchar* uri;
	const gchar* _tmp90_;
	gchar* _tmp91_;
	const gchar* _tmp92_;
	GError* _inner_error0_;
};

struct _DcWindowRefreshSelfMentionKeysData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	GPtrArray* keys;
	GPtrArray* _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GPtrArray* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gboolean _tmp13_;
	DcRpcClient* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	DcRpcClient* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	GPtrArray* _tmp22_;
	DcRpcClient* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	JsonNode* transports;
	DcRpcClient* _tmp27_;
	DcRpcClient* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	JsonNode* _tmp31_;
	gboolean _tmp32_;
	JsonArray* arr;
	JsonArray* _tmp33_;
	JsonArray* _tmp34_;
	guint i;
	gboolean _tmp35_;
	guint _tmp36_;
	JsonArray* _tmp37_;
	JsonObject* obj;
	JsonArray* _tmp38_;
	JsonObject* _tmp39_;
	JsonObject* _tmp40_;
	gchar* _tmp41_;
	JsonObject* _tmp42_;
	JsonObject* _tmp43_;
	gchar* _tmp44_;
	gchar* addr;
	gchar* _tmp45_;
	gboolean _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	gint _tmp49_;
	gint _tmp50_;
	GPtrArray* _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	gchar** _result_;
	gchar** _tmp54_;
	gint _result__length1;
	gint __result__size_;
	gint _vala1_i;
	gboolean _tmp55_;
	gint _tmp56_;
	GPtrArray* _tmp57_;
	gint _tmp58_;
	gint _tmp59_;
	GPtrArray* _tmp60_;
	gconstpointer _tmp61_;
	gchar* _tmp62_;
	gchar** _tmp63_;
	gint _tmp63__length1;
	gchar** _tmp64_;
	gint _tmp64__length1;
	GError* _inner_error0_;
};

struct _DcWindowCheckMentionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gint chat_id;
	gint msg_id;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gint __tmp0__size_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_;
	gchar** _tmp7_;
	gchar** keys;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gint keys_length1;
	gint _keys_size_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	DcMessage* msg;
	DcMessage* _tmp10_;
	DcRpcClient* _tmp11_;
	DcMessage* _tmp12_;
	DcMessage* _tmp13_;
	gboolean _tmp14_;
	DcMessage* _tmp15_;
	DcMessage* _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	DcMessage* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	gchar** _tmp22_;
	gint _tmp22__length1;
	gboolean _tmp23_;
	gboolean _tmp24_;
	DcRpcClient* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	gboolean _tmp30_;
	gboolean _tmp31_;
	gboolean looking;
	gboolean _tmp32_;
	DcRpcClient* _tmp33_;
	gint _tmp34_;
	gint _tmp35_;
	GHashTable* _tmp36_;
	GHashTable* _tmp37_;
	gboolean _tmp38_;
	DcEventHandler* _tmp39_;
	DcSettingsManager* _tmp40_;
	gboolean _tmp41_;
	gboolean _tmp42_;
	const gchar* _tmp43_;
	DcMessage* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	DcMessage* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	gchar* title;
	gchar* _tmp51_;
	const gchar* _tmp52_;
	gboolean _tmp53_;
	DcMessage* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	DcMessage* _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	gint _tmp60_;
	gint _tmp61_;
	DcMessage* _tmp62_;
	const gchar* _tmp63_;
	const gchar* _tmp64_;
	gchar* body;
	gchar* _tmp65_;
	DcEventHandler* _tmp66_;
	const gchar* _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	const gchar* _tmp70_;
	GError* _inner_error0_;
};

struct _DcWindowBackgroundSelfKeysData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gchar** result;
	gint result_length1;
	gchar** keys;
	gchar** _tmp0_;
	gint keys_length1;
	gint _keys_size_;
	gchar* dn;
	DcRpcClient* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* addr;
	DcRpcClient* _tmp11_;
	gchar* _tmp12_;
	gboolean _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	gchar* _tmp16_;
	gchar** _tmp17_;
	gint _tmp17__length1;
	GError* _inner_error0_;
};

struct _DcWindowOpenMentionContactData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint contact_id;
	gint chat_id;
	DcRpcClient* _tmp0_;
	GError* e;
	GError* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GError* _inner_error0_;
};

struct _DcWindowOpenMentionAddressData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gchar* address;
	gint contact_id;
	DcRpcClient* _tmp0_;
	GError* e;
	GError* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GError* _inner_error0_;
};

struct _DcWindowLoadSelfIdentityData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gchar* _tmp0_;
	DcRpcClient* _tmp1_;
	DcRpcClient* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gchar* _tmp5_;
	DcRpcClient* _tmp6_;
	DcRpcClient* _tmp7_;
	gchar* _tmp8_;
	DcRpcClient* _tmp9_;
	DcRpcClient* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	DcRpcClient* _tmp16_;
	DcRpcClient* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GError* _inner_error0_;
};

struct _Block4Data {
	int _ref_count_;
	DcWindow* self;
	GtkLabel* label;
	gpointer _async_data_;
};

struct _DcWindowInstallAndConnectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	Block4Data* _data4_;
	GtkBox* box;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkSpinner* spinner;
	GtkSpinner* _tmp2_;
	GtkSpinner* _tmp3_;
	GtkSpinner* _tmp4_;
	GtkBox* _tmp5_;
	GtkSpinner* _tmp6_;
	GtkLabel* _tmp7_;
	GtkLabel* _tmp8_;
	GtkBox* _tmp9_;
	GtkLabel* _tmp10_;
	GtkBox* _tmp11_;
	DcRpcInstaller* installer;
	DcRpcInstaller* _tmp12_;
	DcRpcInstaller* _tmp13_;
	DcRpcInstaller* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GError* e;
	GError* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	DcSettingsManager* _tmp21_;
	DcRpcServerSource _tmp22_;
	DcRpcServerSource _tmp23_;
	DcSettingsManager* _tmp24_;
	GError* _inner_error0_;
};

struct _DcWindowRefreshTrackingFilterData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gboolean force;
	gchar* result;
	DcSettingsManager* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gchar* _tmp3_;
	gchar* url;
	DcSettingsManager* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
	DcRpcClient* _tmp13_;
	DcRpcClient* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gchar* _tmp17_;
	DcRemoveParamFilter* cached;
	DcRemoveParamFilter* _tmp18_;
	DcRemoveParamFilter* _tmp19_;
	gboolean _tmp20_;
	DcRemoveParamFilter* _tmp21_;
	DcRemoveParamFilter* _tmp22_;
	guint8* body;
	gint body_length1;
	gint _body_size_;
	gchar* mimetype;
	guint8* _tmp23_;
	DcRpcClient* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gint _tmp27_;
	guint8* _tmp28_;
	gint _tmp23__length1;
	gint __tmp23__size_;
	guint8* _tmp29_;
	gint _tmp29__length1;
	GError* e;
	GError* _tmp30_;
	const gchar* _tmp31_;
	GError* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	GString* sb;
	guint8* _tmp35_;
	gint _tmp35__length1;
	GString* _tmp36_;
	GString* _tmp37_;
	guint8* _tmp38_;
	gint _tmp38__length1;
	guint8* _tmp39_;
	gint _tmp39__length1;
	DcRemoveParamFilter* filter;
	GString* _tmp40_;
	const gchar* _tmp41_;
	DcRemoveParamFilter* _tmp42_;
	DcRemoveParamFilter* _tmp43_;
	gchar* _tmp44_;
	GString* _tmp45_;
	const gchar* _tmp46_;
	gchar* _tmp47_;
	DcRemoveParamFilter* _tmp48_;
	DcRemoveParamFilter* _tmp49_;
	DcRemoveParamFilter* _tmp50_;
	gint _tmp51_;
	gint _tmp52_;
	const gchar* _tmp53_;
	GError* _inner_error0_;
};

struct _DcWindowCheckManagedUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gchar* installed;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* tag;
	gchar* _tmp2_;
	gchar* latest;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* current;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	AdwToast* toast;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	AdwToast* _tmp16_;
	AdwToast* _tmp17_;
	AdwToast* _tmp18_;
	AdwToast* _tmp19_;
	AdwToast* _tmp20_;
	AdwToastOverlay* _tmp21_;
	AdwToast* _tmp22_;
	AdwToast* _tmp23_;
	GError* _inner_error0_;
};

struct _DcWindowUpdateManagedServerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	DcRpcInstaller* installer;
	DcRpcInstaller* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GError* e;
	GError* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GError* _inner_error0_;
};

struct _DcWindowReconnectRpcServerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	DcApplication* app;
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	DcApplication* _tmp2_;
	DcApplication* _tmp3_;
	DcApplication* _tmp4_;
	DcRpcClient* _tmp5_;
	DcRpcClient* _tmp6_;
	GtkBox* _tmp7_;
};

struct _Block5Data {
	int _ref_count_;
	DcWindow* self;
	DcChatRow* chat_row;
};

struct _DcWindowLoadChatsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	JsonArray* entries;
	DcRpcClient* _tmp4_;
	DcRpcClient* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	JsonArray* _tmp8_;
	JsonArray* _tmp9_;
	JsonArray* _tmp10_;
	JsonArray* archived;
	DcRpcClient* _tmp11_;
	DcRpcClient* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	JsonArray* _tmp15_;
	gint _tmp16_;
	JsonArray* _tmp17_;
	JsonArray* _tmp18_;
	JsonObject* items;
	DcRpcClient* _tmp19_;
	DcRpcClient* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	JsonArray* _tmp23_;
	JsonObject* _tmp24_;
	gint desired_chat_id;
	gint _tmp25_;
	gint _tmp26_;
	gboolean keep_empty_selection;
	DcChatEntry** parsed_entries;
	DcChatEntry** _tmp27_;
	gint parsed_entries_length1;
	gint _parsed_entries_size_;
	gint* preview_msg_ids;
	gint* _tmp28_;
	gint preview_msg_ids_length1;
	gint _preview_msg_ids_size_;
	guint i;
	gboolean _tmp29_;
	guint _tmp30_;
	JsonArray* _tmp31_;
	gint chat_id;
	JsonArray* _tmp32_;
	gchar* id_str;
	gchar* _tmp33_;
	gboolean _tmp34_;
	JsonObject* _tmp35_;
	JsonObject* _tmp36_;
	const gchar* _tmp37_;
	JsonObject* item;
	JsonObject* _tmp38_;
	const gchar* _tmp39_;
	JsonObject* _tmp40_;
	JsonObject* _tmp41_;
	DcChatEntry* entry;
	JsonObject* _tmp42_;
	DcChatEntry* _tmp43_;
	DcChatEntry* _tmp44_;
	GHashTable* _tmp45_;
	DcChatEntry* _tmp46_;
	DcChatEntry* _tmp47_;
	DcChatEntry* _tmp48_;
	gint _tmp49_;
	gint _tmp50_;
	DcChatEntry* _tmp51_;
	gint _tmp52_;
	gint _tmp53_;
	DcChatEntry** _tmp54_;
	gint _tmp54__length1;
	gint* _tmp55_;
	gint _tmp55__length1;
	GListStore* _tmp56_;
	GtkListBox* _tmp57_;
	GtkListBoxRow* reselect_row;
	DcChatEntry** _tmp58_;
	gint _tmp58__length1;
	DcChatEntry** entry_collection;
	gint entry_collection_length1;
	gint _entry_collection_size_;
	gint entry_it;
	DcChatEntry* _tmp59_;
	DcChatEntry* _vala1_entry;
	Block5Data* _data5_;
	GListStore* _tmp60_;
	DcChatEntry* _tmp61_;
	GtkListBoxRow* row;
	GtkListBoxRow* _tmp62_;
	DcChatEntry* _tmp63_;
	DcChatRow* _tmp64_;
	DcChatRow* _tmp65_;
	DcSettingsManager* _tmp66_;
	DcSidebarMode _tmp67_;
	DcSidebarMode _tmp68_;
	DcChatRow* _tmp69_;
	DcChatRow* _tmp70_;
	DcChatRow* _tmp71_;
	GtkListBoxRow* _tmp72_;
	DcChatRow* _tmp73_;
	GtkListBox* _tmp74_;
	GtkListBoxRow* _tmp75_;
	DcChatEntry* _tmp76_;
	gint _tmp77_;
	gint _tmp78_;
	GtkListBoxRow* _tmp79_;
	GtkListBoxRow* _tmp80_;
	GtkLabel* _tmp81_;
	DcChatEntry* _tmp82_;
	const gchar* _tmp83_;
	const gchar* _tmp84_;
	GtkImage* _tmp85_;
	DcChatEntry* _tmp86_;
	gboolean _tmp87_;
	gboolean _tmp88_;
	GtkListBoxRow* _tmp89_;
	GtkListBox* _tmp90_;
	GtkListBoxRow* _tmp91_;
	GtkListBox* _tmp92_;
	GError* e;
	GError* _tmp93_;
	const gchar* _tmp94_;
	gchar* _tmp95_;
	gchar* _tmp96_;
	GError* _inner_error0_;
};

struct _DcWindowHydrateChatTextPreviewsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	DcChatEntry** entries;
	gint entries_length1;
	gint* msg_ids;
	gint msg_ids_length1;
	gboolean _tmp0_;
	JsonObject* map;
	DcRpcClient* _tmp1_;
	DcRpcClient* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	JsonObject* _tmp5_;
	JsonObject* _tmp6_;
	DcChatEntry** entry_collection;
	gint entry_collection_length1;
	gint _entry_collection_size_;
	gint entry_it;
	DcChatEntry* _tmp7_;
	DcChatEntry* entry;
	DcChatEntry* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gchar* key;
	DcChatEntry* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gchar* _tmp14_;
	JsonObject* _tmp15_;
	const gchar* _tmp16_;
	DcMessage* msg;
	JsonObject* _tmp17_;
	const gchar* _tmp18_;
	JsonObject* _tmp19_;
	DcRpcClient* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	DcMessage* _tmp23_;
	DcMessage* _tmp24_;
	DcChatEntry* _tmp25_;
	DcMessage* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GError* e;
	GError* _tmp29_;
	const gchar* _tmp30_;
	GError* _inner_error0_;
};

struct _DcWindowNoticeChatData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint chat_id;
	DcRpcClient* _tmp0_;
	DcEventHandler* _tmp1_;
	DcEventHandler* _tmp2_;
	DcRpcClient* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	GError* _inner_error0_;
};

struct _DcWindowSaveAttachmentData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gchar* src_path;
	gchar* name;
	GtkFileDialog* dialog;
	GtkFileDialog* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkFileDialog* _tmp4_;
	GFile* dest;
	GtkFileDialog* _tmp5_;
	GFile* _tmp6_;
	GFile* _tmp7_;
	GFile* src_file;
	GFile* _tmp8_;
	GFile* _tmp9_;
	GFile* _tmp10_;
	GError* e;
	GError* _tmp11_;
	GError* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	GError* _inner_error0_;
};

struct _DcWindowPromptWebxdcAppData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	GtkWidget* parent;
	DcRpcClient* app_rpc;
	DcMessage* msg;
	gboolean _tmp0_;
	gboolean can_start;
	gchar* app_name;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gchar* _tmp10_;
	gchar* title;
	gchar* body;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	AdwAlertDialog* dialog;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	AdwAlertDialog* _tmp22_;
	AdwAlertDialog* _tmp23_;
	AdwAlertDialog* _tmp24_;
	AdwAlertDialog* _tmp25_;
	AdwAlertDialog* _tmp26_;
	AdwAlertDialog* _tmp27_;
	AdwAlertDialog* _tmp28_;
	AdwAlertDialog* _tmp29_;
	AdwAlertDialog* _tmp30_;
	gchar* response;
	AdwAlertDialog* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	const gchar* _tmp34_;
	DcMessage* local_msg;
	DcMessage* _tmp35_;
	DcMessage* _tmp36_;
	const gchar* _tmp37_;
	DcMessage* _tmp38_;
	const gchar* _tmp39_;
	DcMessage* _tmp40_;
	const gchar* _tmp41_;
	const gchar* _tmp42_;
	DcMessage* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
};

struct _DcWindowRunWebxdcInstanceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	DcMessage* msg;
	gboolean result;
	gboolean _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	DcMessage* local_msg;
	DcRpcClient* _tmp4_;
	DcMessage* _tmp5_;
	DcMessage* _tmp6_;
	DcRpcClient* _tmp7_;
	DcMessage* _tmp8_;
};

struct _DcWindowEnsureWebxdcFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	DcRpcClient* app_rpc;
	DcMessage* msg;
	DcMessage* result;
	gboolean _tmp0_;
	gboolean _tmp1_;
	DcMessage* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	DcMessage* downloaded;
	gint _tmp9_;
	gint _tmp10_;
	DcMessage* _tmp11_;
	gboolean _tmp12_;
	DcMessage* _tmp13_;
	DcMessage* _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	GError* e;
	GError* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	GError* _inner_error0_;
};

struct _DcWindowPendingNotification {
	GTypeInstance parent_instance;
	volatile int ref_count;
	DcWindowPendingNotificationPrivate * priv;
	gint acct_id;
	gint chat_id;
	gint msg_id;
	gint contact_id;
	gchar* reaction;
};

struct _DcWindowPendingNotificationClass {
	GTypeClass parent_class;
	void (*finalize) (DcWindowPendingNotification *self);
};

struct _DcWindowFlushChatNotificationsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	GPtrArray* items;
	GPtrArray* _tmp0_;
	GPtrArray* _tmp1_;
	GPtrArray* _tmp2_;
	gboolean _tmp3_;
	DcEventHandler* _tmp4_;
	DcSettingsManager* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gint* acct_ids;
	gint* _tmp8_;
	gint acct_ids_length1;
	gint _acct_ids_size_;
	guint i;
	gboolean _tmp9_;
	guint _tmp10_;
	GPtrArray* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gint acct_id;
	GPtrArray* _tmp14_;
	gconstpointer _tmp15_;
	gint* _tmp16_;
	gint _tmp16__length1;
	gint* _tmp17_;
	gint _tmp17__length1;
	gint* acct_id_collection;
	gint acct_id_collection_length1;
	gint _acct_id_collection_size_;
	gint acct_id_it;
	gint _vala1_acct_id;
	GPtrArray* acct_items;
	GPtrArray* _tmp18_;
	guint _vala1_i;
	gboolean _tmp19_;
	guint _tmp20_;
	GPtrArray* _tmp21_;
	gint _tmp22_;
	gint _tmp23_;
	DcWindowPendingNotification* item;
	GPtrArray* _tmp24_;
	gconstpointer _tmp25_;
	DcWindowPendingNotification* _tmp26_;
	DcWindowPendingNotification* _tmp27_;
	GPtrArray* _tmp28_;
	DcWindowPendingNotification* _tmp29_;
	DcWindowPendingNotification* _tmp30_;
	GPtrArray* _tmp31_;
};

struct _DcWindowNotifyAccountItemsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	GPtrArray* items;
	gint* chat_ids;
	gint* _tmp0_;
	gint chat_ids_length1;
	gint _chat_ids_size_;
	gint messages;
	guint i;
	gboolean _tmp1_;
	guint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	DcWindowPendingNotification* item;
	gconstpointer _tmp5_;
	DcWindowPendingNotification* _tmp6_;
	DcWindowPendingNotification* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint* _tmp10_;
	gint _tmp10__length1;
	DcWindowPendingNotification* _tmp11_;
	DcWindowPendingNotification* _tmp12_;
	gint* _tmp13_;
	gint _tmp13__length1;
	gchar* title;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	DcEventHandler* _tmp18_;
	const gchar* _tmp19_;
	gint* _tmp20_;
	gint _tmp20__length1;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gint* _tmp23_;
	gint _tmp23__length1;
	gint* chat_id_collection;
	gint chat_id_collection_length1;
	gint _chat_id_collection_size_;
	gint chat_id_it;
	gint chat_id;
	GPtrArray* group;
	GPtrArray* _tmp24_;
	guint _vala1_i;
	gboolean _tmp25_;
	guint _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	DcWindowPendingNotification* _vala1_item;
	gconstpointer _tmp29_;
	DcWindowPendingNotification* _tmp30_;
	DcWindowPendingNotification* _tmp31_;
	GPtrArray* _tmp32_;
	DcWindowPendingNotification* _tmp33_;
	DcWindowPendingNotification* _tmp34_;
	GPtrArray* _tmp35_;
};

struct _DcWindowNotifyChatGroupData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gint chat_id;
	GPtrArray* group;
	gchar* chat_name;
	JsonObject* chat_obj;
	DcRpcClient* _tmp0_;
	JsonObject* _tmp1_;
	JsonObject* _tmp2_;
	JsonObject* _tmp3_;
	JsonObject* _tmp4_;
	gchar* _tmp5_;
	gint messages;
	DcWindowPendingNotification* msg_item;
	guint i;
	gboolean _tmp6_;
	guint _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gconstpointer _tmp10_;
	const gchar* _tmp11_;
	gint _tmp12_;
	gconstpointer _tmp13_;
	DcWindowPendingNotification* _tmp14_;
	gboolean show;
	DcSettingsManager* _tmp15_;
	gboolean _tmp16_;
	gboolean _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	gchar* title;
	gchar* _tmp20_;
	const gchar* _tmp21_;
	gchar* body;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gboolean _tmp24_;
	DcMessage* msg;
	DcRpcClient* _tmp25_;
	DcWindowPendingNotification* _tmp26_;
	DcMessage* _tmp27_;
	DcMessage* _tmp28_;
	const gchar* _tmp29_;
	DcMessage* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	DcMessage* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	gchar* sender;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gboolean _tmp40_;
	gboolean _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	gint _tmp44_;
	gint _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	const gchar* _tmp49_;
	gchar* _tmp50_;
	const gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_;
	const gchar* _tmp54_;
	gboolean _tmp55_;
	DcMessage* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	DcMessage* _tmp59_;
	const gchar* _tmp60_;
	const gchar* _tmp61_;
	gint _tmp62_;
	gint _tmp63_;
	DcMessage* _tmp64_;
	const gchar* _tmp65_;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	gboolean _tmp68_;
	DcMessage* _tmp69_;
	const gchar* _tmp70_;
	const gchar* _tmp71_;
	DcMessage* _tmp72_;
	const gchar* _tmp73_;
	const gchar* _tmp74_;
	gint _tmp75_;
	gint _tmp76_;
	DcMessage* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	gchar* _tmp80_;
	gboolean _tmp81_;
	DcWindowPendingNotification* r;
	gint _tmp82_;
	gint _tmp83_;
	gconstpointer _tmp84_;
	DcWindowPendingNotification* _tmp85_;
	gchar* reactor;
	gchar* _tmp86_;
	JsonObject* c;
	DcRpcClient* _tmp87_;
	DcWindowPendingNotification* _tmp88_;
	JsonObject* _tmp89_;
	JsonObject* _tmp90_;
	gchar* _tmp91_;
	JsonObject* _tmp92_;
	gchar* _tmp93_;
	gchar* _tmp94_;
	gchar* _tmp95_;
	gchar* _tmp96_;
	const gchar* _tmp97_;
	gint _tmp98_;
	gint _tmp99_;
	const gchar* _tmp100_;
	DcWindowPendingNotification* _tmp101_;
	const gchar* _tmp102_;
	gchar* _tmp103_;
	DcWindowPendingNotification* _tmp104_;
	const gchar* _tmp105_;
	gchar* _tmp106_;
	gchar* _tmp107_;
	const gchar* _tmp108_;
	gchar* _tmp109_;
	DcEventHandler* _tmp110_;
	const gchar* _tmp111_;
	const gchar* _tmp112_;
	GError* _inner_error0_;
};

struct _DcWindowPrefixBackgroundAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gchar* title;
	gchar* result;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_;
	gchar* name;
	DcRpcClient* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gchar* _tmp11_;
	DcRpcClient* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gboolean _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GError* _inner_error0_;
};

struct _DcWindowOnIncomingMsgData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gint chat_id;
	gint msg_id;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	DcConversationView* view;
	GHashTable* _tmp3_;
	gconstpointer _tmp4_;
	DcConversationView* _tmp5_;
	gboolean handled;
	DcConversationView* _tmp6_;
	DcConversationView* _tmp7_;
	gboolean _tmp8_;
	DcConversationView* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
};

struct _DcWindowLoadAccountMenuData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gboolean _tmp0_;
	DcRpcClient* _tmp1_;
	DcRpcClient* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GtkListBox* _tmp5_;
	AdwActionRow* row;
	AdwActionRow* _tmp6_;
	AdwActionRow* _tmp7_;
	AdwActionRow* _tmp8_;
	GtkListBox* _tmp9_;
	AdwActionRow* _tmp10_;
	gint gen;
	gint _tmp11_;
	JsonNode* accounts_node;
	DcRpcClient* _tmp12_;
	JsonNode* _tmp13_;
	JsonNode* _tmp14_;
	JsonArray* accounts;
	JsonNode* _tmp15_;
	JsonArray* _tmp16_;
	JsonArray* _tmp17_;
	GString* state;
	GString* _tmp18_;
	AdwActionRow** rows;
	AdwActionRow** _tmp19_;
	gint rows_length1;
	gint _rows_size_;
	guint i;
	gboolean _tmp20_;
	guint _tmp21_;
	JsonArray* _tmp22_;
	JsonObject* acct;
	JsonArray* _tmp23_;
	JsonObject* _tmp24_;
	JsonObject* _tmp25_;
	gint id;
	JsonObject* _tmp26_;
	AdwActionRow* _tmp27_;
	DcRpcClient* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	GString* _tmp31_;
	AdwActionRow* _tmp32_;
	AdwActionRow* _tmp33_;
	const gchar* _tmp34_;
	GString* _tmp35_;
	const gchar* _tmp36_;
	GString* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	GtkListBox* _tmp40_;
	AdwActionRow** _tmp41_;
	gint _tmp41__length1;
	AdwActionRow** row_collection;
	gint row_collection_length1;
	gint _row_collection_size_;
	gint row_it;
	AdwActionRow* _tmp42_;
	AdwActionRow* _vala1_row;
	GtkListBox* _tmp43_;
	AdwActionRow* _tmp44_;
	AdwActionRow** _tmp45_;
	gint _tmp45__length1;
	AdwActionRow* empty;
	AdwActionRow* _tmp46_;
	AdwActionRow* _tmp47_;
	AdwActionRow* _tmp48_;
	GtkListBox* _tmp49_;
	AdwActionRow* _tmp50_;
	GtkListBox* _tmp51_;
	AdwActionRow* _tmp52_;
	AdwActionRow* _tmp53_;
	GError* e;
	GtkListBox* _tmp54_;
	AdwActionRow* err_row;
	AdwActionRow* _tmp55_;
	AdwActionRow* _tmp56_;
	AdwActionRow* _tmp57_;
	AdwActionRow* _tmp58_;
	GError* _tmp59_;
	const gchar* _tmp60_;
	GtkListBox* _tmp61_;
	AdwActionRow* _tmp62_;
	GError* _inner_error0_;
};

struct _DcWindowBuildAccountMenuRowForIdData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint id;
	gboolean current;
	GString* state;
	AdwActionRow* result;
	gboolean configured;
	DcRpcClient* _tmp0_;
	gchar* email;
	gchar* display_name;
	gchar* avatar;
	gint unread;
	gchar* _tmp1_;
	DcRpcClient* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	DcRpcClient* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	DcRpcClient* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gint _tmp13_;
	DcRpcClient* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	AdwActionRow* _tmp26_;
	GError* _inner_error0_;
};

struct _Block6Data {
	int _ref_count_;
	DcWindow* self;
	gint id;
};

struct _Block7Data {
	int _ref_count_;
	DcWindow* self;
	AdwDialog* dialog;
};

struct _DcWindowAfterProfileCreatedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint new_id;
};

struct _DcWindowAfterInvitationProfileCreatedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint new_id;
	gint chat_id;
	const gchar* _tmp0_;
};

struct _DcWindowAfterSecondaryDeviceImportedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint new_id;
};

struct _DcWindowSetAutoDownloadLimitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint bytes;
	DcSettingsManager* _tmp0_;
	DcRpcClient* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GError* e;
	GError* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GError* _inner_error0_;
};

struct _DcWindowApplyAutoDownloadLimitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	JsonNode* accounts_node;
	DcRpcClient* _tmp0_;
	JsonNode* _tmp1_;
	JsonNode* _tmp2_;
	JsonArray* accounts;
	JsonNode* _tmp3_;
	JsonArray* _tmp4_;
	JsonArray* _tmp5_;
	gchar* limit;
	DcSettingsManager* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gchar* _tmp9_;
	guint i;
	gboolean _tmp10_;
	guint _tmp11_;
	JsonArray* _tmp12_;
	JsonObject* account;
	JsonArray* _tmp13_;
	JsonObject* _tmp14_;
	JsonObject* _tmp15_;
	gint id;
	JsonObject* _tmp16_;
	DcRpcClient* _tmp17_;
	const gchar* _tmp18_;
	GError* _inner_error0_;
};

struct _DcWindowSwitchAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gboolean result;
	gboolean _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	DcRpcClient* _tmp4_;
	DcRpcClient* _tmp5_;
	DcRpcClient* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError* _inner_error0_;
};

struct _Block8Data {
	int _ref_count_;
	DcWindow* self;
	gboolean edits_current_account;
};

struct _DcWindowAfterProfileDeletedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint deleted_id;
	gboolean was_current_account;
	gboolean switched_account;
	DcRpcClient* _tmp0_;
	const gchar* _tmp1_;
};

struct _DcWindowSwitchToFirstConfiguredAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint skip_id;
	gboolean result;
	JsonNode* accounts_node;
	DcRpcClient* _tmp0_;
	JsonNode* _tmp1_;
	JsonNode* _tmp2_;
	JsonArray* accounts;
	JsonNode* _tmp3_;
	JsonArray* _tmp4_;
	JsonArray* _tmp5_;
	guint i;
	gboolean _tmp6_;
	guint _tmp7_;
	JsonArray* _tmp8_;
	JsonObject* acct;
	JsonArray* _tmp9_;
	JsonObject* _tmp10_;
	JsonObject* _tmp11_;
	gint id;
	JsonObject* _tmp12_;
	gboolean _tmp13_;
	gboolean configured;
	gboolean _tmp14_;
	DcRpcClient* _tmp15_;
	gboolean _tmp16_;
	GError* e;
	GError* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	GError* _inner_error0_;
};

struct _DcWindowLoadProfileAvatarData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GtkBox* _tmp3_;
	gchar* name;
	DcRpcClient* _tmp4_;
	DcRpcClient* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gchar* _tmp8_;
	gchar* avatar;
	DcRpcClient* _tmp9_;
	DcRpcClient* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	AdwAvatar* _tmp18_;
	AdwAvatar* _tmp19_;
	const gchar* _tmp20_;
	GdkTexture* _tmp21_;
	GdkTexture* _tmp22_;
	GError* _inner_error0_;
};

struct _DcWindowUpdateUnreadIndicatorsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	GtkBox* _tmp0_;
	gboolean other_unread;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcRpcClient* _tmp3_;
	DcRpcClient* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	DcRpcClient* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	JsonNode* accounts_node;
	DcRpcClient* _tmp10_;
	JsonNode* _tmp11_;
	JsonNode* _tmp12_;
	JsonArray* accounts;
	JsonNode* _tmp13_;
	JsonArray* _tmp14_;
	JsonArray* _tmp15_;
	guint i;
	gboolean _tmp16_;
	guint _tmp17_;
	JsonArray* _tmp18_;
	JsonObject* acct;
	JsonArray* _tmp19_;
	JsonObject* _tmp20_;
	JsonObject* _tmp21_;
	gint id;
	JsonObject* _tmp22_;
	gboolean _tmp23_;
	DcRpcClient* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	DcRpcClient* _tmp28_;
	GtkBox* _tmp29_;
	gboolean _tmp30_;
	GtkPopover* _tmp31_;
	GtkPopover* _tmp32_;
	GError* _inner_error0_;
};

struct _DcWindowCreateChatByEmailData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gchar* email;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint contact_id;
	DcRpcClient* _tmp3_;
	gint chat_id;
	DcRpcClient* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GError* _inner_error0_;
};

struct _Block9Data {
	int _ref_count_;
	DcWindow* self;
	gboolean is_channel;
};

struct _DcWindowAfterGroupCreatedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint chat_id;
	gboolean is_channel;
	const gchar* _tmp0_;
};

struct _DcWindowOpenMediaMessageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gint chat_id;
	gint msg_id;
	gint _tmp0_;
	gint _tmp1_;
};

struct _DcWindowNavigateVoiceAfterOpenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gint chat_id;
	gint msg_id;
	gint direction;
	DcAudioPlaybackItem* item;
	DcAudioPlayback* _tmp0_;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	DcAudioPlaybackItem* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	DcAudioPlaybackItem* _tmp9_;
	DcAudioPlaybackItem* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	DcAudioPlaybackItem* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	DcAudioPlaybackItem* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	DcConversationView* view;
	GHashTable* _tmp19_;
	gconstpointer _tmp20_;
	DcConversationView* _tmp21_;
	DcConversationView* _tmp22_;
	DcConversationView* _tmp23_;
};

struct _DcWindowOpenChatFromNotificationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	gint acct_id;
	gint chat_id;
	gboolean _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
};

struct _Block10Data {
	int _ref_count_;
	DcWindow* self;
	AdwDialog* dialog;
	GtkEntry* entry;
	GtkLabel* status;
	GtkButton* add_btn;
};

struct _DcWindowUseInviteLinkData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	AdwDialog* dialog;
	GtkEntry* entry;
	GtkLabel* status;
	GtkButton* add_btn;
	gchar* invite_link;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	JsonObject* qr;
	DcRpcClient* _tmp6_;
	DcRpcClient* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	const gchar* _tmp10_;
	JsonObject* _tmp11_;
	gboolean _tmp12_;
	JsonObject* _tmp13_;
	JsonObject* _tmp14_;
	AdwDialog* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	gchar* kind;
	JsonObject* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	GQuark _tmp28_;
	gint chat_id;
	DcRpcClient* _tmp29_;
	DcRpcClient* _tmp30_;
	gint _tmp31_;
	gint _tmp32_;
	const gchar* _tmp33_;
	DcRpcClient* _tmp34_;
	DcRpcClient* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	const gchar* _tmp38_;
	GError* e;
	GError* _tmp39_;
	const gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	GError* _inner_error1_;
	AdwDialog* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	gint _tmp48_;
	gint _tmp49_;
	GError* _inner_error0_;
};

struct _DcWindowReloadActiveAccountData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWindow* self;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	AdwAvatar* _tmp3_;
	AdwAvatar* _tmp4_;
	GtkBox* _tmp5_;
	gboolean _tmp6_;
	DcEventHandler* _tmp7_;
	DcEventHandler* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	DcEventHandler* _tmp11_;
};

struct _DcWindowParamSpecPendingNotification {
	GParamSpec parent_instance;
};

struct _Block11Data {
	int _ref_count_;
	DcWindow* self;
	AdwStyleManager* style_manager;
};

static gint DcWindow_private_offset;
static gpointer dc_window_parent_class = NULL;
VALA_EXTERN gchar* dc_message_row_self_display_name;
VALA_EXTERN gchar* dc_message_row_self_avatar_path;
VALA_EXTERN DcRemoveParamFilter* dc_remove_param_filter_active;
static gpointer dc_window_pending_notification_parent_class = NULL;
VALA_EXTERN DcMessageStyle dc_message_row_style;
VALA_EXTERN gboolean dc_message_row_animate_stickers;
VALA_EXTERN gboolean dc_syntax_highlight_dark_mode;

VALA_EXTERN gboolean dc_is_delta_invite_uri (const gchar* uri);
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
VALA_EXTERN GType dc_settings_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsManager, g_object_unref)
VALA_EXTERN GType dc_conversation_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcConversationView, 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_image_viewer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcImageViewer, g_object_unref)
VALA_EXTERN GType dc_video_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcVideoPlayer, g_object_unref)
VALA_EXTERN GType dc_event_handler_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcEventHandler, g_object_unref)
VALA_EXTERN GType dc_chat_context_menu_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcChatContextMenu, g_object_unref)
static gpointer dc_window_pending_notification_ref (gpointer instance);
static void dc_window_pending_notification_unref (gpointer instance);
static GParamSpec* dc_window_param_spec_pending_notification (const gchar* name,
                                                       const gchar* nick,
                                                       const gchar* blurb,
                                                       GType object_type,
                                                       GParamFlags flags) G_GNUC_UNUSED ;
static void dc_window_value_set_pending_notification (GValue* value,
                                               gpointer v_object) G_GNUC_UNUSED ;
static void dc_window_value_take_pending_notification (GValue* value,
                                                gpointer v_object) G_GNUC_UNUSED ;
static gpointer dc_window_value_get_pending_notification (const GValue* value) G_GNUC_UNUSED ;
static GType dc_window_pending_notification_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindowPendingNotification, dc_window_pending_notification_unref)
VALA_EXTERN GType dc_tray_icon_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcTrayIcon, g_object_unref)
VALA_EXTERN GType dc_native_file_drop_target_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcNativeFileDropTarget, g_object_unref)
static void _dc_window_pending_notification_unref0_ (gpointer var);
static void dc_window_sync_webxdc_chat_visibility (DcWindow* self);
VALA_EXTERN gint dc_rpc_client_get_account_id (DcRpcClient* self);
VALA_EXTERN void dc_webxdc_set_active_chat (gint account_id,
                                gint chat_id,
                                gboolean window_visible);
VALA_EXTERN gboolean dc_window_is_chat_visible (DcWindow* self,
                                    gint chat_id);
VALA_EXTERN gint dc_window_get_current_chat_id (DcWindow* self);
static gboolean dc_window_can_show_account_modal (DcWindow* self);
static gboolean dc_window_can_show_rpc_modal (DcWindow* self);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
static void dc_window_update_conversation_header_actions (DcWindow* self);
static void dc_window_present_modal (DcWindow* self,
                              AdwDialog* dialog);
static void __lambda298_ (DcWindow* self);
static void ___lambda298__adw_dialog_closed (AdwDialog* _sender,
                                      gpointer self);
static void dc_window_reset_chat_ui (DcWindow* self);
static void dc_window_discard_all_views (DcWindow* self);
VALA_EXTERN GListStore* dc_window_get_chat_store (DcWindow* self);
VALA_EXTERN void dc_clear_listbox (GtkListBox* lb);
static void dc_window_update_archived_toggle (DcWindow* self);
static void dc_window_show_empty_status (DcWindow* self,
                                  const gchar* icon_name,
                                  const gchar* title,
                                  const gchar* description,
                                  GtkWidget* child);
VALA_EXTERN GType dc_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcApplication, g_object_unref)
VALA_EXTERN DcWindow* dc_window_new (DcApplication* app);
VALA_EXTERN DcWindow* dc_window_construct (GType object_type,
                               DcApplication* app);
static void dc_window_apply_current_appearance (DcWindow* self);
VALA_EXTERN GType dc_theme_override_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void dc_application_apply_theme_override (DcApplication* self,
                                          DcThemeOverride theme);
VALA_EXTERN DcThemeOverride dc_settings_manager_get_theme_override (DcSettingsManager* self);
VALA_EXTERN void dc_application_apply_accent_color (DcApplication* self,
                                        const gchar* hex);
VALA_EXTERN const gchar* dc_settings_manager_get_accent_color (DcSettingsManager* self);
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);
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_window_apply_current_font (DcWindow* self);
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 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_window_queue_font_update (DcWindow* self);
static guint dc_window_add_font_update_timeout (DcWindow* target);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gboolean __lambda299_ (Block1Data* _data1_);
VALA_EXTERN DcConversationView* dc_window_current_view (DcWindow* self);
static gboolean ___lambda299__gsource_func (gpointer self);
static void dc_window_rebuild_current_chat_view (DcWindow* self);
static void dc_window_set_current_chat_id (DcWindow* self,
                                    gint value);
VALA_EXTERN gboolean dc_window_select_chat_by_id (DcWindow* self,
                                      gint chat_id);
static gboolean dc_window_on_close_request (DcWindow* self);
static gboolean dc_window_ensure_tray_visible (DcWindow* self);
static void dc_window_minimize_to_tray (DcWindow* self);
static gboolean dc_window_runs_in_background (DcWindow* self);
static void dc_window_release_background_hold (DcWindow* self);
VALA_EXTERN gboolean dc_application_get_background_mode (DcApplication* self);
VALA_EXTERN void dc_window_set_minimize_to_tray (DcWindow* self,
                                     gboolean enabled);
VALA_EXTERN void dc_settings_manager_save_minimize_to_tray (DcSettingsManager* self,
                                                gboolean v);
static void dc_window_sync_tray (DcWindow* self);
VALA_EXTERN void dc_window_quit_application (DcWindow* self);
VALA_EXTERN void dc_window_handle_primary_q (DcWindow* self);
static void dc_window_close_active_modal (DcWindow* self);
VALA_EXTERN void dc_tray_icon_hide (DcTrayIcon* self);
VALA_EXTERN void dc_window_handle_primary_w (DcWindow* self);
static void dc_window_handle_native_file_drop (DcWindow* self,
                                        const gchar* path,
                                        gdouble x,
                                        gdouble y);
VALA_EXTERN GType dc_chat_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcChatRow, g_object_unref)
static DcChatRow* dc_window_chat_row_at_point (DcWindow* self,
                                        gdouble x,
                                        gdouble y);
static void dc_window_attach_file_to_chat (DcWindow* self,
                                    gint chat_id,
                                    const gchar* path,
                                    const gchar* name);
VALA_EXTERN gint dc_chat_row_get_chat_id (DcChatRow* self);
VALA_EXTERN void dc_conversation_view_attach_dropped_file_path (DcConversationView* self,
                                                    const gchar* path);
VALA_EXTERN gboolean dc_settings_manager_get_minimize_to_tray (DcSettingsManager* self);
VALA_EXTERN void dc_window_restore_from_tray (DcWindow* self);
static void dc_window_ensure_tray_backend (DcWindow* self);
VALA_EXTERN DcTrayIcon* dc_tray_icon_new (GDBusConnection* connection);
VALA_EXTERN DcTrayIcon* dc_tray_icon_construct (GType object_type,
                                    GDBusConnection* connection);
static void dc_window_show_from_tray_on_current_desktop (DcWindow* self,
                                                  const gchar* activation_token);
static void _dc_window_show_from_tray_on_current_desktop_dc_tray_icon_show_on_current_desktop_requested (DcTrayIcon* _sender,
                                                                                                  const gchar* activation_token,
                                                                                                  gpointer self);
static void dc_window_toggle_window_from_tray (DcWindow* self,
                                        const gchar* activation_token);
static void _dc_window_toggle_window_from_tray_dc_tray_icon_window_toggle_requested (DcTrayIcon* _sender,
                                                                              const gchar* activation_token,
                                                                              gpointer self);
static void __lambda301_ (DcWindow* self);
static void ___lambda301__dc_tray_icon_quit_requested (DcTrayIcon* _sender,
                                                gpointer self);
static void __lambda302_ (DcWindow* self,
                   gboolean enabled);
VALA_EXTERN void dc_window_set_notifications_enabled (DcWindow* self,
                                          gboolean enabled);
static void ___lambda302__dc_tray_icon_notifications_toggle_requested (DcTrayIcon* _sender,
                                                                gboolean enabled,
                                                                gpointer self);
VALA_EXTERN void dc_tray_icon_set_notifications_enabled (DcTrayIcon* self,
                                             gboolean enabled);
VALA_EXTERN gboolean dc_settings_manager_get_notifications_enabled (DcSettingsManager* self);
VALA_EXTERN void dc_tray_icon_set_window_visible (DcTrayIcon* self,
                                      gboolean window_visible);
VALA_EXTERN gboolean dc_tray_icon_show (DcTrayIcon* self);
static gboolean dc_window_request_activation_on_current_desktop (DcWindow* self,
                                                          const gchar* token);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void __lambda300_ (Block2Data* _data2_,
                   GObject* obj,
                   GAsyncResult* res);
static void ___lambda300__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
VALA_EXTERN void dc_settings_manager_save_notifications_enabled (DcSettingsManager* self,
                                                     gboolean v);
VALA_EXTERN void dc_event_handler_reconcile_desktop_notifications (DcEventHandler* self,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
VALA_EXTERN void dc_event_handler_reconcile_desktop_notifications_finish (DcEventHandler* self,
                                                              GAsyncResult* _res_);
static void dc_window_build_ui (DcWindow* self);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static GtkPopover* dc_window_build_account_popover (DcWindow* self);
static void __lambda312_ (DcWindow* self);
static void dc_window_load_account_menu (DcWindow* self,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
static void dc_window_load_account_menu_finish (DcWindow* self,
                                         GAsyncResult* _res_);
static void ___lambda312__gtk_widget_map (GtkWidget* _sender,
                                   gpointer self);
VALA_EXTERN gchar* dc_platform_primary_shortcut_text (const gchar* key);
static GMenuModel* dc_window_build_app_menu (DcWindow* self);
static void __lambda415_ (DcWindow* self);
static void ___lambda415__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                    gpointer self);
static void __lambda416_ (DcWindow* self);
static GtkListBoxRow* dc_window_first_visible_chat_row (DcWindow* self);
VALA_EXTERN void dc_conversation_view_focus_entry (DcConversationView* self);
static void ___lambda416__gtk_search_entry_activate (GtkSearchEntry* _sender,
                                              gpointer self);
static gboolean __lambda417_ (DcWindow* self,
                       guint keyval,
                       guint keycode,
                       GdkModifierType state);
static gboolean ___lambda417__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                             guint keyval,
                                                             guint keycode,
                                                             GdkModifierType state,
                                                             gpointer self);
static void __lambda418_ (DcWindow* self);
static void dc_window_toggle_archived_view (DcWindow* self);
static void ___lambda418__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static gboolean dc_window_filter_chats (DcWindow* self,
                                 GtkListBoxRow* row);
static gboolean _dc_window_filter_chats_gtk_list_box_filter_func (GtkListBoxRow* row,
                                                           gpointer self);
static void dc_window_on_chat_selected (DcWindow* self,
                                 GtkListBoxRow* row);
static void _dc_window_on_chat_selected_gtk_list_box_row_selected (GtkListBox* _sender,
                                                            GtkListBoxRow* row,
                                                            gpointer self);
static void __lambda419_ (DcWindow* self,
                   GtkListBoxRow* row);
VALA_EXTERN void dc_conversation_view_flush_pending_seen (DcConversationView* self);
static void ___lambda419__gtk_list_box_row_activated (GtkListBox* _sender,
                                               GtkListBoxRow* row,
                                               gpointer self);
static void __lambda420_ (Block3Data* _data3_,
                   gint n,
                   gdouble x,
                   gdouble y);
VALA_EXTERN void dc_chat_context_menu_show (DcChatContextMenu* self,
                                gint chat_id,
                                gdouble x,
                                gdouble y,
                                GtkWidget* parent);
static void ___lambda420__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                              gint n_press,
                                              gdouble x,
                                              gdouble y,
                                              gpointer self);
static void __lambda421_ (DcWindow* self);
static void dc_window_toggle_sidebar_button (DcWindow* self);
static void ___lambda421__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda422_ (DcWindow* self);
static void dc_window_show_gallery_dialog (DcWindow* self);
static void ___lambda422__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda423_ (DcWindow* self);
static void dc_window_toggle_message_search (DcWindow* self);
static void ___lambda423__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void _vala_GValue_free (GValue* self);
static void __lambda424_ (DcWindow* self);
static void dc_window_apply_sidebar_mode (DcWindow* self,
                                   gboolean update_visibility);
static void ___lambda424__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN GType dc_sidebar_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcSidebarMode dc_settings_manager_get_sidebar_mode (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_save_sidebar_mode (DcSettingsManager* self,
                                            DcSidebarMode v);
VALA_EXTERN GtkWidget* dc_image_viewer_get_widget (DcImageViewer* self);
VALA_EXTERN GtkWidget* dc_video_player_get_widget (DcVideoPlayer* self);
static GtkRevealer* dc_window_build_connection_banner (DcWindow* self);
static gboolean dc_window_on_window_key_pressed (DcWindow* self,
                                          guint keyval,
                                          guint keycode,
                                          GdkModifierType state);
static gboolean _dc_window_on_window_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                guint keyval,
                                                                                guint keycode,
                                                                                GdkModifierType state,
                                                                                gpointer self);
static gboolean dc_window_on_chat_scroll (DcWindow* self,
                                   GtkEventControllerScroll* scroll,
                                   gdouble dx,
                                   gdouble dy);
static gboolean _dc_window_on_chat_scroll_gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                                       gdouble dx,
                                                                       gdouble dy,
                                                                       gpointer self);
static void dc_window_on_account_menu_row_activated (DcWindow* self,
                                              GtkListBoxRow* row);
static void _dc_window_on_account_menu_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                          GtkListBoxRow* row,
                                                                          gpointer self);
static void dc_window_try_connect_data_free (gpointer _data);
static void dc_window_try_connect (DcWindow* self,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_);
static void dc_window_try_connect_finish (DcWindow* self,
                                   GAsyncResult* _res_);
static gboolean dc_window_try_connect_co (DcWindowTryConnectData* _data_);
VALA_EXTERN DcRpcClient* dc_application_get_rpc (DcApplication* self);
VALA_EXTERN GType dc_rpc_server_source_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gchar* dc_account_finder_find_rpc_server (const gchar* custom_path,
                                          DcRpcServerSource source);
VALA_EXTERN gchar* dc_settings_manager_effective_rpc_server_path (DcSettingsManager* self);
VALA_EXTERN DcRpcServerSource dc_settings_manager_effective_rpc_server_source (DcSettingsManager* self);
VALA_EXTERN void dc_window_set_connection_status (DcWindow* self,
                                      gboolean connected,
                                      const gchar* reason);
static void dc_window_show_rpc_not_found (DcWindow* self);
VALA_EXTERN gchar* dc_account_finder_get_data_dir (void);
VALA_EXTERN gchar* dc_settings_manager_effective_accounts_path (DcSettingsManager* self);
VALA_EXTERN void dc_rpc_client_start (DcRpcClient* self,
                          gchar** argv,
                          gint argv_length1,
                          const gchar* cwd,
                          const gchar* accounts_path,
                          GAsyncReadyCallback _callback_,
                          gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_start_finish (DcRpcClient* self,
                                 GAsyncResult* _res_,
                                 GError** error);
static void dc_window_try_connect_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_);
static void __lambda353_ (DcWindow* self,
                   const gchar* reason);
static void ___lambda353__dc_rpc_client_disconnected (DcRpcClient* _sender,
                                               const gchar* reason,
                                               gpointer self);
VALA_EXTERN gboolean dc_settings_manager_rpc_auto_update_enabled (DcSettingsManager* self);
VALA_EXTERN gchar* dc_account_finder_get_managed_rpc_path (void);
static void dc_window_check_managed_update (DcWindow* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void dc_window_check_managed_update_finish (DcWindow* self,
                                            GAsyncResult* _res_);
VALA_EXTERN void dc_account_finder_ensure_configured (DcRpcClient* rpc,
                                          const gchar* preferred_addr,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN gint dc_account_finder_ensure_configured_finish (GAsyncResult* _res_,
                                                 gchar** description,
                                                 gchar** toast_msg);
VALA_EXTERN const gchar* dc_settings_manager_get_default_account_addr (DcSettingsManager* self);
static void dc_window_apply_auto_download_limit (DcWindow* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_window_apply_auto_download_limit_finish (DcWindow* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
VALA_EXTERN void dc_rpc_client_start_io_for_all_accounts (DcRpcClient* self,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_start_io_for_all_accounts_finish (DcRpcClient* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
VALA_EXTERN void dc_window_refresh_tracking_filter (DcWindow* self,
                                        gboolean force,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN gchar* dc_window_refresh_tracking_filter_finish (DcWindow* self,
                                                 GAsyncResult* _res_);
VALA_EXTERN DcEventHandler* dc_event_handler_new (DcRpcClient* rpc);
VALA_EXTERN DcEventHandler* dc_event_handler_construct (GType object_type,
                                            DcRpcClient* rpc);
VALA_EXTERN void dc_webxdc_setup (DcRpcClient* rpc,
                      DcSettingsManager* settings);
VALA_EXTERN void dc_event_handler_set_app (DcEventHandler* self,
                               GApplication* a);
static void __lambda361_ (DcWindow* self);
VALA_EXTERN void dc_window_load_chats (DcWindow* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
VALA_EXTERN void dc_window_load_chats_finish (DcWindow* self,
                                  GAsyncResult* _res_);
static void ___lambda361__dc_event_handler_chats_reload_fired (DcEventHandler* _sender,
                                                        gpointer self);
static void __lambda362_ (DcWindow* self);
VALA_EXTERN void dc_conversation_view_reload_messages (DcConversationView* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN void dc_conversation_view_reload_messages_finish (DcConversationView* self,
                                                  GAsyncResult* _res_);
static void ___lambda362__dc_event_handler_messages_reload_fired (DcEventHandler* _sender,
                                                           gpointer self);
static void __lambda363_ (DcWindow* self,
                   gint acct_id,
                   gint chat_id,
                   gint msg_id);
static void dc_window_on_incoming_msg (DcWindow* self,
                                gint acct_id,
                                gint chat_id,
                                gint msg_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
static void dc_window_on_incoming_msg_finish (DcWindow* self,
                                       GAsyncResult* _res_);
static void ___lambda363__dc_event_handler_incoming_msg_received (DcEventHandler* _sender,
                                                           gint acct_id,
                                                           gint chat_id,
                                                           gint msg_id,
                                                           gpointer self);
static void __lambda365_ (DcWindow* self,
                   gint acct_id,
                   gint chat_id,
                   gint msg_id,
                   gint contact_id,
                   const gchar* reaction);
static void dc_window_queue_chat_notification (DcWindow* self,
                                        gint acct_id,
                                        gint chat_id,
                                        gint msg_id,
                                        gint contact_id,
                                        const gchar* reaction);
static void ___lambda365__dc_event_handler_incoming_reaction_received (DcEventHandler* _sender,
                                                                gint acct_id,
                                                                gint chat_id,
                                                                gint msg_id,
                                                                gint contact_id,
                                                                const gchar* reaction,
                                                                gpointer self);
static void __lambda366_ (DcWindow* self,
                   gint acct_id,
                   gint chat_id);
static void dc_window_on_chat_messages_changed (DcWindow* self,
                                         gint acct_id,
                                         gint chat_id);
static void ___lambda366__dc_event_handler_chat_messages_changed (DcEventHandler* _sender,
                                                           gint acct_id,
                                                           gint chat_id,
                                                           gpointer self);
static void __lambda367_ (DcWindow* self,
                   gint acct_id);
static void dc_window_update_unread_indicators (DcWindow* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dc_window_update_unread_indicators_finish (DcWindow* self,
                                                GAsyncResult* _res_);
static void ___lambda367__dc_event_handler_account_unread_changed (DcEventHandler* _sender,
                                                            gint acct_id,
                                                            gpointer self);
static void __lambda368_ (DcWindow* self,
                   gint acct_id);
VALA_EXTERN void dc_window_invalidate_all_mention_rosters (DcWindow* self);
static void dc_window_refresh_self_mention_keys (DcWindow* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_window_refresh_self_mention_keys_finish (DcWindow* self,
                                                 GAsyncResult* _res_);
static void ___lambda368__dc_event_handler_contacts_changed (DcEventHandler* _sender,
                                                      gint acct_id,
                                                      gpointer self);
VALA_EXTERN DcChatContextMenu* dc_chat_context_menu_new (DcWindow* window,
                                             DcRpcClient* rpc,
                                             GListStore* chat_store);
VALA_EXTERN DcChatContextMenu* dc_chat_context_menu_construct (GType object_type,
                                                   DcWindow* window,
                                                   DcRpcClient* rpc,
                                                   GListStore* chat_store);
static void dc_window_load_self_identity (DcWindow* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
static void dc_window_load_self_identity_finish (DcWindow* self,
                                          GAsyncResult* _res_);
static void dc_window_load_profile_avatar (DcWindow* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void dc_window_load_profile_avatar_finish (DcWindow* self,
                                           GAsyncResult* _res_);
VALA_EXTERN void dc_event_handler_start (DcEventHandler* self,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
VALA_EXTERN void dc_event_handler_start_finish (DcEventHandler* self,
                                    GAsyncResult* _res_);
static void dc_window_show_use_invite_link_dialog (DcWindow* self,
                                            const gchar* prefill);
static void dc_window_clear_self_identity (DcWindow* self);
VALA_EXTERN void dc_rpc_client_set_self_email (DcRpcClient* self,
                                   const gchar* value);
VALA_EXTERN gchar** dc_window_self_mention_keys (DcWindow* self,
                                     gint* result_length1);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static void dc_window_refresh_self_mention_keys_data_free (gpointer _data);
static gboolean dc_window_refresh_self_mention_keys_co (DcWindowRefreshSelfMentionKeysData* _data_);
static void _g_free0_ (gpointer var);
VALA_EXTERN const gchar* dc_rpc_client_get_self_email (DcRpcClient* self);
VALA_EXTERN void dc_rpc_client_list_transports (DcRpcClient* self,
                                    gint acct_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN JsonNode* dc_rpc_client_list_transports_finish (DcRpcClient* self,
                                                GAsyncResult* _res_,
                                                GError** error);
static void dc_window_refresh_self_mention_keys_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
VALA_EXTERN gchar* dc_json_str (JsonObject* obj,
                    const gchar* key);
static void _vala_JsonNode_free (JsonNode* self);
static void _vala_array_add3 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static gchar** _vala_array_dup2 (gchar** self,
                          gssize length);
static void dc_window_check_mention_data_free (gpointer _data);
static void dc_window_check_mention (DcWindow* self,
                              gint acct_id,
                              gint chat_id,
                              gint msg_id,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_);
static void dc_window_check_mention_finish (DcWindow* self,
                                     GAsyncResult* _res_);
static gboolean dc_window_check_mention_co (DcWindowCheckMentionData* _data_);
static gchar** _vala_array_dup3 (gchar** self,
                          gssize length);
static void dc_window_background_self_keys (DcWindow* self,
                                     gint acct_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static gchar** dc_window_background_self_keys_finish (DcWindow* self,
                                               GAsyncResult* _res_,
                                               gint* result_length1);
static void dc_window_check_mention_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_);
VALA_EXTERN GType dc_message_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessage, g_object_unref)
VALA_EXTERN void dc_rpc_client_fetch_message_for (DcRpcClient* self,
                                      gint acct_id,
                                      gint msg_id,
                                      const gchar* self_addr,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_client_fetch_message_for_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
VALA_EXTERN gboolean dc_message_get_is_outgoing (DcMessage* self);
VALA_EXTERN gboolean dc_mentions_mentions_self (const gchar* text,
                                    gchar** self_keys,
                                    gint self_keys_length1);
VALA_EXTERN const gchar* dc_message_get_text (DcMessage* self);
VALA_EXTERN void dc_window_request_reload_chats (DcWindow* self);
VALA_EXTERN const gchar* dc_message_get_sender_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_sender_address (DcMessage* self);
VALA_EXTERN void dc_event_handler_send_mention_notification (DcEventHandler* self,
                                                 gint acct_id,
                                                 gint chat_id,
                                                 const gchar* title,
                                                 const gchar* body);
static void dc_window_background_self_keys_data_free (gpointer _data);
static gboolean dc_window_background_self_keys_co (DcWindowBackgroundSelfKeysData* _data_);
VALA_EXTERN void dc_rpc_client_get_config (DcRpcClient* self,
                               const gchar* key,
                               gint acct_id,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_client_get_config_finish (DcRpcClient* self,
                                        GAsyncResult* _res_,
                                        GError** error);
static void dc_window_background_self_keys_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static void _vala_array_add4 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add5 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
VALA_EXTERN void dc_conversation_view_invalidate_mention_roster (DcConversationView* self);
VALA_EXTERN void dc_window_open_mention (DcWindow* self,
                             const gchar* uri);
static void dc_window_open_mention_contact (DcWindow* self,
                                     gint contact_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void dc_window_open_mention_contact_finish (DcWindow* self,
                                            GAsyncResult* _res_);
static void dc_window_open_mention_address (DcWindow* self,
                                     const gchar* address,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void dc_window_open_mention_address_finish (DcWindow* self,
                                            GAsyncResult* _res_);
static void dc_window_open_mention_contact_data_free (gpointer _data);
static gboolean dc_window_open_mention_contact_co (DcWindowOpenMentionContactData* _data_);
VALA_EXTERN void dc_rpc_client_get_or_create_chat_by_contact (DcRpcClient* self,
                                                  gint contact_id,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_or_create_chat_by_contact_finish (DcRpcClient* self,
                                                         GAsyncResult* _res_,
                                                         GError** error);
static void dc_window_open_mention_contact_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static void dc_window_open_mention_address_data_free (gpointer _data);
static gboolean dc_window_open_mention_address_co (DcWindowOpenMentionAddressData* _data_);
VALA_EXTERN void dc_rpc_client_get_or_create_contact (DcRpcClient* self,
                                          const gchar* email,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_or_create_contact_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void dc_window_open_mention_address_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static void dc_window_load_self_identity_data_free (gpointer _data);
static gboolean dc_window_load_self_identity_co (DcWindowLoadSelfIdentityData* _data_);
static void dc_window_load_self_identity_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
VALA_EXTERN gboolean dc_rpc_installer_can_auto_install (void);
VALA_EXTERN gboolean dc_settings_manager_rpc_server_path_is_fixed (void);
static void ___lambda351_ (DcWindow* self);
static void dc_window_install_and_connect (DcWindow* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void dc_window_install_and_connect_finish (DcWindow* self,
                                           GAsyncResult* _res_);
static void ____lambda351__gtk_button_clicked (GtkButton* _sender,
                                        gpointer self);
static void dc_window_show_settings_dialog (DcWindow* self);
static void _dc_window_show_settings_dialog_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self);
static void dc_window_install_and_connect_data_free (gpointer _data);
static gboolean dc_window_install_and_connect_co (DcWindowInstallAndConnectData* _data_);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
VALA_EXTERN GType dc_rpc_installer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcInstaller, g_object_unref)
VALA_EXTERN DcRpcInstaller* dc_rpc_installer_new (void);
VALA_EXTERN DcRpcInstaller* dc_rpc_installer_construct (GType object_type);
static void __lambda352_ (Block4Data* _data4_,
                   gint64 received,
                   gint64 total);
static void ___lambda352__dc_rpc_installer_progress (DcRpcInstaller* _sender,
                                              gint64 received,
                                              gint64 total,
                                              gpointer self);
VALA_EXTERN void dc_rpc_installer_download_latest (DcRpcInstaller* self,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_installer_download_latest_finish (DcRpcInstaller* self,
                                                GAsyncResult* _res_,
                                                GError** error);
static void dc_window_install_and_connect_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN DcRpcServerSource dc_settings_manager_get_rpc_server_source (DcSettingsManager* self);
VALA_EXTERN void dc_settings_manager_save_rpc_server_source (DcSettingsManager* self,
                                                 DcRpcServerSource v);
VALA_EXTERN void dc_window_reconnect_rpc_server (DcWindow* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_window_reconnect_rpc_server_finish (DcWindow* self,
                                            GAsyncResult* _res_);
static void dc_window_refresh_tracking_filter_data_free (gpointer _data);
static gboolean dc_window_refresh_tracking_filter_co (DcWindowRefreshTrackingFilterData* _data_);
VALA_EXTERN gboolean dc_settings_manager_get_tracking_filter_enabled (DcSettingsManager* self);
VALA_EXTERN const gchar* dc_settings_manager_get_tracking_filter_url (DcSettingsManager* self);
VALA_EXTERN GType dc_remove_param_filter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRemoveParamFilter, g_object_unref)
VALA_EXTERN gboolean dc_remove_param_filter_cache_is_stale (DcRemoveParamFilter* self,
                                                gint64 min_age);
VALA_EXTERN void dc_rpc_client_get_http_response (DcRpcClient* self,
                                      const gchar* url,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN guint8* dc_rpc_client_get_http_response_finish (DcRpcClient* self,
                                                GAsyncResult* _res_,
                                                gchar** mimetype,
                                                gint* result_length1,
                                                GError** error);
static void dc_window_refresh_tracking_filter_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN DcRemoveParamFilter* dc_remove_param_filter_from_text (const gchar* text);
VALA_EXTERN gboolean dc_remove_param_filter_save_cached (const gchar* text);
VALA_EXTERN gint dc_remove_param_filter_get_rule_count (DcRemoveParamFilter* self);
static void dc_window_check_managed_update_data_free (gpointer _data);
static gboolean dc_window_check_managed_update_co (DcWindowCheckManagedUpdateData* _data_);
VALA_EXTERN void dc_rpc_installer_installed_version (GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_installer_installed_version_finish (GAsyncResult* _res_);
static void dc_window_check_managed_update_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
VALA_EXTERN void dc_rpc_installer_fetch_latest_tag (GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN gchar* dc_rpc_installer_fetch_latest_tag_finish (GAsyncResult* _res_,
                                                 GError** error);
VALA_EXTERN gchar* dc_rpc_installer_extract_version (const gchar* text);
static void ___lambda354_ (DcWindow* self);
static void dc_window_update_managed_server (DcWindow* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static void dc_window_update_managed_server_finish (DcWindow* self,
                                             GAsyncResult* _res_);
static void ____lambda354__adw_toast_button_clicked (AdwToast* _sender,
                                              gpointer self);
static void dc_window_update_managed_server_data_free (gpointer _data);
static gboolean dc_window_update_managed_server_co (DcWindowUpdateManagedServerData* _data_);
static void dc_window_update_managed_server_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static void dc_window_reconnect_rpc_server_data_free (gpointer _data);
static gboolean dc_window_reconnect_rpc_server_co (DcWindowReconnectRpcServerData* _data_);
VALA_EXTERN void dc_application_reset_rpc_client (DcApplication* self);
static void dc_window_reconnect_rpc_server_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
VALA_EXTERN void dc_window_clear_chat_view (DcWindow* self);
VALA_EXTERN GType dc_chat_kind_get_type (void) G_GNUC_CONST ;
static DcConversationView* dc_window_get_or_create_view (DcWindow* self,
                                                  gint chat_id,
                                                  DcChatKind kind);
static void dc_window_touch_cached_view (DcWindow* self,
                                  gint chat_id);
VALA_EXTERN void dc_conversation_view_set_chat_kind (DcConversationView* self,
                                         DcChatKind kind);
VALA_EXTERN DcConversationView* dc_conversation_view_new (gint chat_id,
                                              DcWindow* window,
                                              DcRpcClient* rpc,
                                              DcSettingsManager* settings,
                                              DcChatKind chat_kind);
VALA_EXTERN DcConversationView* dc_conversation_view_construct (GType object_type,
                                                    gint chat_id,
                                                    DcWindow* window,
                                                    DcRpcClient* rpc,
                                                    DcSettingsManager* settings,
                                                    DcChatKind chat_kind);
static void dc_window_evict_cached_views (DcWindow* self,
                                   gint keep_chat_id);
static void _vala_array_add6 (gint* * array,
                       gint* length,
                       gint* size,
                       gint value);
static void _vala_array_add7 (gint* * array,
                       gint* length,
                       gint* size,
                       gint value);
static gint* _vala_array_dup4 (gint* self,
                        gssize length);
static void dc_window_forget_cached_view (DcWindow* self,
                                   gint chat_id);
static void _vala_array_add8 (gint* * array,
                       gint* length,
                       gint* size,
                       gint value);
static gint* _vala_array_dup5 (gint* self,
                        gssize length);
static void dc_window_remove_cached_view (DcWindow* self,
                                   gint chat_id);
VALA_EXTERN void dc_conversation_view_close (DcConversationView* self);
VALA_EXTERN void dc_window_request_messages_reload (DcWindow* self);
VALA_EXTERN void dc_event_handler_schedule_messages_reload (DcEventHandler* self);
VALA_EXTERN void dc_window_request_chat_messages_reload (DcWindow* self,
                                             gint chat_id);
static void dc_window_load_chats_data_free (gpointer _data);
static gboolean dc_window_load_chats_co (DcWindowLoadChatsData* _data_);
VALA_EXTERN void dc_rpc_client_get_chatlist_entries_for (DcRpcClient* self,
                                             gint acct_id,
                                             const gchar* query,
                                             gint list_flags,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
VALA_EXTERN JsonArray* dc_rpc_client_get_chatlist_entries_for_finish (DcRpcClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error);
static void dc_window_load_chats_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_get_chatlist_items_by_entries_for (DcRpcClient* self,
                                                      gint acct_id,
                                                      JsonArray* entries,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_chatlist_items_by_entries_for_finish (DcRpcClient* self,
                                                                    GAsyncResult* _res_,
                                                                    GError** error);
VALA_EXTERN GType dc_chat_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcChatEntry, g_object_unref)
VALA_EXTERN DcChatEntry* dc_rpc_parsers_parse_chat_item (gint chat_id,
                                             JsonObject* obj);
VALA_EXTERN void dc_chat_entry_set_has_mention (DcChatEntry* self,
                                    gboolean value);
static void _vala_array_add9 (DcChatEntry** * array,
                       gint* length,
                       gint* size,
                       DcChatEntry* value);
VALA_EXTERN gint dc_chat_entry_get_last_message_id (DcChatEntry* self);
static void _vala_array_add10 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
static void dc_window_hydrate_chat_text_previews (DcWindow* self,
                                           DcChatEntry** entries,
                                           gint entries_length1,
                                           gint* msg_ids,
                                           gint msg_ids_length1,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void dc_window_hydrate_chat_text_previews_finish (DcWindow* self,
                                                  GAsyncResult* _res_);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
VALA_EXTERN DcChatRow* dc_chat_row_new (DcChatEntry* entry);
VALA_EXTERN DcChatRow* dc_chat_row_construct (GType object_type,
                                  DcChatEntry* entry);
VALA_EXTERN void dc_chat_row_set_compact (DcChatRow* self,
                              gboolean compact);
static gboolean _____lambda127_ (Block5Data* _data5_);
static gboolean dc_window_can_attach_file_to_chat (DcWindow* self,
                                            gint chat_id);
static gboolean ______lambda127__dc_chat_row_accept_file_drop (DcChatRow* _sender,
                                                        gpointer self);
static void _____lambda128_ (Block5Data* _data5_,
                      const gchar* path,
                      const gchar* name);
static void ______lambda128__dc_chat_row_file_dropped (DcChatRow* _sender,
                                                const gchar* path,
                                                const gchar* name,
                                                gpointer self);
static void _____lambda129_ (DcWindow* self,
                      const gchar* message);
static void ______lambda129__dc_chat_row_file_drop_failed (DcChatRow* _sender,
                                                    const gchar* message,
                                                    gpointer self);
VALA_EXTERN gint dc_chat_entry_get_id (DcChatEntry* self);
VALA_EXTERN const gchar* dc_chat_entry_get_name (DcChatEntry* self);
VALA_EXTERN gboolean dc_chat_entry_get_is_muted (DcChatEntry* self);
static void dc_window_hydrate_chat_text_previews_data_free (gpointer _data);
static gboolean dc_window_hydrate_chat_text_previews_co (DcWindowHydrateChatTextPreviewsData* _data_);
VALA_EXTERN void dc_rpc_client_get_messages_for (DcRpcClient* self,
                                     gint acct_id,
                                     gint* msg_ids,
                                     gint msg_ids_length1,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_messages_for_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static void dc_window_hydrate_chat_text_previews_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_parsers_parse_message (JsonObject* obj,
                                         const gchar* self_email);
static gboolean dc_window_plain_text_preview_message (DcMessage* msg);
VALA_EXTERN void dc_chat_entry_set_last_message (DcChatEntry* self,
                                     const gchar* value);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_is_info (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_view_type (DcMessage* self);
VALA_EXTERN DcChatEntry* dc_find_chat_entry (GListStore* store,
                                 gint chat_id);
static gboolean dc_window_chat_list_has_focus (DcWindow* self);
VALA_EXTERN gboolean dc_chat_entry_get_is_contact_request (DcChatEntry* self);
VALA_EXTERN gboolean dc_conversation_view_can_accept_dropped_file (DcConversationView* self);
VALA_EXTERN void dc_conversation_view_attach_dropped_file (DcConversationView* self,
                                               const gchar* path,
                                               const gchar* name);
VALA_EXTERN void dc_conversation_view_on_reselected (DcConversationView* self,
                                         gboolean focus_compose);
static void dc_window_notice_chat (DcWindow* self,
                            gint chat_id,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_);
static void dc_window_notice_chat_finish (DcWindow* self,
                                   GAsyncResult* _res_);
VALA_EXTERN DcChatKind dc_chat_entry_get_kind (DcChatEntry* self);
VALA_EXTERN void dc_conversation_view_set_contact_request (DcConversationView* self,
                                               gboolean is_request);
VALA_EXTERN void dc_conversation_view_on_activated (DcConversationView* self,
                                        gboolean focus_compose);
static void dc_window_notice_chat_data_free (gpointer _data);
static gboolean dc_window_notice_chat_co (DcWindowNoticeChatData* _data_);
static void dc_window_clear_chat_mention (DcWindow* self,
                                   gint chat_id);
VALA_EXTERN void dc_rpc_client_marknoticed_chat (DcRpcClient* self,
                                     gint chat_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_marknoticed_chat_finish (DcRpcClient* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static void dc_window_notice_chat_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_);
VALA_EXTERN void dc_event_handler_clear_notifications_for_chat (DcEventHandler* self,
                                                    gint acct_id,
                                                    gint chat_id);
static void dc_window_on_window_focused (DcWindow* self);
VALA_EXTERN void dc_window_show_image_list (DcWindow* self,
                                gchar** paths,
                                gint paths_length1,
                                gint start_index);
VALA_EXTERN void dc_image_viewer_show_list (DcImageViewer* self,
                                gchar** image_paths,
                                gint image_paths_length1,
                                gint start_index);
VALA_EXTERN gchar* dc_window_image_viewer_path (DcWindow* self);
VALA_EXTERN const gchar* dc_image_viewer_get_current_path (DcImageViewer* self);
VALA_EXTERN void dc_window_replace_image_list (DcWindow* self,
                                   gchar** paths,
                                   gint paths_length1,
                                   const gchar* expected_path);
VALA_EXTERN void dc_image_viewer_replace_list (DcImageViewer* self,
                                   gchar** image_paths,
                                   gint image_paths_length1);
VALA_EXTERN GType dc_gallery_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcGalleryDialog, g_object_unref)
VALA_EXTERN DcGalleryDialog* dc_gallery_dialog_new (DcWindow* window,
                                        DcRpcClient* rpc,
                                        gint chat_id,
                                        const gchar* chat_name);
VALA_EXTERN DcGalleryDialog* dc_gallery_dialog_construct (GType object_type,
                                              DcWindow* window,
                                              DcRpcClient* rpc,
                                              gint chat_id,
                                              const gchar* chat_name);
VALA_EXTERN void dc_window_show_video (DcWindow* self,
                           const gchar* path,
                           const gchar* name);
VALA_EXTERN void dc_video_player_show (DcVideoPlayer* self,
                           const gchar* path,
                           const gchar* name);
static void dc_window_save_attachment_data_free (gpointer _data);
VALA_EXTERN void dc_window_save_attachment (DcWindow* self,
                                const gchar* src_path,
                                const gchar* name,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void dc_window_save_attachment_finish (DcWindow* self,
                                       GAsyncResult* _res_);
static gboolean dc_window_save_attachment_co (DcWindowSaveAttachmentData* _data_);
static void dc_window_save_attachment_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_);
VALA_EXTERN gboolean dc_is_dialog_dismissal (GError* _error_);
static void dc_window_prompt_webxdc_app_data_free (gpointer _data);
VALA_EXTERN void dc_window_prompt_webxdc_app (DcWindow* self,
                                  GtkWidget* parent,
                                  DcRpcClient* app_rpc,
                                  DcMessage* msg,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN void dc_window_prompt_webxdc_app_finish (DcWindow* self,
                                         GAsyncResult* _res_);
static gboolean dc_window_prompt_webxdc_app_co (DcWindowPromptWebxdcAppData* _data_);
VALA_EXTERN gboolean dc_webxdc_enabled (void);
VALA_EXTERN gchar* dc_message_display_file_name (DcMessage* self,
                                     const gchar* fallback);
static void dc_window_prompt_webxdc_app_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_);
static void dc_window_ensure_webxdc_file (DcWindow* self,
                                   DcRpcClient* app_rpc,
                                   DcMessage* msg,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
static DcMessage* dc_window_ensure_webxdc_file_finish (DcWindow* self,
                                                GAsyncResult* _res_);
VALA_EXTERN void dc_webxdc_open (GtkWindow* parent,
                     DcRpcClient* rpc,
                     DcMessage* msg);
static void dc_window_run_webxdc_instance_data_free (gpointer _data);
VALA_EXTERN void dc_window_run_webxdc_instance (DcWindow* self,
                                    gint acct_id,
                                    DcMessage* msg,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN gboolean dc_window_run_webxdc_instance_finish (DcWindow* self,
                                               GAsyncResult* _res_);
static gboolean dc_window_run_webxdc_instance_co (DcWindowRunWebxdcInstanceData* _data_);
VALA_EXTERN void dc_window_switch_account (DcWindow* self,
                               gint acct_id,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN gboolean dc_window_switch_account_finish (DcWindow* self,
                                          GAsyncResult* _res_);
static void dc_window_run_webxdc_instance_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void dc_window_ensure_webxdc_file_data_free (gpointer _data);
static gboolean dc_window_ensure_webxdc_file_co (DcWindowEnsureWebxdcFileData* _data_);
VALA_EXTERN gboolean dc_message_get_has_local_file (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_is_downloading_full_message (DcMessage* self);
VALA_EXTERN gboolean dc_message_get_can_download_full_message (DcMessage* self);
VALA_EXTERN void dc_rpc_client_download_full_message (DcRpcClient* self,
                                          gint msg_id,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_download_full_message_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
VALA_EXTERN gint dc_message_get_id (DcMessage* self);
static void dc_window_ensure_webxdc_file_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_fetch_message (DcRpcClient* self,
                                  gint msg_id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_client_fetch_message_finish (DcRpcClient* self,
                                               GAsyncResult* _res_,
                                               GError** error);
VALA_EXTERN void dc_event_handler_schedule_chats_reload (DcEventHandler* self);
static DcWindowPendingNotification* dc_window_pending_notification_new (void);
static DcWindowPendingNotification* dc_window_pending_notification_construct (GType object_type);
static gboolean __lambda364_ (DcWindow* self);
static void dc_window_flush_chat_notifications (DcWindow* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dc_window_flush_chat_notifications_finish (DcWindow* self,
                                                GAsyncResult* _res_);
static gboolean ___lambda364__gsource_func (gpointer self);
static void dc_window_flush_chat_notifications_data_free (gpointer _data);
static gboolean dc_window_flush_chat_notifications_co (DcWindowFlushChatNotificationsData* _data_);
static gboolean dc_window_has_int (gint* haystack,
                            gint haystack_length1,
                            gint needle);
static void _vala_array_add11 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
static void dc_window_notify_account_items (DcWindow* self,
                                     gint acct_id,
                                     GPtrArray* items,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void dc_window_notify_account_items_finish (DcWindow* self,
                                            GAsyncResult* _res_);
static void dc_window_flush_chat_notifications_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void dc_window_notify_account_items_data_free (gpointer _data);
static gboolean dc_window_notify_account_items_co (DcWindowNotifyAccountItemsData* _data_);
static void _vala_array_add12 (gint* * array,
                        gint* length,
                        gint* size,
                        gint value);
static void dc_window_prefix_background_account (DcWindow* self,
                                          gint acct_id,
                                          const gchar* title,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static gchar* dc_window_prefix_background_account_finish (DcWindow* self,
                                                   GAsyncResult* _res_);
static void dc_window_notify_account_items_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
VALA_EXTERN void dc_event_handler_send_chat_notification (DcEventHandler* self,
                                              gint acct_id,
                                              gint chat_id,
                                              const gchar* title,
                                              const gchar* body);
static void dc_window_notify_chat_group (DcWindow* self,
                                  gint acct_id,
                                  gint chat_id,
                                  GPtrArray* group,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
static void dc_window_notify_chat_group_finish (DcWindow* self,
                                         GAsyncResult* _res_);
static void dc_window_notify_chat_group_data_free (gpointer _data);
static gboolean dc_window_notify_chat_group_co (DcWindowNotifyChatGroupData* _data_);
VALA_EXTERN void dc_rpc_client_get_full_chat_by_id_for (DcRpcClient* self,
                                            gint acct_id,
                                            gint chat_id,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_full_chat_by_id_for_finish (DcRpcClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error);
static void dc_window_notify_chat_group_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_);
VALA_EXTERN gboolean dc_json_bool (JsonObject* obj,
                       const gchar* key);
VALA_EXTERN gboolean dc_settings_manager_get_show_notification_contents (DcSettingsManager* self);
VALA_EXTERN void dc_rpc_client_get_contact_for (DcRpcClient* self,
                                    gint acct_id,
                                    gint contact_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_contact_for_finish (DcRpcClient* self,
                                                  GAsyncResult* _res_,
                                                  GError** error);
static void dc_window_prefix_background_account_data_free (gpointer _data);
static gboolean dc_window_prefix_background_account_co (DcWindowPrefixBackgroundAccountData* _data_);
static void dc_window_prefix_background_account_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void dc_window_on_incoming_msg_data_free (gpointer _data);
static gboolean dc_window_on_incoming_msg_co (DcWindowOnIncomingMsgData* _data_);
VALA_EXTERN void dc_conversation_view_handle_incoming_msg (DcConversationView* self,
                                               gint msg_id,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
VALA_EXTERN gboolean dc_conversation_view_handle_incoming_msg_finish (DcConversationView* self,
                                                          GAsyncResult* _res_);
static void dc_window_on_incoming_msg_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_);
VALA_EXTERN void dc_conversation_view_mark_messages_stale (DcConversationView* self);
static void dc_window_mark_all_views_messages_stale (DcWindow* self);
static void dc_window_load_account_menu_data_free (gpointer _data);
static gboolean dc_window_load_account_menu_co (DcWindowLoadAccountMenuData* _data_);
VALA_EXTERN gboolean dc_rpc_client_get_is_connected (DcRpcClient* self);
static void dc_window_focus_current_account_menu_row_if_requested (DcWindow* self);
VALA_EXTERN void dc_rpc_client_get_all_accounts (DcRpcClient* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN JsonNode* dc_rpc_client_get_all_accounts_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void dc_window_load_account_menu_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_);
static void dc_window_build_account_menu_row_for_id (DcWindow* self,
                                              gint id,
                                              gboolean current,
                                              GString* state,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static AdwActionRow* dc_window_build_account_menu_row_for_id_finish (DcWindow* self,
                                                              GAsyncResult* _res_,
                                                              GError** error);
static void _vala_array_add13 (AdwActionRow** * array,
                        gint* length,
                        gint* size,
                        AdwActionRow* value);
static AdwActionRow* dc_window_build_add_account_row (DcWindow* self);
static gboolean __lambda130_ (DcWindow* self);
static void dc_window_focus_current_account_menu_row (DcWindow* self);
static gboolean ___lambda130__gsource_func (gpointer self);
static void dc_window_build_account_menu_row_for_id_data_free (gpointer _data);
static gboolean dc_window_build_account_menu_row_for_id_co (DcWindowBuildAccountMenuRowForIdData* _data_);
VALA_EXTERN void dc_rpc_client_is_configured (DcRpcClient* self,
                                  gint acct_id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN gboolean dc_rpc_client_is_configured_finish (DcRpcClient* self,
                                             GAsyncResult* _res_,
                                             GError** error);
static void dc_window_build_account_menu_row_for_id_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_get_fresh_msg_count (DcRpcClient* self,
                                        gint acct_id,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_fresh_msg_count_finish (DcRpcClient* self,
                                               GAsyncResult* _res_,
                                               GError** error);
static AdwActionRow* dc_window_build_account_menu_row (DcWindow* self,
                                                gint id,
                                                gboolean configured,
                                                gboolean current,
                                                const gchar* email,
                                                const gchar* display_name,
                                                const gchar* avatar,
                                                gint unread);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
VALA_EXTERN GdkTexture* dc_load_avatar (const gchar* path);
static void __lambda131_ (Block6Data* _data6_);
static void dc_window_show_profile_for_account (DcWindow* self,
                                         gint acct_id);
static void ___lambda131__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void dc_window_on_add_account (DcWindow* self);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static AdwActionRow* dc_window_build_add_method_row (DcWindow* self,
                                              const gchar* icon_name,
                                              const gchar* title,
                                              const gchar* subtitle);
static void __lambda304_ (Block7Data* _data7_,
                   GtkListBoxRow* row);
static void dc_window_on_add_account_method_selected (DcWindow* self,
                                               const gchar* method);
static void ___lambda304__gtk_list_box_row_activated (GtkListBox* _sender,
                                               GtkListBoxRow* row,
                                               gpointer self);
static void dc_window_show_classic_email_dialog (DcWindow* self);
static void dc_window_show_secondary_device_dialog (DcWindow* self);
static void dc_window_show_create_profile_dialog (DcWindow* self);
static void dc_window_show_invitation_code_profile_dialog (DcWindow* self);
VALA_EXTERN GType dc_create_profile_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcCreateProfileDialog, g_object_unref)
VALA_EXTERN DcCreateProfileDialog* dc_create_profile_dialog_new (DcRpcClient* rpc,
                                                     DcEventHandler* events);
VALA_EXTERN DcCreateProfileDialog* dc_create_profile_dialog_construct (GType object_type,
                                                           DcRpcClient* rpc,
                                                           DcEventHandler* events);
static void __lambda309_ (DcWindow* self,
                   gint new_id);
static void dc_window_after_profile_created (DcWindow* self,
                                      gint new_id,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static void dc_window_after_profile_created_finish (DcWindow* self,
                                             GAsyncResult* _res_);
static void ___lambda309__dc_create_profile_dialog_account_created (DcCreateProfileDialog* _sender,
                                                             gint new_account_id,
                                                             gpointer self);
static void dc_window_after_profile_created_data_free (gpointer _data);
static gboolean dc_window_after_profile_created_co (DcWindowAfterProfileCreatedData* _data_);
static void dc_window_after_profile_created_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
VALA_EXTERN GType dc_invitation_code_profile_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcInvitationCodeProfileDialog, g_object_unref)
VALA_EXTERN DcInvitationCodeProfileDialog* dc_invitation_code_profile_dialog_new (DcRpcClient* rpc,
                                                                      DcEventHandler* events);
VALA_EXTERN DcInvitationCodeProfileDialog* dc_invitation_code_profile_dialog_construct (GType object_type,
                                                                            DcRpcClient* rpc,
                                                                            DcEventHandler* events);
static void __lambda311_ (DcWindow* self,
                   gint new_id,
                   gint chat_id);
static void dc_window_after_invitation_profile_created (DcWindow* self,
                                                 gint new_id,
                                                 gint chat_id,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static void dc_window_after_invitation_profile_created_finish (DcWindow* self,
                                                        GAsyncResult* _res_);
static void ___lambda311__dc_invitation_code_profile_dialog_account_created (DcInvitationCodeProfileDialog* _sender,
                                                                      gint new_account_id,
                                                                      gint chat_id,
                                                                      gpointer self);
static void dc_window_after_invitation_profile_created_data_free (gpointer _data);
static gboolean dc_window_after_invitation_profile_created_co (DcWindowAfterInvitationProfileCreatedData* _data_);
static void dc_window_after_invitation_profile_created_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
VALA_EXTERN GType dc_receive_backup_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcReceiveBackupDialog, g_object_unref)
VALA_EXTERN DcReceiveBackupDialog* dc_receive_backup_dialog_new (DcRpcClient* rpc,
                                                     DcEventHandler* events);
VALA_EXTERN DcReceiveBackupDialog* dc_receive_backup_dialog_construct (GType object_type,
                                                           DcRpcClient* rpc,
                                                           DcEventHandler* events);
static void __lambda307_ (DcWindow* self,
                   gint new_id);
static void dc_window_after_secondary_device_imported (DcWindow* self,
                                                gint new_id,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static void dc_window_after_secondary_device_imported_finish (DcWindow* self,
                                                       GAsyncResult* _res_);
static void ___lambda307__dc_receive_backup_dialog_account_imported (DcReceiveBackupDialog* _sender,
                                                              gint new_account_id,
                                                              gpointer self);
static void dc_window_after_secondary_device_imported_data_free (gpointer _data);
static gboolean dc_window_after_secondary_device_imported_co (DcWindowAfterSecondaryDeviceImportedData* _data_);
static void dc_window_after_secondary_device_imported_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
VALA_EXTERN GType dc_classic_email_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcClassicEmailDialog, g_object_unref)
VALA_EXTERN DcClassicEmailDialog* dc_classic_email_dialog_new (DcRpcClient* rpc,
                                                   DcEventHandler* events);
VALA_EXTERN DcClassicEmailDialog* dc_classic_email_dialog_construct (GType object_type,
                                                         DcRpcClient* rpc,
                                                         DcEventHandler* events);
static void __lambda305_ (DcWindow* self,
                   gint new_id);
static void ___lambda305__dc_classic_email_dialog_account_created (DcClassicEmailDialog* _sender,
                                                            gint new_account_id,
                                                            gpointer self);
static void dc_window_set_auto_download_limit_data_free (gpointer _data);
VALA_EXTERN void dc_window_set_auto_download_limit (DcWindow* self,
                                        gint bytes,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN void dc_window_set_auto_download_limit_finish (DcWindow* self,
                                               GAsyncResult* _res_);
static gboolean dc_window_set_auto_download_limit_co (DcWindowSetAutoDownloadLimitData* _data_);
VALA_EXTERN void dc_settings_manager_save_auto_download_limit (DcSettingsManager* self,
                                                   gint bytes);
static void dc_window_set_auto_download_limit_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static void dc_window_apply_auto_download_limit_data_free (gpointer _data);
static gboolean dc_window_apply_auto_download_limit_co (DcWindowApplyAutoDownloadLimitData* _data_);
static void dc_window_apply_auto_download_limit_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
VALA_EXTERN gint dc_settings_manager_get_auto_download_limit (DcSettingsManager* self);
VALA_EXTERN void dc_rpc_client_batch_set_config (DcRpcClient* self,
                                     const gchar* key,
                                     const gchar* val,
                                     gint acct_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_batch_set_config_finish (DcRpcClient* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static void dc_window_switch_account_data_free (gpointer _data);
static gboolean dc_window_switch_account_co (DcWindowSwitchAccountData* _data_);
VALA_EXTERN void dc_rpc_client_select_account (DcRpcClient* self,
                                   gint acct_id,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_select_account_finish (DcRpcClient* self,
                                          GAsyncResult* _res_,
                                          GError** error);
static void dc_window_switch_account_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_set_account_id (DcRpcClient* self,
                                   gint value);
VALA_EXTERN void dc_window_reload_active_account (DcWindow* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN void dc_window_reload_active_account_finish (DcWindow* self,
                                             GAsyncResult* _res_);
VALA_EXTERN void dc_show_error (GtkWidget* parent,
                    const gchar* message);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
VALA_EXTERN GType dc_profile_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcProfileDialog, g_object_unref)
VALA_EXTERN DcProfileDialog* dc_profile_dialog_new (DcRpcClient* rpc,
                                        DcSettingsManager* settings,
                                        DcEventHandler* events,
                                        gint acct_id);
VALA_EXTERN DcProfileDialog* dc_profile_dialog_construct (GType object_type,
                                              DcRpcClient* rpc,
                                              DcSettingsManager* settings,
                                              DcEventHandler* events,
                                              gint acct_id);
static void __lambda157_ (Block8Data* _data8_);
static void ___lambda157__dc_profile_dialog_profile_updated (DcProfileDialog* _sender,
                                                      gpointer self);
static void __lambda158_ (Block8Data* _data8_,
                   gint deleted_id);
static void dc_window_after_profile_deleted (DcWindow* self,
                                      gint deleted_id,
                                      gboolean was_current_account,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static void dc_window_after_profile_deleted_finish (DcWindow* self,
                                             GAsyncResult* _res_);
static void ___lambda158__dc_profile_dialog_account_deleted (DcProfileDialog* _sender,
                                                      gint acct_id,
                                                      gpointer self);
static void dc_window_after_profile_deleted_data_free (gpointer _data);
static gboolean dc_window_after_profile_deleted_co (DcWindowAfterProfileDeletedData* _data_);
static void dc_window_switch_to_first_configured_account (DcWindow* self,
                                                   gint skip_id,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static gboolean dc_window_switch_to_first_configured_account_finish (DcWindow* self,
                                                              GAsyncResult* _res_);
static void dc_window_after_profile_deleted_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static void dc_window_switch_to_first_configured_account_data_free (gpointer _data);
static gboolean dc_window_switch_to_first_configured_account_co (DcWindowSwitchToFirstConfiguredAccountData* _data_);
static void dc_window_switch_to_first_configured_account_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_);
static void dc_window_load_profile_avatar_data_free (gpointer _data);
static gboolean dc_window_load_profile_avatar_co (DcWindowLoadProfileAvatarData* _data_);
static void dc_window_load_profile_avatar_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void dc_window_update_unread_indicators_data_free (gpointer _data);
static gboolean dc_window_update_unread_indicators_co (DcWindowUpdateUnreadIndicatorsData* _data_);
static void dc_window_update_unread_indicators_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void dc_window_on_new_chat (DcWindow* self);
VALA_EXTERN GType dc_contact_picker_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcContactPickerDialog, g_object_unref)
VALA_EXTERN DcContactPickerDialog* dc_contact_picker_dialog_new (DcRpcClient* rpc,
                                                     GListStore* chat_store,
                                                     const gchar* title);
VALA_EXTERN DcContactPickerDialog* dc_contact_picker_dialog_construct (GType object_type,
                                                           DcRpcClient* rpc,
                                                           GListStore* chat_store,
                                                           const gchar* title);
static void __lambda314_ (DcWindow* self,
                   gint contact_id,
                   const gchar* email);
static void dc_window_create_chat_by_email (DcWindow* self,
                                     const gchar* email,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void dc_window_create_chat_by_email_finish (DcWindow* self,
                                            GAsyncResult* _res_);
static void ___lambda314__dc_contact_picker_dialog_contact_picked (DcContactPickerDialog* _sender,
                                                            gint contact_id,
                                                            const gchar* email,
                                                            gpointer self);
static void dc_window_create_chat_by_email_data_free (gpointer _data);
static gboolean dc_window_create_chat_by_email_co (DcWindowCreateChatByEmailData* _data_);
static void dc_window_create_chat_by_email_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static void dc_window_on_new_group (DcWindow* self);
static void dc_window_show_group_dialog (DcWindow* self,
                                  gboolean is_channel);
static void dc_window_on_new_channel (DcWindow* self);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
VALA_EXTERN GType dc_new_group_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcNewGroupDialog, g_object_unref)
VALA_EXTERN DcNewGroupDialog* dc_new_group_dialog_new (DcRpcClient* rpc,
                                           gboolean is_channel);
VALA_EXTERN DcNewGroupDialog* dc_new_group_dialog_construct (GType object_type,
                                                 DcRpcClient* rpc,
                                                 gboolean is_channel);
static void __lambda316_ (Block9Data* _data9_,
                   gint chat_id);
static void dc_window_after_group_created (DcWindow* self,
                                    gint chat_id,
                                    gboolean is_channel,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void dc_window_after_group_created_finish (DcWindow* self,
                                           GAsyncResult* _res_);
static void ___lambda316__dc_new_group_dialog_group_created (DcNewGroupDialog* _sender,
                                                      gint chat_id,
                                                      gpointer self);
static void dc_window_after_group_created_data_free (gpointer _data);
static gboolean dc_window_after_group_created_co (DcWindowAfterGroupCreatedData* _data_);
static void dc_window_after_group_created_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN void dc_window_scroll_to_message (DcWindow* self,
                                  gint msg_id);
VALA_EXTERN void dc_conversation_view_scroll_to_message (DcConversationView* self,
                                             gint msg_id);
VALA_EXTERN void dc_window_open_conversation_message (DcWindow* self,
                                          gint chat_id,
                                          gint msg_id);
static void dc_window_open_media_message_data_free (gpointer _data);
VALA_EXTERN void dc_window_open_media_message (DcWindow* self,
                                   gint acct_id,
                                   gint chat_id,
                                   gint msg_id,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void dc_window_open_media_message_finish (DcWindow* self,
                                          GAsyncResult* _res_);
static gboolean dc_window_open_media_message_co (DcWindowOpenMediaMessageData* _data_);
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 dc_window_open_media_message_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
VALA_EXTERN void dc_window_navigate_voice_playback (DcWindow* self,
                                        gint direction);
VALA_EXTERN GType dc_audio_playback_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlaybackItem, g_object_unref)
VALA_EXTERN GType dc_audio_playback_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcAudioPlayback, g_object_unref)
VALA_EXTERN DcAudioPlayback* dc_audio_playback_shared (void);
VALA_EXTERN DcAudioPlaybackItem* dc_audio_playback_get_current_item (DcAudioPlayback* self);
VALA_EXTERN gint dc_audio_playback_item_get_account_id (DcAudioPlaybackItem* self);
static void dc_window_navigate_voice_after_open (DcWindow* self,
                                          gint acct_id,
                                          gint chat_id,
                                          gint msg_id,
                                          gint direction,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_window_navigate_voice_after_open_finish (DcWindow* self,
                                                 GAsyncResult* _res_);
VALA_EXTERN gint dc_audio_playback_item_get_chat_id (DcAudioPlaybackItem* self);
VALA_EXTERN gint dc_audio_playback_item_get_message_id (DcAudioPlaybackItem* self);
VALA_EXTERN void dc_conversation_view_request_voice_navigation (DcConversationView* self,
                                                    gint direction);
static void dc_window_navigate_voice_after_open_data_free (gpointer _data);
static gboolean dc_window_navigate_voice_after_open_co (DcWindowNavigateVoiceAfterOpenData* _data_);
static void dc_window_navigate_voice_after_open_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void dc_window_open_chat_from_notification_data_free (gpointer _data);
static gboolean dc_window_open_chat_from_notification_co (DcWindowOpenChatFromNotificationData* _data_);
static void dc_window_open_chat_from_notification_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static GSimpleAction* dc_window_window_action (DcWindow* self,
                                        const gchar* name);
static void __lambda313_ (DcWindow* self);
static void ___lambda313__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda315_ (DcWindow* self);
static void ___lambda315__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda317_ (DcWindow* self);
static void ___lambda317__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda318_ (DcWindow* self);
static void ___lambda318__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda323_ (DcWindow* self);
static void ___lambda323__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda324_ (DcWindow* self);
static void ___lambda324__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda389_ (DcWindow* self);
static void dc_window_show_stickers_dialog (DcWindow* self);
static void ___lambda389__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda390_ (DcWindow* self);
static void dc_window_show_webxdc_apps_dialog (DcWindow* self);
static void ___lambda390__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda409_ (DcWindow* self);
static void dc_window_show_keyboard_shortcuts_dialog (DcWindow* self);
static void ___lambda409__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda410_ (DcWindow* self);
static void dc_window_show_about_dialog (DcWindow* self);
static void ___lambda410__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda411_ (DcWindow* self);
static void ___lambda411__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda412_ (DcWindow* self);
static void dc_window_adjust_font_size (DcWindow* self,
                                 gint delta);
static void ___lambda412__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda413_ (DcWindow* self);
static void ___lambda413__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
static void __lambda414_ (DcWindow* self);
VALA_EXTERN void dc_settings_manager_save_font_size (DcSettingsManager* self,
                                         gint v);
static void ___lambda414__g_simple_action_activate (GSimpleAction* _sender,
                                             GVariant* parameter,
                                             gpointer self);
VALA_EXTERN gchar** parla_app_data_developers (gint* result_length1);
VALA_EXTERN gchar* parla_app_data_release_notes (void);
VALA_EXTERN void dc_window_handle_invite_uri (DcWindow* self,
                                  const gchar* uri);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void __lambda319_ (Block10Data* _data10_);
static void ___lambda319__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda320_ (Block10Data* _data10_);
static void dc_window_use_invite_link (DcWindow* self,
                                AdwDialog* dialog,
                                GtkEntry* entry,
                                GtkLabel* status,
                                GtkButton* add_btn,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
static void dc_window_use_invite_link_finish (DcWindow* self,
                                       GAsyncResult* _res_);
static void ___lambda320__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda321_ (Block10Data* _data10_);
static void ___lambda321__gtk_editable_changed (GtkEditable* _sender,
                                         gpointer self);
static void __lambda322_ (Block10Data* _data10_);
static void ___lambda322__gtk_entry_activate (GtkEntry* _sender,
                                       gpointer self);
static void dc_window_use_invite_link_data_free (gpointer _data);
static gboolean dc_window_use_invite_link_co (DcWindowUseInviteLinkData* _data_);
VALA_EXTERN void dc_rpc_client_check_qr (DcRpcClient* self,
                             gint acct_id,
                             const gchar* qr_text,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_check_qr_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static void dc_window_use_invite_link_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_secure_join (DcRpcClient* self,
                                gint acct_id,
                                const gchar* qr_text,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_secure_join_finish (DcRpcClient* self,
                                       GAsyncResult* _res_,
                                       GError** error);
VALA_EXTERN void dc_rpc_client_set_config_from_qr (DcRpcClient* self,
                                       gint acct_id,
                                       const gchar* qr_text,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_set_config_from_qr_finish (DcRpcClient* self,
                                              GAsyncResult* _res_,
                                              GError** error);
VALA_EXTERN DcStickerManagerDialog* dc_sticker_manager_dialog_new (DcWindow* window);
VALA_EXTERN DcStickerManagerDialog* dc_sticker_manager_dialog_construct (GType object_type,
                                                             DcWindow* window);
VALA_EXTERN GType dc_sticker_manager_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcStickerManagerDialog, g_object_unref)
VALA_EXTERN DcWebxdcManagerDialog* dc_webxdc_manager_dialog_new (DcWindow* window,
                                                     DcRpcClient* rpc);
VALA_EXTERN DcWebxdcManagerDialog* dc_webxdc_manager_dialog_construct (GType object_type,
                                                           DcWindow* window,
                                                           DcRpcClient* rpc);
VALA_EXTERN GType dc_webxdc_manager_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWebxdcManagerDialog, g_object_unref)
VALA_EXTERN GType dc_settings_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcSettingsDialog, g_object_unref)
VALA_EXTERN DcSettingsDialog* dc_settings_dialog_new (DcWindow* window,
                                          DcRpcClient* rpc);
VALA_EXTERN DcSettingsDialog* dc_settings_dialog_construct (GType object_type,
                                                DcWindow* window,
                                                DcRpcClient* rpc);
static void __lambda388_ (DcWindow* self);
static void ___lambda388__adw_dialog_closed (AdwDialog* _sender,
                                      gpointer self);
static void dc_window_reload_active_account_data_free (gpointer _data);
static gboolean dc_window_reload_active_account_co (DcWindowReloadActiveAccountData* _data_);
static void dc_window_reload_active_account_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
VALA_EXTERN gboolean dc_event_handler_get_is_listening (DcEventHandler* self);
static void dc_window_real_dispose (GObject* base);
static void dc_window_toggle_collapsed_sidebar (DcWindow* self);
static void dc_window_toggle_sidebar_visibility (DcWindow* self);
static void dc_window_toggle_sidebar_width (DcWindow* self);
static void dc_window_set_compact_header_chrome (DcWindow* self,
                                          gboolean compact);
static void dc_window_apply_compact_to_rows (DcWindow* self,
                                      gboolean compact);
VALA_EXTERN gboolean dc_platform_is_macos (void);
VALA_EXTERN gboolean dc_image_viewer_get_visible (DcImageViewer* self);
VALA_EXTERN gboolean dc_image_viewer_handle_key (DcImageViewer* self,
                                     guint keyval);
VALA_EXTERN gboolean dc_video_player_get_visible (DcVideoPlayer* self);
VALA_EXTERN gboolean dc_video_player_handle_key (DcVideoPlayer* self,
                                     guint keyval);
static gboolean dc_window_is_modifier_keyval (guint keyval);
VALA_EXTERN gboolean dc_conversation_view_close_search_if_active (DcConversationView* self);
VALA_EXTERN gboolean dc_conversation_view_has_active_compose_mode (DcConversationView* self);
VALA_EXTERN gboolean dc_conversation_view_compose_entry_has_focus (DcConversationView* self);
VALA_EXTERN void dc_conversation_view_cancel_active_compose_mode (DcConversationView* self);
static gboolean dc_window_is_typeahead_key (guint keyval,
                                     GdkModifierType state);
static gboolean dc_window_focus_in_text_or_overlay (DcWindow* self);
VALA_EXTERN void dc_conversation_view_type_into_entry (DcConversationView* self,
                                           const gchar* text);
VALA_EXTERN gboolean dc_platform_has_primary_modifier (GdkModifierType state);
static gboolean dc_window_select_adjacent_chat (DcWindow* self,
                                         gint delta);
static void dc_window_show_account_menu (DcWindow* self);
static void dc_window_focus_contact_search (DcWindow* self);
static void dc_window_show_quick_switch_dialog (DcWindow* self);
static void dc_window_refresh_current_chat (DcWindow* self);
VALA_EXTERN void dc_chat_context_menu_show_info (DcChatContextMenu* self,
                                     gint chat_id);
VALA_EXTERN gint dc_settings_manager_clamp_font_size (gint size);
VALA_EXTERN gint dc_settings_manager_effective_font_size (DcSettingsManager* self);
VALA_EXTERN void dc_conversation_view_toggle_search (DcConversationView* self);
VALA_EXTERN GType dc_quick_switch_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcQuickSwitchDialog, g_object_unref)
VALA_EXTERN DcQuickSwitchDialog* dc_quick_switch_dialog_new (GListStore* chat_store);
VALA_EXTERN DcQuickSwitchDialog* dc_quick_switch_dialog_construct (GType object_type,
                                                       GListStore* chat_store);
static void __lambda429_ (DcWindow* self,
                   gint chat_id);
static void ___lambda429__dc_quick_switch_dialog_chat_selected (DcQuickSwitchDialog* _sender,
                                                         gint chat_id,
                                                         gpointer self);
VALA_EXTERN void dc_quick_switch_dialog_focus_entry (DcQuickSwitchDialog* self);
VALA_EXTERN gboolean dc_window_current_chat_is_group (DcWindow* self);
static gchar* dc_window_shortcut_accelerator (const gchar* accelerator);
VALA_EXTERN gchar* dc_platform_primary_accelerator_prefix (void);
static gchar* dc_window_shortcut_label_text (const gchar* accelerator);
VALA_EXTERN AdwToast* dc_window_show_action_toast (DcWindow* self,
                                       const gchar* message,
                                       const gchar* button_label);
static void dc_window_set_chat_store (DcWindow* self,
                               GListStore* value);
VALA_EXTERN void dc_event_handler_set_active_chat_id (DcEventHandler* self,
                                          gint value);
static void dc_window_pending_notification_finalize (DcWindowPendingNotification * obj);
static GType dc_window_pending_notification_get_type_once (void);
static GObject * dc_window_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
static void _g_object_unref0_ (gpointer var);
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 DcImageViewer* dc_image_viewer_new (void);
VALA_EXTERN DcImageViewer* dc_image_viewer_construct (GType object_type);
VALA_EXTERN void dc_image_viewer_set_window (DcImageViewer* self,
                                 DcWindow* w);
VALA_EXTERN DcVideoPlayer* dc_video_player_new (void);
VALA_EXTERN DcVideoPlayer* dc_video_player_construct (GType object_type);
VALA_EXTERN void dc_video_player_set_window (DcVideoPlayer* self,
                                 DcWindow* w);
VALA_EXTERN DcNativeFileDropTarget* dc_native_file_drop_target_new (GtkWidget* widget);
VALA_EXTERN DcNativeFileDropTarget* dc_native_file_drop_target_construct (GType object_type,
                                                              GtkWidget* widget);
static void _dc_window_handle_native_file_drop_dc_native_file_drop_target_path_dropped (DcNativeFileDropTarget* _sender,
                                                                                 const gchar* path,
                                                                                 gdouble x,
                                                                                 gdouble y,
                                                                                 gpointer self);
VALA_EXTERN GType dc_message_style_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcMessageStyle dc_settings_manager_get_message_style (DcSettingsManager* self);
VALA_EXTERN gboolean dc_settings_manager_get_animate_stickers (DcSettingsManager* self);
static void _dc_window___lambda430_ (Block11Data* _data11_);
static void __dc_window___lambda430__g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self);
static void _dc_window___lambda431_ (DcWindow* self);
static void __dc_window___lambda431__dc_settings_manager_appearance_changed (DcSettingsManager* _sender,
                                                                      gpointer self);
static void _dc_window___lambda432_ (DcWindow* self);
static void __dc_window___lambda432__dc_settings_manager_font_changed (DcSettingsManager* _sender,
                                                                gpointer self);
static gboolean _dc_window_on_close_request_gtk_window_close_request (GtkWindow* _sender,
                                                               gpointer self);
static void _dc_window___lambda433_ (DcWindow* self);
static void __dc_window___lambda433__g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self);
static void _dc_window_sync_tray_g_object_notify (GObject* _sender,
                                           GParamSpec* pspec,
                                           gpointer self);
static void _dc_window___lambda434_ (DcWindow* self);
static void __dc_window___lambda434__g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self);
static gboolean _dc_window___lambda435_ (DcWindow* self);
static gboolean __dc_window___lambda435__gsource_func (gpointer self);
static void dc_window_finalize (GObject * obj);
static GType dc_window_get_type_once (void);
static void _vala_dc_window_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec);
static void _vala_dc_window_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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const gchar* DC_WINDOW_ADD_PROFILE_METHODS[12] = {"contact-new-symbolic", "Create new profile", "Pick a chatmail relay and create a new account", "phone-symbolic", "Add as secondary device", "Synchronize from another device on the same network", "mail-message-new-symbolic", "Use classic email address", "Sign in with an existing email account", "mail-attachment-symbolic", "Use invitation code", "Join via a dcaccount: link or QR code"};
static const gchar* DC_WINDOW_SHORTCUTS[46] = {"New chat", "<Primary>n", "New group", "<Primary>g", "New channel", "<Primary><Shift>g", "Open settings", "<Primary>comma", "Increase font size", "<Primary>plus", "Decrease font size", "<Primary>minus", "Reset font size", "<Primary>0", "Open chat info", "<Primary>i", "Apps and media gallery", "<Primary>m", "Search in conversation", "<Primary>f", "Search contacts", "<Primary><Shift>f", "Quick switch chat", "<Primary>k", "Focus message entry", "<Primary>l", "Account menu", "<Primary><Shift>a", "Next conversation", "<Primary>Page_Down", "Previous conversation", "<Primary>Page_Up", "Refresh messages", "<Primary>r", "Toggle sidebar", "<Primary>s", "Compact sidebar", "<Primary><Shift>s", "Focus message entry", "Escape", "Cancel reply/edit/image", "Escape", "Close window", "<Primary>w", "Quit application", "<Primary>q"};

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

gboolean
dc_is_delta_invite_uri (const gchar* uri)
{
	gchar* u = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	gboolean result;
	g_return_val_if_fail (uri != NULL, FALSE);
	_tmp0_ = string_strip (uri);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_utf8_strdown (_tmp1_, (gssize) -1);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	u = _tmp3_;
	_tmp5_ = u;
	if (g_str_has_prefix (_tmp5_, "openpgp4fpr:")) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = u;
		_tmp4_ = g_str_has_prefix (_tmp6_, "https://i.delta.chat/");
	}
	result = _tmp4_;
	_g_free0 (u);
	return result;
}

static inline gpointer
dc_window_get_instance_private (DcWindow* self)
{
	return G_STRUCT_MEMBER_P (self, DcWindow_private_offset);
}

static void
_dc_window_pending_notification_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (dc_window_pending_notification_unref (var), NULL));
}

static void
dc_window_sync_webxdc_chat_visibility (DcWindow* self)
{
	gint _tmp0_ = 0;
	DcRpcClient* _tmp1_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->rpc;
	if (_tmp1_ != NULL) {
		DcRpcClient* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = self->priv->rpc;
		_tmp3_ = dc_rpc_client_get_account_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = 0;
	}
	_tmp5_ = gtk_widget_get_visible ((GtkWidget*) self);
	_tmp6_ = _tmp5_;
	dc_webxdc_set_active_chat (_tmp0_, self->priv->_current_chat_id, _tmp6_);
}

gboolean
dc_window_is_chat_visible (DcWindow* self,
                           gint chat_id)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp8_ = FALSE;
	AdwOverlaySplitView* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (chat_id <= 0) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = dc_window_get_current_chat_id (self);
		_tmp2_ = _tmp1_;
		_tmp0_ = chat_id != _tmp2_;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp4_ = gtk_widget_get_visible ((GtkWidget*) self);
	_tmp5_ = _tmp4_;
	if (!_tmp5_) {
		_tmp3_ = TRUE;
	} else {
		gboolean _tmp6_;
		gboolean _tmp7_;
		g_object_get ((GtkWindow*) self, "is-active", &_tmp6_, NULL);
		_tmp7_ = _tmp6_;
		_tmp3_ = !_tmp7_;
	}
	if (_tmp3_) {
		result = FALSE;
		return result;
	}
	_tmp9_ = self->priv->split_view;
	_tmp10_ = adw_overlay_split_view_get_collapsed (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_) {
		AdwOverlaySplitView* _tmp12_;
		gboolean _tmp13_;
		gboolean _tmp14_;
		_tmp12_ = self->priv->split_view;
		_tmp13_ = adw_overlay_split_view_get_show_sidebar (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp8_ = _tmp14_;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}

static gboolean
dc_window_can_show_account_modal (DcWindow* self)
{
	gboolean _tmp0_ = FALSE;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->rpc;
	_tmp2_ = dc_rpc_client_get_account_id (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ > 0) {
		AdwDialog* _tmp4_;
		_tmp4_ = self->priv->active_modal;
		_tmp0_ = _tmp4_ == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
dc_window_can_show_rpc_modal (DcWindow* self)
{
	AdwDialog* _tmp0_;
	DcEventHandler* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ != NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->events;
	if (_tmp1_ != NULL) {
		result = TRUE;
		return result;
	}
	dc_window_show_toast (self, "RPC not ready");
	result = FALSE;
	return result;
}

static void
dc_window_update_conversation_header_actions (DcWindow* self)
{
	gboolean has_chat = FALSE;
	GtkButton* _tmp0_;
	GtkButton* _tmp2_;
	g_return_if_fail (self != NULL);
	has_chat = self->priv->_current_chat_id > 0;
	_tmp0_ = self->priv->message_search_btn;
	if (_tmp0_ != NULL) {
		GtkButton* _tmp1_;
		_tmp1_ = self->priv->message_search_btn;
		gtk_widget_set_visible ((GtkWidget*) _tmp1_, has_chat);
	}
	_tmp2_ = self->priv->gallery_btn;
	if (_tmp2_ != NULL) {
		GtkButton* _tmp3_;
		_tmp3_ = self->priv->gallery_btn;
		gtk_widget_set_visible ((GtkWidget*) _tmp3_, has_chat);
	}
}

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

static void
__lambda298_ (DcWindow* self)
{
	_g_object_unref0 (self->priv->active_modal);
	self->priv->active_modal = NULL;
}

static void
___lambda298__adw_dialog_closed (AdwDialog* _sender,
                                 gpointer self)
{
	__lambda298_ ((DcWindow*) self);
}

static void
dc_window_present_modal (DcWindow* self,
                         AdwDialog* dialog)
{
	AdwDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_tmp0_ = _g_object_ref0 (dialog);
	_g_object_unref0 (self->priv->active_modal);
	self->priv->active_modal = _tmp0_;
	g_signal_connect_object (dialog, "closed", (GCallback) ___lambda298__adw_dialog_closed, self, 0);
	adw_dialog_present (dialog, (GtkWidget*) self);
}

static void
dc_window_reset_chat_ui (DcWindow* self)
{
	GListStore* _tmp0_;
	GtkListBox* _tmp1_;
	GtkSearchEntry* _tmp2_;
	GtkLabel* _tmp3_;
	GtkImage* _tmp4_;
	g_return_if_fail (self != NULL);
	dc_window_discard_all_views (self);
	_tmp0_ = self->priv->_chat_store;
	g_list_store_remove_all (_tmp0_);
	_tmp1_ = self->priv->chat_listbox;
	dc_clear_listbox (_tmp1_);
	_tmp2_ = self->priv->search_entry;
	gtk_editable_set_text ((GtkEditable*) _tmp2_, "");
	self->priv->showing_archived = FALSE;
	self->priv->archived_count = 0;
	dc_window_update_archived_toggle (self);
	_tmp3_ = self->priv->content_title_label;
	gtk_label_set_label (_tmp3_, "Select a chat");
	_tmp4_ = self->priv->content_mute_icon;
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, FALSE);
}

static void
dc_window_show_empty_status (DcWindow* self,
                             const gchar* icon_name,
                             const gchar* title,
                             const gchar* description,
                             GtkWidget* child)
{
	AdwStatusPage* _tmp0_;
	AdwStatusPage* _tmp1_;
	AdwStatusPage* _tmp2_;
	AdwStatusPage* _tmp3_;
	GtkStack* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (icon_name != NULL);
	g_return_if_fail (title != NULL);
	g_return_if_fail (description != NULL);
	_tmp0_ = self->priv->empty_status;
	adw_status_page_set_child (_tmp0_, child);
	_tmp1_ = self->priv->empty_status;
	adw_status_page_set_icon_name (_tmp1_, icon_name);
	_tmp2_ = self->priv->empty_status;
	adw_status_page_set_title (_tmp2_, title);
	_tmp3_ = self->priv->empty_status;
	adw_status_page_set_description (_tmp3_, description);
	_tmp4_ = self->priv->content_stack;
	gtk_stack_set_visible_child_name (_tmp4_, "empty");
}

DcWindow*
dc_window_construct (GType object_type,
                     DcApplication* app)
{
	DcWindow * self = NULL;
	g_return_val_if_fail (app != NULL, NULL);
	self = (DcWindow*) g_object_new (object_type, "application", app, "default-width", 920, "default-height", 640, "width-request", 360, "height-request", 320, "title", "Parla", NULL);
	return self;
}

DcWindow*
dc_window_new (DcApplication* app)
{
	return dc_window_construct (DC_TYPE_WINDOW, app);
}

static void
dc_window_apply_current_appearance (DcWindow* self)
{
	DcApplication* app = NULL;
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	DcApplication* _tmp2_;
	DcApplication* _tmp3_;
	DcApplication* _tmp4_;
	DcSettingsManager* _tmp5_;
	DcThemeOverride _tmp6_;
	DcThemeOverride _tmp7_;
	DcApplication* _tmp8_;
	DcSettingsManager* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	DcApplication* _tmp12_;
	DcSettingsManager* _tmp13_;
	DcBackgroundMode _tmp14_;
	DcBackgroundMode _tmp15_;
	DcSettingsManager* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (DC_IS_APPLICATION (_tmp1_) ? ((DcApplication*) _tmp1_) : NULL);
	app = _tmp2_;
	_tmp3_ = app;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (app);
		return;
	}
	_tmp4_ = app;
	_tmp5_ = self->settings;
	_tmp6_ = dc_settings_manager_get_theme_override (_tmp5_);
	_tmp7_ = _tmp6_;
	dc_application_apply_theme_override (_tmp4_, _tmp7_);
	_tmp8_ = app;
	_tmp9_ = self->settings;
	_tmp10_ = dc_settings_manager_get_accent_color (_tmp9_);
	_tmp11_ = _tmp10_;
	dc_application_apply_accent_color (_tmp8_, _tmp11_);
	_tmp12_ = app;
	_tmp13_ = self->settings;
	_tmp14_ = dc_settings_manager_get_background_mode (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = self->settings;
	_tmp17_ = dc_settings_manager_get_background_color (_tmp16_);
	_tmp18_ = _tmp17_;
	dc_application_apply_background (_tmp12_, _tmp15_, _tmp18_);
	dc_window_apply_current_font (self);
	_g_object_unref0 (app);
}

static void
dc_window_apply_current_font (DcWindow* self)
{
	DcApplication* app = NULL;
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	DcApplication* _tmp2_;
	DcApplication* _tmp3_;
	DcApplication* _tmp4_;
	DcSettingsManager* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	DcSettingsManager* _tmp8_;
	DcFontAttribute _tmp9_;
	DcFontAttribute _tmp10_;
	DcSettingsManager* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (DC_IS_APPLICATION (_tmp1_) ? ((DcApplication*) _tmp1_) : NULL);
	app = _tmp2_;
	_tmp3_ = app;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (app);
		return;
	}
	_tmp4_ = app;
	_tmp5_ = self->settings;
	_tmp6_ = dc_settings_manager_get_font_family (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->settings;
	_tmp9_ = dc_settings_manager_get_font_attribute (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->settings;
	_tmp12_ = dc_settings_manager_get_font_size (_tmp11_);
	_tmp13_ = _tmp12_;
	dc_application_apply_font (_tmp4_, _tmp7_, _tmp10_, _tmp13_);
	_g_object_unref0 (app);
}

static void
dc_window_queue_font_update (DcWindow* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->font_update_source != ((guint) 0)) {
		return;
	}
	self->priv->font_update_source = dc_window_add_font_update_timeout (self);
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		g_weak_ref_clear (&_data1_->window_ref);
		g_slice_free (Block1Data, _data1_);
	}
}

static gboolean
__lambda299_ (Block1Data* _data1_)
{
	DcWindow* window = NULL;
	GObject* _tmp0_;
	DcWindow* _tmp1_;
	DcWindow* _tmp2_;
	DcWindow* _tmp3_;
	DcWindow* _tmp4_;
	DcConversationView* view = NULL;
	DcWindow* _tmp5_;
	DcConversationView* _tmp6_;
	DcConversationView* _tmp7_;
	gboolean result;
	_tmp0_ = g_weak_ref_get (&_data1_->window_ref);
	_tmp1_ = DC_IS_WINDOW (_tmp0_) ? ((DcWindow*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	window = _tmp1_;
	_tmp2_ = window;
	if (_tmp2_ == NULL) {
		result = G_SOURCE_REMOVE;
		_g_object_unref0 (window);
		return result;
	}
	_tmp3_ = window;
	_tmp3_->priv->font_update_source = (guint) 0;
	_tmp4_ = window;
	dc_window_apply_current_font (_tmp4_);
	_tmp5_ = window;
	_tmp6_ = dc_window_current_view (_tmp5_);
	view = _tmp6_;
	_tmp7_ = view;
	if (_tmp7_ != NULL) {
		DcConversationView* _tmp8_;
		_tmp8_ = view;
		gtk_widget_queue_resize ((GtkWidget*) _tmp8_);
	}
	result = G_SOURCE_REMOVE;
	_g_object_unref0 (view);
	_g_object_unref0 (window);
	return result;
}

static gboolean
___lambda299__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda299_ (self);
	return result;
}

static guint
dc_window_add_font_update_timeout (DcWindow* target)
{
	Block1Data* _data1_;
	guint result;
	g_return_val_if_fail (target != NULL, 0U);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	g_weak_ref_init (&_data1_->window_ref, (GObject*) target);
	result = g_timeout_add_full (G_PRIORITY_DEFAULT, DC_WINDOW_FONT_UPDATE_INTERVAL_MS, ___lambda299__gsource_func, block1_data_ref (_data1_), block1_data_unref);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return result;
}

static void
dc_window_rebuild_current_chat_view (DcWindow* self)
{
	gint chat_id = 0;
	gint _tmp0_;
	gint _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_window_get_current_chat_id (self);
	_tmp1_ = _tmp0_;
	chat_id = _tmp1_;
	dc_window_discard_all_views (self);
	if (chat_id > 0) {
		dc_window_set_current_chat_id (self, 0);
		dc_window_select_chat_by_id (self, chat_id);
	}
}

static gboolean
dc_window_on_close_request (DcWindow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->quit_requested) {
		result = FALSE;
		return result;
	}
	if (dc_window_ensure_tray_visible (self)) {
		dc_window_minimize_to_tray (self);
		result = TRUE;
		return result;
	}
	if (dc_window_runs_in_background (self)) {
		dc_window_minimize_to_tray (self);
		result = TRUE;
		return result;
	}
	dc_window_release_background_hold (self);
	result = FALSE;
	return result;
}

static gboolean
dc_window_runs_in_background (DcWindow* self)
{
	DcApplication* app = NULL;
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	DcApplication* _tmp2_;
	gboolean _tmp3_ = FALSE;
	DcApplication* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (DC_IS_APPLICATION (_tmp1_) ? ((DcApplication*) _tmp1_) : NULL);
	app = _tmp2_;
	_tmp4_ = app;
	if (_tmp4_ != NULL) {
		DcApplication* _tmp5_;
		gboolean _tmp6_;
		gboolean _tmp7_;
		_tmp5_ = app;
		_tmp6_ = dc_application_get_background_mode (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp3_ = _tmp7_;
	} else {
		_tmp3_ = FALSE;
	}
	result = _tmp3_;
	_g_object_unref0 (app);
	return result;
}

void
dc_window_set_minimize_to_tray (DcWindow* self,
                                gboolean enabled)
{
	DcSettingsManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->settings;
	dc_settings_manager_save_minimize_to_tray (_tmp0_, enabled);
	dc_window_sync_tray (self);
}

void
dc_window_quit_application (DcWindow* self)
{
	g_return_if_fail (self != NULL);
	dc_window_handle_primary_q (self);
}

void
dc_window_handle_primary_q (DcWindow* self)
{
	DcTrayIcon* _tmp0_;
	GtkApplication* app = NULL;
	GtkApplication* _tmp2_;
	GtkApplication* _tmp3_;
	GtkApplication* _tmp4_;
	GtkApplication* _tmp5_;
	g_return_if_fail (self != NULL);
	self->priv->quit_requested = TRUE;
	dc_window_release_background_hold (self);
	dc_window_close_active_modal (self);
	dc_window_discard_all_views (self);
	_tmp0_ = self->priv->tray;
	if (_tmp0_ != NULL) {
		DcTrayIcon* _tmp1_;
		_tmp1_ = self->priv->tray;
		dc_tray_icon_hide (_tmp1_);
	}
	_tmp2_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	app = _tmp4_;
	gtk_window_close ((GtkWindow*) self);
	_tmp5_ = app;
	if (_tmp5_ != NULL) {
		GtkApplication* _tmp6_;
		_tmp6_ = app;
		g_application_quit ((GApplication*) _tmp6_);
	}
	_g_object_unref0 (app);
}

void
dc_window_handle_primary_w (DcWindow* self)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (dc_window_ensure_tray_visible (self)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = dc_window_runs_in_background (self);
	}
	if (_tmp0_) {
		dc_window_minimize_to_tray (self);
		return;
	}
	dc_window_handle_primary_q (self);
}

static void
dc_window_handle_native_file_drop (DcWindow* self,
                                   const gchar* path,
                                   gdouble x,
                                   gdouble y)
{
	DcChatRow* chat_row = NULL;
	DcChatRow* _tmp0_;
	DcChatRow* _tmp1_;
	DcConversationView* v = NULL;
	DcConversationView* _tmp7_;
	DcConversationView* _tmp8_;
	DcConversationView* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_tmp0_ = dc_window_chat_row_at_point (self, x, y);
	chat_row = _tmp0_;
	_tmp1_ = chat_row;
	if (_tmp1_ != NULL) {
		DcChatRow* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp2_ = chat_row;
		_tmp3_ = dc_chat_row_get_chat_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_path_get_basename (path);
		_tmp6_ = _tmp5_;
		dc_window_attach_file_to_chat (self, _tmp4_, path, _tmp6_);
		_g_free0 (_tmp6_);
		_g_object_unref0 (chat_row);
		return;
	}
	_tmp7_ = dc_window_current_view (self);
	v = _tmp7_;
	_tmp8_ = v;
	if (_tmp8_ == NULL) {
		dc_window_show_toast (self, "Select a chat before dropping a file");
		_g_object_unref0 (v);
		_g_object_unref0 (chat_row);
		return;
	}
	_tmp9_ = v;
	dc_conversation_view_attach_dropped_file_path (_tmp9_, path);
	_g_object_unref0 (v);
	_g_object_unref0 (chat_row);
}

static void
dc_window_sync_tray (DcWindow* self)
{
	DcSettingsManager* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->settings;
	_tmp1_ = dc_settings_manager_get_minimize_to_tray (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		DcTrayIcon* _tmp3_;
		gboolean _tmp5_ = FALSE;
		_tmp3_ = self->priv->tray;
		if (_tmp3_ != NULL) {
			DcTrayIcon* _tmp4_;
			_tmp4_ = self->priv->tray;
			dc_tray_icon_hide (_tmp4_);
		}
		if (dc_window_runs_in_background (self)) {
			return;
		}
		if (self->priv->held_in_background) {
			_tmp5_ = TRUE;
		} else {
			gboolean _tmp6_;
			gboolean _tmp7_;
			_tmp6_ = gtk_widget_get_visible ((GtkWidget*) self);
			_tmp7_ = _tmp6_;
			_tmp5_ = !_tmp7_;
		}
		if (_tmp5_) {
			dc_window_restore_from_tray (self);
		} else {
			dc_window_release_background_hold (self);
		}
		return;
	}
	dc_window_ensure_tray_visible (self);
}

static void
_dc_window_show_from_tray_on_current_desktop_dc_tray_icon_show_on_current_desktop_requested (DcTrayIcon* _sender,
                                                                                             const gchar* activation_token,
                                                                                             gpointer self)
{
	dc_window_show_from_tray_on_current_desktop ((DcWindow*) self, activation_token);
}

static void
_dc_window_toggle_window_from_tray_dc_tray_icon_window_toggle_requested (DcTrayIcon* _sender,
                                                                         const gchar* activation_token,
                                                                         gpointer self)
{
	dc_window_toggle_window_from_tray ((DcWindow*) self, activation_token);
}

static void
__lambda301_ (DcWindow* self)
{
	dc_window_handle_primary_q (self);
}

static void
___lambda301__dc_tray_icon_quit_requested (DcTrayIcon* _sender,
                                           gpointer self)
{
	__lambda301_ ((DcWindow*) self);
}

static void
__lambda302_ (DcWindow* self,
              gboolean enabled)
{
	dc_window_set_notifications_enabled (self, enabled);
}

static void
___lambda302__dc_tray_icon_notifications_toggle_requested (DcTrayIcon* _sender,
                                                           gboolean enabled,
                                                           gpointer self)
{
	__lambda302_ ((DcWindow*) self, enabled);
}

static void
dc_window_ensure_tray_backend (DcWindow* self)
{
	DcTrayIcon* _tmp0_;
	GDBusConnection* conn = NULL;
	GtkApplication* _tmp1_;
	GtkApplication* _tmp2_;
	GDBusConnection* _tmp3_;
	GDBusConnection* _tmp4_;
	GDBusConnection* _tmp5_;
	GDBusConnection* _tmp6_;
	DcTrayIcon* _tmp7_;
	DcTrayIcon* _tmp8_;
	DcTrayIcon* _tmp9_;
	DcTrayIcon* _tmp10_;
	DcTrayIcon* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->tray;
	if (_tmp0_ != NULL) {
		return;
	}
	_tmp1_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_application_get_dbus_connection ((GApplication*) _tmp2_);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	conn = _tmp4_;
	_tmp5_ = conn;
	if (_tmp5_ == NULL) {
		_g_object_unref0 (conn);
		return;
	}
	_tmp6_ = conn;
	_tmp7_ = dc_tray_icon_new (_tmp6_);
	_g_object_unref0 (self->priv->tray);
	self->priv->tray = _tmp7_;
	_tmp8_ = self->priv->tray;
	g_signal_connect_object (_tmp8_, "show-on-current-desktop-requested", (GCallback) _dc_window_show_from_tray_on_current_desktop_dc_tray_icon_show_on_current_desktop_requested, self, 0);
	_tmp9_ = self->priv->tray;
	g_signal_connect_object (_tmp9_, "window-toggle-requested", (GCallback) _dc_window_toggle_window_from_tray_dc_tray_icon_window_toggle_requested, self, 0);
	_tmp10_ = self->priv->tray;
	g_signal_connect_object (_tmp10_, "quit-requested", (GCallback) ___lambda301__dc_tray_icon_quit_requested, self, 0);
	_tmp11_ = self->priv->tray;
	g_signal_connect_object (_tmp11_, "notifications-toggle-requested", (GCallback) ___lambda302__dc_tray_icon_notifications_toggle_requested, self, 0);
	_g_object_unref0 (conn);
}

static gboolean
dc_window_ensure_tray_visible (DcWindow* self)
{
	DcSettingsManager* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcTrayIcon* _tmp3_;
	DcTrayIcon* _tmp4_;
	DcSettingsManager* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	DcTrayIcon* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	DcTrayIcon* _tmp11_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->settings;
	_tmp1_ = dc_settings_manager_get_minimize_to_tray (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		return result;
	}
	dc_window_ensure_tray_backend (self);
	_tmp3_ = self->priv->tray;
	if (_tmp3_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp4_ = self->priv->tray;
	_tmp5_ = self->settings;
	_tmp6_ = dc_settings_manager_get_notifications_enabled (_tmp5_);
	_tmp7_ = _tmp6_;
	dc_tray_icon_set_notifications_enabled (_tmp4_, _tmp7_);
	_tmp8_ = self->priv->tray;
	_tmp9_ = gtk_widget_get_visible ((GtkWidget*) self);
	_tmp10_ = _tmp9_;
	dc_tray_icon_set_window_visible (_tmp8_, _tmp10_);
	_tmp11_ = self->priv->tray;
	result = dc_tray_icon_show (_tmp11_);
	return result;
}

static void
dc_window_minimize_to_tray (DcWindow* self)
{
	g_return_if_fail (self != NULL);
	dc_window_close_active_modal (self);
	gtk_widget_set_visible ((GtkWidget*) self, FALSE);
	if (!self->priv->held_in_background) {
		GtkApplication* _tmp0_;
		GtkApplication* _tmp1_;
		_tmp0_ = gtk_window_get_application ((GtkWindow*) self);
		_tmp1_ = _tmp0_;
		g_application_hold ((GApplication*) _tmp1_);
		self->priv->held_in_background = TRUE;
	}
}

static void
dc_window_close_active_modal (DcWindow* self)
{
	AdwDialog* _tmp0_;
	AdwDialog* dialog = NULL;
	AdwDialog* _tmp1_;
	AdwDialog* _tmp2_;
	AdwDialog* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->active_modal;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	dialog = _tmp2_;
	_g_object_unref0 (self->priv->active_modal);
	self->priv->active_modal = NULL;
	_tmp3_ = dialog;
	adw_dialog_close (_tmp3_);
	_g_object_unref0 (dialog);
}

void
dc_window_restore_from_tray (DcWindow* self)
{
	g_return_if_fail (self != NULL);
	dc_window_release_background_hold (self);
	gtk_window_present ((GtkWindow*) self);
}

static void
dc_window_toggle_window_from_tray (DcWindow* self,
                                   const gchar* activation_token)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_widget_get_visible ((GtkWidget*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		dc_window_minimize_to_tray (self);
		return;
	}
	dc_window_show_from_tray_on_current_desktop (self, activation_token);
}

static void
dc_window_show_from_tray_on_current_desktop (DcWindow* self,
                                             const gchar* activation_token)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	dc_window_release_background_hold (self);
	if (activation_token != NULL) {
		gint _tmp2_;
		gint _tmp3_;
		_tmp2_ = strlen (activation_token);
		_tmp3_ = _tmp2_;
		_tmp1_ = _tmp3_ > 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = dc_window_request_activation_on_current_desktop (self, activation_token);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	gtk_window_present ((GtkWindow*) self);
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		DcWindow* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->conn);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
__lambda300_ (Block2Data* _data2_,
              GObject* obj,
              GAsyncResult* res)
{
	DcWindow* self;
	GError* _inner_error0_ = NULL;
	self = _data2_->self;
	g_return_if_fail (res != NULL);
	{
		GDBusConnection* _tmp0_;
		GVariant* _tmp1_;
		GVariant* _tmp2_;
		_tmp0_ = _data2_->conn;
		_tmp1_ = g_dbus_connection_call_finish (_tmp0_, res, &_inner_error0_);
		_tmp2_ = _tmp1_;
		_g_variant_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_debug ("window.vala:541: Tray activation fallback: %s", _tmp4_);
		gtk_window_present ((GtkWindow*) self);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda300__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	__lambda300_ (self, source_object, res);
	block2_data_unref (self);
}

static gboolean
dc_window_request_activation_on_current_desktop (DcWindow* self,
                                                 const gchar* token)
{
	Block2Data* _data2_;
	GtkApplication* app = NULL;
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	GtkApplication* _tmp2_;
	gboolean _tmp3_ = FALSE;
	GtkApplication* _tmp4_;
	GtkApplication* _tmp8_;
	GDBusConnection* _tmp9_;
	GDBusConnection* _tmp10_;
	gchar* path = NULL;
	GtkApplication* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gboolean _tmp14_ = FALSE;
	GDBusConnection* _tmp15_;
	GVariantBuilder* platform_data = NULL;
	GVariantType* _tmp17_;
	GVariantType* _tmp18_;
	GVariantBuilder* _tmp19_;
	GVariantBuilder* _tmp20_;
	GVariantBuilder* _tmp21_;
	GVariant* _tmp22_;
	GVariant* _tmp23_;
	GVariantBuilder* _tmp24_;
	GVariant* _tmp25_;
	GVariant* _tmp26_;
	GDBusConnection* _tmp27_;
	GtkApplication* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	GVariantBuilder* _tmp32_;
	GVariant* _tmp33_;
	GVariant** _tmp34_;
	GVariant** _tmp35_;
	gint _tmp35__length1;
	GVariant* _tmp36_;
	GVariant* _tmp37_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (token != NULL, FALSE);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	app = _tmp2_;
	_tmp4_ = app;
	if (_tmp4_ == NULL) {
		_tmp3_ = TRUE;
	} else {
		GtkApplication* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp5_ = app;
		_tmp6_ = g_application_get_application_id ((GApplication*) _tmp5_);
		_tmp7_ = _tmp6_;
		_tmp3_ = _tmp7_ == NULL;
	}
	if (_tmp3_) {
		result = FALSE;
		_g_object_unref0 (app);
		block2_data_unref (_data2_);
		_data2_ = NULL;
		return result;
	}
	_tmp8_ = app;
	_tmp9_ = g_application_get_dbus_connection ((GApplication*) _tmp8_);
	_tmp10_ = _g_object_ref0 (_tmp9_);
	_data2_->conn = _tmp10_;
	_tmp11_ = app;
	_tmp12_ = g_application_get_dbus_object_path ((GApplication*) _tmp11_);
	_tmp13_ = g_strdup (_tmp12_);
	path = _tmp13_;
	_tmp15_ = _data2_->conn;
	if (_tmp15_ == NULL) {
		_tmp14_ = TRUE;
	} else {
		const gchar* _tmp16_;
		_tmp16_ = path;
		_tmp14_ = _tmp16_ == NULL;
	}
	if (_tmp14_) {
		result = FALSE;
		_g_free0 (path);
		_g_object_unref0 (app);
		block2_data_unref (_data2_);
		_data2_ = NULL;
		return result;
	}
	_tmp17_ = g_variant_type_new ("a{sv}");
	_tmp18_ = _tmp17_;
	_tmp19_ = g_variant_builder_new (_tmp18_);
	_tmp20_ = _tmp19_;
	_g_variant_type_free0 (_tmp18_);
	platform_data = _tmp20_;
	_tmp21_ = platform_data;
	_tmp22_ = g_variant_new_string (token);
	g_variant_ref_sink (_tmp22_);
	_tmp23_ = _tmp22_;
	g_variant_builder_add (_tmp21_, "{sv}", "activation-token", _tmp23_, NULL);
	_g_variant_unref0 (_tmp23_);
	_tmp24_ = platform_data;
	_tmp25_ = g_variant_new_string (token);
	g_variant_ref_sink (_tmp25_);
	_tmp26_ = _tmp25_;
	g_variant_builder_add (_tmp24_, "{sv}", "desktop-startup-id", _tmp26_, NULL);
	_g_variant_unref0 (_tmp26_);
	_tmp27_ = _data2_->conn;
	_tmp28_ = app;
	_tmp29_ = g_application_get_application_id ((GApplication*) _tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = path;
	_tmp32_ = platform_data;
	_tmp33_ = g_variant_builder_end (_tmp32_);
	g_variant_ref_sink (_tmp33_);
	_tmp34_ = g_new0 (GVariant*, 1 + 1);
	_tmp34_[0] = _tmp33_;
	_tmp35_ = _tmp34_;
	_tmp35__length1 = 1;
	_tmp36_ = g_variant_new_tuple (_tmp35_, 1);
	g_variant_ref_sink (_tmp36_);
	_tmp37_ = _tmp36_;
	g_dbus_connection_call (_tmp27_, _tmp30_, _tmp31_, "org.gtk.Application", "Activate", _tmp37_, NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, ___lambda300__gasync_ready_callback, block2_data_ref (_data2_));
	_g_variant_unref0 (_tmp37_);
	_tmp35_ = (_vala_array_free (_tmp35_, _tmp35__length1, (GDestroyNotify) g_variant_unref), NULL);
	result = TRUE;
	_g_variant_builder_unref0 (platform_data);
	_g_free0 (path);
	_g_object_unref0 (app);
	block2_data_unref (_data2_);
	_data2_ = NULL;
	return result;
}

static void
dc_window_release_background_hold (DcWindow* self)
{
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	g_return_if_fail (self != NULL);
	if (!self->priv->held_in_background) {
		return;
	}
	self->priv->held_in_background = FALSE;
	_tmp0_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp1_ = _tmp0_;
	g_application_release ((GApplication*) _tmp1_);
}

void
dc_window_set_notifications_enabled (DcWindow* self,
                                     gboolean enabled)
{
	DcSettingsManager* _tmp0_;
	DcTrayIcon* _tmp1_;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->settings;
	dc_settings_manager_save_notifications_enabled (_tmp0_, enabled);
	_tmp1_ = self->priv->tray;
	if (_tmp1_ != NULL) {
		DcTrayIcon* _tmp2_;
		_tmp2_ = self->priv->tray;
		dc_tray_icon_set_notifications_enabled (_tmp2_, enabled);
	}
	if (!enabled) {
		DcEventHandler* _tmp4_;
		_tmp4_ = self->priv->events;
		_tmp3_ = _tmp4_ != NULL;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		DcEventHandler* _tmp5_;
		_tmp5_ = self->priv->events;
		dc_event_handler_reconcile_desktop_notifications (_tmp5_, NULL, NULL);
	}
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		DcWindow* self;
		self = _data3_->self;
		_g_object_unref0 (_data3_->right_click);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda312_ (DcWindow* self)
{
	dc_window_load_account_menu (self, NULL, NULL);
}

static void
___lambda312__gtk_widget_map (GtkWidget* _sender,
                              gpointer self)
{
	__lambda312_ ((DcWindow*) self);
}

static void
__lambda415_ (DcWindow* self)
{
	GtkListBox* _tmp0_;
	_tmp0_ = self->priv->chat_listbox;
	gtk_list_box_invalidate_filter (_tmp0_);
}

static void
___lambda415__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                               gpointer self)
{
	__lambda415_ ((DcWindow*) self);
}

static void
__lambda416_ (DcWindow* self)
{
	GtkListBoxRow* row = NULL;
	GtkListBoxRow* _tmp0_;
	GtkListBoxRow* _tmp1_;
	DcChatRow* chat_row = NULL;
	GtkListBoxRow* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* _tmp4_;
	DcChatRow* _tmp5_;
	DcChatRow* _tmp6_;
	DcChatRow* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	GtkSearchEntry* _tmp10_;
	DcConversationView* v = NULL;
	DcConversationView* _tmp11_;
	DcConversationView* _tmp12_;
	_tmp0_ = dc_window_first_visible_chat_row (self);
	row = _tmp0_;
	_tmp1_ = row;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (row);
		return;
	}
	_tmp2_ = row;
	_tmp3_ = gtk_list_box_row_get_child (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp4_) ? ((DcChatRow*) _tmp4_) : NULL);
	chat_row = _tmp5_;
	_tmp6_ = chat_row;
	if (_tmp6_ == NULL) {
		_g_object_unref0 (chat_row);
		_g_object_unref0 (row);
		return;
	}
	_tmp7_ = chat_row;
	_tmp8_ = dc_chat_row_get_chat_id (_tmp7_);
	_tmp9_ = _tmp8_;
	dc_window_select_chat_by_id (self, _tmp9_);
	_tmp10_ = self->priv->search_entry;
	gtk_editable_set_text ((GtkEditable*) _tmp10_, "");
	_tmp11_ = dc_window_current_view (self);
	v = _tmp11_;
	_tmp12_ = v;
	if (_tmp12_ != NULL) {
		DcConversationView* _tmp13_;
		_tmp13_ = v;
		dc_conversation_view_focus_entry (_tmp13_);
	}
	_g_object_unref0 (v);
	_g_object_unref0 (chat_row);
	_g_object_unref0 (row);
}

static void
___lambda416__gtk_search_entry_activate (GtkSearchEntry* _sender,
                                         gpointer self)
{
	__lambda416_ ((DcWindow*) self);
}

static gboolean
__lambda417_ (DcWindow* self,
              guint keyval,
              guint keycode,
              GdkModifierType state)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	if ((state & ((GDK_CONTROL_MASK | GDK_SHIFT_MASK) | GDK_ALT_MASK)) != 0) {
		result = FALSE;
		return result;
	}
	if (keyval == GDK_KEY_Down) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = keyval == GDK_KEY_KP_Down;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = keyval == GDK_KEY_Tab;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = keyval == GDK_KEY_KP_Tab;
	}
	if (_tmp0_) {
		GtkListBoxRow* row = NULL;
		GtkListBoxRow* _tmp3_;
		GtkListBoxRow* _tmp4_;
		_tmp3_ = dc_window_first_visible_chat_row (self);
		row = _tmp3_;
		_tmp4_ = row;
		if (_tmp4_ != NULL) {
			GtkListBoxRow* _tmp5_;
			_tmp5_ = row;
			gtk_widget_grab_focus ((GtkWidget*) _tmp5_);
			result = TRUE;
			_g_object_unref0 (row);
			return result;
		}
		_g_object_unref0 (row);
	}
	result = FALSE;
	return result;
}

static gboolean
___lambda417__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                    guint keyval,
                                                    guint keycode,
                                                    GdkModifierType state,
                                                    gpointer self)
{
	gboolean result;
	result = __lambda417_ ((DcWindow*) self, keyval, keycode, state);
	return result;
}

static void
__lambda418_ (DcWindow* self)
{
	dc_window_toggle_archived_view (self);
}

static void
___lambda418__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda418_ ((DcWindow*) self);
}

static gboolean
_dc_window_filter_chats_gtk_list_box_filter_func (GtkListBoxRow* row,
                                                  gpointer self)
{
	gboolean result;
	result = dc_window_filter_chats ((DcWindow*) self, row);
	return result;
}

static void
_dc_window_on_chat_selected_gtk_list_box_row_selected (GtkListBox* _sender,
                                                       GtkListBoxRow* row,
                                                       gpointer self)
{
	dc_window_on_chat_selected ((DcWindow*) self, row);
}

static void
__lambda419_ (DcWindow* self,
              GtkListBoxRow* row)
{
	gboolean _tmp0_ = FALSE;
	AdwOverlaySplitView* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	DcConversationView* view = NULL;
	DcConversationView* _tmp14_;
	DcConversationView* _tmp15_;
	g_return_if_fail (row != NULL);
	_tmp1_ = self->priv->split_view;
	_tmp2_ = adw_overlay_split_view_get_collapsed (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		AdwOverlaySplitView* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = self->priv->split_view;
		_tmp5_ = adw_overlay_split_view_get_show_sidebar (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		AdwOverlaySplitView* _tmp7_;
		DcConversationView* v = NULL;
		DcConversationView* _tmp8_;
		gboolean _tmp9_ = FALSE;
		DcConversationView* _tmp10_;
		_tmp7_ = self->priv->split_view;
		adw_overlay_split_view_set_show_sidebar (_tmp7_, FALSE);
		_tmp8_ = dc_window_current_view (self);
		v = _tmp8_;
		_tmp10_ = v;
		if (_tmp10_ != NULL) {
			gboolean _tmp11_;
			gboolean _tmp12_;
			g_object_get ((GtkWindow*) self, "is-active", &_tmp11_, NULL);
			_tmp12_ = _tmp11_;
			_tmp9_ = _tmp12_;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			DcConversationView* _tmp13_;
			_tmp13_ = v;
			dc_conversation_view_flush_pending_seen (_tmp13_);
		}
		_g_object_unref0 (v);
	}
	_tmp14_ = dc_window_current_view (self);
	view = _tmp14_;
	_tmp15_ = view;
	if (_tmp15_ != NULL) {
		DcConversationView* _tmp16_;
		_tmp16_ = view;
		dc_conversation_view_focus_entry (_tmp16_);
	}
	_g_object_unref0 (view);
}

static void
___lambda419__gtk_list_box_row_activated (GtkListBox* _sender,
                                          GtkListBoxRow* row,
                                          gpointer self)
{
	__lambda419_ ((DcWindow*) self, row);
}

static void
__lambda420_ (Block3Data* _data3_,
              gint n,
              gdouble x,
              gdouble y)
{
	DcWindow* self;
	GtkListBoxRow* row = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	GtkListBoxRow* _tmp2_;
	GtkListBoxRow* _tmp3_;
	DcChatRow* chat_row = NULL;
	GtkListBoxRow* _tmp4_;
	GtkWidget* _tmp5_;
	GtkWidget* _tmp6_;
	DcChatRow* _tmp7_;
	DcChatRow* _tmp8_;
	GtkGestureClick* _tmp9_;
	DcChatContextMenu* _tmp10_;
	self = _data3_->self;
	_tmp0_ = self->priv->chat_listbox;
	_tmp1_ = gtk_list_box_get_row_at_y (_tmp0_, (gint) y);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	row = _tmp2_;
	_tmp3_ = row;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (row);
		return;
	}
	_tmp4_ = row;
	_tmp5_ = gtk_list_box_row_get_child (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp6_) ? ((DcChatRow*) _tmp6_) : NULL);
	chat_row = _tmp7_;
	_tmp8_ = chat_row;
	if (_tmp8_ == NULL) {
		_g_object_unref0 (chat_row);
		_g_object_unref0 (row);
		return;
	}
	_tmp9_ = _data3_->right_click;
	gtk_gesture_set_state ((GtkGesture*) _tmp9_, GTK_EVENT_SEQUENCE_CLAIMED);
	_tmp10_ = self->priv->chat_menu;
	if (_tmp10_ != NULL) {
		DcChatContextMenu* _tmp11_;
		DcChatRow* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		GtkListBox* _tmp15_;
		_tmp11_ = self->priv->chat_menu;
		_tmp12_ = chat_row;
		_tmp13_ = dc_chat_row_get_chat_id (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = self->priv->chat_listbox;
		dc_chat_context_menu_show (_tmp11_, _tmp14_, x, y, (GtkWidget*) _tmp15_);
	}
	_g_object_unref0 (chat_row);
	_g_object_unref0 (row);
}

static void
___lambda420__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                         gint n_press,
                                         gdouble x,
                                         gdouble y,
                                         gpointer self)
{
	__lambda420_ (self, n_press, x, y);
}

static void
__lambda421_ (DcWindow* self)
{
	dc_window_toggle_sidebar_button (self);
}

static void
___lambda421__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda421_ ((DcWindow*) self);
}

static void
__lambda422_ (DcWindow* self)
{
	dc_window_show_gallery_dialog (self);
}

static void
___lambda422__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda422_ ((DcWindow*) self);
}

static void
__lambda423_ (DcWindow* self)
{
	dc_window_toggle_message_search (self);
}

static void
___lambda423__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda423_ ((DcWindow*) self);
}

static void
_vala_GValue_free (GValue* self)
{
	g_boxed_free (G_TYPE_VALUE, self);
}

static void
__lambda424_ (DcWindow* self)
{
	AdwOverlaySplitView* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = self->priv->split_view;
	_tmp1_ = adw_overlay_split_view_get_collapsed (_tmp0_);
	_tmp2_ = _tmp1_;
	dc_window_apply_sidebar_mode (self, !_tmp2_);
}

static void
___lambda424__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda424_ ((DcWindow*) self);
}

static gboolean
_dc_window_on_window_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                       guint keyval,
                                                                       guint keycode,
                                                                       GdkModifierType state,
                                                                       gpointer self)
{
	gboolean result;
	result = dc_window_on_window_key_pressed ((DcWindow*) self, keyval, keycode, state);
	return result;
}

static gboolean
_dc_window_on_chat_scroll_gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                              gdouble dx,
                                                              gdouble dy,
                                                              gpointer self)
{
	gboolean result;
	result = dc_window_on_chat_scroll ((DcWindow*) self, _sender, dx, dy);
	return result;
}

static void
dc_window_build_ui (DcWindow* self)
{
	Block3Data* _data3_;
	GtkBox* _tmp0_;
	AdwHeaderBar* _tmp1_;
	AdwWindowTitle* _tmp2_;
	AdwHeaderBar* _tmp3_;
	AdwWindowTitle* _tmp4_;
	AdwAvatar* _tmp5_;
	GtkPopover* _tmp6_;
	GtkPopover* _tmp7_;
	GtkBox* _tmp8_;
	GtkBox* _tmp9_;
	GtkBox* _tmp10_;
	GtkBox* _tmp11_;
	GtkBox* _tmp12_;
	GtkOverlay* avatar_overlay = NULL;
	GtkOverlay* _tmp13_;
	GtkOverlay* _tmp14_;
	AdwAvatar* _tmp15_;
	GtkOverlay* _tmp16_;
	GtkBox* _tmp17_;
	GtkMenuButton* _tmp18_;
	GtkMenuButton* _tmp19_;
	GtkOverlay* _tmp20_;
	GtkMenuButton* _tmp21_;
	GtkMenuButton* _tmp22_;
	GtkMenuButton* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GtkMenuButton* _tmp28_;
	GtkPopover* _tmp29_;
	AdwHeaderBar* _tmp30_;
	GtkMenuButton* _tmp31_;
	GtkMenuButton* _tmp32_;
	GtkMenuButton* _tmp33_;
	GtkMenuButton* _tmp34_;
	GtkMenuButton* _tmp35_;
	GtkMenuButton* _tmp36_;
	GMenuModel* _tmp37_;
	GMenuModel* _tmp38_;
	AdwHeaderBar* _tmp39_;
	GtkMenuButton* _tmp40_;
	GtkBox* _tmp41_;
	AdwHeaderBar* _tmp42_;
	GtkSearchEntry* _tmp43_;
	GtkSearchEntry* _tmp44_;
	GtkSearchEntry* _tmp45_;
	GtkSearchEntry* _tmp46_;
	GtkSearchEntry* _tmp47_;
	GtkSearchEntry* _tmp48_;
	GtkSearchEntry* _tmp49_;
	GtkSearchEntry* _tmp50_;
	GtkEventControllerKey* search_keys = NULL;
	GtkEventControllerKey* _tmp51_;
	GtkEventControllerKey* _tmp52_;
	GtkSearchEntry* _tmp53_;
	GtkEventControllerKey* _tmp54_;
	GtkEventController* _tmp55_;
	GtkBox* _tmp56_;
	GtkSearchEntry* _tmp57_;
	AdwButtonContent* _tmp58_;
	AdwButtonContent* _tmp59_;
	GtkButton* _tmp60_;
	GtkButton* _tmp61_;
	AdwButtonContent* _tmp62_;
	GtkButton* _tmp63_;
	GtkButton* _tmp64_;
	GtkButton* _tmp65_;
	GtkButton* _tmp66_;
	GtkButton* _tmp67_;
	GtkButton* _tmp68_;
	GtkBox* _tmp69_;
	GtkButton* _tmp70_;
	GtkScrolledWindow* chat_scroll = NULL;
	GtkScrolledWindow* _tmp71_;
	GtkScrolledWindow* _tmp72_;
	GtkScrolledWindow* _tmp73_;
	GtkListBox* _tmp74_;
	GtkListBox* _tmp75_;
	GtkListBox* _tmp76_;
	GtkListBox* _tmp77_;
	GtkListBox* _tmp78_;
	GtkListBox* _tmp79_;
	GtkGestureClick* _tmp80_;
	GtkGestureClick* _tmp81_;
	GtkGestureClick* _tmp82_;
	GtkGestureClick* _tmp83_;
	GtkListBox* _tmp84_;
	GtkGestureClick* _tmp85_;
	GtkEventController* _tmp86_;
	GtkScrolledWindow* _tmp87_;
	GtkListBox* _tmp88_;
	GtkBox* _tmp89_;
	GtkScrolledWindow* _tmp90_;
	GtkBox* content_box = NULL;
	GtkBox* _tmp91_;
	GtkBox* _tmp92_;
	GtkBox* _tmp93_;
	GtkBox* _tmp94_;
	GtkBox* _tmp95_;
	AdwHeaderBar* _tmp96_;
	GtkLabel* _tmp97_;
	GtkLabel* _tmp98_;
	GtkLabel* _tmp99_;
	GtkImage* _tmp100_;
	GtkImage* _tmp101_;
	GtkImage* _tmp102_;
	GtkImage* _tmp103_;
	GtkImage* _tmp104_;
	GtkBox* content_title_box = NULL;
	GtkBox* _tmp105_;
	GtkBox* _tmp106_;
	GtkLabel* _tmp107_;
	GtkBox* _tmp108_;
	GtkImage* _tmp109_;
	AdwHeaderBar* _tmp110_;
	GtkBox* _tmp111_;
	GtkButton* _tmp112_;
	GtkButton* _tmp113_;
	GtkButton* _tmp114_;
	AdwHeaderBar* _tmp115_;
	GtkButton* _tmp116_;
	GtkButton* _tmp117_;
	GtkButton* _tmp118_;
	gchar* _tmp119_;
	gchar* _tmp120_;
	gchar* _tmp121_;
	gchar* _tmp122_;
	GtkButton* _tmp123_;
	AdwHeaderBar* _tmp124_;
	GtkButton* _tmp125_;
	GtkButton* _tmp126_;
	GtkButton* _tmp127_;
	gchar* _tmp128_;
	gchar* _tmp129_;
	gchar* _tmp130_;
	gchar* _tmp131_;
	GtkButton* _tmp132_;
	AdwHeaderBar* _tmp133_;
	GtkButton* _tmp134_;
	GtkBox* _tmp135_;
	AdwHeaderBar* _tmp136_;
	GtkStack* _tmp137_;
	GtkStack* _tmp138_;
	GtkStack* _tmp139_;
	GtkStack* _tmp140_;
	GtkStack* _tmp141_;
	AdwStatusPage* _tmp142_;
	AdwStatusPage* _tmp143_;
	AdwStatusPage* _tmp144_;
	AdwStatusPage* _tmp145_;
	GtkStack* _tmp146_;
	AdwStatusPage* _tmp147_;
	GtkStack* _tmp148_;
	GtkBox* _tmp149_;
	GtkStack* _tmp150_;
	AdwOverlaySplitView* _tmp151_;
	AdwOverlaySplitView* _tmp152_;
	GtkBox* _tmp153_;
	AdwOverlaySplitView* _tmp154_;
	GtkBox* _tmp155_;
	AdwOverlaySplitView* _tmp156_;
	AdwOverlaySplitView* _tmp157_;
	AdwOverlaySplitView* _tmp158_;
	AdwOverlaySplitView* _tmp159_;
	AdwOverlaySplitView* _tmp160_;
	AdwToastOverlay* _tmp161_;
	AdwToastOverlay* _tmp162_;
	AdwOverlaySplitView* _tmp163_;
	AdwBreakpoint* breakpoint = NULL;
	AdwBreakpointCondition* _tmp164_;
	AdwBreakpoint* _tmp165_;
	AdwBreakpoint* _tmp166_;
	AdwOverlaySplitView* _tmp167_;
	GValue* _tmp168_ = NULL;
	AdwBreakpoint* _tmp169_;
	AdwBreakpoint* _tmp170_;
	AdwBreakpoint* narrow_bp = NULL;
	AdwBreakpointCondition* _tmp171_;
	AdwBreakpoint* _tmp172_;
	AdwBreakpoint* _tmp173_;
	AdwOverlaySplitView* _tmp174_;
	GValue* _tmp175_ = NULL;
	AdwBreakpoint* _tmp176_;
	AdwBreakpoint* _tmp177_;
	AdwOverlaySplitView* _tmp178_;
	DcSettingsManager* _tmp179_;
	DcSidebarMode _tmp180_;
	DcSidebarMode _tmp181_;
	GtkOverlay* image_overlay = NULL;
	GtkOverlay* _tmp183_;
	AdwToastOverlay* _tmp184_;
	DcImageViewer* _tmp185_;
	GtkWidget* _tmp186_;
	GtkWidget* _tmp187_;
	DcVideoPlayer* _tmp188_;
	GtkWidget* _tmp189_;
	GtkWidget* _tmp190_;
	GtkRevealer* _tmp191_;
	GtkRevealer* _tmp192_;
	GtkEventControllerKey* key_ctrl = NULL;
	GtkEventControllerKey* _tmp193_;
	GtkEventController* _tmp194_;
	GtkEventControllerScroll* scroll_ctrl = NULL;
	GtkEventControllerScroll* _tmp195_;
	GtkStack* _tmp196_;
	GtkEventController* _tmp197_;
	g_return_if_fail (self != NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->sidebar_box);
	self->priv->sidebar_box = _tmp0_;
	_tmp1_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->sidebar_header);
	self->priv->sidebar_header = _tmp1_;
	_tmp2_ = (AdwWindowTitle*) adw_window_title_new ("Parla", "");
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->sidebar_title);
	self->priv->sidebar_title = _tmp2_;
	_tmp3_ = self->priv->sidebar_header;
	_tmp4_ = self->priv->sidebar_title;
	adw_header_bar_set_title_widget (_tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = (AdwAvatar*) adw_avatar_new (24, "", TRUE);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->profile_avatar);
	self->priv->profile_avatar = _tmp5_;
	_tmp6_ = dc_window_build_account_popover (self);
	_g_object_unref0 (self->priv->account_popover);
	self->priv->account_popover = _tmp6_;
	_tmp7_ = self->priv->account_popover;
	g_signal_connect_object ((GtkWidget*) _tmp7_, "map", (GCallback) ___lambda312__gtk_widget_map, self, 0);
	_tmp8_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->profile_unread_badge);
	self->priv->profile_unread_badge = _tmp8_;
	_tmp9_ = self->priv->profile_unread_badge;
	gtk_widget_add_css_class ((GtkWidget*) _tmp9_, "account-unread-dot");
	_tmp10_ = self->priv->profile_unread_badge;
	gtk_widget_set_halign ((GtkWidget*) _tmp10_, GTK_ALIGN_END);
	_tmp11_ = self->priv->profile_unread_badge;
	gtk_widget_set_valign ((GtkWidget*) _tmp11_, GTK_ALIGN_END);
	_tmp12_ = self->priv->profile_unread_badge;
	gtk_widget_set_visible ((GtkWidget*) _tmp12_, FALSE);
	_tmp13_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp13_);
	avatar_overlay = _tmp13_;
	_tmp14_ = avatar_overlay;
	_tmp15_ = self->priv->profile_avatar;
	gtk_overlay_set_child (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = avatar_overlay;
	_tmp17_ = self->priv->profile_unread_badge;
	gtk_overlay_add_overlay (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->account_menu_button);
	self->priv->account_menu_button = _tmp18_;
	_tmp19_ = self->priv->account_menu_button;
	_tmp20_ = avatar_overlay;
	gtk_menu_button_set_child (_tmp19_, (GtkWidget*) _tmp20_);
	_tmp21_ = self->priv->account_menu_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp21_, "flat");
	_tmp22_ = self->priv->account_menu_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp22_, "circular");
	_tmp23_ = self->priv->account_menu_button;
	_tmp24_ = dc_platform_primary_shortcut_text ("Shift+A");
	_tmp25_ = _tmp24_;
	_tmp26_ = g_strdup_printf ("Account Menu (%s)", _tmp25_);
	_tmp27_ = _tmp26_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp23_, _tmp27_);
	_g_free0 (_tmp27_);
	_g_free0 (_tmp25_);
	_tmp28_ = self->priv->account_menu_button;
	_tmp29_ = self->priv->account_popover;
	g_object_set ((GObject*) _tmp28_, "popover", _tmp29_, NULL);
	_tmp30_ = self->priv->sidebar_header;
	_tmp31_ = self->priv->account_menu_button;
	adw_header_bar_pack_start (_tmp30_, (GtkWidget*) _tmp31_);
	_tmp32_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_ref_sink (_tmp32_);
	_g_object_unref0 (self->priv->sidebar_menu_button);
	self->priv->sidebar_menu_button = _tmp32_;
	_tmp33_ = self->priv->sidebar_menu_button;
	gtk_menu_button_set_icon_name (_tmp33_, "open-menu-symbolic");
	_tmp34_ = self->priv->sidebar_menu_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp34_, "Main Menu");
	_tmp35_ = self->priv->sidebar_menu_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp35_, "flat");
	_tmp36_ = self->priv->sidebar_menu_button;
	_tmp37_ = dc_window_build_app_menu (self);
	_tmp38_ = _tmp37_;
	gtk_menu_button_set_menu_model (_tmp36_, _tmp38_);
	_g_object_unref0 (_tmp38_);
	_tmp39_ = self->priv->sidebar_header;
	_tmp40_ = self->priv->sidebar_menu_button;
	adw_header_bar_pack_end (_tmp39_, (GtkWidget*) _tmp40_);
	_tmp41_ = self->priv->sidebar_box;
	_tmp42_ = self->priv->sidebar_header;
	gtk_box_append (_tmp41_, (GtkWidget*) _tmp42_);
	_tmp43_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp43_);
	_g_object_unref0 (self->priv->search_entry);
	self->priv->search_entry = _tmp43_;
	_tmp44_ = self->priv->search_entry;
	g_object_set (_tmp44_, "placeholder-text", "Search contacts…", NULL);
	_tmp45_ = self->priv->search_entry;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp45_, 8);
	_tmp46_ = self->priv->search_entry;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp46_, 8);
	_tmp47_ = self->priv->search_entry;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp47_, 4);
	_tmp48_ = self->priv->search_entry;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp48_, 4);
	_tmp49_ = self->priv->search_entry;
	g_signal_connect_object (_tmp49_, "search-changed", (GCallback) ___lambda415__gtk_search_entry_search_changed, self, 0);
	_tmp50_ = self->priv->search_entry;
	g_signal_connect_object (_tmp50_, "activate", (GCallback) ___lambda416__gtk_search_entry_activate, self, 0);
	_tmp51_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	search_keys = _tmp51_;
	_tmp52_ = search_keys;
	g_signal_connect_object (_tmp52_, "key-pressed", (GCallback) ___lambda417__gtk_event_controller_key_key_pressed, self, 0);
	_tmp53_ = self->priv->search_entry;
	_tmp54_ = search_keys;
	_tmp55_ = _g_object_ref0 ((GtkEventController*) _tmp54_);
	gtk_widget_add_controller ((GtkWidget*) _tmp53_, _tmp55_);
	_tmp56_ = self->priv->sidebar_box;
	_tmp57_ = self->priv->search_entry;
	gtk_box_append (_tmp56_, (GtkWidget*) _tmp57_);
	_tmp58_ = (AdwButtonContent*) adw_button_content_new ();
	g_object_ref_sink (_tmp58_);
	_g_object_unref0 (self->priv->archived_btn_content);
	self->priv->archived_btn_content = _tmp58_;
	_tmp59_ = self->priv->archived_btn_content;
	adw_button_content_set_icon_name (_tmp59_, "archive-symbolic");
	_tmp60_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp60_);
	_g_object_unref0 (self->priv->archived_toggle_btn);
	self->priv->archived_toggle_btn = _tmp60_;
	_tmp61_ = self->priv->archived_toggle_btn;
	_tmp62_ = self->priv->archived_btn_content;
	gtk_button_set_child (_tmp61_, (GtkWidget*) _tmp62_);
	_tmp63_ = self->priv->archived_toggle_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp63_, "flat");
	_tmp64_ = self->priv->archived_toggle_btn;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp64_, 8);
	_tmp65_ = self->priv->archived_toggle_btn;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp65_, 8);
	_tmp66_ = self->priv->archived_toggle_btn;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp66_, 4);
	_tmp67_ = self->priv->archived_toggle_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp67_, FALSE);
	_tmp68_ = self->priv->archived_toggle_btn;
	g_signal_connect_object (_tmp68_, "clicked", (GCallback) ___lambda418__gtk_button_clicked, self, 0);
	_tmp69_ = self->priv->sidebar_box;
	_tmp70_ = self->priv->archived_toggle_btn;
	gtk_box_append (_tmp69_, (GtkWidget*) _tmp70_);
	_tmp71_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp71_);
	chat_scroll = _tmp71_;
	_tmp72_ = chat_scroll;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp72_, TRUE);
	_tmp73_ = chat_scroll;
	g_object_set (_tmp73_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp74_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp74_);
	_g_object_unref0 (self->priv->chat_listbox);
	self->priv->chat_listbox = _tmp74_;
	_tmp75_ = self->priv->chat_listbox;
	gtk_list_box_set_selection_mode (_tmp75_, GTK_SELECTION_SINGLE);
	_tmp76_ = self->priv->chat_listbox;
	gtk_widget_add_css_class ((GtkWidget*) _tmp76_, "navigation-sidebar");
	_tmp77_ = self->priv->chat_listbox;
	gtk_list_box_set_filter_func (_tmp77_, _dc_window_filter_chats_gtk_list_box_filter_func, g_object_ref (self), g_object_unref);
	_tmp78_ = self->priv->chat_listbox;
	g_signal_connect_object (_tmp78_, "row-selected", (GCallback) _dc_window_on_chat_selected_gtk_list_box_row_selected, self, 0);
	_tmp79_ = self->priv->chat_listbox;
	g_signal_connect_object (_tmp79_, "row-activated", (GCallback) ___lambda419__gtk_list_box_row_activated, self, 0);
	_tmp80_ = (GtkGestureClick*) gtk_gesture_click_new ();
	_data3_->right_click = _tmp80_;
	_tmp81_ = _data3_->right_click;
	gtk_gesture_single_set_button ((GtkGestureSingle*) _tmp81_, (guint) 3);
	_tmp82_ = _data3_->right_click;
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp82_, GTK_PHASE_CAPTURE);
	_tmp83_ = _data3_->right_click;
	g_signal_connect_data (_tmp83_, "pressed", (GCallback) ___lambda420__gtk_gesture_click_pressed, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	_tmp84_ = self->priv->chat_listbox;
	_tmp85_ = _data3_->right_click;
	_tmp86_ = _g_object_ref0 ((GtkEventController*) _tmp85_);
	gtk_widget_add_controller ((GtkWidget*) _tmp84_, _tmp86_);
	_tmp87_ = chat_scroll;
	_tmp88_ = self->priv->chat_listbox;
	gtk_scrolled_window_set_child (_tmp87_, (GtkWidget*) _tmp88_);
	_tmp89_ = self->priv->sidebar_box;
	_tmp90_ = chat_scroll;
	gtk_box_append (_tmp89_, (GtkWidget*) _tmp90_);
	_tmp91_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp91_);
	content_box = _tmp91_;
	_tmp92_ = content_box;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp92_, TRUE);
	_tmp93_ = content_box;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp93_, TRUE);
	_tmp94_ = content_box;
	gtk_widget_set_halign ((GtkWidget*) _tmp94_, GTK_ALIGN_FILL);
	_tmp95_ = content_box;
	gtk_widget_set_valign ((GtkWidget*) _tmp95_, GTK_ALIGN_FILL);
	_tmp96_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp96_);
	_g_object_unref0 (self->priv->content_header);
	self->priv->content_header = _tmp96_;
	_tmp97_ = (GtkLabel*) gtk_label_new ("Select a chat");
	g_object_ref_sink (_tmp97_);
	_g_object_unref0 (self->priv->content_title_label);
	self->priv->content_title_label = _tmp97_;
	_tmp98_ = self->priv->content_title_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp98_, "heading");
	_tmp99_ = self->priv->content_title_label;
	gtk_label_set_ellipsize (_tmp99_, PANGO_ELLIPSIZE_END);
	_tmp100_ = (GtkImage*) gtk_image_new_from_icon_name ("notifications-disabled-symbolic");
	g_object_ref_sink (_tmp100_);
	_g_object_unref0 (self->priv->content_mute_icon);
	self->priv->content_mute_icon = _tmp100_;
	_tmp101_ = self->priv->content_mute_icon;
	gtk_image_set_pixel_size (_tmp101_, 14);
	_tmp102_ = self->priv->content_mute_icon;
	gtk_widget_add_css_class ((GtkWidget*) _tmp102_, "dim-label");
	_tmp103_ = self->priv->content_mute_icon;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp103_, "Notifications muted");
	_tmp104_ = self->priv->content_mute_icon;
	gtk_widget_set_visible ((GtkWidget*) _tmp104_, FALSE);
	_tmp105_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp105_);
	content_title_box = _tmp105_;
	_tmp106_ = content_title_box;
	_tmp107_ = self->priv->content_title_label;
	gtk_box_append (_tmp106_, (GtkWidget*) _tmp107_);
	_tmp108_ = content_title_box;
	_tmp109_ = self->priv->content_mute_icon;
	gtk_box_append (_tmp108_, (GtkWidget*) _tmp109_);
	_tmp110_ = self->priv->content_header;
	_tmp111_ = content_title_box;
	adw_header_bar_set_title_widget (_tmp110_, (GtkWidget*) _tmp111_);
	_tmp112_ = (GtkButton*) gtk_button_new_from_icon_name ("sidebar-show-symbolic");
	g_object_ref_sink (_tmp112_);
	_g_object_unref0 (self->priv->sidebar_toggle_btn);
	self->priv->sidebar_toggle_btn = _tmp112_;
	_tmp113_ = self->priv->sidebar_toggle_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp113_, "flat");
	_tmp114_ = self->priv->sidebar_toggle_btn;
	g_signal_connect_object (_tmp114_, "clicked", (GCallback) ___lambda421__gtk_button_clicked, self, 0);
	_tmp115_ = self->priv->content_header;
	_tmp116_ = self->priv->sidebar_toggle_btn;
	adw_header_bar_pack_start (_tmp115_, (GtkWidget*) _tmp116_);
	_tmp117_ = (GtkButton*) gtk_button_new_from_icon_name ("view-grid-symbolic");
	g_object_ref_sink (_tmp117_);
	_g_object_unref0 (self->priv->gallery_btn);
	self->priv->gallery_btn = _tmp117_;
	_tmp118_ = self->priv->gallery_btn;
	_tmp119_ = dc_platform_primary_shortcut_text ("M");
	_tmp120_ = _tmp119_;
	_tmp121_ = g_strdup_printf ("Apps and media (%s)", _tmp120_);
	_tmp122_ = _tmp121_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp118_, _tmp122_);
	_g_free0 (_tmp122_);
	_g_free0 (_tmp120_);
	_tmp123_ = self->priv->gallery_btn;
	g_signal_connect_object (_tmp123_, "clicked", (GCallback) ___lambda422__gtk_button_clicked, self, 0);
	_tmp124_ = self->priv->content_header;
	_tmp125_ = self->priv->gallery_btn;
	adw_header_bar_pack_end (_tmp124_, (GtkWidget*) _tmp125_);
	_tmp126_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-find-symbolic");
	g_object_ref_sink (_tmp126_);
	_g_object_unref0 (self->priv->message_search_btn);
	self->priv->message_search_btn = _tmp126_;
	_tmp127_ = self->priv->message_search_btn;
	_tmp128_ = dc_platform_primary_shortcut_text ("F");
	_tmp129_ = _tmp128_;
	_tmp130_ = g_strdup_printf ("Search in conversation (%s)", _tmp129_);
	_tmp131_ = _tmp130_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp127_, _tmp131_);
	_g_free0 (_tmp131_);
	_g_free0 (_tmp129_);
	_tmp132_ = self->priv->message_search_btn;
	g_signal_connect_object (_tmp132_, "clicked", (GCallback) ___lambda423__gtk_button_clicked, self, 0);
	_tmp133_ = self->priv->content_header;
	_tmp134_ = self->priv->message_search_btn;
	adw_header_bar_pack_end (_tmp133_, (GtkWidget*) _tmp134_);
	dc_window_update_conversation_header_actions (self);
	_tmp135_ = content_box;
	_tmp136_ = self->priv->content_header;
	gtk_box_append (_tmp135_, (GtkWidget*) _tmp136_);
	_tmp137_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp137_);
	_g_object_unref0 (self->priv->content_stack);
	self->priv->content_stack = _tmp137_;
	_tmp138_ = self->priv->content_stack;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp138_, TRUE);
	_tmp139_ = self->priv->content_stack;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp139_, TRUE);
	_tmp140_ = self->priv->content_stack;
	gtk_widget_set_halign ((GtkWidget*) _tmp140_, GTK_ALIGN_FILL);
	_tmp141_ = self->priv->content_stack;
	gtk_widget_set_valign ((GtkWidget*) _tmp141_, GTK_ALIGN_FILL);
	_tmp142_ = (AdwStatusPage*) adw_status_page_new ();
	g_object_ref_sink (_tmp142_);
	_g_object_unref0 (self->priv->empty_status);
	self->priv->empty_status = _tmp142_;
	_tmp143_ = self->priv->empty_status;
	adw_status_page_set_icon_name (_tmp143_, "parla-welcome");
	_tmp144_ = self->priv->empty_status;
	adw_status_page_set_title (_tmp144_, "Welcome to Parla");
	_tmp145_ = self->priv->empty_status;
	adw_status_page_set_description (_tmp145_, "Select a chat to start messaging");
	_tmp146_ = self->priv->content_stack;
	_tmp147_ = self->priv->empty_status;
	gtk_stack_add_named (_tmp146_, (GtkWidget*) _tmp147_, "empty");
	_tmp148_ = self->priv->content_stack;
	gtk_stack_set_visible_child_name (_tmp148_, "empty");
	_tmp149_ = content_box;
	_tmp150_ = self->priv->content_stack;
	gtk_box_append (_tmp149_, (GtkWidget*) _tmp150_);
	_tmp151_ = (AdwOverlaySplitView*) adw_overlay_split_view_new ();
	g_object_ref_sink (_tmp151_);
	_g_object_unref0 (self->priv->split_view);
	self->priv->split_view = _tmp151_;
	_tmp152_ = self->priv->split_view;
	_tmp153_ = self->priv->sidebar_box;
	adw_overlay_split_view_set_sidebar (_tmp152_, (GtkWidget*) _tmp153_);
	_tmp154_ = self->priv->split_view;
	_tmp155_ = content_box;
	adw_overlay_split_view_set_content (_tmp154_, (GtkWidget*) _tmp155_);
	_tmp156_ = self->priv->split_view;
	adw_overlay_split_view_set_max_sidebar_width (_tmp156_, DC_WINDOW_FULL_SIDEBAR_MAX_WIDTH);
	_tmp157_ = self->priv->split_view;
	adw_overlay_split_view_set_min_sidebar_width (_tmp157_, DC_WINDOW_FULL_SIDEBAR_MIN_WIDTH);
	_tmp158_ = self->priv->split_view;
	adw_overlay_split_view_set_sidebar_width_fraction (_tmp158_, 0.32);
	_tmp159_ = self->priv->split_view;
	adw_overlay_split_view_set_enable_show_gesture (_tmp159_, TRUE);
	_tmp160_ = self->priv->split_view;
	adw_overlay_split_view_set_enable_hide_gesture (_tmp160_, TRUE);
	_tmp161_ = (AdwToastOverlay*) adw_toast_overlay_new ();
	g_object_ref_sink (_tmp161_);
	_g_object_unref0 (self->priv->toast_overlay);
	self->priv->toast_overlay = _tmp161_;
	_tmp162_ = self->priv->toast_overlay;
	_tmp163_ = self->priv->split_view;
	adw_toast_overlay_set_child (_tmp162_, (GtkWidget*) _tmp163_);
	_tmp164_ = adw_breakpoint_condition_parse ("max-width: 600px");
	_tmp165_ = adw_breakpoint_new (_tmp164_);
	breakpoint = _tmp165_;
	_tmp166_ = breakpoint;
	_tmp167_ = self->priv->split_view;
	_tmp168_ = g_new0 (GValue, 1);
	g_value_init (_tmp168_, G_TYPE_BOOLEAN);
	g_value_set_boolean (_tmp168_, TRUE);
	adw_breakpoint_add_setter (_tmp166_, (GObject*) _tmp167_, "collapsed", _tmp168_);
	__vala_GValue_free0 (_tmp168_);
	_tmp169_ = breakpoint;
	_tmp170_ = _g_object_ref0 (_tmp169_);
	adw_application_window_add_breakpoint ((AdwApplicationWindow*) self, _tmp170_);
	_tmp171_ = adw_breakpoint_condition_parse ("max-width: 280px");
	_tmp172_ = adw_breakpoint_new (_tmp171_);
	narrow_bp = _tmp172_;
	_tmp173_ = narrow_bp;
	_tmp174_ = self->priv->split_view;
	_tmp175_ = g_new0 (GValue, 1);
	g_value_init (_tmp175_, G_TYPE_DOUBLE);
	g_value_set_double (_tmp175_, 220.0);
	adw_breakpoint_add_setter (_tmp173_, (GObject*) _tmp174_, "min-sidebar-width", _tmp175_);
	__vala_GValue_free0 (_tmp175_);
	_tmp176_ = narrow_bp;
	_tmp177_ = _g_object_ref0 (_tmp176_);
	adw_application_window_add_breakpoint ((AdwApplicationWindow*) self, _tmp177_);
	_tmp178_ = self->priv->split_view;
	g_signal_connect_object ((GObject*) _tmp178_, "notify::collapsed", (GCallback) ___lambda424__g_object_notify, self, 0);
	_tmp179_ = self->settings;
	_tmp180_ = dc_settings_manager_get_sidebar_mode (_tmp179_);
	_tmp181_ = _tmp180_;
	if (_tmp181_ == DC_SIDEBAR_MODE_HIDDEN) {
		DcSettingsManager* _tmp182_;
		_tmp182_ = self->settings;
		dc_settings_manager_save_sidebar_mode (_tmp182_, DC_SIDEBAR_MODE_FULL);
	}
	dc_window_apply_sidebar_mode (self, TRUE);
	_tmp183_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp183_);
	image_overlay = _tmp183_;
	_tmp184_ = self->priv->toast_overlay;
	gtk_overlay_set_child (image_overlay, (GtkWidget*) _tmp184_);
	_tmp185_ = self->priv->image_viewer;
	_tmp186_ = dc_image_viewer_get_widget (_tmp185_);
	_tmp187_ = _tmp186_;
	gtk_overlay_add_overlay (image_overlay, _tmp187_);
	_tmp188_ = self->priv->video_player;
	_tmp189_ = dc_video_player_get_widget (_tmp188_);
	_tmp190_ = _tmp189_;
	gtk_overlay_add_overlay (image_overlay, _tmp190_);
	_tmp191_ = dc_window_build_connection_banner (self);
	_tmp192_ = _tmp191_;
	gtk_overlay_add_overlay (image_overlay, (GtkWidget*) _tmp192_);
	_g_object_unref0 (_tmp192_);
	adw_application_window_set_content ((AdwApplicationWindow*) self, (GtkWidget*) image_overlay);
	_tmp193_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key_ctrl = _tmp193_;
	gtk_event_controller_set_propagation_phase ((GtkEventController*) key_ctrl, GTK_PHASE_CAPTURE);
	g_signal_connect_object (key_ctrl, "key-pressed", (GCallback) _dc_window_on_window_key_pressed_gtk_event_controller_key_key_pressed, self, 0);
	_tmp194_ = _g_object_ref0 ((GtkEventController*) key_ctrl);
	gtk_widget_add_controller (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), _tmp194_);
	_tmp195_ = (GtkEventControllerScroll*) gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL | GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
	scroll_ctrl = _tmp195_;
	gtk_event_controller_set_propagation_phase ((GtkEventController*) scroll_ctrl, GTK_PHASE_CAPTURE);
	g_signal_connect_object (scroll_ctrl, "scroll", (GCallback) _dc_window_on_chat_scroll_gtk_event_controller_scroll_scroll, self, 0);
	_tmp196_ = self->priv->content_stack;
	_tmp197_ = _g_object_ref0 ((GtkEventController*) scroll_ctrl);
	gtk_widget_add_controller ((GtkWidget*) _tmp196_, _tmp197_);
	_g_object_unref0 (scroll_ctrl);
	_g_object_unref0 (key_ctrl);
	_g_object_unref0 (image_overlay);
	_g_object_unref0 (narrow_bp);
	_g_object_unref0 (breakpoint);
	_g_object_unref0 (content_title_box);
	_g_object_unref0 (content_box);
	_g_object_unref0 (chat_scroll);
	_g_object_unref0 (search_keys);
	_g_object_unref0 (avatar_overlay);
	block3_data_unref (_data3_);
	_data3_ = NULL;
}

static void
_dc_window_on_account_menu_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                     GtkListBoxRow* row,
                                                                     gpointer self)
{
	dc_window_on_account_menu_row_activated ((DcWindow*) self, row);
}

static GtkPopover*
dc_window_build_account_popover (DcWindow* self)
{
	GtkPopover* popover = NULL;
	GtkPopover* _tmp0_;
	GtkBox* box = NULL;
	GtkBox* _tmp1_;
	GtkLabel* title = NULL;
	GtkLabel* _tmp2_;
	GtkListBox* _tmp3_;
	GtkListBox* _tmp4_;
	GtkListBox* _tmp5_;
	GtkListBox* _tmp6_;
	GtkListBox* _tmp7_;
	GtkPopover* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp0_);
	popover = _tmp0_;
	gtk_popover_set_has_arrow (popover, TRUE);
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp1_);
	box = _tmp1_;
	gtk_widget_set_margin_start ((GtkWidget*) box, 10);
	gtk_widget_set_margin_end ((GtkWidget*) box, 10);
	gtk_widget_set_margin_top ((GtkWidget*) box, 10);
	gtk_widget_set_margin_bottom ((GtkWidget*) box, 10);
	g_object_set ((GtkWidget*) box, "width-request", 300, NULL);
	_tmp2_ = (GtkLabel*) gtk_label_new ("Profiles");
	g_object_ref_sink (_tmp2_);
	title = _tmp2_;
	gtk_widget_add_css_class ((GtkWidget*) title, "heading");
	gtk_widget_set_halign ((GtkWidget*) title, GTK_ALIGN_START);
	gtk_label_set_xalign (title, (gfloat) 0);
	gtk_box_append (box, (GtkWidget*) title);
	_tmp3_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->account_menu_list);
	self->priv->account_menu_list = _tmp3_;
	_tmp4_ = self->priv->account_menu_list;
	gtk_list_box_set_selection_mode (_tmp4_, GTK_SELECTION_NONE);
	_tmp5_ = self->priv->account_menu_list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "boxed-list");
	_tmp6_ = self->priv->account_menu_list;
	g_signal_connect_object (_tmp6_, "row-activated", (GCallback) _dc_window_on_account_menu_row_activated_gtk_list_box_row_activated, self, 0);
	_tmp7_ = self->priv->account_menu_list;
	gtk_box_append (box, (GtkWidget*) _tmp7_);
	gtk_popover_set_child (popover, (GtkWidget*) box);
	result = popover;
	_g_object_unref0 (title);
	_g_object_unref0 (box);
	return result;
}

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

static void
dc_window_try_connect (DcWindow* self,
                       GAsyncReadyCallback _callback_,
                       gpointer _user_data_)
{
	DcWindowTryConnectData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowTryConnectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_try_connect_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_try_connect_co (_data_);
}

static void
dc_window_try_connect_finish (DcWindow* self,
                              GAsyncResult* _res_)
{
	DcWindowTryConnectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_try_connect_ready (GObject* source_object,
                             GAsyncResult* _res_,
                             gpointer _user_data_)
{
	DcWindowTryConnectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_try_connect_co (_data_);
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
__lambda353_ (DcWindow* self,
              const gchar* reason)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (reason != NULL);
	_tmp0_ = g_strconcat ("Disconnected — ", reason, NULL);
	_tmp1_ = _tmp0_;
	dc_window_set_connection_status (self, FALSE, _tmp1_);
	_g_free0 (_tmp1_);
}

static void
___lambda353__dc_rpc_client_disconnected (DcRpcClient* _sender,
                                          const gchar* reason,
                                          gpointer self)
{
	__lambda353_ ((DcWindow*) self, reason);
}

static void
__lambda361_ (DcWindow* self)
{
	dc_window_load_chats (self, NULL, NULL);
}

static void
___lambda361__dc_event_handler_chats_reload_fired (DcEventHandler* _sender,
                                                   gpointer self)
{
	__lambda361_ ((DcWindow*) self);
}

static void
__lambda362_ (DcWindow* self)
{
	DcConversationView* v = NULL;
	DcConversationView* _tmp0_;
	DcConversationView* _tmp1_;
	_tmp0_ = dc_window_current_view (self);
	v = _tmp0_;
	_tmp1_ = v;
	if (_tmp1_ != NULL) {
		DcConversationView* _tmp2_;
		_tmp2_ = v;
		dc_conversation_view_reload_messages (_tmp2_, NULL, NULL);
	}
	_g_object_unref0 (v);
}

static void
___lambda362__dc_event_handler_messages_reload_fired (DcEventHandler* _sender,
                                                      gpointer self)
{
	__lambda362_ ((DcWindow*) self);
}

static void
__lambda363_ (DcWindow* self,
              gint acct_id,
              gint chat_id,
              gint msg_id)
{
	dc_window_on_incoming_msg (self, acct_id, chat_id, msg_id, NULL, NULL);
}

static void
___lambda363__dc_event_handler_incoming_msg_received (DcEventHandler* _sender,
                                                      gint acct_id,
                                                      gint chat_id,
                                                      gint msg_id,
                                                      gpointer self)
{
	__lambda363_ ((DcWindow*) self, acct_id, chat_id, msg_id);
}

static void
__lambda365_ (DcWindow* self,
              gint acct_id,
              gint chat_id,
              gint msg_id,
              gint contact_id,
              const gchar* reaction)
{
	g_return_if_fail (reaction != NULL);
	dc_window_queue_chat_notification (self, acct_id, chat_id, msg_id, contact_id, reaction);
}

static void
___lambda365__dc_event_handler_incoming_reaction_received (DcEventHandler* _sender,
                                                           gint acct_id,
                                                           gint chat_id,
                                                           gint msg_id,
                                                           gint contact_id,
                                                           const gchar* reaction,
                                                           gpointer self)
{
	__lambda365_ ((DcWindow*) self, acct_id, chat_id, msg_id, contact_id, reaction);
}

static void
__lambda366_ (DcWindow* self,
              gint acct_id,
              gint chat_id)
{
	dc_window_on_chat_messages_changed (self, acct_id, chat_id);
}

static void
___lambda366__dc_event_handler_chat_messages_changed (DcEventHandler* _sender,
                                                      gint acct_id,
                                                      gint chat_id,
                                                      gpointer self)
{
	__lambda366_ ((DcWindow*) self, acct_id, chat_id);
}

static void
__lambda367_ (DcWindow* self,
              gint acct_id)
{
	dc_window_update_unread_indicators (self, NULL, NULL);
}

static void
___lambda367__dc_event_handler_account_unread_changed (DcEventHandler* _sender,
                                                       gint acct_id,
                                                       gpointer self)
{
	__lambda367_ ((DcWindow*) self, acct_id);
}

static void
__lambda368_ (DcWindow* self,
              gint acct_id)
{
	dc_window_invalidate_all_mention_rosters (self);
	dc_window_refresh_self_mention_keys (self, NULL, NULL);
}

static void
___lambda368__dc_event_handler_contacts_changed (DcEventHandler* _sender,
                                                 gint acct_id,
                                                 gpointer self)
{
	__lambda368_ ((DcWindow*) self, acct_id);
}

static gboolean
dc_window_try_connect_co (DcWindowTryConnectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		case 7:
		goto _state_7;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gtk_window_get_application ((GtkWindow*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = dc_application_get_rpc (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, DC_TYPE_APPLICATION, DcApplication));
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->self->priv->rpc = _data_->_tmp3_;
	dc_window_show_empty_status (_data_->self, "parla-welcome", "Welcome to Parla", "Select a chat to start messaging", NULL);
	_data_->_tmp4_ = _data_->self->settings;
	_data_->_tmp5_ = dc_settings_manager_effective_rpc_server_path (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = _data_->self->settings;
	_data_->_tmp8_ = dc_account_finder_find_rpc_server (_data_->_tmp6_, dc_settings_manager_effective_rpc_server_source (_data_->_tmp7_));
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_free0 (_data_->_tmp6_);
	_data_->rpc_path = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->rpc_path;
	if (_data_->_tmp10_ == NULL) {
		dc_window_set_connection_status (_data_->self, FALSE, "RPC server not found");
		dc_window_show_rpc_not_found (_data_->self);
		_g_free0 (_data_->rpc_path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = dc_account_finder_get_data_dir ();
	_data_->data_dir = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->self->settings;
	_data_->_tmp13_ = dc_settings_manager_effective_accounts_path (_data_->_tmp12_);
	_data_->accounts_path = _data_->_tmp13_;
	{
		_data_->_tmp14_ = _data_->self->priv->rpc;
		_data_->_tmp15_ = _data_->rpc_path;
		_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
		_data_->_tmp17_ = g_new0 (gchar*, 1 + 1);
		_data_->_tmp17_[0] = _data_->_tmp16_;
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp18__length1 = 1;
		_data_->_tmp19_ = _data_->data_dir;
		_data_->_tmp20_ = _data_->accounts_path;
		_data_->_state_ = 1;
		dc_rpc_client_start (_data_->_tmp14_, _data_->_tmp18_, (gint) 1, _data_->_tmp19_, _data_->_tmp20_, dc_window_try_connect_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_start_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp18_ = (_vala_array_free (_data_->_tmp18_, _data_->_tmp18__length1, (GDestroyNotify) g_free), NULL);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp21_ = _data_->e;
		_data_->_tmp22_ = _data_->_tmp21_->message;
		_data_->_tmp23_ = g_strdup (_data_->_tmp22_);
		_data_->msg = _data_->_tmp23_;
		_data_->_tmp25_ = _data_->msg;
		_data_->_tmp26_ = g_utf8_strdown (_data_->_tmp25_, (gssize) -1);
		_data_->_tmp27_ = _data_->_tmp26_;
		_data_->_tmp28_ = string_contains (_data_->_tmp27_, "already running");
		_g_free0 (_data_->_tmp27_);
		if (_data_->_tmp28_) {
			_data_->_tmp24_ = TRUE;
		} else {
			_data_->_tmp29_ = _data_->msg;
			_data_->_tmp30_ = g_utf8_strdown (_data_->_tmp29_, (gssize) -1);
			_data_->_tmp31_ = _data_->_tmp30_;
			_data_->_tmp24_ = string_contains (_data_->_tmp31_, "accounts.lock");
			_g_free0 (_data_->_tmp31_);
		}
		if (_data_->_tmp24_) {
			dc_window_show_toast (_data_->self, "Cannot connect - account store is already in use");
			_data_->_tmp32_ = _data_->self->priv->empty_status;
			adw_status_page_set_description (_data_->_tmp32_, "The Delta Chat account store is already in use.\n\n" "Close the other Delta Chat or Parla process, then restart this app.");
			dc_window_set_connection_status (_data_->self, FALSE, "Account store is already in use");
		} else {
			_data_->_tmp33_ = _data_->msg;
			_data_->_tmp34_ = g_strconcat ("RPC server error: ", _data_->_tmp33_, NULL);
			_data_->_tmp35_ = _data_->_tmp34_;
			dc_window_show_toast (_data_->self, _data_->_tmp35_);
			_g_free0 (_data_->_tmp35_);
			_data_->_tmp36_ = _data_->self->priv->empty_status;
			_data_->_tmp37_ = _data_->msg;
			_data_->_tmp38_ = g_markup_escape_text (_data_->_tmp37_, (gssize) -1);
			_data_->_tmp39_ = _data_->_tmp38_;
			_data_->_tmp40_ = g_strconcat ("Failed to start RPC server:\n\n", _data_->_tmp39_, NULL);
			_data_->_tmp41_ = _data_->_tmp40_;
			adw_status_page_set_description (_data_->_tmp36_, _data_->_tmp41_);
			_g_free0 (_data_->_tmp41_);
			_g_free0 (_data_->_tmp39_);
			dc_window_set_connection_status (_data_->self, FALSE, "Cannot reach RPC server");
		}
		_g_free0 (_data_->msg);
		_g_error_free0 (_data_->e);
		_g_free0 (_data_->accounts_path);
		_g_free0 (_data_->data_dir);
		_g_free0 (_data_->rpc_path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->accounts_path);
		_g_free0 (_data_->data_dir);
		_g_free0 (_data_->rpc_path);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	dc_window_set_connection_status (_data_->self, TRUE, NULL);
	_data_->_tmp42_ = _data_->self->priv->rpc;
	g_signal_connect_object (_data_->_tmp42_, "disconnected", (GCallback) ___lambda353__dc_rpc_client_disconnected, _data_->self, 0);
	_data_->_tmp44_ = _data_->self->settings;
	if (dc_settings_manager_rpc_auto_update_enabled (_data_->_tmp44_)) {
		_data_->_tmp45_ = _data_->rpc_path;
		_data_->_tmp46_ = dc_account_finder_get_managed_rpc_path ();
		_data_->_tmp47_ = _data_->_tmp46_;
		_data_->_tmp43_ = g_strcmp0 (_data_->_tmp45_, _data_->_tmp47_) == 0;
		_g_free0 (_data_->_tmp47_);
	} else {
		_data_->_tmp43_ = FALSE;
	}
	if (_data_->_tmp43_) {
		dc_window_check_managed_update (_data_->self, NULL, NULL);
	}
	_data_->_tmp48_ = _data_->self->priv->rpc;
	_data_->_tmp49_ = _data_->self->settings;
	_data_->_tmp50_ = dc_settings_manager_get_default_account_addr (_data_->_tmp49_);
	_data_->_tmp51_ = _data_->_tmp50_;
	_data_->_tmp52_ = NULL;
	_data_->_tmp53_ = NULL;
	_data_->_state_ = 2;
	dc_account_finder_ensure_configured (_data_->_tmp48_, _data_->_tmp51_, dc_window_try_connect_ready, _data_);
	return FALSE;
	_state_2:
	dc_account_finder_ensure_configured_finish (_data_->_res_, &_data_->_tmp52_, &_data_->_tmp53_);
	_g_free0 (_data_->acct_desc);
	_data_->acct_desc = _data_->_tmp52_;
	_g_free0 (_data_->acct_toast);
	_data_->acct_toast = _data_->_tmp53_;
	_data_->_tmp54_ = _data_->acct_toast;
	if (_data_->_tmp54_ != NULL) {
		_data_->_tmp55_ = _data_->acct_toast;
		dc_window_show_toast (_data_->self, _data_->_tmp55_);
	}
	_data_->_tmp56_ = _data_->acct_desc;
	if (_data_->_tmp56_ != NULL) {
		_data_->_tmp57_ = _data_->self->priv->empty_status;
		_data_->_tmp58_ = _data_->acct_desc;
		adw_status_page_set_description (_data_->_tmp57_, _data_->_tmp58_);
	}
	_data_->_tmp59_ = _data_->self->priv->rpc;
	_data_->_tmp60_ = dc_rpc_client_get_account_id (_data_->_tmp59_);
	_data_->_tmp61_ = _data_->_tmp60_;
	if (_data_->_tmp61_ > 0) {
		{
			_data_->_state_ = 3;
			dc_window_apply_auto_download_limit (_data_->self, dc_window_try_connect_ready, _data_);
			return FALSE;
			_state_3:
			dc_window_apply_auto_download_limit_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
			_data_->_tmp62_ = _data_->self->priv->rpc;
			_data_->_state_ = 4;
			dc_rpc_client_start_io_for_all_accounts (_data_->_tmp62_, dc_window_try_connect_ready, _data_);
			return FALSE;
			_state_4:
			dc_rpc_client_start_io_for_all_accounts_finish (_data_->_tmp62_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
		}
		goto __finally1;
		__catch1_g_error:
		{
			_data_->_vala1_e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp63_ = _data_->_vala1_e;
			_data_->_tmp64_ = _data_->_tmp63_->message;
			_data_->_tmp65_ = g_strconcat ("Connection setup error: ", _data_->_tmp64_, NULL);
			_data_->_tmp66_ = _data_->_tmp65_;
			dc_window_show_toast (_data_->self, _data_->_tmp66_);
			_g_free0 (_data_->_tmp66_);
			_g_error_free0 (_data_->_vala1_e);
		}
		__finally1:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->acct_toast);
			_g_free0 (_data_->acct_desc);
			_g_free0 (_data_->accounts_path);
			_g_free0 (_data_->data_dir);
			_g_free0 (_data_->rpc_path);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		dc_window_refresh_tracking_filter (_data_->self, FALSE, NULL, NULL);
	}
	_data_->_tmp67_ = _data_->self->priv->rpc;
	_data_->_tmp68_ = dc_event_handler_new (_data_->_tmp67_);
	_g_object_unref0 (_data_->self->priv->events);
	_data_->self->priv->events = _data_->_tmp68_;
	_data_->_tmp69_ = _data_->self->priv->rpc;
	_data_->_tmp70_ = _data_->self->settings;
	dc_webxdc_setup (_data_->_tmp69_, _data_->_tmp70_);
	_data_->_tmp71_ = _data_->self->priv->events;
	_data_->_tmp72_ = gtk_window_get_application ((GtkWindow*) _data_->self);
	_data_->_tmp73_ = _data_->_tmp72_;
	dc_event_handler_set_app (_data_->_tmp71_, (GApplication*) _data_->_tmp73_);
	_data_->_tmp74_ = _data_->self->priv->events;
	g_signal_connect_object (_data_->_tmp74_, "chats-reload-fired", (GCallback) ___lambda361__dc_event_handler_chats_reload_fired, _data_->self, 0);
	_data_->_tmp75_ = _data_->self->priv->events;
	g_signal_connect_object (_data_->_tmp75_, "messages-reload-fired", (GCallback) ___lambda362__dc_event_handler_messages_reload_fired, _data_->self, 0);
	_data_->_tmp76_ = _data_->self->priv->events;
	g_signal_connect_object (_data_->_tmp76_, "incoming-msg-received", (GCallback) ___lambda363__dc_event_handler_incoming_msg_received, _data_->self, 0);
	_data_->_tmp77_ = _data_->self->priv->events;
	g_signal_connect_object (_data_->_tmp77_, "incoming-reaction-received", (GCallback) ___lambda365__dc_event_handler_incoming_reaction_received, _data_->self, 0);
	_data_->_tmp78_ = _data_->self->priv->events;
	g_signal_connect_object (_data_->_tmp78_, "chat-messages-changed", (GCallback) ___lambda366__dc_event_handler_chat_messages_changed, _data_->self, 0);
	_data_->_tmp79_ = _data_->self->priv->events;
	g_signal_connect_object (_data_->_tmp79_, "account-unread-changed", (GCallback) ___lambda367__dc_event_handler_account_unread_changed, _data_->self, 0);
	_data_->_tmp80_ = _data_->self->priv->events;
	g_signal_connect_object (_data_->_tmp80_, "contacts-changed", (GCallback) ___lambda368__dc_event_handler_contacts_changed, _data_->self, 0);
	_data_->_tmp81_ = _data_->self->priv->rpc;
	_data_->_tmp82_ = _data_->self->priv->_chat_store;
	_data_->_tmp83_ = dc_chat_context_menu_new (_data_->self, _data_->_tmp81_, _data_->_tmp82_);
	_g_object_unref0 (_data_->self->priv->chat_menu);
	_data_->self->priv->chat_menu = _data_->_tmp83_;
	_data_->_tmp84_ = _data_->self->priv->rpc;
	_data_->_tmp85_ = dc_rpc_client_get_account_id (_data_->_tmp84_);
	_data_->_tmp86_ = _data_->_tmp85_;
	if (_data_->_tmp86_ > 0) {
		_data_->_state_ = 5;
		dc_window_load_self_identity (_data_->self, dc_window_try_connect_ready, _data_);
		return FALSE;
		_state_5:
		dc_window_load_self_identity_finish (_data_->self, _data_->_res_);
		_data_->_state_ = 6;
		dc_window_load_chats (_data_->self, dc_window_try_connect_ready, _data_);
		return FALSE;
		_state_6:
		dc_window_load_chats_finish (_data_->self, _data_->_res_);
		_data_->_state_ = 7;
		dc_window_load_profile_avatar (_data_->self, dc_window_try_connect_ready, _data_);
		return FALSE;
		_state_7:
		dc_window_load_profile_avatar_finish (_data_->self, _data_->_res_);
		_data_->_tmp87_ = _data_->self->priv->events;
		dc_event_handler_start (_data_->_tmp87_, NULL, NULL);
		_data_->_tmp88_ = _data_->self->priv->events;
		dc_event_handler_reconcile_desktop_notifications (_data_->_tmp88_, NULL, NULL);
		_data_->_tmp89_ = _data_->self->priv->pending_invite_uri;
		if (_data_->_tmp89_ != NULL) {
			_data_->_tmp90_ = _data_->self->priv->pending_invite_uri;
			_data_->_tmp91_ = g_strdup (_data_->_tmp90_);
			_data_->uri = _data_->_tmp91_;
			_g_free0 (_data_->self->priv->pending_invite_uri);
			_data_->self->priv->pending_invite_uri = NULL;
			_data_->_tmp92_ = _data_->uri;
			dc_window_show_use_invite_link_dialog (_data_->self, _data_->_tmp92_);
			_g_free0 (_data_->uri);
		}
	}
	_g_free0 (_data_->acct_toast);
	_g_free0 (_data_->acct_desc);
	_g_free0 (_data_->accounts_path);
	_g_free0 (_data_->data_dir);
	_g_free0 (_data_->rpc_path);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_clear_self_identity (DcWindow* self)
{
	DcRpcClient* _tmp0_;
	gchar** _tmp1_;
	GHashTable* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->rpc;
	dc_rpc_client_set_self_email (_tmp0_, NULL);
	_g_free0 (dc_message_row_self_display_name);
	dc_message_row_self_display_name = NULL;
	_g_free0 (dc_message_row_self_avatar_path);
	dc_message_row_self_avatar_path = NULL;
	_tmp1_ = g_new0 (gchar*, 0 + 1);
	self->priv->self_mention_keys_cache = (_vala_array_free (self->priv->self_mention_keys_cache, self->priv->self_mention_keys_cache_length1, (GDestroyNotify) g_free), NULL);
	self->priv->self_mention_keys_cache = _tmp1_;
	self->priv->self_mention_keys_cache_length1 = 0;
	self->priv->_self_mention_keys_cache_size_ = self->priv->self_mention_keys_cache_length1;
	_tmp2_ = self->priv->mentioned_chats;
	g_hash_table_remove_all (_tmp2_);
}

static gchar**
_vala_array_dup1 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

gchar**
dc_window_self_mention_keys (DcWindow* self,
                             gint* result_length1)
{
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->self_mention_keys_cache;
	_tmp0__length1 = self->priv->self_mention_keys_cache_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup1 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

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

static void
dc_window_refresh_self_mention_keys (DcWindow* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcWindowRefreshSelfMentionKeysData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowRefreshSelfMentionKeysData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_refresh_self_mention_keys_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_refresh_self_mention_keys_co (_data_);
}

static void
dc_window_refresh_self_mention_keys_finish (DcWindow* self,
                                            GAsyncResult* _res_)
{
	DcWindowRefreshSelfMentionKeysData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
dc_window_refresh_self_mention_keys_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcWindowRefreshSelfMentionKeysData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_refresh_self_mention_keys_co (_data_);
}

static gpointer
_json_array_ref0 (gpointer self)
{
	return self ? json_array_ref (self) : NULL;
}

static gpointer
_json_object_ref0 (gpointer self)
{
	return self ? json_object_ref (self) : NULL;
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static gint
vala_g_ptr_array_get_length (GPtrArray* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) self->len;
	return result;
}

static void
_vala_array_add3 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar**
_vala_array_dup2 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static gboolean
dc_window_refresh_self_mention_keys_co (DcWindowRefreshSelfMentionKeysData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	_data_->keys = _data_->_tmp0_;
	_data_->_tmp2_ = dc_message_row_self_display_name;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = dc_message_row_self_display_name;
		_data_->_tmp4_ = string_strip (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = strlen (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp1_ = _data_->_tmp7_ > 0;
		_g_free0 (_data_->_tmp5_);
	} else {
		_data_->_tmp1_ = FALSE;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp8_ = _data_->keys;
		_data_->_tmp9_ = dc_message_row_self_display_name;
		_data_->_tmp10_ = string_strip (_data_->_tmp9_);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_tmp12_ = g_utf8_strdown (_data_->_tmp11_, (gssize) -1);
		g_ptr_array_add (_data_->_tmp8_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp11_);
	}
	_data_->_tmp14_ = _data_->self->priv->rpc;
	_data_->_tmp15_ = dc_rpc_client_get_self_email (_data_->_tmp14_);
	_data_->_tmp16_ = _data_->_tmp15_;
	if (_data_->_tmp16_ != NULL) {
		_data_->_tmp17_ = _data_->self->priv->rpc;
		_data_->_tmp18_ = dc_rpc_client_get_self_email (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = strlen (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp13_ = _data_->_tmp21_ > 0;
	} else {
		_data_->_tmp13_ = FALSE;
	}
	if (_data_->_tmp13_) {
		_data_->_tmp22_ = _data_->keys;
		_data_->_tmp23_ = _data_->self->priv->rpc;
		_data_->_tmp24_ = dc_rpc_client_get_self_email (_data_->_tmp23_);
		_data_->_tmp25_ = _data_->_tmp24_;
		_data_->_tmp26_ = g_utf8_strdown (_data_->_tmp25_, (gssize) -1);
		g_ptr_array_add (_data_->_tmp22_, _data_->_tmp26_);
	}
	{
		_data_->_tmp27_ = _data_->self->priv->rpc;
		_data_->_tmp28_ = _data_->self->priv->rpc;
		_data_->_tmp29_ = dc_rpc_client_get_account_id (_data_->_tmp28_);
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_state_ = 1;
		dc_rpc_client_list_transports (_data_->_tmp27_, _data_->_tmp30_, dc_window_refresh_self_mention_keys_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp31_ = dc_rpc_client_list_transports_finish (_data_->_tmp27_, _data_->_res_, &_data_->_inner_error0_);
		_data_->transports = _data_->_tmp31_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->transports != NULL) {
			_data_->_tmp32_ = json_node_get_node_type (_data_->transports) == JSON_NODE_ARRAY;
		} else {
			_data_->_tmp32_ = FALSE;
		}
		if (_data_->_tmp32_) {
			_data_->_tmp33_ = json_node_get_array (_data_->transports);
			_data_->_tmp34_ = _json_array_ref0 (_data_->_tmp33_);
			_data_->arr = _data_->_tmp34_;
			{
				_data_->i = (guint) 0;
				{
					_data_->_tmp35_ = TRUE;
					while (TRUE) {
						if (!_data_->_tmp35_) {
							_data_->_tmp36_ = _data_->i;
							_data_->i = _data_->_tmp36_ + 1;
						}
						_data_->_tmp35_ = FALSE;
						_data_->_tmp37_ = _data_->arr;
						if (!(_data_->i < json_array_get_length (_data_->_tmp37_))) {
							break;
						}
						_data_->_tmp38_ = _data_->arr;
						_data_->_tmp39_ = json_array_get_object_element (_data_->_tmp38_, _data_->i);
						_data_->_tmp40_ = _json_object_ref0 (_data_->_tmp39_);
						_data_->obj = _data_->_tmp40_;
						_data_->_tmp42_ = _data_->obj;
						if (_data_->_tmp42_ != NULL) {
							_data_->_tmp43_ = _data_->obj;
							_data_->_tmp44_ = dc_json_str (_data_->_tmp43_, "addr");
							_g_free0 (_data_->_tmp41_);
							_data_->_tmp41_ = _data_->_tmp44_;
						} else {
							_g_free0 (_data_->_tmp41_);
							_data_->_tmp41_ = NULL;
						}
						_data_->_tmp45_ = _data_->_tmp41_;
						_data_->_tmp41_ = NULL;
						_data_->addr = _data_->_tmp45_;
						_data_->_tmp47_ = _data_->addr;
						if (_data_->_tmp47_ != NULL) {
							_data_->_tmp48_ = _data_->addr;
							_data_->_tmp49_ = strlen (_data_->_tmp48_);
							_data_->_tmp50_ = _data_->_tmp49_;
							_data_->_tmp46_ = _data_->_tmp50_ > 0;
						} else {
							_data_->_tmp46_ = FALSE;
						}
						if (_data_->_tmp46_) {
							_data_->_tmp51_ = _data_->keys;
							_data_->_tmp52_ = _data_->addr;
							_data_->_tmp53_ = g_utf8_strdown (_data_->_tmp52_, (gssize) -1);
							g_ptr_array_add (_data_->_tmp51_, _data_->_tmp53_);
						}
						_g_free0 (_data_->addr);
						_g_free0 (_data_->_tmp41_);
						_json_object_unref0 (_data_->obj);
					}
				}
			}
			_json_array_unref0 (_data_->arr);
		}
		__vala_JsonNode_free0 (_data_->transports);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_ptr_array_unref0 (_data_->keys);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp54_ = g_new0 (gchar*, 0 + 1);
	_data_->_result_ = _data_->_tmp54_;
	_data_->_result__length1 = 0;
	_data_->__result__size_ = _data_->_result__length1;
	{
		_data_->_vala1_i = 0;
		{
			_data_->_tmp55_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp55_) {
					_data_->_tmp56_ = _data_->_vala1_i;
					_data_->_vala1_i = _data_->_tmp56_ + 1;
				}
				_data_->_tmp55_ = FALSE;
				_data_->_tmp57_ = _data_->keys;
				_data_->_tmp58_ = vala_g_ptr_array_get_length (_data_->_tmp57_);
				_data_->_tmp59_ = _data_->_tmp58_;
				if (!(_data_->_vala1_i < _data_->_tmp59_)) {
					break;
				}
				_data_->_tmp60_ = _data_->keys;
				_data_->_tmp61_ = g_ptr_array_index (_data_->_tmp60_, (guint) _data_->_vala1_i);
				_data_->_tmp62_ = g_strdup ((const gchar*) _data_->_tmp61_);
				_vala_array_add3 (&_data_->_result_, &_data_->_result__length1, &_data_->__result__size_, _data_->_tmp62_);
			}
		}
	}
	_data_->_tmp63_ = _data_->_result_;
	_data_->_tmp63__length1 = _data_->_result__length1;
	_data_->_tmp64_ = (_data_->_tmp63_ != NULL) ? _vala_array_dup2 (_data_->_tmp63_, _data_->_tmp63__length1) : _data_->_tmp63_;
	_data_->_tmp64__length1 = _data_->_tmp63__length1;
	_data_->self->priv->self_mention_keys_cache = (_vala_array_free (_data_->self->priv->self_mention_keys_cache, _data_->self->priv->self_mention_keys_cache_length1, (GDestroyNotify) g_free), NULL);
	_data_->self->priv->self_mention_keys_cache = _data_->_tmp64_;
	_data_->self->priv->self_mention_keys_cache_length1 = _data_->_tmp64__length1;
	_data_->self->priv->_self_mention_keys_cache_size_ = _data_->self->priv->self_mention_keys_cache_length1;
	_data_->_result_ = (_vala_array_free (_data_->_result_, _data_->_result__length1, (GDestroyNotify) g_free), NULL);
	_g_ptr_array_unref0 (_data_->keys);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_check_mention (DcWindow* self,
                         gint acct_id,
                         gint chat_id,
                         gint msg_id,
                         GAsyncReadyCallback _callback_,
                         gpointer _user_data_)
{
	DcWindowCheckMentionData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowCheckMentionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_check_mention_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_data_->chat_id = chat_id;
	_data_->msg_id = msg_id;
	dc_window_check_mention_co (_data_);
}

static void
dc_window_check_mention_finish (DcWindow* self,
                                GAsyncResult* _res_)
{
	DcWindowCheckMentionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gchar**
_vala_array_dup3 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
dc_window_check_mention_ready (GObject* source_object,
                               GAsyncResult* _res_,
                               gpointer _user_data_)
{
	DcWindowCheckMentionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_check_mention_co (_data_);
}

static gboolean
dc_window_check_mention_co (DcWindowCheckMentionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0__length1 = 0;
	_data_->__tmp0__size_ = 0;
	_data_->_tmp1_ = _data_->self->priv->rpc;
	_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (_data_->acct_id == _data_->_tmp3_) {
		_data_->_tmp4_ = _data_->self->priv->self_mention_keys_cache;
		_data_->_tmp4__length1 = _data_->self->priv->self_mention_keys_cache_length1;
		_data_->_tmp5_ = (_data_->_tmp4_ != NULL) ? _vala_array_dup3 (_data_->_tmp4_, _data_->_tmp4__length1) : _data_->_tmp4_;
		_data_->_tmp5__length1 = _data_->_tmp4__length1;
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = _data_->_tmp5_;
		_data_->_tmp0__length1 = _data_->_tmp5__length1;
		_data_->__tmp0__size_ = _data_->_tmp0__length1;
	} else {
		_data_->_tmp6_ = 0;
		_data_->_state_ = 1;
		dc_window_background_self_keys (_data_->self, _data_->acct_id, dc_window_check_mention_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp7_ = dc_window_background_self_keys_finish (_data_->self, _data_->_res_, &_data_->_tmp6_);
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = _data_->_tmp7_;
		_data_->_tmp0__length1 = _data_->_tmp6_;
		_data_->__tmp0__size_ = _data_->_tmp0__length1;
	}
	_data_->_tmp8_ = _data_->_tmp0_;
	_data_->_tmp8__length1 = _data_->_tmp0__length1;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0__length1 = 0;
	_data_->keys = _data_->_tmp8_;
	_data_->keys_length1 = _data_->_tmp8__length1;
	_data_->_keys_size_ = _data_->keys_length1;
	_data_->_tmp9_ = _data_->keys;
	_data_->_tmp9__length1 = _data_->keys_length1;
	if (_data_->_tmp9__length1 == 0) {
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->msg = NULL;
	{
		_data_->_tmp11_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_fetch_message_for (_data_->_tmp11_, _data_->acct_id, _data_->msg_id, NULL, dc_window_check_mention_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp12_ = dc_rpc_client_fetch_message_for_finish (_data_->_tmp11_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp10_ = _data_->_tmp12_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp13_ = _data_->_tmp10_;
		_data_->_tmp10_ = NULL;
		_g_object_unref0 (_data_->msg);
		_data_->msg = _data_->_tmp13_;
		_g_object_unref0 (_data_->_tmp10_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_g_object_unref0 (_data_->msg);
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->msg);
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp15_ = _data_->msg;
	if (_data_->_tmp15_ == NULL) {
		_data_->_tmp14_ = TRUE;
	} else {
		_data_->_tmp16_ = _data_->msg;
		_data_->_tmp17_ = dc_message_get_is_outgoing (_data_->_tmp16_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp14_ = _data_->_tmp18_;
	}
	if (_data_->_tmp14_) {
		_g_object_unref0 (_data_->msg);
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp19_ = _data_->msg;
	_data_->_tmp20_ = dc_message_get_text (_data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = _data_->keys;
	_data_->_tmp22__length1 = _data_->keys_length1;
	if (!dc_mentions_mentions_self (_data_->_tmp21_, _data_->_tmp22_, (gint) _data_->_tmp22__length1)) {
		_g_object_unref0 (_data_->msg);
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp25_ = _data_->self->priv->rpc;
	_data_->_tmp26_ = dc_rpc_client_get_account_id (_data_->_tmp25_);
	_data_->_tmp27_ = _data_->_tmp26_;
	if (_data_->acct_id == _data_->_tmp27_) {
		_data_->_tmp28_ = dc_window_get_current_chat_id (_data_->self);
		_data_->_tmp29_ = _data_->_tmp28_;
		_data_->_tmp24_ = _data_->chat_id == _data_->_tmp29_;
	} else {
		_data_->_tmp24_ = FALSE;
	}
	if (_data_->_tmp24_) {
		g_object_get ((GtkWindow*) _data_->self, "is-active", &_data_->_tmp30_, NULL);
		_data_->_tmp31_ = _data_->_tmp30_;
		_data_->_tmp23_ = _data_->_tmp31_;
	} else {
		_data_->_tmp23_ = FALSE;
	}
	_data_->looking = _data_->_tmp23_;
	if (_data_->looking) {
		_g_object_unref0 (_data_->msg);
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp33_ = _data_->self->priv->rpc;
	_data_->_tmp34_ = dc_rpc_client_get_account_id (_data_->_tmp33_);
	_data_->_tmp35_ = _data_->_tmp34_;
	if (_data_->acct_id == _data_->_tmp35_) {
		_data_->_tmp36_ = _data_->self->priv->mentioned_chats;
		_data_->_tmp32_ = !g_hash_table_contains (_data_->_tmp36_, (gpointer) ((gintptr) _data_->chat_id));
	} else {
		_data_->_tmp32_ = FALSE;
	}
	if (_data_->_tmp32_) {
		_data_->_tmp37_ = _data_->self->priv->mentioned_chats;
		g_hash_table_add (_data_->_tmp37_, (gpointer) ((gintptr) _data_->chat_id));
		dc_window_request_reload_chats (_data_->self);
	}
	_data_->_tmp39_ = _data_->self->priv->events;
	if (_data_->_tmp39_ != NULL) {
		_data_->_tmp40_ = _data_->self->settings;
		_data_->_tmp41_ = dc_settings_manager_get_notifications_enabled (_data_->_tmp40_);
		_data_->_tmp42_ = _data_->_tmp41_;
		_data_->_tmp38_ = _data_->_tmp42_;
	} else {
		_data_->_tmp38_ = FALSE;
	}
	if (_data_->_tmp38_) {
		_data_->_tmp44_ = _data_->msg;
		_data_->_tmp45_ = dc_message_get_sender_name (_data_->_tmp44_);
		_data_->_tmp46_ = _data_->_tmp45_;
		_data_->_tmp43_ = _data_->_tmp46_;
		if (_data_->_tmp43_ == NULL) {
			_data_->_tmp48_ = _data_->msg;
			_data_->_tmp49_ = dc_message_get_sender_address (_data_->_tmp48_);
			_data_->_tmp50_ = _data_->_tmp49_;
			_data_->_tmp47_ = _data_->_tmp50_;
			if (_data_->_tmp47_ == NULL) {
				_data_->_tmp47_ = "New mention";
			}
			_data_->_tmp43_ = _data_->_tmp47_;
		}
		_data_->_tmp51_ = g_strdup (_data_->_tmp43_);
		_data_->title = _data_->_tmp51_;
		_data_->_tmp54_ = _data_->msg;
		_data_->_tmp55_ = dc_message_get_text (_data_->_tmp54_);
		_data_->_tmp56_ = _data_->_tmp55_;
		if (_data_->_tmp56_ != NULL) {
			_data_->_tmp57_ = _data_->msg;
			_data_->_tmp58_ = dc_message_get_text (_data_->_tmp57_);
			_data_->_tmp59_ = _data_->_tmp58_;
			_data_->_tmp60_ = strlen (_data_->_tmp59_);
			_data_->_tmp61_ = _data_->_tmp60_;
			_data_->_tmp53_ = _data_->_tmp61_ > 0;
		} else {
			_data_->_tmp53_ = FALSE;
		}
		if (_data_->_tmp53_) {
			_data_->_tmp62_ = _data_->msg;
			_data_->_tmp63_ = dc_message_get_text (_data_->_tmp62_);
			_data_->_tmp64_ = _data_->_tmp63_;
			_data_->_tmp52_ = _data_->_tmp64_;
		} else {
			_data_->_tmp52_ = "Mentioned you";
		}
		_data_->_tmp65_ = g_strdup (_data_->_tmp52_);
		_data_->body = _data_->_tmp65_;
		_data_->_tmp66_ = _data_->self->priv->events;
		_data_->_tmp67_ = _data_->title;
		_data_->_tmp68_ = g_strconcat ("@ ", _data_->_tmp67_, NULL);
		_data_->_tmp69_ = _data_->_tmp68_;
		_data_->_tmp70_ = _data_->body;
		dc_event_handler_send_mention_notification (_data_->_tmp66_, _data_->acct_id, _data_->chat_id, _data_->_tmp69_, _data_->_tmp70_);
		_g_free0 (_data_->_tmp69_);
		_g_free0 (_data_->body);
		_g_free0 (_data_->title);
	}
	_g_object_unref0 (_data_->msg);
	_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
	_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_background_self_keys_data_free (gpointer _data)
{
	DcWindowBackgroundSelfKeysData* _data_;
	_data_ = _data;
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowBackgroundSelfKeysData, _data_);
}

static void
dc_window_background_self_keys (DcWindow* self,
                                gint acct_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcWindowBackgroundSelfKeysData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowBackgroundSelfKeysData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_background_self_keys_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	dc_window_background_self_keys_co (_data_);
}

static gchar**
dc_window_background_self_keys_finish (DcWindow* self,
                                       GAsyncResult* _res_,
                                       gint* result_length1)
{
	gchar** result;
	DcWindowBackgroundSelfKeysData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}

static void
dc_window_background_self_keys_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcWindowBackgroundSelfKeysData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_background_self_keys_co (_data_);
}

static void
_vala_array_add4 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add5 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gboolean
dc_window_background_self_keys_co (DcWindowBackgroundSelfKeysData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_new0 (gchar*, 0 + 1);
	_data_->keys = _data_->_tmp0_;
	_data_->keys_length1 = 0;
	_data_->_keys_size_ = _data_->keys_length1;
	{
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_config (_data_->_tmp1_, "displayname", _data_->acct_id, dc_window_background_self_keys_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = dc_rpc_client_get_config_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->dn = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->dn != NULL) {
			_data_->_tmp4_ = string_strip (_data_->dn);
			_data_->_tmp5_ = _data_->_tmp4_;
			_data_->_tmp6_ = strlen (_data_->_tmp5_);
			_data_->_tmp7_ = _data_->_tmp6_;
			_data_->_tmp3_ = _data_->_tmp7_ > 0;
			_g_free0 (_data_->_tmp5_);
		} else {
			_data_->_tmp3_ = FALSE;
		}
		if (_data_->_tmp3_) {
			_data_->_tmp8_ = string_strip (_data_->dn);
			_data_->_tmp9_ = _data_->_tmp8_;
			_data_->_tmp10_ = g_utf8_strdown (_data_->_tmp9_, (gssize) -1);
			_vala_array_add4 (&_data_->keys, &_data_->keys_length1, &_data_->_keys_size_, _data_->_tmp10_);
			_g_free0 (_data_->_tmp9_);
		}
		_g_free0 (_data_->dn);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp11_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_get_config (_data_->_tmp11_, "addr", _data_->acct_id, dc_window_background_self_keys_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp12_ = dc_rpc_client_get_config_finish (_data_->_tmp11_, _data_->_res_, &_data_->_inner_error0_);
		_data_->addr = _data_->_tmp12_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		if (_data_->addr != NULL) {
			_data_->_tmp14_ = strlen (_data_->addr);
			_data_->_tmp15_ = _data_->_tmp14_;
			_data_->_tmp13_ = _data_->_tmp15_ > 0;
		} else {
			_data_->_tmp13_ = FALSE;
		}
		if (_data_->_tmp13_) {
			_data_->_tmp16_ = g_utf8_strdown (_data_->addr, (gssize) -1);
			_vala_array_add5 (&_data_->keys, &_data_->keys_length1, &_data_->_keys_size_, _data_->_tmp16_);
		}
		_g_free0 (_data_->addr);
	}
	goto __finally1;
	__catch1_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_data_->keys = (_vala_array_free (_data_->keys, _data_->keys_length1, (GDestroyNotify) g_free), NULL);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp17_ = _data_->keys;
	_data_->_tmp17__length1 = _data_->keys_length1;
	_data_->result_length1 = _data_->_tmp17__length1;
	_data_->result = _data_->_tmp17_;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
dc_window_invalidate_all_mention_rosters (DcWindow* self)
{
	GHashTableIter iter = {0};
	GHashTable* _tmp0_;
	gint key = 0;
	DcConversationView* v = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views;
	g_hash_table_iter_init (&iter, _tmp0_);
	while (TRUE) {
		gconstpointer _tmp1_ = NULL;
		gconstpointer _tmp2_ = NULL;
		gboolean _tmp3_;
		DcConversationView* _tmp4_;
		DcConversationView* _tmp5_;
		_tmp3_ = g_hash_table_iter_next (&iter, (gpointer*) (&_tmp1_), (gpointer*) (&_tmp2_));
		key = (gint) ((gintptr) _tmp1_);
		_g_object_unref0 (v);
		_tmp4_ = _g_object_ref0 ((DcConversationView*) _tmp2_);
		v = _tmp4_;
		if (!_tmp3_) {
			break;
		}
		_tmp5_ = v;
		dc_conversation_view_invalidate_mention_roster (_tmp5_);
	}
	_g_object_unref0 (v);
}

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

void
dc_window_open_mention (DcWindow* self,
                        const gchar* uri)
{
	gchar* spec = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	if (!g_str_has_prefix (uri, "parla-mention:")) {
		return;
	}
	_tmp0_ = strlen ("parla-mention:");
	_tmp1_ = _tmp0_;
	_tmp2_ = string_substring (uri, (glong) _tmp1_, (glong) -1);
	spec = _tmp2_;
	_tmp3_ = spec;
	if (g_str_has_prefix (_tmp3_, "cid=")) {
		gint cid = 0;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gint _tmp7_;
		_tmp4_ = spec;
		_tmp5_ = string_substring (_tmp4_, (glong) 4, (glong) -1);
		_tmp6_ = _tmp5_;
		_tmp7_ = atoi (_tmp6_);
		_g_free0 (_tmp6_);
		cid = _tmp7_;
		if (cid > 0) {
			dc_window_open_mention_contact (self, cid, NULL, NULL);
		}
	} else {
		const gchar* _tmp8_;
		_tmp8_ = spec;
		if (g_str_has_prefix (_tmp8_, "addr=")) {
			gchar* _tmp9_ = NULL;
			const gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* addr = NULL;
			gchar* _tmp17_;
			const gchar* _tmp18_;
			_tmp10_ = spec;
			_tmp11_ = string_substring (_tmp10_, (glong) 5, (glong) -1);
			_tmp12_ = _tmp11_;
			_tmp13_ = g_uri_unescape_string (_tmp12_, NULL);
			_tmp14_ = _tmp13_;
			_g_free0 (_tmp12_);
			_tmp9_ = _tmp14_;
			if (_tmp9_ == NULL) {
				const gchar* _tmp15_;
				gchar* _tmp16_;
				_tmp15_ = spec;
				_tmp16_ = string_substring (_tmp15_, (glong) 5, (glong) -1);
				_g_free0 (_tmp9_);
				_tmp9_ = _tmp16_;
			}
			_tmp17_ = _tmp9_;
			_tmp9_ = NULL;
			addr = _tmp17_;
			_tmp18_ = addr;
			dc_window_open_mention_address (self, _tmp18_, NULL, NULL);
			_g_free0 (addr);
			_g_free0 (_tmp9_);
		}
	}
	_g_free0 (spec);
}

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

static void
dc_window_open_mention_contact (DcWindow* self,
                                gint contact_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcWindowOpenMentionContactData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowOpenMentionContactData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_open_mention_contact_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->contact_id = contact_id;
	dc_window_open_mention_contact_co (_data_);
}

static void
dc_window_open_mention_contact_finish (DcWindow* self,
                                       GAsyncResult* _res_)
{
	DcWindowOpenMentionContactData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_open_mention_contact_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcWindowOpenMentionContactData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_open_mention_contact_co (_data_);
}

static gboolean
dc_window_open_mention_contact_co (DcWindowOpenMentionContactData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_or_create_chat_by_contact (_data_->_tmp0_, _data_->contact_id, dc_window_open_mention_contact_ready, _data_);
		return FALSE;
		_state_1:
		_data_->chat_id = dc_rpc_client_get_or_create_chat_by_contact_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->chat_id <= 0) {
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_state_ = 2;
		dc_window_load_chats (_data_->self, dc_window_open_mention_contact_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_load_chats_finish (_data_->self, _data_->_res_);
		dc_window_select_chat_by_id (_data_->self, _data_->chat_id);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp1_ = _data_->e;
		_data_->_tmp2_ = _data_->_tmp1_->message;
		_data_->_tmp3_ = g_strconcat ("Could not open chat: ", _data_->_tmp2_, NULL);
		_data_->_tmp4_ = _data_->_tmp3_;
		dc_window_show_toast (_data_->self, _data_->_tmp4_);
		_g_free0 (_data_->_tmp4_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_open_mention_address_data_free (gpointer _data)
{
	DcWindowOpenMentionAddressData* _data_;
	_data_ = _data;
	_g_free0 (_data_->address);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowOpenMentionAddressData, _data_);
}

static void
dc_window_open_mention_address (DcWindow* self,
                                const gchar* address,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcWindowOpenMentionAddressData* _data_;
	DcWindow* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (address != NULL);
	_data_ = g_slice_new0 (DcWindowOpenMentionAddressData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_open_mention_address_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (address);
	_g_free0 (_data_->address);
	_data_->address = _tmp1_;
	dc_window_open_mention_address_co (_data_);
}

static void
dc_window_open_mention_address_finish (DcWindow* self,
                                       GAsyncResult* _res_)
{
	DcWindowOpenMentionAddressData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_open_mention_address_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcWindowOpenMentionAddressData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_open_mention_address_co (_data_);
}

static gboolean
dc_window_open_mention_address_co (DcWindowOpenMentionAddressData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_or_create_contact (_data_->_tmp0_, _data_->address, dc_window_open_mention_address_ready, _data_);
		return FALSE;
		_state_1:
		_data_->contact_id = dc_rpc_client_get_or_create_contact_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->contact_id <= 0) {
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_state_ = 2;
		dc_window_open_mention_contact (_data_->self, _data_->contact_id, dc_window_open_mention_address_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_open_mention_contact_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp1_ = _data_->e;
		_data_->_tmp2_ = _data_->_tmp1_->message;
		_data_->_tmp3_ = g_strconcat ("Could not open chat: ", _data_->_tmp2_, NULL);
		_data_->_tmp4_ = _data_->_tmp3_;
		dc_window_show_toast (_data_->self, _data_->_tmp4_);
		_g_free0 (_data_->_tmp4_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_load_self_identity (DcWindow* self,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	DcWindowLoadSelfIdentityData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowLoadSelfIdentityData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_load_self_identity_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_load_self_identity_co (_data_);
}

static void
dc_window_load_self_identity_finish (DcWindow* self,
                                     GAsyncResult* _res_)
{
	DcWindowLoadSelfIdentityData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_load_self_identity_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	DcWindowLoadSelfIdentityData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_load_self_identity_co (_data_);
}

static gboolean
dc_window_load_self_identity_co (DcWindowLoadSelfIdentityData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_tmp3_ = dc_rpc_client_get_account_id (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_state_ = 1;
		dc_rpc_client_get_config (_data_->_tmp1_, "addr", _data_->_tmp4_, dc_window_load_self_identity_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = dc_rpc_client_get_config_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp0_ = _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->self->priv->rpc;
		dc_rpc_client_set_self_email (_data_->_tmp6_, _data_->_tmp0_);
		_g_free0 (_data_->_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_data_->_tmp7_ = _data_->self->priv->rpc;
		dc_rpc_client_set_self_email (_data_->_tmp7_, NULL);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp9_ = _data_->self->priv->rpc;
		_data_->_tmp10_ = _data_->self->priv->rpc;
		_data_->_tmp11_ = dc_rpc_client_get_account_id (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_state_ = 2;
		dc_rpc_client_get_config (_data_->_tmp9_, "displayname", _data_->_tmp12_, dc_window_load_self_identity_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp13_ = dc_rpc_client_get_config_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp8_ = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_tmp14_ = _data_->_tmp8_;
		_data_->_tmp8_ = NULL;
		_g_free0 (dc_message_row_self_display_name);
		dc_message_row_self_display_name = _data_->_tmp14_;
		_g_free0 (_data_->_tmp8_);
	}
	goto __finally1;
	__catch1_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_g_free0 (dc_message_row_self_display_name);
		dc_message_row_self_display_name = NULL;
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp16_ = _data_->self->priv->rpc;
		_data_->_tmp17_ = _data_->self->priv->rpc;
		_data_->_tmp18_ = dc_rpc_client_get_account_id (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_state_ = 3;
		dc_rpc_client_get_config (_data_->_tmp16_, "selfavatar", _data_->_tmp19_, dc_window_load_self_identity_ready, _data_);
		return FALSE;
		_state_3:
		_data_->_tmp20_ = dc_rpc_client_get_config_finish (_data_->_tmp16_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp15_ = _data_->_tmp20_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch2_g_error;
		}
		_data_->_tmp21_ = _data_->_tmp15_;
		_data_->_tmp15_ = NULL;
		_g_free0 (dc_message_row_self_avatar_path);
		dc_message_row_self_avatar_path = _data_->_tmp21_;
		_g_free0 (_data_->_tmp15_);
	}
	goto __finally2;
	__catch2_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_g_free0 (dc_message_row_self_avatar_path);
		dc_message_row_self_avatar_path = NULL;
	}
	__finally2:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 4;
	dc_window_refresh_self_mention_keys (_data_->self, dc_window_load_self_identity_ready, _data_);
	return FALSE;
	_state_4:
	dc_window_refresh_self_mention_keys_finish (_data_->self, _data_->_res_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
___lambda351_ (DcWindow* self)
{
	dc_window_install_and_connect (self, NULL, NULL);
}

static void
____lambda351__gtk_button_clicked (GtkButton* _sender,
                                   gpointer self)
{
	___lambda351_ ((DcWindow*) self);
}

static void
_dc_window_show_settings_dialog_gtk_button_clicked (GtkButton* _sender,
                                                    gpointer self)
{
	dc_window_show_settings_dialog ((DcWindow*) self);
}

static void
dc_window_show_rpc_not_found (DcWindow* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean can_download = FALSE;
	gchar* icon_name = NULL;
	gchar* _tmp1_;
	gchar* title = NULL;
	gchar* _tmp2_;
	gchar* description = NULL;
	gboolean _tmp3_ = FALSE;
	DcSettingsManager* _tmp4_;
	GtkWidget* child = NULL;
	const gchar* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	GtkWidget* _tmp51_;
	g_return_if_fail (self != NULL);
	if (dc_rpc_installer_can_auto_install ()) {
		_tmp0_ = !dc_settings_manager_rpc_server_path_is_fixed ();
	} else {
		_tmp0_ = FALSE;
	}
	can_download = _tmp0_;
	_tmp1_ = g_strdup ("dialog-error-symbolic");
	icon_name = _tmp1_;
	_tmp2_ = g_strdup ("RPC server not found");
	title = _tmp2_;
	_tmp4_ = self->settings;
	if (dc_settings_manager_effective_rpc_server_source (_tmp4_) == DC_RPC_SERVER_SOURCE_CUSTOM) {
		DcSettingsManager* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp5_ = self->settings;
		_tmp6_ = dc_settings_manager_effective_rpc_server_path (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = strlen (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp3_ = _tmp9_ > 0;
		_g_free0 (_tmp7_);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		const gchar* _tmp10_ = NULL;
		DcSettingsManager* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		if (can_download) {
			_tmp10_ = "\n\nDownload the engine to use it instead.";
		} else {
			_tmp10_ = "";
		}
		_tmp11_ = self->settings;
		_tmp12_ = dc_settings_manager_effective_rpc_server_path (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_markup_escape_text (_tmp13_, (gssize) -1);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_strconcat ("Configured path is missing or not executable:\n", _tmp15_, NULL);
		_tmp17_ = _tmp16_;
		_tmp18_ = g_strconcat (_tmp17_, _tmp10_, NULL);
		_g_free0 (description);
		description = _tmp18_;
		_g_free0 (_tmp17_);
		_g_free0 (_tmp15_);
		_g_free0 (_tmp13_);
	} else {
		if (can_download) {
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			_tmp19_ = g_strdup ("parla-welcome");
			_g_free0 (icon_name);
			icon_name = _tmp19_;
			_tmp20_ = g_strdup ("Welcome to Parla");
			_g_free0 (title);
			title = _tmp20_;
			_tmp21_ = g_strdup ("Parla needs the Delta Chat engine to connect.\n" "Download it once to get started.");
			_g_free0 (description);
			description = _tmp21_;
		} else {
			gchar* _tmp22_;
			gchar* _tmp23_;
			_tmp22_ = g_strdup ("Delta Chat engine required");
			_g_free0 (title);
			title = _tmp22_;
			_tmp23_ = g_strdup ("No prebuilt deltachat-rpc-server is available for this\n" "architecture. Install it manually (see docs/rpc-server.md)\n" "or choose a binary in Settings.");
			_g_free0 (description);
			description = _tmp23_;
		}
	}
	if (can_download) {
		GtkBox* box = NULL;
		GtkBox* _tmp24_;
		GtkBox* _tmp25_;
		GtkButton* dl = NULL;
		GtkButton* _tmp26_;
		GtkButton* _tmp27_;
		GtkButton* _tmp28_;
		GtkButton* _tmp29_;
		GtkButton* _tmp30_;
		GtkBox* _tmp31_;
		GtkButton* _tmp32_;
		GtkButton* settings_link = NULL;
		GtkButton* _tmp33_;
		GtkButton* _tmp34_;
		GtkButton* _tmp35_;
		GtkButton* _tmp36_;
		GtkBox* _tmp37_;
		GtkButton* _tmp38_;
		GtkBox* _tmp39_;
		GtkWidget* _tmp40_;
		_tmp24_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
		g_object_ref_sink (_tmp24_);
		box = _tmp24_;
		_tmp25_ = box;
		gtk_widget_set_halign ((GtkWidget*) _tmp25_, GTK_ALIGN_CENTER);
		_tmp26_ = (GtkButton*) gtk_button_new_with_label ("Download & start");
		g_object_ref_sink (_tmp26_);
		dl = _tmp26_;
		_tmp27_ = dl;
		gtk_widget_add_css_class ((GtkWidget*) _tmp27_, "suggested-action");
		_tmp28_ = dl;
		gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "pill");
		_tmp29_ = dl;
		gtk_widget_set_halign ((GtkWidget*) _tmp29_, GTK_ALIGN_CENTER);
		_tmp30_ = dl;
		g_signal_connect_object (_tmp30_, "clicked", (GCallback) ____lambda351__gtk_button_clicked, self, 0);
		_tmp31_ = box;
		_tmp32_ = dl;
		gtk_box_append (_tmp31_, (GtkWidget*) _tmp32_);
		_tmp33_ = (GtkButton*) gtk_button_new_with_label ("Open Settings…");
		g_object_ref_sink (_tmp33_);
		settings_link = _tmp33_;
		_tmp34_ = settings_link;
		gtk_widget_add_css_class ((GtkWidget*) _tmp34_, "flat");
		_tmp35_ = settings_link;
		gtk_widget_set_halign ((GtkWidget*) _tmp35_, GTK_ALIGN_CENTER);
		_tmp36_ = settings_link;
		g_signal_connect_object (_tmp36_, "clicked", (GCallback) _dc_window_show_settings_dialog_gtk_button_clicked, self, 0);
		_tmp37_ = box;
		_tmp38_ = settings_link;
		gtk_box_append (_tmp37_, (GtkWidget*) _tmp38_);
		_tmp39_ = box;
		_tmp40_ = _g_object_ref0 ((GtkWidget*) _tmp39_);
		_g_object_unref0 (child);
		child = _tmp40_;
		_g_object_unref0 (settings_link);
		_g_object_unref0 (dl);
		_g_object_unref0 (box);
	} else {
		GtkButton* btn = NULL;
		GtkButton* _tmp41_;
		GtkButton* _tmp42_;
		GtkButton* _tmp43_;
		GtkButton* _tmp44_;
		GtkButton* _tmp45_;
		GtkButton* _tmp46_;
		GtkWidget* _tmp47_;
		_tmp41_ = (GtkButton*) gtk_button_new_with_label ("Open Settings…");
		g_object_ref_sink (_tmp41_);
		btn = _tmp41_;
		_tmp42_ = btn;
		gtk_widget_add_css_class ((GtkWidget*) _tmp42_, "suggested-action");
		_tmp43_ = btn;
		gtk_widget_add_css_class ((GtkWidget*) _tmp43_, "pill");
		_tmp44_ = btn;
		gtk_widget_set_halign ((GtkWidget*) _tmp44_, GTK_ALIGN_CENTER);
		_tmp45_ = btn;
		g_signal_connect_object (_tmp45_, "clicked", (GCallback) _dc_window_show_settings_dialog_gtk_button_clicked, self, 0);
		_tmp46_ = btn;
		_tmp47_ = _g_object_ref0 ((GtkWidget*) _tmp46_);
		_g_object_unref0 (child);
		child = _tmp47_;
		dc_window_show_toast (self, "deltachat-rpc-server not found");
		_g_object_unref0 (btn);
	}
	_tmp48_ = icon_name;
	_tmp49_ = title;
	_tmp50_ = description;
	_tmp51_ = child;
	dc_window_show_empty_status (self, _tmp48_, _tmp49_, _tmp50_, _tmp51_);
	_g_object_unref0 (child);
	_g_free0 (description);
	_g_free0 (title);
	_g_free0 (icon_name);
}

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

static void
dc_window_install_and_connect (DcWindow* self,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DcWindowInstallAndConnectData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowInstallAndConnectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_install_and_connect_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_install_and_connect_co (_data_);
}

static void
dc_window_install_and_connect_finish (DcWindow* self,
                                      GAsyncResult* _res_)
{
	DcWindowInstallAndConnectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		DcWindow* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->label);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
__lambda352_ (Block4Data* _data4_,
              gint64 received,
              gint64 total)
{
	DcWindow* self;
	self = _data4_->self;
	if (total > ((gint64) 0)) {
		gdouble pct = 0.0;
		GtkLabel* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		pct = (((gdouble) received) / ((gdouble) total)) * 100.0;
		_tmp0_ = _data4_->label;
		_tmp1_ = g_strdup_printf ("Downloading Delta Chat engine… %.0f%% (%.1f MB)", pct, total / 1048576.0);
		_tmp2_ = _tmp1_;
		gtk_label_set_label (_tmp0_, _tmp2_);
		_g_free0 (_tmp2_);
	} else {
		GtkLabel* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = _data4_->label;
		_tmp4_ = g_strdup_printf ("Downloading Delta Chat engine… %.1f MB", received / 1048576.0);
		_tmp5_ = _tmp4_;
		gtk_label_set_label (_tmp3_, _tmp5_);
		_g_free0 (_tmp5_);
	}
}

static void
___lambda352__dc_rpc_installer_progress (DcRpcInstaller* _sender,
                                         gint64 received,
                                         gint64 total,
                                         gpointer self)
{
	__lambda352_ (self, received, total);
}

static void
dc_window_install_and_connect_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DcWindowInstallAndConnectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_install_and_connect_co (_data_);
}

static gboolean
dc_window_install_and_connect_co (DcWindowInstallAndConnectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data4_ = g_slice_new0 (Block4Data);
	_data_->_data4_->_ref_count_ = 1;
	_data_->_data4_->self = g_object_ref (_data_->self);
	_data_->_data4_->_async_data_ = _data_;
	_data_->_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	g_object_ref_sink (_data_->_tmp0_);
	_data_->box = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->box;
	gtk_widget_set_halign ((GtkWidget*) _data_->_tmp1_, GTK_ALIGN_CENTER);
	_data_->_tmp2_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_data_->_tmp2_);
	_data_->spinner = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->spinner;
	gtk_spinner_set_spinning (_data_->_tmp3_, TRUE);
	_data_->_tmp4_ = _data_->spinner;
	gtk_widget_set_size_request ((GtkWidget*) _data_->_tmp4_, 32, 32);
	_data_->_tmp5_ = _data_->box;
	_data_->_tmp6_ = _data_->spinner;
	gtk_box_append (_data_->_tmp5_, (GtkWidget*) _data_->_tmp6_);
	_data_->_tmp7_ = (GtkLabel*) gtk_label_new ("Downloading Delta Chat engine…");
	g_object_ref_sink (_data_->_tmp7_);
	_data_->_data4_->label = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->_data4_->label;
	gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp8_, "dim-label");
	_data_->_tmp9_ = _data_->box;
	_data_->_tmp10_ = _data_->_data4_->label;
	gtk_box_append (_data_->_tmp9_, (GtkWidget*) _data_->_tmp10_);
	_data_->_tmp11_ = _data_->box;
	dc_window_show_empty_status (_data_->self, "folder-download-symbolic", "Setting up Parla", "", (GtkWidget*) _data_->_tmp11_);
	_data_->_tmp12_ = dc_rpc_installer_new ();
	_data_->installer = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->installer;
	g_signal_connect_data (_data_->_tmp13_, "progress", (GCallback) ___lambda352__dc_rpc_installer_progress, block4_data_ref (_data_->_data4_), (GClosureNotify) block4_data_unref, 0);
	{
		_data_->_tmp14_ = _data_->installer;
		_data_->_state_ = 1;
		dc_rpc_installer_download_latest (_data_->_tmp14_, dc_window_install_and_connect_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp15_ = dc_rpc_installer_download_latest_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp16_ = _data_->_tmp15_;
		_g_free0 (_data_->_tmp16_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp17_ = _data_->e;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		_data_->_tmp19_ = g_strconcat ("Download failed: ", _data_->_tmp18_, NULL);
		_data_->_tmp20_ = _data_->_tmp19_;
		dc_window_show_toast (_data_->self, _data_->_tmp20_);
		_g_free0 (_data_->_tmp20_);
		dc_window_show_rpc_not_found (_data_->self);
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->installer);
		_g_object_unref0 (_data_->spinner);
		_g_object_unref0 (_data_->box);
		block4_data_unref (_data_->_data4_);
		_data_->_data4_ = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->installer);
		_g_object_unref0 (_data_->spinner);
		_g_object_unref0 (_data_->box);
		block4_data_unref (_data_->_data4_);
		_data_->_data4_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp21_ = _data_->self->settings;
	_data_->_tmp22_ = dc_settings_manager_get_rpc_server_source (_data_->_tmp21_);
	_data_->_tmp23_ = _data_->_tmp22_;
	if (_data_->_tmp23_ != DC_RPC_SERVER_SOURCE_AUTO) {
		_data_->_tmp24_ = _data_->self->settings;
		dc_settings_manager_save_rpc_server_source (_data_->_tmp24_, DC_RPC_SERVER_SOURCE_AUTO);
	}
	dc_window_show_toast (_data_->self, "Delta Chat engine installed");
	_data_->_state_ = 2;
	dc_window_reconnect_rpc_server (_data_->self, dc_window_install_and_connect_ready, _data_);
	return FALSE;
	_state_2:
	dc_window_reconnect_rpc_server_finish (_data_->self, _data_->_res_);
	_g_object_unref0 (_data_->installer);
	_g_object_unref0 (_data_->spinner);
	_g_object_unref0 (_data_->box);
	block4_data_unref (_data_->_data4_);
	_data_->_data4_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_refresh_tracking_filter_data_free (gpointer _data)
{
	DcWindowRefreshTrackingFilterData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowRefreshTrackingFilterData, _data_);
}

void
dc_window_refresh_tracking_filter (DcWindow* self,
                                   gboolean force,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	DcWindowRefreshTrackingFilterData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowRefreshTrackingFilterData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_refresh_tracking_filter_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->force = force;
	dc_window_refresh_tracking_filter_co (_data_);
}

gchar*
dc_window_refresh_tracking_filter_finish (DcWindow* self,
                                          GAsyncResult* _res_)
{
	gchar* result;
	DcWindowRefreshTrackingFilterData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

/**
         * Downloads the uBlock/AdGuard removeparam list configured in
         * Settings → Links and installs it as the active link cleaner.
         * Without `force` the cached copy is kept until it expires.
         * Returns null on success, otherwise a message for the user.
         */
static void
dc_window_refresh_tracking_filter_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DcWindowRefreshTrackingFilterData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_refresh_tracking_filter_co (_data_);
}

static gboolean
dc_window_refresh_tracking_filter_co (DcWindowRefreshTrackingFilterData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->settings;
	_data_->_tmp1_ = dc_settings_manager_get_tracking_filter_enabled (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (!_data_->_tmp2_) {
		_data_->_tmp3_ = g_strdup ("Filter list disabled");
		_data_->result = _data_->_tmp3_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->self->settings;
	_data_->_tmp5_ = dc_settings_manager_get_tracking_filter_url (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
	_data_->url = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->url;
	_data_->_tmp9_ = strlen (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	if (_data_->_tmp10_ == 0) {
		_data_->_tmp11_ = g_strdup ("No filter list URL configured");
		_data_->result = _data_->_tmp11_;
		_g_free0 (_data_->url);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp13_ = _data_->self->priv->rpc;
	if (_data_->_tmp13_ == NULL) {
		_data_->_tmp12_ = TRUE;
	} else {
		_data_->_tmp14_ = _data_->self->priv->rpc;
		_data_->_tmp15_ = dc_rpc_client_get_account_id (_data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		_data_->_tmp12_ = _data_->_tmp16_ <= 0;
	}
	if (_data_->_tmp12_) {
		_data_->_tmp17_ = g_strdup ("Not connected: the list is downloaded through the " "active account");
		_data_->result = _data_->_tmp17_;
		_g_free0 (_data_->url);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (!_data_->force) {
		_data_->_tmp18_ = dc_remove_param_filter_active;
		_data_->_tmp19_ = _g_object_ref0 (_data_->_tmp18_);
		_data_->cached = _data_->_tmp19_;
		_data_->_tmp21_ = _data_->cached;
		if (_data_->_tmp21_ != NULL) {
			_data_->_tmp22_ = _data_->cached;
			_data_->_tmp20_ = !dc_remove_param_filter_cache_is_stale (_data_->_tmp22_, (gint64) 3600);
		} else {
			_data_->_tmp20_ = FALSE;
		}
		if (_data_->_tmp20_) {
			_data_->result = NULL;
			_g_object_unref0 (_data_->cached);
			_g_free0 (_data_->url);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_object_unref0 (_data_->cached);
	}
	_data_->body_length1 = 0;
	_data_->_body_size_ = 0;
	{
		_data_->_tmp24_ = _data_->self->priv->rpc;
		_data_->_tmp25_ = _data_->url;
		_data_->_tmp26_ = NULL;
		_data_->_tmp27_ = 0;
		_data_->_state_ = 1;
		dc_rpc_client_get_http_response (_data_->_tmp24_, _data_->_tmp25_, dc_window_refresh_tracking_filter_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp28_ = dc_rpc_client_get_http_response_finish (_data_->_tmp24_, _data_->_res_, &_data_->_tmp26_, &_data_->_tmp27_, &_data_->_inner_error0_);
		_g_free0 (_data_->mimetype);
		_data_->mimetype = _data_->_tmp26_;
		_data_->_tmp23_ = _data_->_tmp28_;
		_data_->_tmp23__length1 = _data_->_tmp27_;
		_data_->__tmp23__size_ = _data_->_tmp23__length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp29_ = _data_->_tmp23_;
		_data_->_tmp29__length1 = _data_->_tmp23__length1;
		_data_->_tmp23_ = NULL;
		_data_->_tmp23__length1 = 0;
		_data_->body = (g_free (_data_->body), NULL);
		_data_->body = _data_->_tmp29_;
		_data_->body_length1 = _data_->_tmp29__length1;
		_data_->_body_size_ = _data_->body_length1;
		_data_->_tmp23_ = (g_free (_data_->_tmp23_), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp30_ = _data_->e;
		_data_->_tmp31_ = _data_->_tmp30_->message;
		g_warning ("window.vala:1293: tracking filter: download failed: %s", _data_->_tmp31_);
		_data_->_tmp32_ = _data_->e;
		_data_->_tmp33_ = _data_->_tmp32_->message;
		_data_->_tmp34_ = g_strconcat ("Download failed: ", _data_->_tmp33_, NULL);
		_data_->result = _data_->_tmp34_;
		_g_error_free0 (_data_->e);
		_g_free0 (_data_->mimetype);
		_data_->body = (g_free (_data_->body), NULL);
		_g_free0 (_data_->url);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->mimetype);
		_data_->body = (g_free (_data_->body), NULL);
		_g_free0 (_data_->url);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp35_ = _data_->body;
	_data_->_tmp35__length1 = _data_->body_length1;
	_data_->_tmp36_ = g_string_sized_new ((gsize) (_data_->_tmp35__length1 + 1));
	_data_->sb = _data_->_tmp36_;
	_data_->_tmp37_ = _data_->sb;
	_data_->_tmp38_ = _data_->body;
	_data_->_tmp38__length1 = _data_->body_length1;
	_data_->_tmp39_ = _data_->body;
	_data_->_tmp39__length1 = _data_->body_length1;
	g_string_append_len (_data_->_tmp37_, (const gchar*) _data_->_tmp38_, (gssize) _data_->_tmp39__length1);
	_data_->_tmp40_ = _data_->sb;
	_data_->_tmp41_ = _data_->_tmp40_->str;
	_data_->_tmp42_ = dc_remove_param_filter_from_text (_data_->_tmp41_);
	_data_->filter = _data_->_tmp42_;
	_data_->_tmp43_ = _data_->filter;
	if (_data_->_tmp43_ == NULL) {
		_data_->_tmp44_ = g_strdup ("The downloaded file contains no $removeparam rules");
		_data_->result = _data_->_tmp44_;
		_g_object_unref0 (_data_->filter);
		_g_string_free0 (_data_->sb);
		_g_free0 (_data_->mimetype);
		_data_->body = (g_free (_data_->body), NULL);
		_g_free0 (_data_->url);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp45_ = _data_->sb;
	_data_->_tmp46_ = _data_->_tmp45_->str;
	if (!dc_remove_param_filter_save_cached (_data_->_tmp46_)) {
		_data_->_tmp47_ = g_strdup ("Could not save the filter list");
		_data_->result = _data_->_tmp47_;
		_g_object_unref0 (_data_->filter);
		_g_string_free0 (_data_->sb);
		_g_free0 (_data_->mimetype);
		_data_->body = (g_free (_data_->body), NULL);
		_g_free0 (_data_->url);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp48_ = _data_->filter;
	_data_->_tmp49_ = _g_object_ref0 (_data_->_tmp48_);
	_g_object_unref0 (dc_remove_param_filter_active);
	dc_remove_param_filter_active = _data_->_tmp49_;
	_data_->_tmp50_ = _data_->filter;
	_data_->_tmp51_ = dc_remove_param_filter_get_rule_count (_data_->_tmp50_);
	_data_->_tmp52_ = _data_->_tmp51_;
	_data_->_tmp53_ = _data_->url;
	g_debug ("window.vala:1304: tracking filter: %d rules from %s", _data_->_tmp52_, _data_->_tmp53_);
	_data_->result = NULL;
	_g_object_unref0 (_data_->filter);
	_g_string_free0 (_data_->sb);
	_g_free0 (_data_->mimetype);
	_data_->body = (g_free (_data_->body), NULL);
	_g_free0 (_data_->url);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_check_managed_update (DcWindow* self,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcWindowCheckManagedUpdateData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowCheckManagedUpdateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_check_managed_update_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_check_managed_update_co (_data_);
}

static void
dc_window_check_managed_update_finish (DcWindow* self,
                                       GAsyncResult* _res_)
{
	DcWindowCheckManagedUpdateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_check_managed_update_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcWindowCheckManagedUpdateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_check_managed_update_co (_data_);
}

static void
___lambda354_ (DcWindow* self)
{
	dc_window_update_managed_server (self, NULL, NULL);
}

static void
____lambda354__adw_toast_button_clicked (AdwToast* _sender,
                                         gpointer self)
{
	___lambda354_ ((DcWindow*) self);
}

static gboolean
dc_window_check_managed_update_co (DcWindowCheckManagedUpdateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_state_ = 1;
		dc_rpc_installer_installed_version (dc_window_check_managed_update_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp0_ = dc_rpc_installer_installed_version_finish (_data_->_res_);
		_data_->installed = _data_->_tmp0_;
		_data_->_tmp1_ = _data_->installed;
		if (_data_->_tmp1_ == NULL) {
			_g_free0 (_data_->installed);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_state_ = 2;
		dc_rpc_installer_fetch_latest_tag (dc_window_check_managed_update_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp2_ = dc_rpc_installer_fetch_latest_tag_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->tag = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->installed);
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->tag;
		_data_->_tmp4_ = dc_rpc_installer_extract_version (_data_->_tmp3_);
		_data_->latest = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->installed;
		_data_->_tmp6_ = dc_rpc_installer_extract_version (_data_->_tmp5_);
		_data_->current = _data_->_tmp6_;
		_data_->_tmp9_ = _data_->latest;
		if (_data_->_tmp9_ == NULL) {
			_data_->_tmp8_ = TRUE;
		} else {
			_data_->_tmp10_ = _data_->current;
			_data_->_tmp8_ = _data_->_tmp10_ == NULL;
		}
		if (_data_->_tmp8_) {
			_data_->_tmp7_ = TRUE;
		} else {
			_data_->_tmp11_ = _data_->latest;
			_data_->_tmp12_ = _data_->current;
			_data_->_tmp7_ = g_strcmp0 (_data_->_tmp11_, _data_->_tmp12_) == 0;
		}
		if (_data_->_tmp7_) {
			_g_free0 (_data_->current);
			_g_free0 (_data_->latest);
			_g_free0 (_data_->tag);
			_g_free0 (_data_->installed);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp13_ = _data_->latest;
		_data_->_tmp14_ = g_strdup_printf ("Delta Chat engine update available: %s", _data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp16_ = adw_toast_new (_data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_g_free0 (_data_->_tmp15_);
		_data_->toast = _data_->_tmp17_;
		_data_->_tmp18_ = _data_->toast;
		adw_toast_set_timeout (_data_->_tmp18_, (guint) 8);
		_data_->_tmp19_ = _data_->toast;
		adw_toast_set_button_label (_data_->_tmp19_, "Update");
		_data_->_tmp20_ = _data_->toast;
		g_signal_connect_object (_data_->_tmp20_, "button-clicked", (GCallback) ____lambda354__adw_toast_button_clicked, _data_->self, 0);
		_data_->_tmp21_ = _data_->self->priv->toast_overlay;
		_data_->_tmp22_ = _data_->toast;
		_data_->_tmp23_ = _g_object_ref0 (_data_->_tmp22_);
		adw_toast_overlay_add_toast (_data_->_tmp21_, _data_->_tmp23_);
		_g_object_unref0 (_data_->toast);
		_g_free0 (_data_->current);
		_g_free0 (_data_->latest);
		_g_free0 (_data_->tag);
		_g_free0 (_data_->installed);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_update_managed_server (DcWindow* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcWindowUpdateManagedServerData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowUpdateManagedServerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_update_managed_server_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_update_managed_server_co (_data_);
}

static void
dc_window_update_managed_server_finish (DcWindow* self,
                                        GAsyncResult* _res_)
{
	DcWindowUpdateManagedServerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_update_managed_server_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcWindowUpdateManagedServerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_update_managed_server_co (_data_);
}

static gboolean
dc_window_update_managed_server_co (DcWindowUpdateManagedServerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	dc_window_show_toast (_data_->self, "Updating Delta Chat engine…");
	_data_->_tmp0_ = dc_rpc_installer_new ();
	_data_->installer = _data_->_tmp0_;
	{
		_data_->_state_ = 1;
		dc_rpc_installer_download_latest (_data_->installer, dc_window_update_managed_server_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = dc_rpc_installer_download_latest_finish (_data_->installer, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp2_ = _data_->_tmp1_;
		_g_free0 (_data_->_tmp2_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		dc_window_show_toast (_data_->self, "Update installed");
		_data_->_state_ = 2;
		dc_window_reconnect_rpc_server (_data_->self, dc_window_update_managed_server_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_reconnect_rpc_server_finish (_data_->self, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp3_ = _data_->e;
		_data_->_tmp4_ = _data_->_tmp3_->message;
		_data_->_tmp5_ = g_strconcat ("Update failed: ", _data_->_tmp4_, NULL);
		_data_->_tmp6_ = _data_->_tmp5_;
		dc_window_show_toast (_data_->self, _data_->_tmp6_);
		_g_free0 (_data_->_tmp6_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->installer);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->installer);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

void
dc_window_reconnect_rpc_server (DcWindow* self,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcWindowReconnectRpcServerData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowReconnectRpcServerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_reconnect_rpc_server_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_reconnect_rpc_server_co (_data_);
}

void
dc_window_reconnect_rpc_server_finish (DcWindow* self,
                                       GAsyncResult* _res_)
{
	DcWindowReconnectRpcServerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_reconnect_rpc_server_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcWindowReconnectRpcServerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_reconnect_rpc_server_co (_data_);
}

static gboolean
dc_window_reconnect_rpc_server_co (DcWindowReconnectRpcServerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->reconnecting_rpc) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->self->priv->reconnecting_rpc = TRUE;
	_data_->_tmp0_ = gtk_window_get_application ((GtkWindow*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, DC_TYPE_APPLICATION, DcApplication));
	_data_->app = _data_->_tmp2_;
	dc_window_discard_all_views (_data_->self);
	_data_->_tmp3_ = _data_->app;
	dc_application_reset_rpc_client (_data_->_tmp3_);
	_data_->_tmp4_ = _data_->app;
	_data_->_tmp5_ = dc_application_get_rpc (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->self->priv->rpc = _data_->_tmp6_;
	_g_object_unref0 (_data_->self->priv->events);
	_data_->self->priv->events = NULL;
	_g_object_unref0 (_data_->self->priv->chat_menu);
	_data_->self->priv->chat_menu = NULL;
	dc_window_set_current_chat_id (_data_->self, 0);
	dc_window_reset_chat_ui (_data_->self);
	_data_->_tmp7_ = _data_->self->priv->profile_unread_badge;
	gtk_widget_set_visible ((GtkWidget*) _data_->_tmp7_, FALSE);
	dc_window_show_empty_status (_data_->self, "parla-welcome", "Connecting", "Starting Delta Chat engine…", NULL);
	dc_window_set_connection_status (_data_->self, FALSE, "Reconnecting…");
	_data_->_state_ = 1;
	dc_window_try_connect (_data_->self, dc_window_reconnect_rpc_server_ready, _data_);
	return FALSE;
	_state_1:
	dc_window_try_connect_finish (_data_->self, _data_->_res_);
	_data_->self->priv->reconnecting_rpc = FALSE;
	_g_object_unref0 (_data_->app);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
dc_window_clear_chat_view (DcWindow* self)
{
	GtkListBox* _tmp0_;
	GtkLabel* _tmp1_;
	GtkImage* _tmp2_;
	g_return_if_fail (self != NULL);
	dc_window_set_current_chat_id (self, 0);
	self->priv->suppress_chat_selection = TRUE;
	_tmp0_ = self->priv->chat_listbox;
	gtk_list_box_select_row (_tmp0_, NULL);
	self->priv->suppress_chat_selection = FALSE;
	_tmp1_ = self->priv->content_title_label;
	gtk_label_set_label (_tmp1_, "Select a chat");
	_tmp2_ = self->priv->content_mute_icon;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, FALSE);
	dc_window_show_empty_status (self, "parla-welcome", "Parla", "Select a chat to start messaging.", NULL);
}

DcConversationView*
dc_window_current_view (DcWindow* self)
{
	gint _tmp0_;
	gint _tmp1_;
	GHashTable* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gconstpointer _tmp5_;
	DcConversationView* _tmp6_;
	DcConversationView* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = dc_window_get_current_chat_id (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ <= 0) {
		result = NULL;
		return result;
	}
	_tmp2_ = self->priv->views;
	_tmp3_ = dc_window_get_current_chat_id (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_hash_table_lookup (_tmp2_, (gpointer) ((gintptr) _tmp4_));
	_tmp6_ = _g_object_ref0 ((DcConversationView*) _tmp5_);
	result = _tmp6_;
	return result;
}

static DcConversationView*
dc_window_get_or_create_view (DcWindow* self,
                              gint chat_id,
                              DcChatKind kind)
{
	DcConversationView* v = NULL;
	GHashTable* _tmp0_;
	gconstpointer _tmp1_;
	DcConversationView* _tmp2_;
	DcConversationView* _tmp3_;
	DcRpcClient* _tmp5_;
	DcSettingsManager* _tmp6_;
	DcConversationView* _tmp7_;
	GHashTable* _tmp8_;
	DcConversationView* _tmp9_;
	DcConversationView* _tmp10_;
	GtkStack* _tmp11_;
	DcConversationView* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	DcConversationView* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->views;
	_tmp1_ = g_hash_table_lookup (_tmp0_, (gpointer) ((gintptr) chat_id));
	_tmp2_ = _g_object_ref0 ((DcConversationView*) _tmp1_);
	v = _tmp2_;
	_tmp3_ = v;
	if (_tmp3_ != NULL) {
		DcConversationView* _tmp4_;
		dc_window_touch_cached_view (self, chat_id);
		_tmp4_ = v;
		dc_conversation_view_set_chat_kind (_tmp4_, kind);
		result = v;
		return result;
	}
	_tmp5_ = self->priv->rpc;
	_tmp6_ = self->settings;
	_tmp7_ = dc_conversation_view_new (chat_id, self, _tmp5_, _tmp6_, kind);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (v);
	v = _tmp7_;
	_tmp8_ = self->priv->views;
	_tmp9_ = v;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	g_hash_table_insert (_tmp8_, (gpointer) ((gintptr) chat_id), _tmp10_);
	_tmp11_ = self->priv->content_stack;
	_tmp12_ = v;
	_tmp13_ = g_strdup_printf ("chat_%d", chat_id);
	_tmp14_ = _tmp13_;
	gtk_stack_add_named (_tmp11_, (GtkWidget*) _tmp12_, _tmp14_);
	_g_free0 (_tmp14_);
	dc_window_touch_cached_view (self, chat_id);
	dc_window_evict_cached_views (self, chat_id);
	result = v;
	return result;
}

static void
_vala_array_add6 (gint* * array,
                  gint* length,
                  gint* size,
                  gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static void
_vala_array_add7 (gint* * array,
                  gint* length,
                  gint* size,
                  gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static gint*
_vala_array_dup4 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

static void
dc_window_touch_cached_view (DcWindow* self,
                             gint chat_id)
{
	gint* next = NULL;
	gint* _tmp0_;
	gint next_length1;
	gint _next_size_;
	gint* _tmp1_;
	gint _tmp1__length1;
	gint* _tmp2_;
	gint _tmp2__length1;
	gint* _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (gint, 0);
	next = _tmp0_;
	next_length1 = 0;
	_next_size_ = next_length1;
	_tmp1_ = self->priv->view_recency;
	_tmp1__length1 = self->priv->view_recency_length1;
	{
		gint* id_collection = NULL;
		gint id_collection_length1 = 0;
		gint _id_collection_size_ = 0;
		gint id_it = 0;
		id_collection = _tmp1_;
		id_collection_length1 = _tmp1__length1;
		for (id_it = 0; id_it < id_collection_length1; id_it = id_it + 1) {
			gint id = 0;
			id = id_collection[id_it];
			{
				if (id != chat_id) {
					_vala_array_add6 (&next, &next_length1, &_next_size_, id);
				}
			}
		}
	}
	_vala_array_add7 (&next, &next_length1, &_next_size_, chat_id);
	_tmp2_ = next;
	_tmp2__length1 = next_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup4 (_tmp2_, _tmp2__length1) : _tmp2_;
	_tmp3__length1 = _tmp2__length1;
	self->priv->view_recency = (g_free (self->priv->view_recency), NULL);
	self->priv->view_recency = _tmp3_;
	self->priv->view_recency_length1 = _tmp3__length1;
	self->priv->_view_recency_size_ = self->priv->view_recency_length1;
	next = (g_free (next), NULL);
}

static void
_vala_array_add8 (gint* * array,
                  gint* length,
                  gint* size,
                  gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static gint*
_vala_array_dup5 (gint* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gint));
	}
	return NULL;
}

static void
dc_window_forget_cached_view (DcWindow* self,
                              gint chat_id)
{
	gint* next = NULL;
	gint* _tmp0_;
	gint next_length1;
	gint _next_size_;
	gint* _tmp1_;
	gint _tmp1__length1;
	gint* _tmp2_;
	gint _tmp2__length1;
	gint* _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (gint, 0);
	next = _tmp0_;
	next_length1 = 0;
	_next_size_ = next_length1;
	_tmp1_ = self->priv->view_recency;
	_tmp1__length1 = self->priv->view_recency_length1;
	{
		gint* id_collection = NULL;
		gint id_collection_length1 = 0;
		gint _id_collection_size_ = 0;
		gint id_it = 0;
		id_collection = _tmp1_;
		id_collection_length1 = _tmp1__length1;
		for (id_it = 0; id_it < id_collection_length1; id_it = id_it + 1) {
			gint id = 0;
			id = id_collection[id_it];
			{
				if (id != chat_id) {
					_vala_array_add8 (&next, &next_length1, &_next_size_, id);
				}
			}
		}
	}
	_tmp2_ = next;
	_tmp2__length1 = next_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup5 (_tmp2_, _tmp2__length1) : _tmp2_;
	_tmp3__length1 = _tmp2__length1;
	self->priv->view_recency = (g_free (self->priv->view_recency), NULL);
	self->priv->view_recency = _tmp3_;
	self->priv->view_recency_length1 = _tmp3__length1;
	self->priv->_view_recency_size_ = self->priv->view_recency_length1;
	next = (g_free (next), NULL);
}

static void
dc_window_evict_cached_views (DcWindow* self,
                              gint keep_chat_id)
{
	g_return_if_fail (self != NULL);
	while (TRUE) {
		GHashTable* _tmp0_;
		gint candidate = 0;
		gint* _tmp1_;
		gint _tmp1__length1;
		_tmp0_ = self->priv->views;
		if (!(g_hash_table_size (_tmp0_) > DC_WINDOW_MAX_CACHED_CONVERSATION_VIEWS)) {
			break;
		}
		candidate = 0;
		_tmp1_ = self->priv->view_recency;
		_tmp1__length1 = self->priv->view_recency_length1;
		{
			gint* id_collection = NULL;
			gint id_collection_length1 = 0;
			gint _id_collection_size_ = 0;
			gint id_it = 0;
			id_collection = _tmp1_;
			id_collection_length1 = _tmp1__length1;
			for (id_it = 0; id_it < id_collection_length1; id_it = id_it + 1) {
				gint id = 0;
				id = id_collection[id_it];
				{
					gboolean _tmp2_ = FALSE;
					if (id != keep_chat_id) {
						gint _tmp3_;
						gint _tmp4_;
						_tmp3_ = dc_window_get_current_chat_id (self);
						_tmp4_ = _tmp3_;
						_tmp2_ = id != _tmp4_;
					} else {
						_tmp2_ = FALSE;
					}
					if (_tmp2_) {
						candidate = id;
						break;
					}
				}
			}
		}
		if (candidate <= 0) {
			return;
		}
		dc_window_remove_cached_view (self, candidate);
	}
}

static void
dc_window_remove_cached_view (DcWindow* self,
                              gint chat_id)
{
	DcConversationView* view = NULL;
	GHashTable* _tmp0_;
	gconstpointer _tmp1_;
	DcConversationView* _tmp2_;
	DcConversationView* _tmp3_;
	DcConversationView* _tmp4_;
	GtkStack* _tmp5_;
	DcConversationView* _tmp6_;
	GHashTable* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views;
	_tmp1_ = g_hash_table_lookup (_tmp0_, (gpointer) ((gintptr) chat_id));
	_tmp2_ = _g_object_ref0 ((DcConversationView*) _tmp1_);
	view = _tmp2_;
	_tmp3_ = view;
	if (_tmp3_ == NULL) {
		dc_window_forget_cached_view (self, chat_id);
		_g_object_unref0 (view);
		return;
	}
	_tmp4_ = view;
	dc_conversation_view_close (_tmp4_);
	_tmp5_ = self->priv->content_stack;
	_tmp6_ = view;
	gtk_stack_remove (_tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = self->priv->views;
	g_hash_table_remove (_tmp7_, (gpointer) ((gintptr) chat_id));
	dc_window_forget_cached_view (self, chat_id);
	_g_object_unref0 (view);
}

void
dc_window_request_messages_reload (DcWindow* self)
{
	DcEventHandler* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->events;
	if (_tmp0_ != NULL) {
		DcEventHandler* _tmp1_;
		_tmp1_ = self->priv->events;
		dc_event_handler_schedule_messages_reload (_tmp1_);
	}
}

void
dc_window_request_chat_messages_reload (DcWindow* self,
                                        gint chat_id)
{
	DcConversationView* v = NULL;
	GHashTable* _tmp0_;
	gconstpointer _tmp1_;
	DcConversationView* _tmp2_;
	DcConversationView* _tmp3_;
	g_return_if_fail (self != NULL);
	if (chat_id <= 0) {
		return;
	}
	_tmp0_ = self->priv->views;
	_tmp1_ = g_hash_table_lookup (_tmp0_, (gpointer) ((gintptr) chat_id));
	_tmp2_ = _g_object_ref0 ((DcConversationView*) _tmp1_);
	v = _tmp2_;
	_tmp3_ = v;
	if (_tmp3_ != NULL) {
		DcConversationView* _tmp4_;
		_tmp4_ = v;
		dc_conversation_view_reload_messages (_tmp4_, NULL, NULL);
	}
	_g_object_unref0 (v);
}

static void
dc_window_toggle_archived_view (DcWindow* self)
{
	GtkSearchEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->showing_archived = !self->priv->showing_archived;
	_tmp0_ = self->priv->search_entry;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, "");
	dc_window_update_archived_toggle (self);
	dc_window_load_chats (self, NULL, NULL);
}

static void
dc_window_update_archived_toggle (DcWindow* self)
{
	GtkButton* _tmp0_;
	gboolean compact = FALSE;
	DcSettingsManager* _tmp1_;
	DcSidebarMode _tmp2_;
	DcSidebarMode _tmp3_;
	gboolean _tmp4_ = FALSE;
	GtkButton* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->archived_toggle_btn;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->settings;
	_tmp2_ = dc_settings_manager_get_sidebar_mode (_tmp1_);
	_tmp3_ = _tmp2_;
	compact = _tmp3_ == DC_SIDEBAR_MODE_COMPACT;
	if (self->priv->showing_archived) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = self->priv->archived_count > 0;
	}
	_tmp5_ = self->priv->archived_toggle_btn;
	gtk_widget_set_visible ((GtkWidget*) _tmp5_, _tmp4_);
	if (self->priv->showing_archived) {
		AdwButtonContent* _tmp6_;
		const gchar* _tmp7_ = NULL;
		AdwButtonContent* _tmp8_;
		GtkButton* _tmp9_;
		_tmp6_ = self->priv->archived_btn_content;
		adw_button_content_set_icon_name (_tmp6_, "go-previous-symbolic");
		if (compact) {
			_tmp7_ = "";
		} else {
			_tmp7_ = "Back to Chats";
		}
		_tmp8_ = self->priv->archived_btn_content;
		adw_button_content_set_label (_tmp8_, _tmp7_);
		_tmp9_ = self->priv->archived_toggle_btn;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp9_, "Back to Chats");
	} else {
		AdwButtonContent* _tmp10_;
		gchar* _tmp11_ = NULL;
		AdwButtonContent* _tmp14_;
		GtkButton* _tmp15_;
		_tmp10_ = self->priv->archived_btn_content;
		adw_button_content_set_icon_name (_tmp10_, "archive-symbolic");
		if (compact) {
			gchar* _tmp12_;
			_tmp12_ = g_strdup ("");
			_g_free0 (_tmp11_);
			_tmp11_ = _tmp12_;
		} else {
			gchar* _tmp13_;
			_tmp13_ = g_strdup_printf ("Archived Chats (%d)", self->priv->archived_count);
			_g_free0 (_tmp11_);
			_tmp11_ = _tmp13_;
		}
		_tmp14_ = self->priv->archived_btn_content;
		adw_button_content_set_label (_tmp14_, _tmp11_);
		_tmp15_ = self->priv->archived_toggle_btn;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp15_, "Show Archived Chats");
		_g_free0 (_tmp11_);
	}
}

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

void
dc_window_load_chats (DcWindow* self,
                      GAsyncReadyCallback _callback_,
                      gpointer _user_data_)
{
	DcWindowLoadChatsData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowLoadChatsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_load_chats_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_load_chats_co (_data_);
}

void
dc_window_load_chats_finish (DcWindow* self,
                             GAsyncResult* _res_)
{
	DcWindowLoadChatsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_load_chats_ready (GObject* source_object,
                            GAsyncResult* _res_,
                            gpointer _user_data_)
{
	DcWindowLoadChatsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_load_chats_co (_data_);
}

static void
_vala_array_add9 (DcChatEntry** * array,
                  gint* length,
                  gint* size,
                  DcChatEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (DcChatEntry*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add10 (gint* * array,
                   gint* length,
                   gint* size,
                   gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		DcWindow* self;
		self = _data5_->self;
		_g_object_unref0 (_data5_->chat_row);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static gboolean
_____lambda127_ (Block5Data* _data5_)
{
	DcWindow* self;
	DcChatRow* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	self = _data5_->self;
	_tmp0_ = _data5_->chat_row;
	_tmp1_ = dc_chat_row_get_chat_id (_tmp0_);
	_tmp2_ = _tmp1_;
	result = dc_window_can_attach_file_to_chat (self, _tmp2_);
	return result;
}

static gboolean
______lambda127__dc_chat_row_accept_file_drop (DcChatRow* _sender,
                                               gpointer self)
{
	gboolean result;
	result = _____lambda127_ (self);
	return result;
}

static void
_____lambda128_ (Block5Data* _data5_,
                 const gchar* path,
                 const gchar* name)
{
	DcWindow* self;
	DcChatRow* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	self = _data5_->self;
	g_return_if_fail (path != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = _data5_->chat_row;
	_tmp1_ = dc_chat_row_get_chat_id (_tmp0_);
	_tmp2_ = _tmp1_;
	dc_window_attach_file_to_chat (self, _tmp2_, path, name);
}

static void
______lambda128__dc_chat_row_file_dropped (DcChatRow* _sender,
                                           const gchar* path,
                                           const gchar* name,
                                           gpointer self)
{
	_____lambda128_ (self, path, name);
}

static void
_____lambda129_ (DcWindow* self,
                 const gchar* message)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (message != NULL);
	_tmp0_ = g_strconcat ("Attach failed: ", message, NULL);
	_tmp1_ = _tmp0_;
	dc_window_show_toast (self, _tmp1_);
	_g_free0 (_tmp1_);
}

static void
______lambda129__dc_chat_row_file_drop_failed (DcChatRow* _sender,
                                               const gchar* message,
                                               gpointer self)
{
	_____lambda129_ ((DcWindow*) self, message);
}

static gboolean
dc_window_load_chats_co (DcWindowLoadChatsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_ <= 0) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		if (_data_->self->priv->showing_archived) {
			_data_->_tmp3_ = DC_RPC_CLIENT_GCL_ARCHIVED_ONLY;
		} else {
			_data_->_tmp3_ = DC_RPC_CLIENT_GCL_NO_SPECIALS;
		}
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_tmp5_ = _data_->self->priv->rpc;
		_data_->_tmp6_ = dc_rpc_client_get_account_id (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_state_ = 1;
		dc_rpc_client_get_chatlist_entries_for (_data_->_tmp4_, _data_->_tmp7_, NULL, _data_->_tmp3_, dc_window_load_chats_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp8_ = dc_rpc_client_get_chatlist_entries_for_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		_data_->entries = _data_->_tmp8_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp9_ = _data_->entries;
		if (_data_->_tmp9_ == NULL) {
			_json_array_unref0 (_data_->entries);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		if (_data_->self->priv->showing_archived) {
			_data_->_tmp10_ = _data_->entries;
			_data_->self->priv->archived_count = (gint) json_array_get_length (_data_->_tmp10_);
			if (_data_->self->priv->archived_count == 0) {
				_data_->self->priv->showing_archived = FALSE;
				dc_window_update_archived_toggle (_data_->self);
				_data_->_state_ = 2;
				dc_window_load_chats (_data_->self, dc_window_load_chats_ready, _data_);
				return FALSE;
				_state_2:
				dc_window_load_chats_finish (_data_->self, _data_->_res_);
				_json_array_unref0 (_data_->entries);
				g_task_return_pointer (_data_->_async_result, _data_, NULL);
				if (_data_->_state_ != 0) {
					while (!g_task_get_completed (_data_->_async_result)) {
						g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
					}
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		} else {
			_data_->_tmp11_ = _data_->self->priv->rpc;
			_data_->_tmp12_ = _data_->self->priv->rpc;
			_data_->_tmp13_ = dc_rpc_client_get_account_id (_data_->_tmp12_);
			_data_->_tmp14_ = _data_->_tmp13_;
			_data_->_state_ = 3;
			dc_rpc_client_get_chatlist_entries_for (_data_->_tmp11_, _data_->_tmp14_, NULL, DC_RPC_CLIENT_GCL_ARCHIVED_ONLY, dc_window_load_chats_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp15_ = dc_rpc_client_get_chatlist_entries_for_finish (_data_->_tmp11_, _data_->_res_, &_data_->_inner_error0_);
			_data_->archived = _data_->_tmp15_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_json_array_unref0 (_data_->entries);
				goto __catch0_g_error;
			}
			_data_->_tmp17_ = _data_->archived;
			if (_data_->_tmp17_ != NULL) {
				_data_->_tmp18_ = _data_->archived;
				_data_->_tmp16_ = (gint) json_array_get_length (_data_->_tmp18_);
			} else {
				_data_->_tmp16_ = 0;
			}
			_data_->self->priv->archived_count = _data_->_tmp16_;
			_json_array_unref0 (_data_->archived);
		}
		dc_window_update_archived_toggle (_data_->self);
		_data_->_tmp19_ = _data_->self->priv->rpc;
		_data_->_tmp20_ = _data_->self->priv->rpc;
		_data_->_tmp21_ = dc_rpc_client_get_account_id (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = _data_->entries;
		_data_->_state_ = 4;
		dc_rpc_client_get_chatlist_items_by_entries_for (_data_->_tmp19_, _data_->_tmp22_, _data_->_tmp23_, dc_window_load_chats_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp24_ = dc_rpc_client_get_chatlist_items_by_entries_for_finish (_data_->_tmp19_, _data_->_res_, &_data_->_inner_error0_);
		_data_->items = _data_->_tmp24_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_json_array_unref0 (_data_->entries);
			goto __catch0_g_error;
		}
		_data_->_tmp25_ = dc_window_get_current_chat_id (_data_->self);
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->desired_chat_id = _data_->_tmp26_;
		_data_->keep_empty_selection = _data_->desired_chat_id <= 0;
		_data_->self->priv->suppress_chat_selection = TRUE;
		_data_->_tmp27_ = g_new0 (DcChatEntry*, 0 + 1);
		_data_->parsed_entries = _data_->_tmp27_;
		_data_->parsed_entries_length1 = 0;
		_data_->_parsed_entries_size_ = _data_->parsed_entries_length1;
		_data_->_tmp28_ = g_new0 (gint, 0);
		_data_->preview_msg_ids = _data_->_tmp28_;
		_data_->preview_msg_ids_length1 = 0;
		_data_->_preview_msg_ids_size_ = _data_->preview_msg_ids_length1;
		{
			_data_->i = (guint) 0;
			{
				_data_->_tmp29_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp29_) {
						_data_->_tmp30_ = _data_->i;
						_data_->i = _data_->_tmp30_ + 1;
					}
					_data_->_tmp29_ = FALSE;
					_data_->_tmp31_ = _data_->entries;
					if (!(_data_->i < json_array_get_length (_data_->_tmp31_))) {
						break;
					}
					_data_->_tmp32_ = _data_->entries;
					_data_->chat_id = (gint) json_array_get_int_element (_data_->_tmp32_, _data_->i);
					_data_->_tmp33_ = g_strdup_printf ("%i", _data_->chat_id);
					_data_->id_str = _data_->_tmp33_;
					_data_->_tmp35_ = _data_->items;
					if (_data_->_tmp35_ != NULL) {
						_data_->_tmp36_ = _data_->items;
						_data_->_tmp37_ = _data_->id_str;
						_data_->_tmp34_ = json_object_has_member (_data_->_tmp36_, _data_->_tmp37_);
					} else {
						_data_->_tmp34_ = FALSE;
					}
					if (_data_->_tmp34_) {
						_data_->_tmp38_ = _data_->items;
						_data_->_tmp39_ = _data_->id_str;
						_data_->_tmp40_ = json_object_get_object_member (_data_->_tmp38_, _data_->_tmp39_);
						_data_->_tmp41_ = _json_object_ref0 (_data_->_tmp40_);
						_data_->item = _data_->_tmp41_;
						_data_->_tmp42_ = _data_->item;
						_data_->_tmp43_ = dc_rpc_parsers_parse_chat_item (_data_->chat_id, _data_->_tmp42_);
						_data_->entry = _data_->_tmp43_;
						_data_->_tmp44_ = _data_->entry;
						_data_->_tmp45_ = _data_->self->priv->mentioned_chats;
						dc_chat_entry_set_has_mention (_data_->_tmp44_, g_hash_table_contains (_data_->_tmp45_, (gpointer) ((gintptr) _data_->chat_id)));
						_data_->_tmp46_ = _data_->entry;
						_data_->_tmp47_ = _g_object_ref0 (_data_->_tmp46_);
						_vala_array_add9 (&_data_->parsed_entries, &_data_->parsed_entries_length1, &_data_->_parsed_entries_size_, _data_->_tmp47_);
						_data_->_tmp48_ = _data_->entry;
						_data_->_tmp49_ = dc_chat_entry_get_last_message_id (_data_->_tmp48_);
						_data_->_tmp50_ = _data_->_tmp49_;
						if (_data_->_tmp50_ > 0) {
							_data_->_tmp51_ = _data_->entry;
							_data_->_tmp52_ = dc_chat_entry_get_last_message_id (_data_->_tmp51_);
							_data_->_tmp53_ = _data_->_tmp52_;
							_vala_array_add10 (&_data_->preview_msg_ids, &_data_->preview_msg_ids_length1, &_data_->_preview_msg_ids_size_, _data_->_tmp53_);
						}
						_g_object_unref0 (_data_->entry);
						_json_object_unref0 (_data_->item);
					}
					_g_free0 (_data_->id_str);
				}
			}
		}
		_data_->_tmp54_ = _data_->parsed_entries;
		_data_->_tmp54__length1 = _data_->parsed_entries_length1;
		_data_->_tmp55_ = _data_->preview_msg_ids;
		_data_->_tmp55__length1 = _data_->preview_msg_ids_length1;
		_data_->_state_ = 5;
		dc_window_hydrate_chat_text_previews (_data_->self, _data_->_tmp54_, (gint) _data_->_tmp54__length1, _data_->_tmp55_, (gint) _data_->_tmp55__length1, dc_window_load_chats_ready, _data_);
		return FALSE;
		_state_5:
		dc_window_hydrate_chat_text_previews_finish (_data_->self, _data_->_res_);
		_data_->_tmp56_ = _data_->self->priv->_chat_store;
		g_list_store_remove_all (_data_->_tmp56_);
		_data_->_tmp57_ = _data_->self->priv->chat_listbox;
		dc_clear_listbox (_data_->_tmp57_);
		_data_->reselect_row = NULL;
		_data_->_tmp58_ = _data_->parsed_entries;
		_data_->_tmp58__length1 = _data_->parsed_entries_length1;
		{
			_data_->entry_collection_length1 = 0;
			_data_->_entry_collection_size_ = 0;
			_data_->entry_collection = _data_->_tmp58_;
			_data_->entry_collection_length1 = _data_->_tmp58__length1;
			for (_data_->entry_it = 0; _data_->entry_it < _data_->entry_collection_length1; _data_->entry_it = _data_->entry_it + 1) {
				_data_->_tmp59_ = _g_object_ref0 (_data_->entry_collection[_data_->entry_it]);
				_data_->_vala1_entry = _data_->_tmp59_;
				{
					_data_->_data5_ = g_slice_new0 (Block5Data);
					_data_->_data5_->_ref_count_ = 1;
					_data_->_data5_->self = g_object_ref (_data_->self);
					_data_->_tmp60_ = _data_->self->priv->_chat_store;
					_data_->_tmp61_ = _data_->_vala1_entry;
					g_list_store_append (_data_->_tmp60_, (GObject*) _data_->_tmp61_);
					_data_->_tmp62_ = (GtkListBoxRow*) gtk_list_box_row_new ();
					g_object_ref_sink (_data_->_tmp62_);
					_data_->row = _data_->_tmp62_;
					_data_->_tmp63_ = _data_->_vala1_entry;
					_data_->_tmp64_ = dc_chat_row_new (_data_->_tmp63_);
					g_object_ref_sink (_data_->_tmp64_);
					_data_->_data5_->chat_row = _data_->_tmp64_;
					_data_->_tmp65_ = _data_->_data5_->chat_row;
					_data_->_tmp66_ = _data_->self->settings;
					_data_->_tmp67_ = dc_settings_manager_get_sidebar_mode (_data_->_tmp66_);
					_data_->_tmp68_ = _data_->_tmp67_;
					dc_chat_row_set_compact (_data_->_tmp65_, _data_->_tmp68_ == DC_SIDEBAR_MODE_COMPACT);
					_data_->_tmp69_ = _data_->_data5_->chat_row;
					g_signal_connect_data (_data_->_tmp69_, "accept-file-drop", (GCallback) ______lambda127__dc_chat_row_accept_file_drop, block5_data_ref (_data_->_data5_), (GClosureNotify) block5_data_unref, 0);
					_data_->_tmp70_ = _data_->_data5_->chat_row;
					g_signal_connect_data (_data_->_tmp70_, "file-dropped", (GCallback) ______lambda128__dc_chat_row_file_dropped, block5_data_ref (_data_->_data5_), (GClosureNotify) block5_data_unref, 0);
					_data_->_tmp71_ = _data_->_data5_->chat_row;
					g_signal_connect_object (_data_->_tmp71_, "file-drop-failed", (GCallback) ______lambda129__dc_chat_row_file_drop_failed, _data_->self, 0);
					_data_->_tmp72_ = _data_->row;
					_data_->_tmp73_ = _data_->_data5_->chat_row;
					gtk_list_box_row_set_child (_data_->_tmp72_, (GtkWidget*) _data_->_tmp73_);
					_data_->_tmp74_ = _data_->self->priv->chat_listbox;
					_data_->_tmp75_ = _data_->row;
					gtk_list_box_append (_data_->_tmp74_, (GtkWidget*) _data_->_tmp75_);
					_data_->_tmp76_ = _data_->_vala1_entry;
					_data_->_tmp77_ = dc_chat_entry_get_id (_data_->_tmp76_);
					_data_->_tmp78_ = _data_->_tmp77_;
					if (_data_->_tmp78_ == _data_->desired_chat_id) {
						_data_->_tmp79_ = _data_->row;
						_data_->_tmp80_ = _g_object_ref0 (_data_->_tmp79_);
						_g_object_unref0 (_data_->reselect_row);
						_data_->reselect_row = _data_->_tmp80_;
						_data_->_tmp81_ = _data_->self->priv->content_title_label;
						_data_->_tmp82_ = _data_->_vala1_entry;
						_data_->_tmp83_ = dc_chat_entry_get_name (_data_->_tmp82_);
						_data_->_tmp84_ = _data_->_tmp83_;
						gtk_label_set_label (_data_->_tmp81_, _data_->_tmp84_);
						_data_->_tmp85_ = _data_->self->priv->content_mute_icon;
						_data_->_tmp86_ = _data_->_vala1_entry;
						_data_->_tmp87_ = dc_chat_entry_get_is_muted (_data_->_tmp86_);
						_data_->_tmp88_ = _data_->_tmp87_;
						gtk_widget_set_visible ((GtkWidget*) _data_->_tmp85_, _data_->_tmp88_);
					}
					_g_object_unref0 (_data_->row);
					_g_object_unref0 (_data_->_vala1_entry);
					block5_data_unref (_data_->_data5_);
					_data_->_data5_ = NULL;
				}
			}
		}
		_data_->self->priv->suppress_chat_selection = FALSE;
		_data_->_tmp89_ = _data_->reselect_row;
		if (_data_->_tmp89_ != NULL) {
			_data_->self->priv->suppress_reselect_scroll = TRUE;
			_data_->_tmp90_ = _data_->self->priv->chat_listbox;
			_data_->_tmp91_ = _data_->reselect_row;
			gtk_list_box_select_row (_data_->_tmp90_, _data_->_tmp91_);
			_data_->self->priv->suppress_reselect_scroll = FALSE;
		} else {
			if (_data_->keep_empty_selection) {
				_data_->_tmp92_ = _data_->self->priv->chat_listbox;
				gtk_list_box_select_row (_data_->_tmp92_, NULL);
			} else {
				dc_window_clear_chat_view (_data_->self);
			}
		}
		_g_object_unref0 (_data_->reselect_row);
		_data_->preview_msg_ids = (g_free (_data_->preview_msg_ids), NULL);
		_data_->parsed_entries = (_vala_array_free (_data_->parsed_entries, _data_->parsed_entries_length1, (GDestroyNotify) g_object_unref), NULL);
		_json_object_unref0 (_data_->items);
		_json_array_unref0 (_data_->entries);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->self->priv->suppress_chat_selection = FALSE;
		_data_->_tmp93_ = _data_->e;
		_data_->_tmp94_ = _data_->_tmp93_->message;
		_data_->_tmp95_ = g_strconcat ("Failed to load chats: ", _data_->_tmp94_, NULL);
		_data_->_tmp96_ = _data_->_tmp95_;
		dc_window_show_toast (_data_->self, _data_->_tmp96_);
		_g_free0 (_data_->_tmp96_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_hydrate_chat_text_previews (DcWindow* self,
                                      DcChatEntry** entries,
                                      gint entries_length1,
                                      gint* msg_ids,
                                      gint msg_ids_length1,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcWindowHydrateChatTextPreviewsData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowHydrateChatTextPreviewsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_hydrate_chat_text_previews_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->entries = entries;
	_data_->entries_length1 = entries_length1;
	_data_->msg_ids = msg_ids;
	_data_->msg_ids_length1 = msg_ids_length1;
	dc_window_hydrate_chat_text_previews_co (_data_);
}

static void
dc_window_hydrate_chat_text_previews_finish (DcWindow* self,
                                             GAsyncResult* _res_)
{
	DcWindowHydrateChatTextPreviewsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_hydrate_chat_text_previews_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcWindowHydrateChatTextPreviewsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_hydrate_chat_text_previews_co (_data_);
}

static gboolean
dc_window_hydrate_chat_text_previews_co (DcWindowHydrateChatTextPreviewsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->entries_length1 == 0) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp0_ = _data_->msg_ids_length1 == 0;
	}
	if (_data_->_tmp0_) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_tmp3_ = dc_rpc_client_get_account_id (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_state_ = 1;
		dc_rpc_client_get_messages_for (_data_->_tmp1_, _data_->_tmp4_, _data_->msg_ids, (gint) _data_->msg_ids_length1, dc_window_hydrate_chat_text_previews_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = dc_rpc_client_get_messages_for_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->map = _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->map;
		if (_data_->_tmp6_ == NULL) {
			_json_object_unref0 (_data_->map);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		{
			_data_->entry_collection_length1 = 0;
			_data_->_entry_collection_size_ = 0;
			_data_->entry_collection = _data_->entries;
			_data_->entry_collection_length1 = _data_->entries_length1;
			for (_data_->entry_it = 0; _data_->entry_it < _data_->entry_collection_length1; _data_->entry_it = _data_->entry_it + 1) {
				_data_->_tmp7_ = _g_object_ref0 (_data_->entry_collection[_data_->entry_it]);
				_data_->entry = _data_->_tmp7_;
				{
					_data_->_tmp8_ = _data_->entry;
					_data_->_tmp9_ = dc_chat_entry_get_last_message_id (_data_->_tmp8_);
					_data_->_tmp10_ = _data_->_tmp9_;
					if (_data_->_tmp10_ <= 0) {
						_g_object_unref0 (_data_->entry);
						continue;
					}
					_data_->_tmp11_ = _data_->entry;
					_data_->_tmp12_ = dc_chat_entry_get_last_message_id (_data_->_tmp11_);
					_data_->_tmp13_ = _data_->_tmp12_;
					_data_->_tmp14_ = g_strdup_printf ("%i", _data_->_tmp13_);
					_data_->key = _data_->_tmp14_;
					_data_->_tmp15_ = _data_->map;
					_data_->_tmp16_ = _data_->key;
					if (!json_object_has_member (_data_->_tmp15_, _data_->_tmp16_)) {
						_g_free0 (_data_->key);
						_g_object_unref0 (_data_->entry);
						continue;
					}
					_data_->_tmp17_ = _data_->map;
					_data_->_tmp18_ = _data_->key;
					_data_->_tmp19_ = json_object_get_object_member (_data_->_tmp17_, _data_->_tmp18_);
					_data_->_tmp20_ = _data_->self->priv->rpc;
					_data_->_tmp21_ = dc_rpc_client_get_self_email (_data_->_tmp20_);
					_data_->_tmp22_ = _data_->_tmp21_;
					_data_->_tmp23_ = dc_rpc_parsers_parse_message (_data_->_tmp19_, _data_->_tmp22_);
					_data_->msg = _data_->_tmp23_;
					_data_->_tmp24_ = _data_->msg;
					if (!dc_window_plain_text_preview_message (_data_->_tmp24_)) {
						_g_object_unref0 (_data_->msg);
						_g_free0 (_data_->key);
						_g_object_unref0 (_data_->entry);
						continue;
					}
					_data_->_tmp25_ = _data_->entry;
					_data_->_tmp26_ = _data_->msg;
					_data_->_tmp27_ = dc_message_get_text (_data_->_tmp26_);
					_data_->_tmp28_ = _data_->_tmp27_;
					dc_chat_entry_set_last_message (_data_->_tmp25_, _data_->_tmp28_);
					_g_object_unref0 (_data_->msg);
					_g_free0 (_data_->key);
					_g_object_unref0 (_data_->entry);
				}
			}
		}
		_json_object_unref0 (_data_->map);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp29_ = _data_->e;
		_data_->_tmp30_ = _data_->_tmp29_->message;
		g_warning ("window.vala:1597: hydrate_chat_text_previews: %s", _data_->_tmp30_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
dc_window_plain_text_preview_message (DcMessage* msg)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp9_ = FALSE;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gboolean _tmp16_ = FALSE;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gboolean _tmp23_;
	gboolean _tmp24_;
	gboolean _tmp25_ = FALSE;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	gchar* vt = NULL;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gboolean _tmp35_ = FALSE;
	const gchar* _tmp36_;
	gboolean result;
	g_return_val_if_fail (msg != NULL, FALSE);
	_tmp1_ = dc_message_get_text (msg);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp3_ = dc_message_get_text (msg);
		_tmp4_ = _tmp3_;
		_tmp5_ = string_strip (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp0_ = _tmp8_ == 0;
		_g_free0 (_tmp6_);
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp10_ = dc_message_get_file_path (msg);
	_tmp11_ = _tmp10_;
	if (_tmp11_ != NULL) {
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		gint _tmp14_;
		gint _tmp15_;
		_tmp12_ = dc_message_get_file_path (msg);
		_tmp13_ = _tmp12_;
		_tmp14_ = strlen (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp9_ = _tmp15_ > 0;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		result = FALSE;
		return result;
	}
	_tmp17_ = dc_message_get_file_name (msg);
	_tmp18_ = _tmp17_;
	if (_tmp18_ != NULL) {
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		_tmp19_ = dc_message_get_file_name (msg);
		_tmp20_ = _tmp19_;
		_tmp21_ = strlen (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp16_ = _tmp22_ > 0;
	} else {
		_tmp16_ = FALSE;
	}
	if (_tmp16_) {
		result = FALSE;
		return result;
	}
	_tmp23_ = dc_message_get_is_info (msg);
	_tmp24_ = _tmp23_;
	if (_tmp24_) {
		result = FALSE;
		return result;
	}
	_tmp26_ = dc_message_get_view_type (msg);
	_tmp27_ = _tmp26_;
	if (_tmp27_ == NULL) {
		_tmp25_ = TRUE;
	} else {
		const gchar* _tmp28_;
		const gchar* _tmp29_;
		gint _tmp30_;
		gint _tmp31_;
		_tmp28_ = dc_message_get_view_type (msg);
		_tmp29_ = _tmp28_;
		_tmp30_ = strlen (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp25_ = _tmp31_ == 0;
	}
	if (_tmp25_) {
		result = TRUE;
		return result;
	}
	_tmp32_ = dc_message_get_view_type (msg);
	_tmp33_ = _tmp32_;
	_tmp34_ = g_utf8_strdown (_tmp33_, (gssize) -1);
	vt = _tmp34_;
	_tmp36_ = vt;
	if (g_strcmp0 (_tmp36_, "text") == 0) {
		_tmp35_ = TRUE;
	} else {
		const gchar* _tmp37_;
		_tmp37_ = vt;
		_tmp35_ = g_strcmp0 (_tmp37_, "unknown") == 0;
	}
	result = _tmp35_;
	_g_free0 (vt);
	return result;
}

static gboolean
dc_window_filter_chats (DcWindow* self,
                        GtkListBoxRow* row)
{
	gchar* query = NULL;
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	DcChatRow* chat_row = NULL;
	GtkWidget* _tmp10_;
	GtkWidget* _tmp11_;
	DcChatRow* _tmp12_;
	DcChatRow* _tmp13_;
	DcChatEntry* entry = NULL;
	GListStore* _tmp14_;
	DcChatRow* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	DcChatEntry* _tmp18_;
	DcChatEntry* _tmp19_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (row != NULL, FALSE);
	_tmp0_ = self->priv->search_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_strip (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_utf8_strdown (_tmp4_, (gssize) -1);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	query = _tmp6_;
	_tmp7_ = query;
	_tmp8_ = strlen (_tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ == 0) {
		result = TRUE;
		_g_free0 (query);
		return result;
	}
	_tmp10_ = gtk_list_box_row_get_child (row);
	_tmp11_ = _tmp10_;
	_tmp12_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp11_) ? ((DcChatRow*) _tmp11_) : NULL);
	chat_row = _tmp12_;
	_tmp13_ = chat_row;
	if (_tmp13_ == NULL) {
		result = TRUE;
		_g_object_unref0 (chat_row);
		_g_free0 (query);
		return result;
	}
	_tmp14_ = self->priv->_chat_store;
	_tmp15_ = chat_row;
	_tmp16_ = dc_chat_row_get_chat_id (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = dc_find_chat_entry (_tmp14_, _tmp17_);
	entry = _tmp18_;
	_tmp19_ = entry;
	if (_tmp19_ != NULL) {
		DcChatEntry* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		const gchar* _tmp25_;
		gboolean _tmp26_;
		_tmp20_ = entry;
		_tmp21_ = dc_chat_entry_get_name (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = g_utf8_strdown (_tmp22_, (gssize) -1);
		_tmp24_ = _tmp23_;
		_tmp25_ = query;
		_tmp26_ = string_contains (_tmp24_, _tmp25_);
		_g_free0 (_tmp24_);
		result = _tmp26_;
		_g_object_unref0 (entry);
		_g_object_unref0 (chat_row);
		_g_free0 (query);
		return result;
	}
	result = TRUE;
	_g_object_unref0 (entry);
	_g_object_unref0 (chat_row);
	_g_free0 (query);
	return result;
}

static gboolean
dc_window_chat_list_has_focus (DcWindow* self)
{
	GtkWidget* f = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GtkWidget* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_root_get_focus ((GtkRoot*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	f = _tmp1_;
	_tmp3_ = f;
	if (_tmp3_ != NULL) {
		gboolean _tmp4_ = FALSE;
		GtkWidget* _tmp5_;
		GtkListBox* _tmp6_;
		_tmp5_ = f;
		_tmp6_ = self->priv->chat_listbox;
		if (_tmp5_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_widget_get_type (), GtkWidget)) {
			_tmp4_ = TRUE;
		} else {
			GtkWidget* _tmp7_;
			GtkListBox* _tmp8_;
			_tmp7_ = f;
			_tmp8_ = self->priv->chat_listbox;
			_tmp4_ = gtk_widget_is_ancestor (_tmp7_, (GtkWidget*) _tmp8_);
		}
		_tmp2_ = _tmp4_;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_g_object_unref0 (f);
	return result;
}

static gboolean
dc_window_can_attach_file_to_chat (DcWindow* self,
                                   gint chat_id)
{
	DcChatEntry* entry = NULL;
	GListStore* _tmp0_;
	DcChatEntry* _tmp1_;
	gboolean _tmp2_ = FALSE;
	DcChatEntry* _tmp3_;
	DcConversationView* view = NULL;
	GHashTable* _tmp7_;
	gconstpointer _tmp8_;
	DcConversationView* _tmp9_;
	gboolean _tmp10_ = FALSE;
	DcConversationView* _tmp11_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_chat_store;
	_tmp1_ = dc_find_chat_entry (_tmp0_, chat_id);
	entry = _tmp1_;
	_tmp3_ = entry;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		DcChatEntry* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = entry;
		_tmp5_ = dc_chat_entry_get_is_contact_request (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp2_ = _tmp6_;
	}
	if (_tmp2_) {
		result = FALSE;
		_g_object_unref0 (entry);
		return result;
	}
	_tmp7_ = self->priv->views;
	_tmp8_ = g_hash_table_lookup (_tmp7_, (gpointer) ((gintptr) chat_id));
	_tmp9_ = _g_object_ref0 ((DcConversationView*) _tmp8_);
	view = _tmp9_;
	_tmp11_ = view;
	if (_tmp11_ == NULL) {
		_tmp10_ = TRUE;
	} else {
		DcConversationView* _tmp12_;
		_tmp12_ = view;
		_tmp10_ = dc_conversation_view_can_accept_dropped_file (_tmp12_);
	}
	result = _tmp10_;
	_g_object_unref0 (view);
	_g_object_unref0 (entry);
	return result;
}

static void
dc_window_attach_file_to_chat (DcWindow* self,
                               gint chat_id,
                               const gchar* path,
                               const gchar* name)
{
	DcConversationView* view = NULL;
	DcConversationView* _tmp0_;
	DcConversationView* _tmp1_;
	DcConversationView* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	g_return_if_fail (name != NULL);
	if (!dc_window_can_attach_file_to_chat (self, chat_id)) {
		dc_window_show_toast (self, "Attach failed: cannot attach here");
		return;
	}
	if (!dc_window_select_chat_by_id (self, chat_id)) {
		dc_window_show_toast (self, "Attach failed: chat is unavailable");
		return;
	}
	_tmp0_ = dc_window_current_view (self);
	view = _tmp0_;
	_tmp1_ = view;
	if (_tmp1_ == NULL) {
		dc_window_show_toast (self, "Attach failed: chat is unavailable");
		_g_object_unref0 (view);
		return;
	}
	_tmp2_ = view;
	dc_conversation_view_attach_dropped_file (_tmp2_, path, name);
	_g_object_unref0 (view);
}

static DcChatRow*
dc_window_chat_row_at_point (DcWindow* self,
                             gdouble x,
                             gdouble y)
{
	GtkWidget* widget = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	DcChatRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_widget_pick ((GtkWidget*) self, x, y, GTK_PICK_DEFAULT);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	widget = _tmp1_;
	while (TRUE) {
		gboolean _tmp2_ = FALSE;
		GtkWidget* _tmp3_;
		DcChatRow* chat_row = NULL;
		GtkWidget* _tmp5_;
		DcChatRow* _tmp6_;
		DcChatRow* _tmp7_;
		GtkListBoxRow* list_row = NULL;
		GtkWidget* _tmp8_;
		GtkListBoxRow* _tmp9_;
		GtkListBoxRow* _tmp10_;
		GtkWidget* _tmp16_;
		GtkWidget* _tmp17_;
		GtkWidget* _tmp18_;
		_tmp3_ = widget;
		if (_tmp3_ != NULL) {
			GtkWidget* _tmp4_;
			_tmp4_ = widget;
			_tmp2_ = _tmp4_ != G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget);
		} else {
			_tmp2_ = FALSE;
		}
		if (!_tmp2_) {
			break;
		}
		_tmp5_ = widget;
		_tmp6_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp5_) ? ((DcChatRow*) _tmp5_) : NULL);
		chat_row = _tmp6_;
		_tmp7_ = chat_row;
		if (_tmp7_ != NULL) {
			result = chat_row;
			_g_object_unref0 (widget);
			return result;
		}
		_tmp8_ = widget;
		_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, gtk_list_box_row_get_type ()) ? ((GtkListBoxRow*) _tmp8_) : NULL);
		list_row = _tmp9_;
		_tmp10_ = list_row;
		if (_tmp10_ != NULL) {
			GtkListBoxRow* _tmp11_;
			GtkWidget* _tmp12_;
			GtkWidget* _tmp13_;
			DcChatRow* _tmp14_;
			DcChatRow* _tmp15_;
			_tmp11_ = list_row;
			_tmp12_ = gtk_list_box_row_get_child (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp13_) ? ((DcChatRow*) _tmp13_) : NULL);
			_g_object_unref0 (chat_row);
			chat_row = _tmp14_;
			_tmp15_ = chat_row;
			if (_tmp15_ != NULL) {
				result = chat_row;
				_g_object_unref0 (list_row);
				_g_object_unref0 (widget);
				return result;
			}
		}
		_tmp16_ = widget;
		_tmp17_ = gtk_widget_get_parent (_tmp16_);
		_tmp18_ = _g_object_ref0 (_tmp17_);
		_g_object_unref0 (widget);
		widget = _tmp18_;
		_g_object_unref0 (list_row);
		_g_object_unref0 (chat_row);
	}
	result = NULL;
	_g_object_unref0 (widget);
	return result;
}

static GtkListBoxRow*
dc_window_first_visible_chat_row (DcWindow* self)
{
	gint idx = 0;
	GtkListBoxRow* row = NULL;
	GtkListBoxRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	idx = 0;
	while (TRUE) {
		GtkListBox* _tmp0_;
		GtkListBoxRow* _tmp1_;
		GtkListBoxRow* _tmp2_;
		GtkListBoxRow* _tmp3_;
		GtkListBoxRow* _tmp4_;
		gint _tmp5_;
		_tmp0_ = self->priv->chat_listbox;
		_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, idx);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		_g_object_unref0 (row);
		row = _tmp2_;
		_tmp3_ = row;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = row;
		if (dc_window_filter_chats (self, _tmp4_)) {
			result = row;
			return result;
		}
		_tmp5_ = idx;
		idx = _tmp5_ + 1;
	}
	result = NULL;
	_g_object_unref0 (row);
	return result;
}

static void
dc_window_on_chat_selected (DcWindow* self,
                            GtkListBoxRow* row)
{
	DcChatRow* chat_row = NULL;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	DcChatRow* _tmp2_;
	DcChatRow* _tmp3_;
	gint chat_id = 0;
	DcChatRow* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gboolean _tmp7_ = FALSE;
	AdwOverlaySplitView* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	gboolean focus_compose = FALSE;
	gint _tmp11_;
	gint _tmp12_;
	DcChatEntry* entry = NULL;
	GListStore* _tmp23_;
	DcChatEntry* _tmp24_;
	DcChatKind _tmp25_ = 0;
	DcChatEntry* _tmp26_;
	DcConversationView* view = NULL;
	DcConversationView* _tmp30_;
	DcChatEntry* _tmp31_;
	gboolean _tmp36_ = FALSE;
	DcChatEntry* _tmp37_;
	GtkImage* _tmp41_;
	gboolean _tmp42_ = FALSE;
	DcChatEntry* _tmp43_;
	DcConversationView* _tmp47_;
	GtkStack* _tmp48_;
	gchar* _tmp49_;
	gchar* _tmp50_;
	DcConversationView* _tmp51_;
	AdwOverlaySplitView* _tmp52_;
	gboolean _tmp53_;
	gboolean _tmp54_;
	gboolean _tmp56_;
	gboolean _tmp57_;
	gint _tmp59_;
	gint _tmp60_;
	g_return_if_fail (self != NULL);
	if (self->priv->suppress_chat_selection) {
		return;
	}
	if (row == NULL) {
		return;
	}
	_tmp0_ = gtk_list_box_row_get_child (row);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp1_) ? ((DcChatRow*) _tmp1_) : NULL);
	chat_row = _tmp2_;
	_tmp3_ = chat_row;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (chat_row);
		return;
	}
	_tmp4_ = chat_row;
	_tmp5_ = dc_chat_row_get_chat_id (_tmp4_);
	_tmp6_ = _tmp5_;
	chat_id = _tmp6_;
	_tmp8_ = self->priv->split_view;
	_tmp9_ = adw_overlay_split_view_get_collapsed (_tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = !dc_window_chat_list_has_focus (self);
	}
	focus_compose = _tmp7_;
	_tmp11_ = dc_window_get_current_chat_id (self);
	_tmp12_ = _tmp11_;
	if (chat_id == _tmp12_) {
		AdwOverlaySplitView* _tmp13_;
		gboolean _tmp14_;
		gboolean _tmp15_;
		DcConversationView* v = NULL;
		DcConversationView* _tmp17_;
		DcConversationView* _tmp18_;
		if (self->priv->suppress_reselect_scroll) {
			_g_object_unref0 (chat_row);
			return;
		}
		_tmp13_ = self->priv->split_view;
		_tmp14_ = adw_overlay_split_view_get_collapsed (_tmp13_);
		_tmp15_ = _tmp14_;
		if (_tmp15_) {
			AdwOverlaySplitView* _tmp16_;
			_tmp16_ = self->priv->split_view;
			adw_overlay_split_view_set_show_sidebar (_tmp16_, FALSE);
		}
		_tmp17_ = dc_window_current_view (self);
		v = _tmp17_;
		_tmp18_ = v;
		if (_tmp18_ != NULL) {
			DcConversationView* _tmp19_;
			gboolean _tmp20_;
			gboolean _tmp21_;
			_tmp19_ = v;
			dc_conversation_view_on_reselected (_tmp19_, focus_compose);
			g_object_get ((GtkWindow*) self, "is-active", &_tmp20_, NULL);
			_tmp21_ = _tmp20_;
			if (_tmp21_) {
				DcConversationView* _tmp22_;
				_tmp22_ = v;
				dc_conversation_view_flush_pending_seen (_tmp22_);
			}
		}
		dc_window_notice_chat (self, chat_id, NULL, NULL);
		_g_object_unref0 (v);
		_g_object_unref0 (chat_row);
		return;
	}
	_tmp23_ = self->priv->_chat_store;
	_tmp24_ = dc_find_chat_entry (_tmp23_, chat_id);
	entry = _tmp24_;
	_tmp26_ = entry;
	if (_tmp26_ != NULL) {
		DcChatEntry* _tmp27_;
		DcChatKind _tmp28_;
		DcChatKind _tmp29_;
		_tmp27_ = entry;
		_tmp28_ = dc_chat_entry_get_kind (_tmp27_);
		_tmp29_ = _tmp28_;
		_tmp25_ = _tmp29_;
	} else {
		_tmp25_ = DC_CHAT_KIND_UNKNOWN;
	}
	_tmp30_ = dc_window_get_or_create_view (self, chat_id, _tmp25_);
	view = _tmp30_;
	dc_window_set_current_chat_id (self, chat_id);
	_tmp31_ = entry;
	if (_tmp31_ != NULL) {
		GtkLabel* _tmp32_;
		DcChatEntry* _tmp33_;
		const gchar* _tmp34_;
		const gchar* _tmp35_;
		_tmp32_ = self->priv->content_title_label;
		_tmp33_ = entry;
		_tmp34_ = dc_chat_entry_get_name (_tmp33_);
		_tmp35_ = _tmp34_;
		gtk_label_set_label (_tmp32_, _tmp35_);
	}
	_tmp37_ = entry;
	if (_tmp37_ != NULL) {
		DcChatEntry* _tmp38_;
		gboolean _tmp39_;
		gboolean _tmp40_;
		_tmp38_ = entry;
		_tmp39_ = dc_chat_entry_get_is_muted (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp36_ = _tmp40_;
	} else {
		_tmp36_ = FALSE;
	}
	_tmp41_ = self->priv->content_mute_icon;
	gtk_widget_set_visible ((GtkWidget*) _tmp41_, _tmp36_);
	_tmp43_ = entry;
	if (_tmp43_ != NULL) {
		DcChatEntry* _tmp44_;
		gboolean _tmp45_;
		gboolean _tmp46_;
		_tmp44_ = entry;
		_tmp45_ = dc_chat_entry_get_is_contact_request (_tmp44_);
		_tmp46_ = _tmp45_;
		_tmp42_ = _tmp46_;
	} else {
		_tmp42_ = FALSE;
	}
	_tmp47_ = view;
	dc_conversation_view_set_contact_request (_tmp47_, _tmp42_);
	_tmp48_ = self->priv->content_stack;
	_tmp49_ = g_strdup_printf ("chat_%d", chat_id);
	_tmp50_ = _tmp49_;
	gtk_stack_set_visible_child_name (_tmp48_, _tmp50_);
	_g_free0 (_tmp50_);
	_tmp51_ = view;
	dc_conversation_view_on_activated (_tmp51_, focus_compose);
	_tmp52_ = self->priv->split_view;
	_tmp53_ = adw_overlay_split_view_get_collapsed (_tmp52_);
	_tmp54_ = _tmp53_;
	if (_tmp54_) {
		AdwOverlaySplitView* _tmp55_;
		_tmp55_ = self->priv->split_view;
		adw_overlay_split_view_set_show_sidebar (_tmp55_, FALSE);
	}
	g_object_get ((GtkWindow*) self, "is-active", &_tmp56_, NULL);
	_tmp57_ = _tmp56_;
	if (_tmp57_) {
		DcConversationView* _tmp58_;
		_tmp58_ = view;
		dc_conversation_view_flush_pending_seen (_tmp58_);
	}
	_tmp59_ = dc_window_get_current_chat_id (self);
	_tmp60_ = _tmp59_;
	dc_window_notice_chat (self, _tmp60_, NULL, NULL);
	_g_object_unref0 (view);
	_g_object_unref0 (entry);
	_g_object_unref0 (chat_row);
}

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

static void
dc_window_notice_chat (DcWindow* self,
                       gint chat_id,
                       GAsyncReadyCallback _callback_,
                       gpointer _user_data_)
{
	DcWindowNoticeChatData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowNoticeChatData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_notice_chat_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_window_notice_chat_co (_data_);
}

static void
dc_window_notice_chat_finish (DcWindow* self,
                              GAsyncResult* _res_)
{
	DcWindowNoticeChatData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_notice_chat_ready (GObject* source_object,
                             GAsyncResult* _res_,
                             gpointer _user_data_)
{
	DcWindowNoticeChatData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_notice_chat_co (_data_);
}

static gboolean
dc_window_notice_chat_co (DcWindowNoticeChatData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	dc_window_clear_chat_mention (_data_->self, _data_->chat_id);
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_marknoticed_chat (_data_->_tmp0_, _data_->chat_id, dc_window_notice_chat_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_marknoticed_chat_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = _data_->self->priv->events;
	if (_data_->_tmp1_ != NULL) {
		_data_->_tmp2_ = _data_->self->priv->events;
		_data_->_tmp3_ = _data_->self->priv->rpc;
		_data_->_tmp4_ = dc_rpc_client_get_account_id (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		dc_event_handler_clear_notifications_for_chat (_data_->_tmp2_, _data_->_tmp5_, _data_->chat_id);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_clear_chat_mention (DcWindow* self,
                              gint chat_id)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mentioned_chats;
	if (g_hash_table_remove (_tmp0_, (gpointer) ((gintptr) chat_id))) {
		dc_window_request_reload_chats (self);
	}
}

static void
dc_window_on_window_focused (DcWindow* self)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	AdwOverlaySplitView* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	DcConversationView* v = NULL;
	DcConversationView* _tmp9_;
	DcConversationView* _tmp10_;
	gint _tmp12_;
	gint _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_window_get_current_chat_id (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ <= 0) {
		return;
	}
	_tmp3_ = self->priv->split_view;
	_tmp4_ = adw_overlay_split_view_get_collapsed (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_) {
		AdwOverlaySplitView* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp6_ = self->priv->split_view;
		_tmp7_ = adw_overlay_split_view_get_show_sidebar (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp2_ = _tmp8_;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		return;
	}
	_tmp9_ = dc_window_current_view (self);
	v = _tmp9_;
	_tmp10_ = v;
	if (_tmp10_ != NULL) {
		DcConversationView* _tmp11_;
		_tmp11_ = v;
		dc_conversation_view_flush_pending_seen (_tmp11_);
	}
	_tmp12_ = dc_window_get_current_chat_id (self);
	_tmp13_ = _tmp12_;
	dc_window_notice_chat (self, _tmp13_, NULL, NULL);
	_g_object_unref0 (v);
}

void
dc_window_show_image_list (DcWindow* self,
                           gchar** paths,
                           gint paths_length1,
                           gint start_index)
{
	DcImageViewer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->image_viewer;
	dc_image_viewer_show_list (_tmp0_, paths, (gint) paths_length1, start_index);
}

gchar*
dc_window_image_viewer_path (DcWindow* self)
{
	DcImageViewer* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->image_viewer;
	_tmp1_ = dc_image_viewer_get_current_path (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

/** Extends the open viewer's list; no-op unless it still shows
            `expected_path`. */
void
dc_window_replace_image_list (DcWindow* self,
                              gchar** paths,
                              gint paths_length1,
                              const gchar* expected_path)
{
	DcImageViewer* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	DcImageViewer* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (expected_path != NULL);
	_tmp0_ = self->priv->image_viewer;
	_tmp1_ = dc_image_viewer_get_current_path (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, expected_path) != 0) {
		return;
	}
	_tmp3_ = self->priv->image_viewer;
	dc_image_viewer_replace_list (_tmp3_, paths, (gint) paths_length1);
}

static void
dc_window_show_gallery_dialog (DcWindow* self)
{
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gint _tmp2_;
	DcChatEntry* entry = NULL;
	GListStore* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	DcChatEntry* _tmp6_;
	const gchar* _tmp7_ = NULL;
	DcChatEntry* _tmp8_;
	DcGalleryDialog* dialog = NULL;
	DcRpcClient* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	DcGalleryDialog* _tmp15_;
	DcGalleryDialog* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp1_ = dc_window_get_current_chat_id (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ <= 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = !dc_window_can_show_rpc_modal (self);
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->priv->_chat_store;
	_tmp4_ = dc_window_get_current_chat_id (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = dc_find_chat_entry (_tmp3_, _tmp5_);
	entry = _tmp6_;
	_tmp8_ = entry;
	if (_tmp8_ != NULL) {
		DcChatEntry* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp9_ = entry;
		_tmp10_ = dc_chat_entry_get_name (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp7_ = _tmp11_;
	} else {
		_tmp7_ = NULL;
	}
	_tmp12_ = self->priv->rpc;
	_tmp13_ = dc_window_get_current_chat_id (self);
	_tmp14_ = _tmp13_;
	_tmp15_ = dc_gallery_dialog_new (self, _tmp12_, _tmp14_, _tmp7_);
	g_object_ref_sink (_tmp15_);
	dialog = _tmp15_;
	_tmp16_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp16_);
	_g_object_unref0 (dialog);
	_g_object_unref0 (entry);
}

void
dc_window_show_video (DcWindow* self,
                      const gchar* path,
                      const gchar* name)
{
	DcVideoPlayer* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_tmp0_ = self->priv->video_player;
	dc_video_player_show (_tmp0_, path, name);
}

static void
dc_window_save_attachment_data_free (gpointer _data)
{
	DcWindowSaveAttachmentData* _data_;
	_data_ = _data;
	_g_free0 (_data_->src_path);
	_g_free0 (_data_->name);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowSaveAttachmentData, _data_);
}

void
dc_window_save_attachment (DcWindow* self,
                           const gchar* src_path,
                           const gchar* name,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	DcWindowSaveAttachmentData* _data_;
	DcWindow* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (src_path != NULL);
	_data_ = g_slice_new0 (DcWindowSaveAttachmentData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_save_attachment_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (src_path);
	_g_free0 (_data_->src_path);
	_data_->src_path = _tmp1_;
	_tmp2_ = g_strdup (name);
	_g_free0 (_data_->name);
	_data_->name = _tmp2_;
	dc_window_save_attachment_co (_data_);
}

void
dc_window_save_attachment_finish (DcWindow* self,
                                  GAsyncResult* _res_)
{
	DcWindowSaveAttachmentData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_save_attachment_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_)
{
	DcWindowSaveAttachmentData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_save_attachment_co (_data_);
}

static gboolean
dc_window_save_attachment_co (DcWindowSaveAttachmentData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gtk_file_dialog_new ();
	_data_->dialog = _data_->_tmp0_;
	_data_->_tmp2_ = g_strdup (_data_->name);
	_data_->_tmp1_ = _data_->_tmp2_;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp3_ = g_path_get_basename (_data_->src_path);
		_g_free0 (_data_->_tmp1_);
		_data_->_tmp1_ = _data_->_tmp3_;
	}
	_data_->_tmp4_ = _data_->dialog;
	gtk_file_dialog_set_initial_name (_data_->_tmp4_, _data_->_tmp1_);
	{
		_data_->_tmp5_ = _data_->dialog;
		_data_->_state_ = 1;
		gtk_file_dialog_save (_data_->_tmp5_, (GtkWindow*) _data_->self, NULL, dc_window_save_attachment_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp6_ = gtk_file_dialog_save_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_);
		_data_->dest = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp7_ = _data_->dest;
		if (_data_->_tmp7_ == NULL) {
			_g_object_unref0 (_data_->dest);
			_g_free0 (_data_->_tmp1_);
			_g_object_unref0 (_data_->dialog);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp8_ = g_file_new_for_path (_data_->src_path);
		_data_->src_file = _data_->_tmp8_;
		_data_->_tmp9_ = _data_->src_file;
		_data_->_tmp10_ = _data_->dest;
		_data_->_state_ = 2;
		g_file_copy_async (_data_->_tmp9_, _data_->_tmp10_, G_FILE_COPY_OVERWRITE, G_PRIORITY_DEFAULT, NULL, NULL, NULL, dc_window_save_attachment_ready, _data_);
		return FALSE;
		_state_2:
		g_file_copy_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->src_file);
			_g_object_unref0 (_data_->dest);
			goto __catch0_g_error;
		}
		dc_window_show_toast (_data_->self, "File saved");
		_g_object_unref0 (_data_->src_file);
		_g_object_unref0 (_data_->dest);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp11_ = _data_->e;
		if (dc_is_dialog_dismissal (_data_->_tmp11_)) {
			_g_error_free0 (_data_->e);
			_g_free0 (_data_->_tmp1_);
			_g_object_unref0 (_data_->dialog);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp12_ = _data_->e;
		_data_->_tmp13_ = _data_->_tmp12_->message;
		_data_->_tmp14_ = g_strconcat ("Save failed: ", _data_->_tmp13_, NULL);
		_data_->_tmp15_ = _data_->_tmp14_;
		dc_window_show_toast (_data_->self, _data_->_tmp15_);
		_g_free0 (_data_->_tmp15_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->_tmp1_);
		_g_object_unref0 (_data_->dialog);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_free0 (_data_->_tmp1_);
	_g_object_unref0 (_data_->dialog);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_prompt_webxdc_app_data_free (gpointer _data)
{
	DcWindowPromptWebxdcAppData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->parent);
	_g_object_unref0 (_data_->app_rpc);
	_g_object_unref0 (_data_->msg);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowPromptWebxdcAppData, _data_);
}

void
dc_window_prompt_webxdc_app (DcWindow* self,
                             GtkWidget* parent,
                             DcRpcClient* app_rpc,
                             DcMessage* msg,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_)
{
	DcWindowPromptWebxdcAppData* _data_;
	DcWindow* _tmp0_;
	GtkWidget* _tmp1_;
	DcRpcClient* _tmp2_;
	DcMessage* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	g_return_if_fail (app_rpc != NULL);
	g_return_if_fail (msg != NULL);
	_data_ = g_slice_new0 (DcWindowPromptWebxdcAppData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_prompt_webxdc_app_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (parent);
	_g_object_unref0 (_data_->parent);
	_data_->parent = _tmp1_;
	_tmp2_ = _g_object_ref0 (app_rpc);
	_g_object_unref0 (_data_->app_rpc);
	_data_->app_rpc = _tmp2_;
	_tmp3_ = _g_object_ref0 (msg);
	_g_object_unref0 (_data_->msg);
	_data_->msg = _tmp3_;
	dc_window_prompt_webxdc_app_co (_data_);
}

void
dc_window_prompt_webxdc_app_finish (DcWindow* self,
                                    GAsyncResult* _res_)
{
	DcWindowPromptWebxdcAppData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/** One entry point for Webxdc attachments in conversations and the
            gallery. Unsupported builds and disabled settings deliberately
            omit Start App instead of offering an action that cannot work. */
static void
dc_window_prompt_webxdc_app_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_)
{
	DcWindowPromptWebxdcAppData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_prompt_webxdc_app_co (_data_);
}

static gboolean
dc_window_prompt_webxdc_app_co (DcWindowPromptWebxdcAppData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (DC_WEBXDC_AVAILABLE) {
		_data_->_tmp0_ = dc_webxdc_enabled ();
	} else {
		_data_->_tmp0_ = FALSE;
	}
	_data_->can_start = _data_->_tmp0_;
	_data_->_tmp1_ = dc_message_display_file_name (_data_->msg, "App");
	_data_->app_name = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->app_name;
	_data_->_tmp3_ = g_utf8_strdown (_data_->_tmp2_, (gssize) -1);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = g_str_has_suffix (_data_->_tmp4_, ".xdc");
	_g_free0 (_data_->_tmp4_);
	if (_data_->_tmp5_) {
		_data_->_tmp6_ = _data_->app_name;
		_data_->_tmp7_ = _data_->app_name;
		_data_->_tmp8_ = strlen (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = string_substring (_data_->_tmp6_, (glong) 0, (glong) (_data_->_tmp9_ - 4));
		_g_free0 (_data_->app_name);
		_data_->app_name = _data_->_tmp10_;
	}
	if (!DC_WEBXDC_AVAILABLE) {
		_data_->_tmp11_ = g_strdup ("Cannot Start Webxdc App");
		_g_free0 (_data_->title);
		_data_->title = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->app_name;
		_data_->_tmp13_ = g_strdup_printf ("This version of Parla was built without Webxdc " "support, so it cannot start “%s”. You can still " "download the .xdc file.", _data_->_tmp12_);
		_g_free0 (_data_->body);
		_data_->body = _data_->_tmp13_;
	} else {
		if (!dc_webxdc_enabled ()) {
			_data_->_tmp14_ = g_strdup ("Webxdc Apps Are Disabled");
			_g_free0 (_data_->title);
			_data_->title = _data_->_tmp14_;
			_data_->_tmp15_ = _data_->app_name;
			_data_->_tmp16_ = g_strdup_printf ("Webxdc apps are turned off in Settings, so Parla " "cannot start “%s”. You can still download the .xdc " "file.", _data_->_tmp15_);
			_g_free0 (_data_->body);
			_data_->body = _data_->_tmp16_;
		} else {
			_data_->_tmp17_ = g_strdup ("Open Webxdc App?");
			_g_free0 (_data_->title);
			_data_->title = _data_->_tmp17_;
			_data_->_tmp18_ = _data_->app_name;
			_data_->_tmp19_ = g_strdup_printf ("Start “%s” in Parla, or download its .xdc file " "without opening it.", _data_->_tmp18_);
			_g_free0 (_data_->body);
			_data_->body = _data_->_tmp19_;
		}
	}
	_data_->_tmp20_ = _data_->title;
	_data_->_tmp21_ = _data_->body;
	_data_->_tmp22_ = (AdwAlertDialog*) adw_alert_dialog_new (_data_->_tmp20_, _data_->_tmp21_);
	g_object_ref_sink (_data_->_tmp22_);
	_data_->dialog = _data_->_tmp22_;
	_data_->_tmp23_ = _data_->dialog;
	adw_alert_dialog_add_response (_data_->_tmp23_, "cancel", "Cancel");
	_data_->_tmp24_ = _data_->dialog;
	adw_alert_dialog_add_response (_data_->_tmp24_, "download", "Download File");
	if (_data_->can_start) {
		_data_->_tmp25_ = _data_->dialog;
		adw_alert_dialog_add_response (_data_->_tmp25_, "start", "Start App");
		_data_->_tmp26_ = _data_->dialog;
		adw_alert_dialog_set_response_appearance (_data_->_tmp26_, "start", ADW_RESPONSE_SUGGESTED);
		_data_->_tmp27_ = _data_->dialog;
		adw_alert_dialog_set_default_response (_data_->_tmp27_, "start");
	} else {
		_data_->_tmp28_ = _data_->dialog;
		adw_alert_dialog_set_response_appearance (_data_->_tmp28_, "download", ADW_RESPONSE_SUGGESTED);
		_data_->_tmp29_ = _data_->dialog;
		adw_alert_dialog_set_default_response (_data_->_tmp29_, "download");
	}
	_data_->_tmp30_ = _data_->dialog;
	adw_alert_dialog_set_close_response (_data_->_tmp30_, "cancel");
	_data_->_tmp31_ = _data_->dialog;
	_data_->_state_ = 1;
	adw_alert_dialog_choose (_data_->_tmp31_, _data_->parent, NULL, dc_window_prompt_webxdc_app_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp32_ = adw_alert_dialog_choose_finish (_data_->_tmp31_, _data_->_res_);
	_data_->_tmp33_ = g_strdup (_data_->_tmp32_);
	_data_->response = _data_->_tmp33_;
	_data_->_tmp34_ = _data_->response;
	if (g_strcmp0 (_data_->_tmp34_, "cancel") == 0) {
		_g_free0 (_data_->response);
		_g_object_unref0 (_data_->dialog);
		_g_free0 (_data_->body);
		_g_free0 (_data_->title);
		_g_free0 (_data_->app_name);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 2;
	dc_window_ensure_webxdc_file (_data_->self, _data_->app_rpc, _data_->msg, dc_window_prompt_webxdc_app_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp35_ = dc_window_ensure_webxdc_file_finish (_data_->self, _data_->_res_);
	_data_->local_msg = _data_->_tmp35_;
	_data_->_tmp36_ = _data_->local_msg;
	if (_data_->_tmp36_ == NULL) {
		_g_object_unref0 (_data_->local_msg);
		_g_free0 (_data_->response);
		_g_object_unref0 (_data_->dialog);
		_g_free0 (_data_->body);
		_g_free0 (_data_->title);
		_g_free0 (_data_->app_name);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp37_ = _data_->response;
	if (g_strcmp0 (_data_->_tmp37_, "start") == 0) {
		_data_->_tmp38_ = _data_->local_msg;
		dc_webxdc_open ((GtkWindow*) _data_->self, _data_->app_rpc, _data_->_tmp38_);
	} else {
		_data_->_tmp39_ = _data_->response;
		if (g_strcmp0 (_data_->_tmp39_, "download") == 0) {
			_data_->_tmp40_ = _data_->local_msg;
			_data_->_tmp41_ = dc_message_get_file_path (_data_->_tmp40_);
			_data_->_tmp42_ = _data_->_tmp41_;
			_data_->_tmp43_ = _data_->local_msg;
			_data_->_tmp44_ = dc_message_get_file_name (_data_->_tmp43_);
			_data_->_tmp45_ = _data_->_tmp44_;
			_data_->_state_ = 3;
			dc_window_save_attachment (_data_->self, _data_->_tmp42_, _data_->_tmp45_, dc_window_prompt_webxdc_app_ready, _data_);
			return FALSE;
			_state_3:
			dc_window_save_attachment_finish (_data_->self, _data_->_res_);
		}
	}
	_g_object_unref0 (_data_->local_msg);
	_g_free0 (_data_->response);
	_g_object_unref0 (_data_->dialog);
	_g_free0 (_data_->body);
	_g_free0 (_data_->title);
	_g_free0 (_data_->app_name);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_run_webxdc_instance_data_free (gpointer _data)
{
	DcWindowRunWebxdcInstanceData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->msg);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowRunWebxdcInstanceData, _data_);
}

void
dc_window_run_webxdc_instance (DcWindow* self,
                               gint acct_id,
                               DcMessage* msg,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DcWindowRunWebxdcInstanceData* _data_;
	DcWindow* _tmp0_;
	DcMessage* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (msg != NULL);
	_data_ = g_slice_new0 (DcWindowRunWebxdcInstanceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_run_webxdc_instance_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_tmp1_ = _g_object_ref0 (msg);
	_g_object_unref0 (_data_->msg);
	_data_->msg = _tmp1_;
	dc_window_run_webxdc_instance_co (_data_);
}

gboolean
dc_window_run_webxdc_instance_finish (DcWindow* self,
                                      GAsyncResult* _res_)
{
	gboolean result;
	DcWindowRunWebxdcInstanceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

/** Start (or re-present) a Webxdc instance from the Apps manager.
            The instance may live in another profile; switch first so the
            app window talks to the account its chat belongs to. */
static void
dc_window_run_webxdc_instance_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DcWindowRunWebxdcInstanceData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_run_webxdc_instance_co (_data_);
}

static gboolean
dc_window_run_webxdc_instance_co (DcWindowRunWebxdcInstanceData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!DC_WEBXDC_AVAILABLE) {
		dc_window_show_toast (_data_->self, "This build of Parla has no Webxdc support");
		_data_->result = FALSE;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (!dc_webxdc_enabled ()) {
		dc_window_show_toast (_data_->self, "Webxdc apps are disabled in Settings");
		_data_->result = FALSE;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = _data_->self->priv->rpc;
	_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (_data_->acct_id != _data_->_tmp3_) {
		_data_->_state_ = 1;
		dc_window_switch_account (_data_->self, _data_->acct_id, dc_window_run_webxdc_instance_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp0_ = !dc_window_switch_account_finish (_data_->self, _data_->_res_);
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		_data_->result = FALSE;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->self->priv->rpc;
	_data_->_state_ = 2;
	dc_window_ensure_webxdc_file (_data_->self, _data_->_tmp4_, _data_->msg, dc_window_run_webxdc_instance_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp5_ = dc_window_ensure_webxdc_file_finish (_data_->self, _data_->_res_);
	_data_->local_msg = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->local_msg;
	if (_data_->_tmp6_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->local_msg);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp7_ = _data_->self->priv->rpc;
	_data_->_tmp8_ = _data_->local_msg;
	dc_webxdc_open ((GtkWindow*) _data_->self, _data_->_tmp7_, _data_->_tmp8_);
	_data_->result = TRUE;
	_g_object_unref0 (_data_->local_msg);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_ensure_webxdc_file_data_free (gpointer _data)
{
	DcWindowEnsureWebxdcFileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->app_rpc);
	_g_object_unref0 (_data_->msg);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowEnsureWebxdcFileData, _data_);
}

static void
dc_window_ensure_webxdc_file (DcWindow* self,
                              DcRpcClient* app_rpc,
                              DcMessage* msg,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	DcWindowEnsureWebxdcFileData* _data_;
	DcWindow* _tmp0_;
	DcRpcClient* _tmp1_;
	DcMessage* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (app_rpc != NULL);
	g_return_if_fail (msg != NULL);
	_data_ = g_slice_new0 (DcWindowEnsureWebxdcFileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_ensure_webxdc_file_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (app_rpc);
	_g_object_unref0 (_data_->app_rpc);
	_data_->app_rpc = _tmp1_;
	_tmp2_ = _g_object_ref0 (msg);
	_g_object_unref0 (_data_->msg);
	_data_->msg = _tmp2_;
	dc_window_ensure_webxdc_file_co (_data_);
}

static DcMessage*
dc_window_ensure_webxdc_file_finish (DcWindow* self,
                                     GAsyncResult* _res_)
{
	DcMessage* result;
	DcWindowEnsureWebxdcFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_window_ensure_webxdc_file_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	DcWindowEnsureWebxdcFileData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_ensure_webxdc_file_co (_data_);
}

static gboolean
dc_window_ensure_webxdc_file_co (DcWindowEnsureWebxdcFileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dc_message_get_has_local_file (_data_->msg);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_) {
		_data_->_tmp2_ = _g_object_ref0 (_data_->msg);
		_data_->result = _data_->_tmp2_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = dc_message_get_is_downloading_full_message (_data_->msg);
	_data_->_tmp4_ = _data_->_tmp3_;
	if (_data_->_tmp4_) {
		dc_window_show_toast (_data_->self, "The app file is still downloading");
		_data_->result = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = dc_message_get_can_download_full_message (_data_->msg);
	_data_->_tmp6_ = _data_->_tmp5_;
	if (!_data_->_tmp6_) {
		dc_window_show_toast (_data_->self, "The app file is not available for download");
		_data_->result = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		dc_window_show_toast (_data_->self, "Downloading app…");
		_data_->_tmp7_ = dc_message_get_id (_data_->msg);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_state_ = 1;
		dc_rpc_client_download_full_message (_data_->app_rpc, _data_->_tmp8_, dc_window_ensure_webxdc_file_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_download_full_message_finish (_data_->app_rpc, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp9_ = dc_message_get_id (_data_->msg);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_state_ = 2;
		dc_rpc_client_fetch_message (_data_->app_rpc, _data_->_tmp10_, dc_window_ensure_webxdc_file_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp11_ = dc_rpc_client_fetch_message_finish (_data_->app_rpc, _data_->_res_, &_data_->_inner_error0_);
		_data_->downloaded = _data_->_tmp11_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp13_ = _data_->downloaded;
		if (_data_->_tmp13_ != NULL) {
			_data_->_tmp14_ = _data_->downloaded;
			_data_->_tmp15_ = dc_message_get_has_local_file (_data_->_tmp14_);
			_data_->_tmp16_ = _data_->_tmp15_;
			_data_->_tmp12_ = _data_->_tmp16_;
		} else {
			_data_->_tmp12_ = FALSE;
		}
		if (_data_->_tmp12_) {
			_data_->result = _data_->downloaded;
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		dc_window_show_toast (_data_->self, "The app file has not finished downloading");
		_g_object_unref0 (_data_->downloaded);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp17_ = _data_->e;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		_data_->_tmp19_ = g_strconcat ("App download failed: ", _data_->_tmp18_, NULL);
		_data_->_tmp20_ = _data_->_tmp19_;
		dc_window_show_toast (_data_->self, _data_->_tmp20_);
		_g_free0 (_data_->_tmp20_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
dc_window_request_reload_chats (DcWindow* self)
{
	DcEventHandler* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->events;
	if (_tmp0_ != NULL) {
		DcEventHandler* _tmp1_;
		_tmp1_ = self->priv->events;
		dc_event_handler_schedule_chats_reload (_tmp1_);
	}
}

static gpointer
_dc_window_pending_notification_ref0 (gpointer self)
{
	return self ? dc_window_pending_notification_ref (self) : NULL;
}

static gboolean
__lambda364_ (DcWindow* self)
{
	gboolean result;
	self->priv->notification_flush_timer = (guint) 0;
	dc_window_flush_chat_notifications (self, NULL, NULL);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda364__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda364_ ((DcWindow*) self);
	return result;
}

static void
dc_window_queue_chat_notification (DcWindow* self,
                                   gint acct_id,
                                   gint chat_id,
                                   gint msg_id,
                                   gint contact_id,
                                   const gchar* reaction)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_;
	gboolean _tmp9_;
	DcWindowPendingNotification* p = NULL;
	DcWindowPendingNotification* _tmp12_;
	DcWindowPendingNotification* _tmp13_;
	DcWindowPendingNotification* _tmp14_;
	DcWindowPendingNotification* _tmp15_;
	DcWindowPendingNotification* _tmp16_;
	DcWindowPendingNotification* _tmp17_;
	gchar* _tmp18_;
	GPtrArray* _tmp19_;
	DcWindowPendingNotification* _tmp20_;
	DcWindowPendingNotification* _tmp21_;
	g_return_if_fail (self != NULL);
	if (acct_id <= 0) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = chat_id <= 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		DcEventHandler* _tmp3_;
		_tmp3_ = self->priv->events;
		_tmp1_ = _tmp3_ == NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		DcSettingsManager* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = self->settings;
		_tmp5_ = dc_settings_manager_get_notifications_enabled (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = !_tmp6_;
	}
	if (_tmp0_) {
		return;
	}
	_tmp8_ = gtk_widget_get_visible ((GtkWidget*) self);
	_tmp9_ = _tmp8_;
	if (_tmp9_) {
		gboolean _tmp10_;
		gboolean _tmp11_;
		g_object_get ((GtkWindow*) self, "is-active", &_tmp10_, NULL);
		_tmp11_ = _tmp10_;
		_tmp7_ = _tmp11_;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		return;
	}
	_tmp12_ = dc_window_pending_notification_new ();
	p = _tmp12_;
	_tmp13_ = p;
	_tmp13_->acct_id = acct_id;
	_tmp14_ = p;
	_tmp14_->chat_id = chat_id;
	_tmp15_ = p;
	_tmp15_->msg_id = msg_id;
	_tmp16_ = p;
	_tmp16_->contact_id = contact_id;
	_tmp17_ = p;
	_tmp18_ = g_strdup (reaction);
	_g_free0 (_tmp17_->reaction);
	_tmp17_->reaction = _tmp18_;
	_tmp19_ = self->priv->pending_notifications;
	_tmp20_ = p;
	_tmp21_ = _dc_window_pending_notification_ref0 (_tmp20_);
	g_ptr_array_add (_tmp19_, _tmp21_);
	if (self->priv->notification_flush_timer > ((guint) 0)) {
		_dc_window_pending_notification_unref0 (p);
		return;
	}
	self->priv->notification_flush_timer = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 400, ___lambda364__gsource_func, g_object_ref (self), g_object_unref);
	_dc_window_pending_notification_unref0 (p);
}

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

static void
dc_window_flush_chat_notifications (DcWindow* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DcWindowFlushChatNotificationsData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowFlushChatNotificationsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_flush_chat_notifications_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_flush_chat_notifications_co (_data_);
}

static void
dc_window_flush_chat_notifications_finish (DcWindow* self,
                                           GAsyncResult* _res_)
{
	DcWindowFlushChatNotificationsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gpointer
_g_ptr_array_ref0 (gpointer self)
{
	return self ? g_ptr_array_ref (self) : NULL;
}

static void
_vala_array_add11 (gint* * array,
                   gint* length,
                   gint* size,
                   gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static void
dc_window_flush_chat_notifications_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DcWindowFlushChatNotificationsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_flush_chat_notifications_co (_data_);
}

static gboolean
dc_window_flush_chat_notifications_co (DcWindowFlushChatNotificationsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->pending_notifications;
	_data_->_tmp1_ = _g_ptr_array_ref0 (_data_->_tmp0_);
	_data_->items = _data_->_tmp1_;
	_data_->_tmp2_ = g_ptr_array_new_full ((guint) 0, _dc_window_pending_notification_unref0_);
	_g_ptr_array_unref0 (_data_->self->priv->pending_notifications);
	_data_->self->priv->pending_notifications = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->self->priv->events;
	if (_data_->_tmp4_ == NULL) {
		_data_->_tmp3_ = TRUE;
	} else {
		_data_->_tmp5_ = _data_->self->settings;
		_data_->_tmp6_ = dc_settings_manager_get_notifications_enabled (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp3_ = !_data_->_tmp7_;
	}
	if (_data_->_tmp3_) {
		_g_ptr_array_unref0 (_data_->items);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = g_new0 (gint, 0);
	_data_->acct_ids = _data_->_tmp8_;
	_data_->acct_ids_length1 = 0;
	_data_->_acct_ids_size_ = _data_->acct_ids_length1;
	{
		_data_->i = (guint) 0;
		{
			_data_->_tmp9_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp9_) {
					_data_->_tmp10_ = _data_->i;
					_data_->i = _data_->_tmp10_ + 1;
				}
				_data_->_tmp9_ = FALSE;
				_data_->_tmp11_ = _data_->items;
				_data_->_tmp12_ = vala_g_ptr_array_get_length (_data_->_tmp11_);
				_data_->_tmp13_ = _data_->_tmp12_;
				if (!(_data_->i < ((guint) _data_->_tmp13_))) {
					break;
				}
				_data_->_tmp14_ = _data_->items;
				_data_->_tmp15_ = g_ptr_array_index (_data_->_tmp14_, _data_->i);
				_data_->acct_id = ((DcWindowPendingNotification*) _data_->_tmp15_)->acct_id;
				_data_->_tmp16_ = _data_->acct_ids;
				_data_->_tmp16__length1 = _data_->acct_ids_length1;
				if (!dc_window_has_int (_data_->_tmp16_, (gint) _data_->_tmp16__length1, _data_->acct_id)) {
					_vala_array_add11 (&_data_->acct_ids, &_data_->acct_ids_length1, &_data_->_acct_ids_size_, _data_->acct_id);
				}
			}
		}
	}
	_data_->_tmp17_ = _data_->acct_ids;
	_data_->_tmp17__length1 = _data_->acct_ids_length1;
	{
		_data_->acct_id_collection_length1 = 0;
		_data_->_acct_id_collection_size_ = 0;
		_data_->acct_id_collection = _data_->_tmp17_;
		_data_->acct_id_collection_length1 = _data_->_tmp17__length1;
		for (_data_->acct_id_it = 0; _data_->acct_id_it < _data_->acct_id_collection_length1; _data_->acct_id_it = _data_->acct_id_it + 1) {
			_data_->_vala1_acct_id = _data_->acct_id_collection[_data_->acct_id_it];
			{
				_data_->_tmp18_ = g_ptr_array_new_full ((guint) 0, _dc_window_pending_notification_unref0_);
				_data_->acct_items = _data_->_tmp18_;
				{
					_data_->_vala1_i = (guint) 0;
					{
						_data_->_tmp19_ = TRUE;
						while (TRUE) {
							if (!_data_->_tmp19_) {
								_data_->_tmp20_ = _data_->_vala1_i;
								_data_->_vala1_i = _data_->_tmp20_ + 1;
							}
							_data_->_tmp19_ = FALSE;
							_data_->_tmp21_ = _data_->items;
							_data_->_tmp22_ = vala_g_ptr_array_get_length (_data_->_tmp21_);
							_data_->_tmp23_ = _data_->_tmp22_;
							if (!(_data_->_vala1_i < ((guint) _data_->_tmp23_))) {
								break;
							}
							_data_->_tmp24_ = _data_->items;
							_data_->_tmp25_ = g_ptr_array_index (_data_->_tmp24_, _data_->_vala1_i);
							_data_->_tmp26_ = _dc_window_pending_notification_ref0 ((DcWindowPendingNotification*) _data_->_tmp25_);
							_data_->item = _data_->_tmp26_;
							_data_->_tmp27_ = _data_->item;
							if (_data_->_tmp27_->acct_id == _data_->_vala1_acct_id) {
								_data_->_tmp28_ = _data_->acct_items;
								_data_->_tmp29_ = _data_->item;
								_data_->_tmp30_ = _dc_window_pending_notification_ref0 (_data_->_tmp29_);
								g_ptr_array_add (_data_->_tmp28_, _data_->_tmp30_);
							}
							_dc_window_pending_notification_unref0 (_data_->item);
						}
					}
				}
				_data_->_tmp31_ = _data_->acct_items;
				_data_->_state_ = 1;
				dc_window_notify_account_items (_data_->self, _data_->_vala1_acct_id, _data_->_tmp31_, dc_window_flush_chat_notifications_ready, _data_);
				return FALSE;
				_state_1:
				dc_window_notify_account_items_finish (_data_->self, _data_->_res_);
				_g_ptr_array_unref0 (_data_->acct_items);
			}
		}
	}
	_data_->acct_ids = (g_free (_data_->acct_ids), NULL);
	_g_ptr_array_unref0 (_data_->items);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_notify_account_items_data_free (gpointer _data)
{
	DcWindowNotifyAccountItemsData* _data_;
	_data_ = _data;
	_g_ptr_array_unref0 (_data_->items);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowNotifyAccountItemsData, _data_);
}

static void
dc_window_notify_account_items (DcWindow* self,
                                gint acct_id,
                                GPtrArray* items,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcWindowNotifyAccountItemsData* _data_;
	DcWindow* _tmp0_;
	GPtrArray* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (items != NULL);
	_data_ = g_slice_new0 (DcWindowNotifyAccountItemsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_notify_account_items_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_tmp1_ = _g_ptr_array_ref0 (items);
	_g_ptr_array_unref0 (_data_->items);
	_data_->items = _tmp1_;
	dc_window_notify_account_items_co (_data_);
}

static void
dc_window_notify_account_items_finish (DcWindow* self,
                                       GAsyncResult* _res_)
{
	DcWindowNotifyAccountItemsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
_vala_array_add12 (gint* * array,
                   gint* length,
                   gint* size,
                   gint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static void
dc_window_notify_account_items_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcWindowNotifyAccountItemsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_notify_account_items_co (_data_);
}

static gboolean
dc_window_notify_account_items_co (DcWindowNotifyAccountItemsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_new0 (gint, 0);
	_data_->chat_ids = _data_->_tmp0_;
	_data_->chat_ids_length1 = 0;
	_data_->_chat_ids_size_ = _data_->chat_ids_length1;
	_data_->messages = 0;
	{
		_data_->i = (guint) 0;
		{
			_data_->_tmp1_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp1_) {
					_data_->_tmp2_ = _data_->i;
					_data_->i = _data_->_tmp2_ + 1;
				}
				_data_->_tmp1_ = FALSE;
				_data_->_tmp3_ = vala_g_ptr_array_get_length (_data_->items);
				_data_->_tmp4_ = _data_->_tmp3_;
				if (!(_data_->i < ((guint) _data_->_tmp4_))) {
					break;
				}
				_data_->_tmp5_ = g_ptr_array_index (_data_->items, _data_->i);
				_data_->_tmp6_ = _dc_window_pending_notification_ref0 ((DcWindowPendingNotification*) _data_->_tmp5_);
				_data_->item = _data_->_tmp6_;
				_data_->_tmp7_ = _data_->item;
				_data_->_tmp8_ = _data_->_tmp7_->reaction;
				if (_data_->_tmp8_ == NULL) {
					_data_->_tmp9_ = _data_->messages;
					_data_->messages = _data_->_tmp9_ + 1;
				}
				_data_->_tmp10_ = _data_->chat_ids;
				_data_->_tmp10__length1 = _data_->chat_ids_length1;
				_data_->_tmp11_ = _data_->item;
				if (!dc_window_has_int (_data_->_tmp10_, (gint) _data_->_tmp10__length1, _data_->_tmp11_->chat_id)) {
					_data_->_tmp12_ = _data_->item;
					_vala_array_add12 (&_data_->chat_ids, &_data_->chat_ids_length1, &_data_->_chat_ids_size_, _data_->_tmp12_->chat_id);
				}
				_dc_window_pending_notification_unref0 (_data_->item);
			}
		}
	}
	_data_->_tmp13_ = _data_->chat_ids;
	_data_->_tmp13__length1 = _data_->chat_ids_length1;
	if (_data_->_tmp13__length1 > 3) {
		_data_->_tmp14_ = g_strdup_printf ("%d new messages", _data_->messages);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_state_ = 1;
		dc_window_prefix_background_account (_data_->self, _data_->acct_id, _data_->_tmp15_, dc_window_notify_account_items_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp16_ = dc_window_prefix_background_account_finish (_data_->self, _data_->_res_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_g_free0 (_data_->_tmp15_);
		_data_->title = _data_->_tmp17_;
		_data_->_tmp18_ = _data_->self->priv->events;
		_data_->_tmp19_ = _data_->title;
		_data_->_tmp20_ = _data_->chat_ids;
		_data_->_tmp20__length1 = _data_->chat_ids_length1;
		_data_->_tmp21_ = g_strdup_printf ("In %d chats", _data_->_tmp20__length1);
		_data_->_tmp22_ = _data_->_tmp21_;
		dc_event_handler_send_chat_notification (_data_->_tmp18_, _data_->acct_id, 0, _data_->_tmp19_, _data_->_tmp22_);
		_g_free0 (_data_->_tmp22_);
		_g_free0 (_data_->title);
		_data_->chat_ids = (g_free (_data_->chat_ids), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp23_ = _data_->chat_ids;
	_data_->_tmp23__length1 = _data_->chat_ids_length1;
	{
		_data_->chat_id_collection_length1 = 0;
		_data_->_chat_id_collection_size_ = 0;
		_data_->chat_id_collection = _data_->_tmp23_;
		_data_->chat_id_collection_length1 = _data_->_tmp23__length1;
		for (_data_->chat_id_it = 0; _data_->chat_id_it < _data_->chat_id_collection_length1; _data_->chat_id_it = _data_->chat_id_it + 1) {
			_data_->chat_id = _data_->chat_id_collection[_data_->chat_id_it];
			{
				_data_->_tmp24_ = g_ptr_array_new_full ((guint) 0, _dc_window_pending_notification_unref0_);
				_data_->group = _data_->_tmp24_;
				{
					_data_->_vala1_i = (guint) 0;
					{
						_data_->_tmp25_ = TRUE;
						while (TRUE) {
							if (!_data_->_tmp25_) {
								_data_->_tmp26_ = _data_->_vala1_i;
								_data_->_vala1_i = _data_->_tmp26_ + 1;
							}
							_data_->_tmp25_ = FALSE;
							_data_->_tmp27_ = vala_g_ptr_array_get_length (_data_->items);
							_data_->_tmp28_ = _data_->_tmp27_;
							if (!(_data_->_vala1_i < ((guint) _data_->_tmp28_))) {
								break;
							}
							_data_->_tmp29_ = g_ptr_array_index (_data_->items, _data_->_vala1_i);
							_data_->_tmp30_ = _dc_window_pending_notification_ref0 ((DcWindowPendingNotification*) _data_->_tmp29_);
							_data_->_vala1_item = _data_->_tmp30_;
							_data_->_tmp31_ = _data_->_vala1_item;
							if (_data_->_tmp31_->chat_id == _data_->chat_id) {
								_data_->_tmp32_ = _data_->group;
								_data_->_tmp33_ = _data_->_vala1_item;
								_data_->_tmp34_ = _dc_window_pending_notification_ref0 (_data_->_tmp33_);
								g_ptr_array_add (_data_->_tmp32_, _data_->_tmp34_);
							}
							_dc_window_pending_notification_unref0 (_data_->_vala1_item);
						}
					}
				}
				_data_->_tmp35_ = _data_->group;
				_data_->_state_ = 2;
				dc_window_notify_chat_group (_data_->self, _data_->acct_id, _data_->chat_id, _data_->_tmp35_, dc_window_notify_account_items_ready, _data_);
				return FALSE;
				_state_2:
				dc_window_notify_chat_group_finish (_data_->self, _data_->_res_);
				_g_ptr_array_unref0 (_data_->group);
			}
		}
	}
	_data_->chat_ids = (g_free (_data_->chat_ids), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_notify_chat_group_data_free (gpointer _data)
{
	DcWindowNotifyChatGroupData* _data_;
	_data_ = _data;
	_g_ptr_array_unref0 (_data_->group);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowNotifyChatGroupData, _data_);
}

static void
dc_window_notify_chat_group (DcWindow* self,
                             gint acct_id,
                             gint chat_id,
                             GPtrArray* group,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_)
{
	DcWindowNotifyChatGroupData* _data_;
	DcWindow* _tmp0_;
	GPtrArray* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (group != NULL);
	_data_ = g_slice_new0 (DcWindowNotifyChatGroupData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_notify_chat_group_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_data_->chat_id = chat_id;
	_tmp1_ = _g_ptr_array_ref0 (group);
	_g_ptr_array_unref0 (_data_->group);
	_data_->group = _tmp1_;
	dc_window_notify_chat_group_co (_data_);
}

static void
dc_window_notify_chat_group_finish (DcWindow* self,
                                    GAsyncResult* _res_)
{
	DcWindowNotifyChatGroupData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_notify_chat_group_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_)
{
	DcWindowNotifyChatGroupData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_notify_chat_group_co (_data_);
}

static gboolean
dc_window_notify_chat_group_co (DcWindowNotifyChatGroupData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->chat_name = NULL;
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_full_chat_by_id_for (_data_->_tmp0_, _data_->acct_id, _data_->chat_id, dc_window_notify_chat_group_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = dc_rpc_client_get_full_chat_by_id_for_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		_data_->chat_obj = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->chat_obj;
		if (_data_->_tmp2_ != NULL) {
			_data_->_tmp3_ = _data_->chat_obj;
			if (dc_json_bool (_data_->_tmp3_, "isMuted")) {
				_json_object_unref0 (_data_->chat_obj);
				_g_free0 (_data_->chat_name);
				g_task_return_pointer (_data_->_async_result, _data_, NULL);
				if (_data_->_state_ != 0) {
					while (!g_task_get_completed (_data_->_async_result)) {
						g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
					}
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp4_ = _data_->chat_obj;
			_data_->_tmp5_ = dc_json_str (_data_->_tmp4_, "name");
			_g_free0 (_data_->chat_name);
			_data_->chat_name = _data_->_tmp5_;
		}
		_json_object_unref0 (_data_->chat_obj);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->chat_name);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->messages = 0;
	_data_->msg_item = NULL;
	{
		_data_->i = (guint) 0;
		{
			_data_->_tmp6_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp6_) {
					_data_->_tmp7_ = _data_->i;
					_data_->i = _data_->_tmp7_ + 1;
				}
				_data_->_tmp6_ = FALSE;
				_data_->_tmp8_ = vala_g_ptr_array_get_length (_data_->group);
				_data_->_tmp9_ = _data_->_tmp8_;
				if (!(_data_->i < ((guint) _data_->_tmp9_))) {
					break;
				}
				_data_->_tmp10_ = g_ptr_array_index (_data_->group, _data_->i);
				_data_->_tmp11_ = ((DcWindowPendingNotification*) _data_->_tmp10_)->reaction;
				if (_data_->_tmp11_ == NULL) {
					_data_->_tmp12_ = _data_->messages;
					_data_->messages = _data_->_tmp12_ + 1;
					_data_->_tmp13_ = g_ptr_array_index (_data_->group, _data_->i);
					_data_->_tmp14_ = _dc_window_pending_notification_ref0 ((DcWindowPendingNotification*) _data_->_tmp13_);
					_dc_window_pending_notification_unref0 (_data_->msg_item);
					_data_->msg_item = _data_->_tmp14_;
				}
			}
		}
	}
	_data_->_tmp15_ = _data_->self->settings;
	_data_->_tmp16_ = dc_settings_manager_get_show_notification_contents (_data_->_tmp15_);
	_data_->_tmp17_ = _data_->_tmp16_;
	_data_->show = _data_->_tmp17_;
	_data_->_tmp19_ = _data_->chat_name;
	_data_->_tmp18_ = _data_->_tmp19_;
	if (_data_->_tmp18_ == NULL) {
		_data_->_tmp18_ = "New message";
	}
	_data_->_tmp20_ = g_strdup (_data_->_tmp18_);
	_data_->title = _data_->_tmp20_;
	if (_data_->messages == 0) {
		_data_->_tmp21_ = "New reaction";
	} else {
		_data_->_tmp21_ = "New message";
	}
	_data_->_tmp22_ = g_strdup (_data_->_tmp21_);
	_data_->body = _data_->_tmp22_;
	if (_data_->messages > 1) {
		_data_->_tmp23_ = g_strdup_printf ("%d new messages", _data_->messages);
		_g_free0 (_data_->body);
		_data_->body = _data_->_tmp23_;
	} else {
		if (_data_->messages == 1) {
			_data_->_tmp24_ = _data_->show;
		} else {
			_data_->_tmp24_ = FALSE;
		}
		if (_data_->_tmp24_) {
			{
				_data_->_tmp25_ = _data_->self->priv->rpc;
				_data_->_tmp26_ = _data_->msg_item;
				_data_->_state_ = 2;
				dc_rpc_client_fetch_message_for (_data_->_tmp25_, _data_->acct_id, _data_->_tmp26_->msg_id, NULL, dc_window_notify_chat_group_ready, _data_);
				return FALSE;
				_state_2:
				_data_->_tmp27_ = dc_rpc_client_fetch_message_for_finish (_data_->_tmp25_, _data_->_res_, &_data_->_inner_error0_);
				_data_->msg = _data_->_tmp27_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
				_data_->_tmp28_ = _data_->msg;
				if (_data_->_tmp28_ != NULL) {
					_data_->_tmp30_ = _data_->msg;
					_data_->_tmp31_ = dc_message_get_sender_name (_data_->_tmp30_);
					_data_->_tmp32_ = _data_->_tmp31_;
					_data_->_tmp29_ = _data_->_tmp32_;
					if (_data_->_tmp29_ == NULL) {
						_data_->_tmp34_ = _data_->msg;
						_data_->_tmp35_ = dc_message_get_sender_address (_data_->_tmp34_);
						_data_->_tmp36_ = _data_->_tmp35_;
						_data_->_tmp33_ = _data_->_tmp36_;
						if (_data_->_tmp33_ == NULL) {
							_data_->_tmp37_ = _data_->title;
							_data_->_tmp33_ = _data_->_tmp37_;
						}
						_data_->_tmp29_ = _data_->_tmp33_;
					}
					_data_->_tmp38_ = g_strdup (_data_->_tmp29_);
					_data_->sender = _data_->_tmp38_;
					_data_->_tmp42_ = _data_->chat_name;
					if (_data_->_tmp42_ != NULL) {
						_data_->_tmp43_ = _data_->chat_name;
						_data_->_tmp44_ = strlen (_data_->_tmp43_);
						_data_->_tmp45_ = _data_->_tmp44_;
						_data_->_tmp41_ = _data_->_tmp45_ > 0;
					} else {
						_data_->_tmp41_ = FALSE;
					}
					if (_data_->_tmp41_) {
						_data_->_tmp46_ = _data_->chat_name;
						_data_->_tmp47_ = _data_->sender;
						_data_->_tmp40_ = g_strcmp0 (_data_->_tmp46_, _data_->_tmp47_) != 0;
					} else {
						_data_->_tmp40_ = FALSE;
					}
					if (_data_->_tmp40_) {
						_data_->_tmp48_ = _data_->sender;
						_data_->_tmp49_ = _data_->chat_name;
						_data_->_tmp50_ = g_strdup_printf ("%s (%s)", _data_->_tmp48_, _data_->_tmp49_);
						_g_free0 (_data_->_tmp39_);
						_data_->_tmp39_ = _data_->_tmp50_;
					} else {
						_data_->_tmp51_ = _data_->sender;
						_data_->_tmp52_ = g_strdup (_data_->_tmp51_);
						_g_free0 (_data_->_tmp39_);
						_data_->_tmp39_ = _data_->_tmp52_;
					}
					_data_->_tmp53_ = _data_->_tmp39_;
					_data_->_tmp39_ = NULL;
					_g_free0 (_data_->title);
					_data_->title = _data_->_tmp53_;
					_data_->_tmp56_ = _data_->msg;
					_data_->_tmp57_ = dc_message_get_text (_data_->_tmp56_);
					_data_->_tmp58_ = _data_->_tmp57_;
					if (_data_->_tmp58_ != NULL) {
						_data_->_tmp59_ = _data_->msg;
						_data_->_tmp60_ = dc_message_get_text (_data_->_tmp59_);
						_data_->_tmp61_ = _data_->_tmp60_;
						_data_->_tmp62_ = strlen (_data_->_tmp61_);
						_data_->_tmp63_ = _data_->_tmp62_;
						_data_->_tmp55_ = _data_->_tmp63_ > 0;
					} else {
						_data_->_tmp55_ = FALSE;
					}
					if (_data_->_tmp55_) {
						_data_->_tmp64_ = _data_->msg;
						_data_->_tmp65_ = dc_message_get_text (_data_->_tmp64_);
						_data_->_tmp66_ = _data_->_tmp65_;
						_data_->_tmp54_ = _data_->_tmp66_;
					} else {
						_data_->_tmp69_ = _data_->msg;
						_data_->_tmp70_ = dc_message_get_file_name (_data_->_tmp69_);
						_data_->_tmp71_ = _data_->_tmp70_;
						if (_data_->_tmp71_ != NULL) {
							_data_->_tmp72_ = _data_->msg;
							_data_->_tmp73_ = dc_message_get_file_name (_data_->_tmp72_);
							_data_->_tmp74_ = _data_->_tmp73_;
							_data_->_tmp75_ = strlen (_data_->_tmp74_);
							_data_->_tmp76_ = _data_->_tmp75_;
							_data_->_tmp68_ = _data_->_tmp76_ > 0;
						} else {
							_data_->_tmp68_ = FALSE;
						}
						if (_data_->_tmp68_) {
							_data_->_tmp77_ = _data_->msg;
							_data_->_tmp78_ = dc_message_get_file_name (_data_->_tmp77_);
							_data_->_tmp79_ = _data_->_tmp78_;
							_data_->_tmp67_ = _data_->_tmp79_;
						} else {
							_data_->_tmp67_ = "New message";
						}
						_data_->_tmp54_ = _data_->_tmp67_;
					}
					_data_->_tmp80_ = g_strdup (_data_->_tmp54_);
					_g_free0 (_data_->body);
					_data_->body = _data_->_tmp80_;
					_g_free0 (_data_->_tmp39_);
					_g_free0 (_data_->sender);
				}
				_g_object_unref0 (_data_->msg);
			}
			goto __finally1;
			__catch1_g_error:
			{
				g_clear_error (&_data_->_inner_error0_);
			}
			__finally1:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->body);
				_g_free0 (_data_->title);
				_dc_window_pending_notification_unref0 (_data_->msg_item);
				_g_free0 (_data_->chat_name);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		} else {
			if (_data_->messages == 0) {
				_data_->_tmp81_ = _data_->show;
			} else {
				_data_->_tmp81_ = FALSE;
			}
			if (_data_->_tmp81_) {
				_data_->_tmp82_ = vala_g_ptr_array_get_length (_data_->group);
				_data_->_tmp83_ = _data_->_tmp82_;
				_data_->_tmp84_ = g_ptr_array_index (_data_->group, (guint) (_data_->_tmp83_ - 1));
				_data_->_tmp85_ = _dc_window_pending_notification_ref0 ((DcWindowPendingNotification*) _data_->_tmp84_);
				_data_->r = _data_->_tmp85_;
				_data_->_tmp86_ = g_strdup ("");
				_data_->reactor = _data_->_tmp86_;
				{
					_data_->_tmp87_ = _data_->self->priv->rpc;
					_data_->_tmp88_ = _data_->r;
					_data_->_state_ = 3;
					dc_rpc_client_get_contact_for (_data_->_tmp87_, _data_->acct_id, _data_->_tmp88_->contact_id, dc_window_notify_chat_group_ready, _data_);
					return FALSE;
					_state_3:
					_data_->_tmp89_ = dc_rpc_client_get_contact_for_finish (_data_->_tmp87_, _data_->_res_, &_data_->_inner_error0_);
					_data_->c = _data_->_tmp89_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch2_g_error;
					}
					_data_->_tmp90_ = _data_->c;
					if (_data_->_tmp90_ != NULL) {
						_data_->_tmp92_ = _data_->c;
						_data_->_tmp93_ = dc_json_str (_data_->_tmp92_, "displayName");
						_data_->_tmp91_ = _data_->_tmp93_;
						if (_data_->_tmp91_ == NULL) {
							_data_->_tmp94_ = g_strdup ("");
							_g_free0 (_data_->_tmp91_);
							_data_->_tmp91_ = _data_->_tmp94_;
						}
						_data_->_tmp95_ = _data_->_tmp91_;
						_data_->_tmp91_ = NULL;
						_g_free0 (_data_->reactor);
						_data_->reactor = _data_->_tmp95_;
						_g_free0 (_data_->_tmp91_);
					}
					_json_object_unref0 (_data_->c);
				}
				goto __finally2;
				__catch2_g_error:
				{
					g_clear_error (&_data_->_inner_error0_);
				}
				__finally2:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_free0 (_data_->reactor);
					_dc_window_pending_notification_unref0 (_data_->r);
					_g_free0 (_data_->body);
					_g_free0 (_data_->title);
					_dc_window_pending_notification_unref0 (_data_->msg_item);
					_g_free0 (_data_->chat_name);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp97_ = _data_->reactor;
				_data_->_tmp98_ = strlen (_data_->_tmp97_);
				_data_->_tmp99_ = _data_->_tmp98_;
				if (_data_->_tmp99_ > 0) {
					_data_->_tmp100_ = _data_->reactor;
					_data_->_tmp101_ = _data_->r;
					_data_->_tmp102_ = _data_->_tmp101_->reaction;
					_data_->_tmp103_ = g_strdup_printf ("%s reacted %s", _data_->_tmp100_, _data_->_tmp102_);
					_g_free0 (_data_->_tmp96_);
					_data_->_tmp96_ = _data_->_tmp103_;
				} else {
					_data_->_tmp104_ = _data_->r;
					_data_->_tmp105_ = _data_->_tmp104_->reaction;
					_data_->_tmp106_ = g_strdup_printf ("Reacted %s", _data_->_tmp105_);
					_g_free0 (_data_->_tmp96_);
					_data_->_tmp96_ = _data_->_tmp106_;
				}
				_data_->_tmp107_ = _data_->_tmp96_;
				_data_->_tmp96_ = NULL;
				_g_free0 (_data_->body);
				_data_->body = _data_->_tmp107_;
				_g_free0 (_data_->_tmp96_);
				_g_free0 (_data_->reactor);
				_dc_window_pending_notification_unref0 (_data_->r);
			}
		}
	}
	_data_->_tmp108_ = _data_->title;
	_data_->_state_ = 4;
	dc_window_prefix_background_account (_data_->self, _data_->acct_id, _data_->_tmp108_, dc_window_notify_chat_group_ready, _data_);
	return FALSE;
	_state_4:
	_data_->_tmp109_ = dc_window_prefix_background_account_finish (_data_->self, _data_->_res_);
	_g_free0 (_data_->title);
	_data_->title = _data_->_tmp109_;
	_data_->_tmp110_ = _data_->self->priv->events;
	_data_->_tmp111_ = _data_->title;
	_data_->_tmp112_ = _data_->body;
	dc_event_handler_send_chat_notification (_data_->_tmp110_, _data_->acct_id, _data_->chat_id, _data_->_tmp111_, _data_->_tmp112_);
	_g_free0 (_data_->body);
	_g_free0 (_data_->title);
	_dc_window_pending_notification_unref0 (_data_->msg_item);
	_g_free0 (_data_->chat_name);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_prefix_background_account_data_free (gpointer _data)
{
	DcWindowPrefixBackgroundAccountData* _data_;
	_data_ = _data;
	_g_free0 (_data_->title);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowPrefixBackgroundAccountData, _data_);
}

static void
dc_window_prefix_background_account (DcWindow* self,
                                     gint acct_id,
                                     const gchar* title,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcWindowPrefixBackgroundAccountData* _data_;
	DcWindow* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	_data_ = g_slice_new0 (DcWindowPrefixBackgroundAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_prefix_background_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_tmp1_ = g_strdup (title);
	_g_free0 (_data_->title);
	_data_->title = _tmp1_;
	dc_window_prefix_background_account_co (_data_);
}

static gchar*
dc_window_prefix_background_account_finish (DcWindow* self,
                                            GAsyncResult* _res_)
{
	gchar* result;
	DcWindowPrefixBackgroundAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_window_prefix_background_account_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcWindowPrefixBackgroundAccountData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_prefix_background_account_co (_data_);
}

static gboolean
dc_window_prefix_background_account_co (DcWindowPrefixBackgroundAccountData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->acct_id == _data_->_tmp2_) {
		_data_->_tmp3_ = g_strdup (_data_->title);
		_data_->result = _data_->_tmp3_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_config (_data_->_tmp4_, "displayname", _data_->acct_id, dc_window_prefix_background_account_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = dc_rpc_client_get_config_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		_data_->name = _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp7_ = _data_->name;
		if (_data_->_tmp7_ == NULL) {
			_data_->_tmp6_ = TRUE;
		} else {
			_data_->_tmp8_ = _data_->name;
			_data_->_tmp9_ = strlen (_data_->_tmp8_);
			_data_->_tmp10_ = _data_->_tmp9_;
			_data_->_tmp6_ = _data_->_tmp10_ == 0;
		}
		if (_data_->_tmp6_) {
			_data_->_tmp12_ = _data_->self->priv->rpc;
			_data_->_state_ = 2;
			dc_rpc_client_get_config (_data_->_tmp12_, "addr", _data_->acct_id, dc_window_prefix_background_account_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp13_ = dc_rpc_client_get_config_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp11_ = _data_->_tmp13_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->name);
				goto __catch0_g_error;
			}
			_data_->_tmp14_ = _data_->_tmp11_;
			_data_->_tmp11_ = NULL;
			_g_free0 (_data_->name);
			_data_->name = _data_->_tmp14_;
			_g_free0 (_data_->_tmp11_);
		}
		_data_->_tmp16_ = _data_->name;
		if (_data_->_tmp16_ != NULL) {
			_data_->_tmp17_ = _data_->name;
			_data_->_tmp18_ = strlen (_data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp15_ = _data_->_tmp19_ > 0;
		} else {
			_data_->_tmp15_ = FALSE;
		}
		if (_data_->_tmp15_) {
			_data_->_tmp20_ = _data_->name;
			_data_->_tmp21_ = g_strdup_printf ("[%s] %s", _data_->_tmp20_, _data_->title);
			_data_->result = _data_->_tmp21_;
			_g_free0 (_data_->name);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_free0 (_data_->name);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp22_ = g_strdup (_data_->title);
	_data_->result = _data_->_tmp22_;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
dc_window_has_int (gint* haystack,
                   gint haystack_length1,
                   gint needle)
{
	gboolean result;
	{
		gint* x_collection = NULL;
		gint x_collection_length1 = 0;
		gint _x_collection_size_ = 0;
		gint x_it = 0;
		x_collection = haystack;
		x_collection_length1 = haystack_length1;
		for (x_it = 0; x_it < x_collection_length1; x_it = x_it + 1) {
			gint x = 0;
			x = x_collection[x_it];
			{
				if (x == needle) {
					result = TRUE;
					return result;
				}
			}
		}
	}
	result = FALSE;
	return result;
}

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

static void
dc_window_on_incoming_msg (DcWindow* self,
                           gint acct_id,
                           gint chat_id,
                           gint msg_id,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	DcWindowOnIncomingMsgData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowOnIncomingMsgData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_on_incoming_msg_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_data_->chat_id = chat_id;
	_data_->msg_id = msg_id;
	dc_window_on_incoming_msg_co (_data_);
}

static void
dc_window_on_incoming_msg_finish (DcWindow* self,
                                  GAsyncResult* _res_)
{
	DcWindowOnIncomingMsgData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_on_incoming_msg_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_)
{
	DcWindowOnIncomingMsgData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_on_incoming_msg_co (_data_);
}

static gboolean
dc_window_on_incoming_msg_co (DcWindowOnIncomingMsgData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	dc_window_check_mention (_data_->self, _data_->acct_id, _data_->chat_id, _data_->msg_id, NULL, NULL);
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->acct_id != _data_->_tmp2_) {
		dc_window_queue_chat_notification (_data_->self, _data_->acct_id, _data_->chat_id, _data_->msg_id, 0, NULL);
		dc_window_update_unread_indicators (_data_->self, NULL, NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->self->priv->views;
	_data_->_tmp4_ = g_hash_table_lookup (_data_->_tmp3_, (gpointer) ((gintptr) _data_->chat_id));
	_data_->_tmp5_ = _g_object_ref0 ((DcConversationView*) _data_->_tmp4_);
	_data_->view = _data_->_tmp5_;
	_data_->handled = FALSE;
	_data_->_tmp6_ = _data_->view;
	if (_data_->_tmp6_ != NULL) {
		_data_->_tmp7_ = _data_->view;
		_data_->_state_ = 1;
		dc_conversation_view_handle_incoming_msg (_data_->_tmp7_, _data_->msg_id, dc_window_on_incoming_msg_ready, _data_);
		return FALSE;
		_state_1:
		_data_->handled = dc_conversation_view_handle_incoming_msg_finish (_data_->_tmp7_, _data_->_res_);
	}
	_data_->_tmp9_ = _data_->view;
	if (_data_->_tmp9_ != NULL) {
		_data_->_tmp8_ = !_data_->handled;
	} else {
		_data_->_tmp8_ = FALSE;
	}
	if (_data_->_tmp8_) {
		_data_->_tmp10_ = dc_window_get_current_chat_id (_data_->self);
		_data_->_tmp11_ = _data_->_tmp10_;
		if (_data_->chat_id == _data_->_tmp11_) {
			dc_window_request_messages_reload (_data_->self);
		}
	}
	dc_window_queue_chat_notification (_data_->self, _data_->acct_id, _data_->chat_id, _data_->msg_id, 0, NULL);
	dc_window_request_reload_chats (_data_->self);
	_g_object_unref0 (_data_->view);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_on_chat_messages_changed (DcWindow* self,
                                    gint acct_id,
                                    gint chat_id)
{
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->rpc;
	_tmp1_ = dc_rpc_client_get_account_id (_tmp0_);
	_tmp2_ = _tmp1_;
	if (acct_id != _tmp2_) {
		return;
	}
	if (chat_id > 0) {
		DcConversationView* view = NULL;
		GHashTable* _tmp3_;
		gconstpointer _tmp4_;
		DcConversationView* _tmp5_;
		DcConversationView* _tmp6_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp3_ = self->priv->views;
		_tmp4_ = g_hash_table_lookup (_tmp3_, (gpointer) ((gintptr) chat_id));
		_tmp5_ = _g_object_ref0 ((DcConversationView*) _tmp4_);
		view = _tmp5_;
		_tmp6_ = view;
		if (_tmp6_ != NULL) {
			DcConversationView* _tmp7_;
			_tmp7_ = view;
			dc_conversation_view_mark_messages_stale (_tmp7_);
		}
		_tmp8_ = dc_window_get_current_chat_id (self);
		_tmp9_ = _tmp8_;
		if (chat_id == _tmp9_) {
			dc_window_request_messages_reload (self);
		}
		_g_object_unref0 (view);
		return;
	}
	dc_window_mark_all_views_messages_stale (self);
	dc_window_request_messages_reload (self);
}

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

static void
dc_window_load_account_menu (DcWindow* self,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_)
{
	DcWindowLoadAccountMenuData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowLoadAccountMenuData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_load_account_menu_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_load_account_menu_co (_data_);
}

static void
dc_window_load_account_menu_finish (DcWindow* self,
                                    GAsyncResult* _res_)
{
	DcWindowLoadAccountMenuData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_load_account_menu_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_)
{
	DcWindowLoadAccountMenuData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_load_account_menu_co (_data_);
}

static void
_vala_array_add13 (AdwActionRow** * array,
                   gint* length,
                   gint* size,
                   AdwActionRow* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (AdwActionRow*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gboolean
dc_window_load_account_menu_co (DcWindowLoadAccountMenuData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->rpc;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_tmp3_ = dc_rpc_client_get_is_connected (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp0_ = !_data_->_tmp4_;
	}
	if (_data_->_tmp0_) {
		_g_free0 (_data_->self->priv->account_menu_state);
		_data_->self->priv->account_menu_state = NULL;
		_data_->_tmp5_ = _data_->self->priv->account_menu_list;
		dc_clear_listbox (_data_->_tmp5_);
		_data_->_tmp6_ = (AdwActionRow*) adw_action_row_new ();
		g_object_ref_sink (_data_->_tmp6_);
		_data_->row = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp7_, "Not connected");
		_data_->_tmp8_ = _data_->row;
		adw_action_row_set_subtitle (_data_->_tmp8_, "Open Settings to configure the RPC server");
		_data_->_tmp9_ = _data_->self->priv->account_menu_list;
		_data_->_tmp10_ = _data_->row;
		gtk_list_box_append (_data_->_tmp9_, (GtkWidget*) _data_->_tmp10_);
		dc_window_focus_current_account_menu_row_if_requested (_data_->self);
		_g_object_unref0 (_data_->row);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->self->priv->account_menu_load_gen = _data_->self->priv->account_menu_load_gen + 1;
	_data_->_tmp11_ = _data_->self->priv->account_menu_load_gen;
	_data_->gen = _data_->_tmp11_;
	{
		_data_->_tmp12_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_all_accounts (_data_->_tmp12_, dc_window_load_account_menu_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp13_ = dc_rpc_client_get_all_accounts_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
		_data_->accounts_node = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = _data_->accounts_node;
		if (_data_->_tmp14_ == NULL) {
			__vala_JsonNode_free0 (_data_->accounts_node);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp15_ = _data_->accounts_node;
		_data_->_tmp16_ = json_node_get_array (_data_->_tmp15_);
		_data_->_tmp17_ = _json_array_ref0 (_data_->_tmp16_);
		_data_->accounts = _data_->_tmp17_;
		_data_->_tmp18_ = g_string_new ("");
		_data_->state = _data_->_tmp18_;
		_data_->_tmp19_ = g_new0 (AdwActionRow*, 0 + 1);
		_data_->rows = _data_->_tmp19_;
		_data_->rows_length1 = 0;
		_data_->_rows_size_ = _data_->rows_length1;
		{
			_data_->i = (guint) 0;
			{
				_data_->_tmp20_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp20_) {
						_data_->_tmp21_ = _data_->i;
						_data_->i = _data_->_tmp21_ + 1;
					}
					_data_->_tmp20_ = FALSE;
					_data_->_tmp22_ = _data_->accounts;
					if (!(_data_->i < json_array_get_length (_data_->_tmp22_))) {
						break;
					}
					_data_->_tmp23_ = _data_->accounts;
					_data_->_tmp24_ = json_array_get_object_element (_data_->_tmp23_, _data_->i);
					_data_->_tmp25_ = _json_object_ref0 (_data_->_tmp24_);
					_data_->acct = _data_->_tmp25_;
					_data_->_tmp26_ = _data_->acct;
					_data_->id = (gint) json_object_get_int_member (_data_->_tmp26_, "id");
					_data_->_tmp28_ = _data_->self->priv->rpc;
					_data_->_tmp29_ = dc_rpc_client_get_account_id (_data_->_tmp28_);
					_data_->_tmp30_ = _data_->_tmp29_;
					_data_->_tmp31_ = _data_->state;
					_data_->_state_ = 2;
					dc_window_build_account_menu_row_for_id (_data_->self, _data_->id, _data_->id == _data_->_tmp30_, _data_->_tmp31_, dc_window_load_account_menu_ready, _data_);
					return FALSE;
					_state_2:
					_data_->_tmp32_ = dc_window_build_account_menu_row_for_id_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
					_data_->_tmp27_ = _data_->_tmp32_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_json_object_unref0 (_data_->acct);
						_data_->rows = (_vala_array_free (_data_->rows, _data_->rows_length1, (GDestroyNotify) g_object_unref), NULL);
						_g_string_free0 (_data_->state);
						_json_array_unref0 (_data_->accounts);
						__vala_JsonNode_free0 (_data_->accounts_node);
						goto __catch0_g_error;
					}
					_data_->_tmp33_ = _data_->_tmp27_;
					_data_->_tmp27_ = NULL;
					_vala_array_add13 (&_data_->rows, &_data_->rows_length1, &_data_->_rows_size_, _data_->_tmp33_);
					_g_object_unref0 (_data_->_tmp27_);
					_json_object_unref0 (_data_->acct);
				}
			}
		}
		if (_data_->gen != _data_->self->priv->account_menu_load_gen) {
			_data_->rows = (_vala_array_free (_data_->rows, _data_->rows_length1, (GDestroyNotify) g_object_unref), NULL);
			_g_string_free0 (_data_->state);
			_json_array_unref0 (_data_->accounts);
			__vala_JsonNode_free0 (_data_->accounts_node);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp34_ = _data_->self->priv->account_menu_state;
		_data_->_tmp35_ = _data_->state;
		_data_->_tmp36_ = _data_->_tmp35_->str;
		if (g_strcmp0 (_data_->_tmp34_, _data_->_tmp36_) == 0) {
			dc_window_focus_current_account_menu_row_if_requested (_data_->self);
			_data_->rows = (_vala_array_free (_data_->rows, _data_->rows_length1, (GDestroyNotify) g_object_unref), NULL);
			_g_string_free0 (_data_->state);
			_json_array_unref0 (_data_->accounts);
			__vala_JsonNode_free0 (_data_->accounts_node);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp37_ = _data_->state;
		_data_->_tmp38_ = _data_->_tmp37_->str;
		_data_->_tmp39_ = g_strdup (_data_->_tmp38_);
		_g_free0 (_data_->self->priv->account_menu_state);
		_data_->self->priv->account_menu_state = _data_->_tmp39_;
		_data_->_tmp40_ = _data_->self->priv->account_menu_list;
		dc_clear_listbox (_data_->_tmp40_);
		_data_->_tmp41_ = _data_->rows;
		_data_->_tmp41__length1 = _data_->rows_length1;
		{
			_data_->row_collection_length1 = 0;
			_data_->_row_collection_size_ = 0;
			_data_->row_collection = _data_->_tmp41_;
			_data_->row_collection_length1 = _data_->_tmp41__length1;
			for (_data_->row_it = 0; _data_->row_it < _data_->row_collection_length1; _data_->row_it = _data_->row_it + 1) {
				_data_->_tmp42_ = _g_object_ref0 (_data_->row_collection[_data_->row_it]);
				_data_->_vala1_row = _data_->_tmp42_;
				{
					_data_->_tmp43_ = _data_->self->priv->account_menu_list;
					_data_->_tmp44_ = _data_->_vala1_row;
					gtk_list_box_append (_data_->_tmp43_, (GtkWidget*) _data_->_tmp44_);
					_g_object_unref0 (_data_->_vala1_row);
				}
			}
		}
		_data_->_tmp45_ = _data_->rows;
		_data_->_tmp45__length1 = _data_->rows_length1;
		if (_data_->_tmp45__length1 == 0) {
			_data_->_tmp46_ = (AdwActionRow*) adw_action_row_new ();
			g_object_ref_sink (_data_->_tmp46_);
			_data_->empty = _data_->_tmp46_;
			_data_->_tmp47_ = _data_->empty;
			adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp47_, "No accounts");
			_data_->_tmp48_ = _data_->empty;
			adw_action_row_set_subtitle (_data_->_tmp48_, "Add an account to get started");
			_data_->_tmp49_ = _data_->self->priv->account_menu_list;
			_data_->_tmp50_ = _data_->empty;
			gtk_list_box_append (_data_->_tmp49_, (GtkWidget*) _data_->_tmp50_);
			_g_object_unref0 (_data_->empty);
		}
		_data_->_tmp51_ = _data_->self->priv->account_menu_list;
		_data_->_tmp52_ = dc_window_build_add_account_row (_data_->self);
		_data_->_tmp53_ = _data_->_tmp52_;
		gtk_list_box_append (_data_->_tmp51_, (GtkWidget*) _data_->_tmp53_);
		_g_object_unref0 (_data_->_tmp53_);
		dc_window_focus_current_account_menu_row_if_requested (_data_->self);
		_data_->rows = (_vala_array_free (_data_->rows, _data_->rows_length1, (GDestroyNotify) g_object_unref), NULL);
		_g_string_free0 (_data_->state);
		_json_array_unref0 (_data_->accounts);
		__vala_JsonNode_free0 (_data_->accounts_node);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		if (_data_->gen != _data_->self->priv->account_menu_load_gen) {
			_g_error_free0 (_data_->e);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_free0 (_data_->self->priv->account_menu_state);
		_data_->self->priv->account_menu_state = NULL;
		_data_->_tmp54_ = _data_->self->priv->account_menu_list;
		dc_clear_listbox (_data_->_tmp54_);
		_data_->_tmp55_ = (AdwActionRow*) adw_action_row_new ();
		g_object_ref_sink (_data_->_tmp55_);
		_data_->err_row = _data_->_tmp55_;
		_data_->_tmp56_ = _data_->err_row;
		adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _data_->_tmp56_, FALSE);
		_data_->_tmp57_ = _data_->err_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _data_->_tmp57_, "Error loading accounts");
		_data_->_tmp58_ = _data_->err_row;
		_data_->_tmp59_ = _data_->e;
		_data_->_tmp60_ = _data_->_tmp59_->message;
		adw_action_row_set_subtitle (_data_->_tmp58_, _data_->_tmp60_);
		_data_->_tmp61_ = _data_->self->priv->account_menu_list;
		_data_->_tmp62_ = _data_->err_row;
		gtk_list_box_append (_data_->_tmp61_, (GtkWidget*) _data_->_tmp62_);
		dc_window_focus_current_account_menu_row_if_requested (_data_->self);
		_g_object_unref0 (_data_->err_row);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
__lambda130_ (DcWindow* self)
{
	gboolean result;
	dc_window_focus_current_account_menu_row (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda130__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda130_ ((DcWindow*) self);
	return result;
}

static void
dc_window_focus_current_account_menu_row_if_requested (DcWindow* self)
{
	g_return_if_fail (self != NULL);
	if (!self->priv->focus_current_account_on_menu_load) {
		return;
	}
	self->priv->focus_current_account_on_menu_load = FALSE;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda130__gsource_func, g_object_ref (self), g_object_unref);
}

static void
dc_window_focus_current_account_menu_row (DcWindow* self)
{
	GtkListBoxRow* fallback = NULL;
	gint _tmp0_ = 0;
	DcRpcClient* _tmp1_;
	gint current_account_id = 0;
	gint idx = 0;
	GtkListBoxRow* row = NULL;
	GtkListBoxRow* _tmp20_;
	g_return_if_fail (self != NULL);
	fallback = NULL;
	_tmp1_ = self->priv->rpc;
	if (_tmp1_ != NULL) {
		DcRpcClient* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = self->priv->rpc;
		_tmp3_ = dc_rpc_client_get_account_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = 0;
	}
	current_account_id = _tmp0_;
	idx = 0;
	while (TRUE) {
		GtkListBox* _tmp5_;
		GtkListBoxRow* _tmp6_;
		GtkListBoxRow* _tmp7_;
		GtkListBoxRow* _tmp8_;
		GtkListBoxRow* _tmp9_;
		AdwActionRow* action_row = NULL;
		GtkListBoxRow* _tmp12_;
		AdwActionRow* _tmp13_;
		gboolean _tmp14_ = FALSE;
		AdwActionRow* _tmp15_;
		gint _tmp19_;
		_tmp5_ = self->priv->account_menu_list;
		_tmp6_ = gtk_list_box_get_row_at_index (_tmp5_, idx);
		_tmp7_ = _g_object_ref0 (_tmp6_);
		_g_object_unref0 (row);
		row = _tmp7_;
		_tmp8_ = row;
		if (!(_tmp8_ != NULL)) {
			break;
		}
		_tmp9_ = fallback;
		if (_tmp9_ == NULL) {
			GtkListBoxRow* _tmp10_;
			GtkListBoxRow* _tmp11_;
			_tmp10_ = row;
			_tmp11_ = _g_object_ref0 (_tmp10_);
			_g_object_unref0 (fallback);
			fallback = _tmp11_;
		}
		_tmp12_ = row;
		_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, adw_action_row_get_type ()) ? ((AdwActionRow*) _tmp12_) : NULL);
		action_row = _tmp13_;
		_tmp15_ = action_row;
		if (_tmp15_ != NULL) {
			AdwActionRow* _tmp16_;
			gconstpointer _tmp17_;
			_tmp16_ = action_row;
			_tmp17_ = g_object_get_data ((GObject*) _tmp16_, "acct-id");
			_tmp14_ = ((gint) ((gintptr) _tmp17_)) == current_account_id;
		} else {
			_tmp14_ = FALSE;
		}
		if (_tmp14_) {
			GtkListBoxRow* _tmp18_;
			_tmp18_ = row;
			gtk_widget_grab_focus ((GtkWidget*) _tmp18_);
			_g_object_unref0 (action_row);
			_g_object_unref0 (row);
			_g_object_unref0 (fallback);
			return;
		}
		_tmp19_ = idx;
		idx = _tmp19_ + 1;
		_g_object_unref0 (action_row);
	}
	_tmp20_ = fallback;
	if (_tmp20_ != NULL) {
		GtkListBoxRow* _tmp21_;
		_tmp21_ = fallback;
		gtk_widget_grab_focus ((GtkWidget*) _tmp21_);
	}
	_g_object_unref0 (row);
	_g_object_unref0 (fallback);
}

static AdwActionRow*
dc_window_build_add_account_row (DcWindow* self)
{
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp0_;
	GtkImage* icon = NULL;
	GtkImage* _tmp1_;
	AdwActionRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) row, "Add Profile");
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) row, TRUE);
	g_object_set_data_full ((GObject*) row, "acct-id", (gpointer) ((gintptr) -1), NULL);
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name ("list-add-symbolic");
	g_object_ref_sink (_tmp1_);
	icon = _tmp1_;
	gtk_widget_set_valign ((GtkWidget*) icon, GTK_ALIGN_CENTER);
	adw_action_row_add_prefix (row, (GtkWidget*) icon);
	result = row;
	_g_object_unref0 (icon);
	return result;
}

static void
dc_window_build_account_menu_row_for_id_data_free (gpointer _data)
{
	DcWindowBuildAccountMenuRowForIdData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowBuildAccountMenuRowForIdData, _data_);
}

static void
dc_window_build_account_menu_row_for_id (DcWindow* self,
                                         gint id,
                                         gboolean current,
                                         GString* state,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	DcWindowBuildAccountMenuRowForIdData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (state != NULL);
	_data_ = g_slice_new0 (DcWindowBuildAccountMenuRowForIdData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_build_account_menu_row_for_id_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->id = id;
	_data_->current = current;
	_data_->state = state;
	dc_window_build_account_menu_row_for_id_co (_data_);
}

static AdwActionRow*
dc_window_build_account_menu_row_for_id_finish (DcWindow* self,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	AdwActionRow* result;
	DcWindowBuildAccountMenuRowForIdData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_window_build_account_menu_row_for_id_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	DcWindowBuildAccountMenuRowForIdData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_build_account_menu_row_for_id_co (_data_);
}

static gboolean
dc_window_build_account_menu_row_for_id_co (DcWindowBuildAccountMenuRowForIdData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_state_ = 1;
	dc_rpc_client_is_configured (_data_->_tmp0_, _data_->id, dc_window_build_account_menu_row_for_id_ready, _data_);
	return FALSE;
	_state_1:
	_data_->configured = dc_rpc_client_is_configured_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->email = NULL;
	_data_->display_name = NULL;
	_data_->avatar = NULL;
	_data_->unread = 0;
	if (_data_->configured) {
		{
			_data_->_tmp2_ = _data_->self->priv->rpc;
			_data_->_state_ = 2;
			dc_rpc_client_get_config (_data_->_tmp2_, "addr", _data_->id, dc_window_build_account_menu_row_for_id_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp3_ = dc_rpc_client_get_config_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp1_ = _data_->_tmp3_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp4_ = _data_->_tmp1_;
			_data_->_tmp1_ = NULL;
			_g_free0 (_data_->email);
			_data_->email = _data_->_tmp4_;
			_data_->_tmp6_ = _data_->self->priv->rpc;
			_data_->_state_ = 3;
			dc_rpc_client_get_config (_data_->_tmp6_, "displayname", _data_->id, dc_window_build_account_menu_row_for_id_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp7_ = dc_rpc_client_get_config_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp5_ = _data_->_tmp7_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->_tmp1_);
				goto __catch0_g_error;
			}
			_data_->_tmp8_ = _data_->_tmp5_;
			_data_->_tmp5_ = NULL;
			_g_free0 (_data_->display_name);
			_data_->display_name = _data_->_tmp8_;
			_data_->_tmp10_ = _data_->self->priv->rpc;
			_data_->_state_ = 4;
			dc_rpc_client_get_config (_data_->_tmp10_, "selfavatar", _data_->id, dc_window_build_account_menu_row_for_id_ready, _data_);
			return FALSE;
			_state_4:
			_data_->_tmp11_ = dc_rpc_client_get_config_finish (_data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp9_ = _data_->_tmp11_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->_tmp5_);
				_g_free0 (_data_->_tmp1_);
				goto __catch0_g_error;
			}
			_data_->_tmp12_ = _data_->_tmp9_;
			_data_->_tmp9_ = NULL;
			_g_free0 (_data_->avatar);
			_data_->avatar = _data_->_tmp12_;
			_data_->_tmp14_ = _data_->self->priv->rpc;
			_data_->_state_ = 5;
			dc_rpc_client_get_fresh_msg_count (_data_->_tmp14_, _data_->id, dc_window_build_account_menu_row_for_id_ready, _data_);
			return FALSE;
			_state_5:
			_data_->_tmp13_ = dc_rpc_client_get_fresh_msg_count_finish (_data_->_tmp14_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_free0 (_data_->_tmp9_);
				_g_free0 (_data_->_tmp5_);
				_g_free0 (_data_->_tmp1_);
				goto __catch0_g_error;
			}
			_data_->unread = _data_->_tmp13_;
			_g_free0 (_data_->_tmp9_);
			_g_free0 (_data_->_tmp5_);
			_g_free0 (_data_->_tmp1_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->avatar);
			_g_free0 (_data_->display_name);
			_g_free0 (_data_->email);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	if (_data_->configured) {
		_data_->_tmp15_ = 1;
	} else {
		_data_->_tmp15_ = 0;
	}
	if (_data_->current) {
		_data_->_tmp16_ = 1;
	} else {
		_data_->_tmp16_ = 0;
	}
	_data_->_tmp18_ = _data_->email;
	_data_->_tmp17_ = _data_->_tmp18_;
	if (_data_->_tmp17_ == NULL) {
		_data_->_tmp17_ = "";
	}
	_data_->_tmp20_ = _data_->display_name;
	_data_->_tmp19_ = _data_->_tmp20_;
	if (_data_->_tmp19_ == NULL) {
		_data_->_tmp19_ = "";
	}
	_data_->_tmp22_ = _data_->avatar;
	_data_->_tmp21_ = _data_->_tmp22_;
	if (_data_->_tmp21_ == NULL) {
		_data_->_tmp21_ = "";
	}
	g_string_append_printf (_data_->state, "%d|%d|%d|%s|%s|%s|%d\n", _data_->id, _data_->_tmp15_, _data_->_tmp16_, _data_->_tmp17_, _data_->_tmp19_, _data_->_tmp21_, _data_->unread);
	_data_->_tmp23_ = _data_->email;
	_data_->_tmp24_ = _data_->display_name;
	_data_->_tmp25_ = _data_->avatar;
	_data_->_tmp26_ = dc_window_build_account_menu_row (_data_->self, _data_->id, _data_->configured, _data_->current, _data_->_tmp23_, _data_->_tmp24_, _data_->_tmp25_, _data_->unread);
	_data_->result = _data_->_tmp26_;
	_g_free0 (_data_->avatar);
	_g_free0 (_data_->display_name);
	_g_free0 (_data_->email);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		DcWindow* self;
		self = _data6_->self;
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
__lambda131_ (Block6Data* _data6_)
{
	DcWindow* self;
	GtkPopover* _tmp0_;
	self = _data6_->self;
	_tmp0_ = self->priv->account_popover;
	gtk_popover_popdown (_tmp0_);
	dc_window_show_profile_for_account (self, _data6_->id);
}

static void
___lambda131__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda131_ (self);
}

static AdwActionRow*
dc_window_build_account_menu_row (DcWindow* self,
                                  gint id,
                                  gboolean configured,
                                  gboolean current,
                                  const gchar* email,
                                  const gchar* display_name,
                                  const gchar* avatar,
                                  gint unread)
{
	Block6Data* _data6_;
	gchar* title = NULL;
	gboolean _tmp0_ = FALSE;
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp9_;
	AdwActionRow* _tmp10_;
	AdwActionRow* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_ = NULL;
	AdwActionRow* _tmp14_;
	gboolean _tmp15_ = FALSE;
	AdwActionRow* _tmp16_;
	AdwActionRow* _tmp17_;
	AdwAvatar* avatar_widget = NULL;
	const gchar* _tmp19_;
	AdwAvatar* _tmp20_;
	AdwAvatar* _tmp21_;
	GdkTexture* _tmp22_;
	GdkTexture* _tmp23_;
	GtkButton* edit_btn = NULL;
	GtkButton* _tmp41_;
	GtkButton* _tmp42_;
	GtkButton* _tmp43_;
	GtkButton* _tmp44_;
	GtkButton* _tmp45_;
	GtkButton* _tmp46_;
	AdwActionRow* _tmp47_;
	GtkButton* _tmp48_;
	AdwActionRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_data6_->id = id;
	if (display_name != NULL) {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (display_name);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup (display_name);
		_g_free0 (title);
		title = _tmp3_;
	} else {
		if (configured) {
			gchar* _tmp4_ = NULL;
			gchar* _tmp5_;
			gchar* _tmp7_;
			_tmp5_ = g_strdup (email);
			_tmp4_ = _tmp5_;
			if (_tmp4_ == NULL) {
				gchar* _tmp6_;
				_tmp6_ = g_strdup_printf ("Account #%d", _data6_->id);
				_g_free0 (_tmp4_);
				_tmp4_ = _tmp6_;
			}
			_tmp7_ = _tmp4_;
			_tmp4_ = NULL;
			_g_free0 (title);
			title = _tmp7_;
			_g_free0 (_tmp4_);
		} else {
			gchar* _tmp8_;
			_tmp8_ = g_strdup ("Unconfigured account");
			_g_free0 (title);
			title = _tmp8_;
		}
	}
	_tmp9_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp9_);
	row = _tmp9_;
	_tmp10_ = row;
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp10_, FALSE);
	_tmp11_ = row;
	_tmp12_ = title;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp11_, _tmp12_);
	_tmp13_ = email;
	if (_tmp13_ == NULL) {
		_tmp13_ = "";
	}
	_tmp14_ = row;
	adw_action_row_set_subtitle (_tmp14_, _tmp13_);
	if (configured) {
		_tmp15_ = !current;
	} else {
		_tmp15_ = FALSE;
	}
	_tmp16_ = row;
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp16_, _tmp15_);
	_tmp17_ = row;
	g_object_set_data_full ((GObject*) _tmp17_, "acct-id", (gpointer) ((gintptr) _data6_->id), NULL);
	if (current) {
		AdwActionRow* _tmp18_;
		_tmp18_ = row;
		gtk_widget_add_css_class ((GtkWidget*) _tmp18_, "current-account-row");
	}
	_tmp19_ = title;
	_tmp20_ = (AdwAvatar*) adw_avatar_new (32, _tmp19_, TRUE);
	g_object_ref_sink (_tmp20_);
	avatar_widget = _tmp20_;
	_tmp21_ = avatar_widget;
	_tmp22_ = dc_load_avatar (avatar);
	_tmp23_ = _tmp22_;
	adw_avatar_set_custom_image (_tmp21_, (GdkPaintable*) _tmp23_);
	_g_object_unref0 (_tmp23_);
	if (unread > 0) {
		gchar* _tmp24_ = NULL;
		GtkLabel* badge = NULL;
		GtkLabel* _tmp27_;
		GtkLabel* _tmp28_;
		GtkLabel* _tmp29_;
		GtkLabel* _tmp30_;
		GtkOverlay* overlay = NULL;
		GtkOverlay* _tmp31_;
		GtkOverlay* _tmp32_;
		AdwAvatar* _tmp33_;
		GtkOverlay* _tmp34_;
		GtkLabel* _tmp35_;
		GtkOverlay* _tmp36_;
		AdwActionRow* _tmp37_;
		GtkOverlay* _tmp38_;
		if (unread > 99) {
			gchar* _tmp25_;
			_tmp25_ = g_strdup ("99+");
			_g_free0 (_tmp24_);
			_tmp24_ = _tmp25_;
		} else {
			gchar* _tmp26_;
			_tmp26_ = g_strdup_printf ("%i", unread);
			_g_free0 (_tmp24_);
			_tmp24_ = _tmp26_;
		}
		_tmp27_ = (GtkLabel*) gtk_label_new (_tmp24_);
		g_object_ref_sink (_tmp27_);
		badge = _tmp27_;
		_tmp28_ = badge;
		gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "account-unread-badge");
		_tmp29_ = badge;
		gtk_widget_set_halign ((GtkWidget*) _tmp29_, GTK_ALIGN_END);
		_tmp30_ = badge;
		gtk_widget_set_valign ((GtkWidget*) _tmp30_, GTK_ALIGN_END);
		_tmp31_ = (GtkOverlay*) gtk_overlay_new ();
		g_object_ref_sink (_tmp31_);
		overlay = _tmp31_;
		_tmp32_ = overlay;
		_tmp33_ = avatar_widget;
		gtk_overlay_set_child (_tmp32_, (GtkWidget*) _tmp33_);
		_tmp34_ = overlay;
		_tmp35_ = badge;
		gtk_overlay_add_overlay (_tmp34_, (GtkWidget*) _tmp35_);
		_tmp36_ = overlay;
		gtk_widget_set_valign ((GtkWidget*) _tmp36_, GTK_ALIGN_CENTER);
		_tmp37_ = row;
		_tmp38_ = overlay;
		adw_action_row_add_prefix (_tmp37_, (GtkWidget*) _tmp38_);
		_g_object_unref0 (overlay);
		_g_object_unref0 (badge);
		_g_free0 (_tmp24_);
	} else {
		AdwActionRow* _tmp39_;
		AdwAvatar* _tmp40_;
		_tmp39_ = row;
		_tmp40_ = avatar_widget;
		adw_action_row_add_prefix (_tmp39_, (GtkWidget*) _tmp40_);
	}
	_tmp41_ = (GtkButton*) gtk_button_new_from_icon_name ("preferences-system-symbolic");
	g_object_ref_sink (_tmp41_);
	edit_btn = _tmp41_;
	_tmp42_ = edit_btn;
	gtk_widget_set_valign ((GtkWidget*) _tmp42_, GTK_ALIGN_CENTER);
	_tmp43_ = edit_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp43_, "flat");
	_tmp44_ = edit_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp44_, "Edit profile");
	_tmp45_ = edit_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp45_, configured);
	_tmp46_ = edit_btn;
	g_signal_connect_data (_tmp46_, "clicked", (GCallback) ___lambda131__gtk_button_clicked, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp47_ = row;
	_tmp48_ = edit_btn;
	adw_action_row_add_suffix (_tmp47_, (GtkWidget*) _tmp48_);
	if (!configured) {
		GtkLabel* status = NULL;
		GtkLabel* _tmp49_;
		GtkLabel* _tmp50_;
		GtkLabel* _tmp51_;
		GtkLabel* _tmp52_;
		AdwActionRow* _tmp53_;
		GtkLabel* _tmp54_;
		_tmp49_ = (GtkLabel*) gtk_label_new ("Not configured");
		g_object_ref_sink (_tmp49_);
		status = _tmp49_;
		_tmp50_ = status;
		gtk_widget_add_css_class ((GtkWidget*) _tmp50_, "caption");
		_tmp51_ = status;
		gtk_widget_add_css_class ((GtkWidget*) _tmp51_, "dim-label");
		_tmp52_ = status;
		gtk_widget_set_valign ((GtkWidget*) _tmp52_, GTK_ALIGN_CENTER);
		_tmp53_ = row;
		_tmp54_ = status;
		adw_action_row_add_suffix (_tmp53_, (GtkWidget*) _tmp54_);
		_g_object_unref0 (status);
	}
	result = row;
	_g_object_unref0 (edit_btn);
	_g_object_unref0 (avatar_widget);
	_g_free0 (title);
	block6_data_unref (_data6_);
	_data6_ = NULL;
	return result;
}

static void
dc_window_on_account_menu_row_activated (DcWindow* self,
                                         GtkListBoxRow* row)
{
	AdwActionRow* action_row = NULL;
	AdwActionRow* _tmp0_;
	AdwActionRow* _tmp1_;
	gint acct_id = 0;
	AdwActionRow* _tmp2_;
	gconstpointer _tmp3_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	AdwActionRow* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	GtkPopover* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (row, adw_action_row_get_type ()) ? ((AdwActionRow*) row) : NULL);
	action_row = _tmp0_;
	_tmp1_ = action_row;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (action_row);
		return;
	}
	_tmp2_ = action_row;
	_tmp3_ = g_object_get_data ((GObject*) _tmp2_, "acct-id");
	acct_id = (gint) ((gintptr) _tmp3_);
	if (acct_id == -1) {
		GtkPopover* _tmp4_;
		_tmp4_ = self->priv->account_popover;
		gtk_popover_popdown (_tmp4_);
		dc_window_on_add_account (self);
		_g_object_unref0 (action_row);
		return;
	}
	_tmp7_ = action_row;
	_tmp8_ = gtk_list_box_row_get_activatable ((GtkListBoxRow*) _tmp7_);
	_tmp9_ = _tmp8_;
	if (!_tmp9_) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = acct_id <= 0;
	}
	if (_tmp6_) {
		_tmp5_ = TRUE;
	} else {
		DcRpcClient* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		_tmp10_ = self->priv->rpc;
		_tmp11_ = dc_rpc_client_get_account_id (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp5_ = acct_id == _tmp12_;
	}
	if (_tmp5_) {
		_g_object_unref0 (action_row);
		return;
	}
	_tmp13_ = self->priv->account_popover;
	gtk_popover_popdown (_tmp13_);
	dc_window_switch_account (self, acct_id, NULL, NULL);
	_g_object_unref0 (action_row);
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		DcWindow* self;
		self = _data7_->self;
		_g_object_unref0 (_data7_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static void
__lambda304_ (Block7Data* _data7_,
              GtkListBoxRow* row)
{
	DcWindow* self;
	gchar* method = NULL;
	gconstpointer _tmp0_;
	gchar* _tmp1_;
	AdwDialog* _tmp2_;
	self = _data7_->self;
	g_return_if_fail (row != NULL);
	_tmp0_ = g_object_get_data ((GObject*) row, "add-method");
	_tmp1_ = g_strdup ((const gchar*) _tmp0_);
	method = _tmp1_;
	_tmp2_ = _data7_->dialog;
	adw_dialog_close (_tmp2_);
	dc_window_on_add_account_method_selected (self, method);
	_g_free0 (method);
}

static void
___lambda304__gtk_list_box_row_activated (GtkListBox* _sender,
                                          GtkListBoxRow* row,
                                          gpointer self)
{
	__lambda304_ (self, row);
}

static void
dc_window_on_add_account (DcWindow* self)
{
	Block7Data* _data7_;
	AdwDialog* _tmp0_;
	AdwDialog* _tmp1_;
	AdwDialog* _tmp2_;
	AdwDialog* _tmp3_;
	GtkBox* box = NULL;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	AdwHeaderBar* _tmp6_;
	AdwHeaderBar* _tmp7_;
	GtkLabel* intro = NULL;
	GtkLabel* _tmp8_;
	GtkLabel* _tmp9_;
	GtkLabel* _tmp10_;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkLabel* _tmp13_;
	GtkBox* _tmp14_;
	GtkLabel* _tmp15_;
	GtkListBox* list = NULL;
	GtkListBox* _tmp16_;
	GtkListBox* _tmp17_;
	GtkListBox* _tmp18_;
	GtkListBox* _tmp19_;
	GtkListBox* _tmp20_;
	GtkListBox* _tmp21_;
	GtkListBox* _tmp22_;
	GtkListBox* _tmp30_;
	GtkBox* _tmp31_;
	GtkListBox* _tmp32_;
	AdwDialog* _tmp33_;
	GtkBox* _tmp34_;
	AdwDialog* _tmp35_;
	g_return_if_fail (self != NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ != NULL) {
		block7_data_unref (_data7_);
		_data7_ = NULL;
		return;
	}
	_tmp1_ = adw_dialog_new ();
	g_object_ref_sink (_tmp1_);
	_data7_->dialog = _tmp1_;
	_tmp2_ = _data7_->dialog;
	adw_dialog_set_title (_tmp2_, "Add Profile");
	_tmp3_ = _data7_->dialog;
	adw_dialog_set_content_width (_tmp3_, 460);
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp4_);
	box = _tmp4_;
	_tmp5_ = box;
	_tmp6_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	gtk_box_append (_tmp5_, (GtkWidget*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = (GtkLabel*) gtk_label_new ("Choose how you want to add an account.");
	g_object_ref_sink (_tmp8_);
	intro = _tmp8_;
	_tmp9_ = intro;
	gtk_widget_set_halign ((GtkWidget*) _tmp9_, GTK_ALIGN_START);
	_tmp10_ = intro;
	_tmp11_ = intro;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp11_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp10_, 12);
	_tmp12_ = intro;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp12_, 12);
	_tmp13_ = intro;
	gtk_widget_add_css_class ((GtkWidget*) _tmp13_, "dim-label");
	_tmp14_ = box;
	_tmp15_ = intro;
	gtk_box_append (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp16_);
	list = _tmp16_;
	_tmp17_ = list;
	gtk_list_box_set_selection_mode (_tmp17_, GTK_SELECTION_NONE);
	_tmp18_ = list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp18_, "boxed-list");
	_tmp19_ = list;
	_tmp20_ = list;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp20_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp19_, 12);
	_tmp21_ = list;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp21_, 8);
	_tmp22_ = list;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp22_, 12);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp23_ = FALSE;
			_tmp23_ = TRUE;
			while (TRUE) {
				GtkListBox* _tmp24_;
				const gchar* _tmp25_;
				const gchar* _tmp26_;
				const gchar* _tmp27_;
				AdwActionRow* _tmp28_;
				AdwActionRow* _tmp29_;
				if (!_tmp23_) {
					i += 3;
				}
				_tmp23_ = FALSE;
				if (!((i + 2) < G_N_ELEMENTS (DC_WINDOW_ADD_PROFILE_METHODS))) {
					break;
				}
				_tmp24_ = list;
				_tmp25_ = DC_WINDOW_ADD_PROFILE_METHODS[i];
				_tmp26_ = DC_WINDOW_ADD_PROFILE_METHODS[i + 1];
				_tmp27_ = DC_WINDOW_ADD_PROFILE_METHODS[i + 2];
				_tmp28_ = dc_window_build_add_method_row (self, _tmp25_, _tmp26_, _tmp27_);
				_tmp29_ = _tmp28_;
				gtk_list_box_append (_tmp24_, (GtkWidget*) _tmp29_);
				_g_object_unref0 (_tmp29_);
			}
		}
	}
	_tmp30_ = list;
	g_signal_connect_data (_tmp30_, "row-activated", (GCallback) ___lambda304__gtk_list_box_row_activated, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_tmp31_ = box;
	_tmp32_ = list;
	gtk_box_append (_tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = _data7_->dialog;
	_tmp34_ = box;
	adw_dialog_set_child (_tmp33_, (GtkWidget*) _tmp34_);
	_tmp35_ = _data7_->dialog;
	dc_window_present_modal (self, _tmp35_);
	_g_object_unref0 (list);
	_g_object_unref0 (intro);
	_g_object_unref0 (box);
	block7_data_unref (_data7_);
	_data7_ = NULL;
}

static AdwActionRow*
dc_window_build_add_method_row (DcWindow* self,
                                const gchar* icon_name,
                                const gchar* title,
                                const gchar* subtitle)
{
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp0_;
	gchar* _tmp1_;
	GtkImage* icon = NULL;
	GtkImage* _tmp2_;
	GtkImage* chevron = NULL;
	GtkImage* _tmp3_;
	AdwActionRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (icon_name != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (subtitle != NULL, NULL);
	_tmp0_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) row, title);
	adw_action_row_set_subtitle (row, subtitle);
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) row, TRUE);
	_tmp1_ = g_strdup (title);
	g_object_set_data_full ((GObject*) row, "add-method", _tmp1_, g_free);
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name (icon_name);
	g_object_ref_sink (_tmp2_);
	icon = _tmp2_;
	gtk_widget_set_valign ((GtkWidget*) icon, GTK_ALIGN_CENTER);
	adw_action_row_add_prefix (row, (GtkWidget*) icon);
	_tmp3_ = (GtkImage*) gtk_image_new_from_icon_name ("go-next-symbolic");
	g_object_ref_sink (_tmp3_);
	chevron = _tmp3_;
	gtk_widget_set_valign ((GtkWidget*) chevron, GTK_ALIGN_CENTER);
	gtk_widget_add_css_class ((GtkWidget*) chevron, "dim-label");
	adw_action_row_add_suffix (row, (GtkWidget*) chevron);
	result = row;
	_g_object_unref0 (chevron);
	_g_object_unref0 (icon);
	return result;
}

static void
dc_window_on_add_account_method_selected (DcWindow* self,
                                          const gchar* method)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (method != NULL);
	if (g_strcmp0 (method, "Use classic email address") == 0) {
		dc_window_show_classic_email_dialog (self);
	} else {
		if (g_strcmp0 (method, "Add as secondary device") == 0) {
			dc_window_show_secondary_device_dialog (self);
		} else {
			if (g_strcmp0 (method, "Create new profile") == 0) {
				dc_window_show_create_profile_dialog (self);
			} else {
				if (g_strcmp0 (method, "Use invitation code") == 0) {
					dc_window_show_invitation_code_profile_dialog (self);
				}
			}
		}
	}
}

static void
__lambda309_ (DcWindow* self,
              gint new_id)
{
	dc_window_after_profile_created (self, new_id, NULL, NULL);
}

static void
___lambda309__dc_create_profile_dialog_account_created (DcCreateProfileDialog* _sender,
                                                        gint new_account_id,
                                                        gpointer self)
{
	__lambda309_ ((DcWindow*) self, new_account_id);
}

static void
dc_window_show_create_profile_dialog (DcWindow* self)
{
	DcCreateProfileDialog* dialog = NULL;
	DcRpcClient* _tmp0_;
	DcEventHandler* _tmp1_;
	DcCreateProfileDialog* _tmp2_;
	DcCreateProfileDialog* _tmp3_;
	DcCreateProfileDialog* _tmp4_;
	g_return_if_fail (self != NULL);
	if (!dc_window_can_show_rpc_modal (self)) {
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = self->priv->events;
	_tmp2_ = dc_create_profile_dialog_new (_tmp0_, _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	g_signal_connect_object (_tmp3_, "account-created", (GCallback) ___lambda309__dc_create_profile_dialog_account_created, self, 0);
	_tmp4_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp4_);
	_g_object_unref0 (dialog);
}

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

static void
dc_window_after_profile_created (DcWindow* self,
                                 gint new_id,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcWindowAfterProfileCreatedData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowAfterProfileCreatedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_after_profile_created_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->new_id = new_id;
	dc_window_after_profile_created_co (_data_);
}

static void
dc_window_after_profile_created_finish (DcWindow* self,
                                        GAsyncResult* _res_)
{
	DcWindowAfterProfileCreatedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_after_profile_created_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcWindowAfterProfileCreatedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_after_profile_created_co (_data_);
}

static gboolean
dc_window_after_profile_created_co (DcWindowAfterProfileCreatedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dc_window_switch_account (_data_->self, _data_->new_id, dc_window_after_profile_created_ready, _data_);
	return FALSE;
	_state_1:
	if (dc_window_switch_account_finish (_data_->self, _data_->_res_)) {
		dc_window_show_toast (_data_->self, "Profile created");
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda311_ (DcWindow* self,
              gint new_id,
              gint chat_id)
{
	dc_window_after_invitation_profile_created (self, new_id, chat_id, NULL, NULL);
}

static void
___lambda311__dc_invitation_code_profile_dialog_account_created (DcInvitationCodeProfileDialog* _sender,
                                                                 gint new_account_id,
                                                                 gint chat_id,
                                                                 gpointer self)
{
	__lambda311_ ((DcWindow*) self, new_account_id, chat_id);
}

static void
dc_window_show_invitation_code_profile_dialog (DcWindow* self)
{
	DcInvitationCodeProfileDialog* dialog = NULL;
	DcRpcClient* _tmp0_;
	DcEventHandler* _tmp1_;
	DcInvitationCodeProfileDialog* _tmp2_;
	DcInvitationCodeProfileDialog* _tmp3_;
	DcInvitationCodeProfileDialog* _tmp4_;
	g_return_if_fail (self != NULL);
	if (!dc_window_can_show_rpc_modal (self)) {
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = self->priv->events;
	_tmp2_ = dc_invitation_code_profile_dialog_new (_tmp0_, _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	g_signal_connect_object (_tmp3_, "account-created", (GCallback) ___lambda311__dc_invitation_code_profile_dialog_account_created, self, 0);
	_tmp4_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp4_);
	_g_object_unref0 (dialog);
}

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

static void
dc_window_after_invitation_profile_created (DcWindow* self,
                                            gint new_id,
                                            gint chat_id,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	DcWindowAfterInvitationProfileCreatedData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowAfterInvitationProfileCreatedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_after_invitation_profile_created_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->new_id = new_id;
	_data_->chat_id = chat_id;
	dc_window_after_invitation_profile_created_co (_data_);
}

static void
dc_window_after_invitation_profile_created_finish (DcWindow* self,
                                                   GAsyncResult* _res_)
{
	DcWindowAfterInvitationProfileCreatedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_after_invitation_profile_created_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	DcWindowAfterInvitationProfileCreatedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_after_invitation_profile_created_co (_data_);
}

static gboolean
dc_window_after_invitation_profile_created_co (DcWindowAfterInvitationProfileCreatedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dc_window_switch_account (_data_->self, _data_->new_id, dc_window_after_invitation_profile_created_ready, _data_);
	return FALSE;
	_state_1:
	if (dc_window_switch_account_finish (_data_->self, _data_->_res_)) {
		if (_data_->chat_id > 0) {
			_data_->_state_ = 2;
			dc_window_load_chats (_data_->self, dc_window_after_invitation_profile_created_ready, _data_);
			return FALSE;
			_state_2:
			dc_window_load_chats_finish (_data_->self, _data_->_res_);
			dc_window_select_chat_by_id (_data_->self, _data_->chat_id);
		}
		if (_data_->chat_id > 0) {
			_data_->_tmp0_ = "Profile created and invitation accepted";
		} else {
			_data_->_tmp0_ = "Profile created";
		}
		dc_window_show_toast (_data_->self, _data_->_tmp0_);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda307_ (DcWindow* self,
              gint new_id)
{
	dc_window_after_secondary_device_imported (self, new_id, NULL, NULL);
}

static void
___lambda307__dc_receive_backup_dialog_account_imported (DcReceiveBackupDialog* _sender,
                                                         gint new_account_id,
                                                         gpointer self)
{
	__lambda307_ ((DcWindow*) self, new_account_id);
}

static void
dc_window_show_secondary_device_dialog (DcWindow* self)
{
	DcReceiveBackupDialog* dialog = NULL;
	DcRpcClient* _tmp0_;
	DcEventHandler* _tmp1_;
	DcReceiveBackupDialog* _tmp2_;
	DcReceiveBackupDialog* _tmp3_;
	DcReceiveBackupDialog* _tmp4_;
	g_return_if_fail (self != NULL);
	if (!dc_window_can_show_rpc_modal (self)) {
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = self->priv->events;
	_tmp2_ = dc_receive_backup_dialog_new (_tmp0_, _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	g_signal_connect_object (_tmp3_, "account-imported", (GCallback) ___lambda307__dc_receive_backup_dialog_account_imported, self, 0);
	_tmp4_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp4_);
	_g_object_unref0 (dialog);
}

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

static void
dc_window_after_secondary_device_imported (DcWindow* self,
                                           gint new_id,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	DcWindowAfterSecondaryDeviceImportedData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowAfterSecondaryDeviceImportedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_after_secondary_device_imported_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->new_id = new_id;
	dc_window_after_secondary_device_imported_co (_data_);
}

static void
dc_window_after_secondary_device_imported_finish (DcWindow* self,
                                                  GAsyncResult* _res_)
{
	DcWindowAfterSecondaryDeviceImportedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_after_secondary_device_imported_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	DcWindowAfterSecondaryDeviceImportedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_after_secondary_device_imported_co (_data_);
}

static gboolean
dc_window_after_secondary_device_imported_co (DcWindowAfterSecondaryDeviceImportedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dc_window_switch_account (_data_->self, _data_->new_id, dc_window_after_secondary_device_imported_ready, _data_);
	return FALSE;
	_state_1:
	if (dc_window_switch_account_finish (_data_->self, _data_->_res_)) {
		dc_window_show_toast (_data_->self, "Profile imported");
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda305_ (DcWindow* self,
              gint new_id)
{
	dc_window_after_profile_created (self, new_id, NULL, NULL);
}

static void
___lambda305__dc_classic_email_dialog_account_created (DcClassicEmailDialog* _sender,
                                                       gint new_account_id,
                                                       gpointer self)
{
	__lambda305_ ((DcWindow*) self, new_account_id);
}

static void
dc_window_show_classic_email_dialog (DcWindow* self)
{
	DcClassicEmailDialog* dialog = NULL;
	DcRpcClient* _tmp0_;
	DcEventHandler* _tmp1_;
	DcClassicEmailDialog* _tmp2_;
	DcClassicEmailDialog* _tmp3_;
	DcClassicEmailDialog* _tmp4_;
	g_return_if_fail (self != NULL);
	if (!dc_window_can_show_rpc_modal (self)) {
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = self->priv->events;
	_tmp2_ = dc_classic_email_dialog_new (_tmp0_, _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	g_signal_connect_object (_tmp3_, "account-created", (GCallback) ___lambda305__dc_classic_email_dialog_account_created, self, 0);
	_tmp4_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp4_);
	_g_object_unref0 (dialog);
}

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

void
dc_window_set_auto_download_limit (DcWindow* self,
                                   gint bytes,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	DcWindowSetAutoDownloadLimitData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowSetAutoDownloadLimitData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_set_auto_download_limit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->bytes = bytes;
	dc_window_set_auto_download_limit_co (_data_);
}

void
dc_window_set_auto_download_limit_finish (DcWindow* self,
                                          GAsyncResult* _res_)
{
	DcWindowSetAutoDownloadLimitData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_set_auto_download_limit_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DcWindowSetAutoDownloadLimitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_set_auto_download_limit_co (_data_);
}

static gboolean
dc_window_set_auto_download_limit_co (DcWindowSetAutoDownloadLimitData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->settings;
	dc_settings_manager_save_auto_download_limit (_data_->_tmp0_, _data_->bytes);
	_data_->_tmp1_ = _data_->self->priv->rpc;
	_data_->_tmp2_ = dc_rpc_client_get_is_connected (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (!_data_->_tmp3_) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_state_ = 1;
		dc_window_apply_auto_download_limit (_data_->self, dc_window_set_auto_download_limit_ready, _data_);
		return FALSE;
		_state_1:
		dc_window_apply_auto_download_limit_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		_data_->_tmp6_ = g_strconcat ("Unable to update attachment downloads: ", _data_->_tmp5_, NULL);
		_data_->_tmp7_ = _data_->_tmp6_;
		dc_window_show_toast (_data_->self, _data_->_tmp7_);
		_g_free0 (_data_->_tmp7_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_apply_auto_download_limit (DcWindow* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcWindowApplyAutoDownloadLimitData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowApplyAutoDownloadLimitData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_apply_auto_download_limit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_apply_auto_download_limit_co (_data_);
}

static void
dc_window_apply_auto_download_limit_finish (DcWindow* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	DcWindowApplyAutoDownloadLimitData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
dc_window_apply_auto_download_limit_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcWindowApplyAutoDownloadLimitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_apply_auto_download_limit_co (_data_);
}

static gboolean
dc_window_apply_auto_download_limit_co (DcWindowApplyAutoDownloadLimitData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_state_ = 1;
	dc_rpc_client_get_all_accounts (_data_->_tmp0_, dc_window_apply_auto_download_limit_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = dc_rpc_client_get_all_accounts_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
	_data_->accounts_node = _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->accounts_node;
	if (_data_->_tmp2_ == NULL) {
		__vala_JsonNode_free0 (_data_->accounts_node);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->accounts_node;
	_data_->_tmp4_ = json_node_get_array (_data_->_tmp3_);
	_data_->_tmp5_ = _json_array_ref0 (_data_->_tmp4_);
	_data_->accounts = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->self->settings;
	_data_->_tmp7_ = dc_settings_manager_get_auto_download_limit (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = g_strdup_printf ("%i", _data_->_tmp8_);
	_data_->limit = _data_->_tmp9_;
	{
		_data_->i = (guint) 0;
		{
			_data_->_tmp10_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp10_) {
					_data_->_tmp11_ = _data_->i;
					_data_->i = _data_->_tmp11_ + 1;
				}
				_data_->_tmp10_ = FALSE;
				_data_->_tmp12_ = _data_->accounts;
				if (!(_data_->i < json_array_get_length (_data_->_tmp12_))) {
					break;
				}
				_data_->_tmp13_ = _data_->accounts;
				_data_->_tmp14_ = json_array_get_object_element (_data_->_tmp13_, _data_->i);
				_data_->_tmp15_ = _json_object_ref0 (_data_->_tmp14_);
				_data_->account = _data_->_tmp15_;
				_data_->_tmp16_ = _data_->account;
				_data_->id = (gint) json_object_get_int_member (_data_->_tmp16_, "id");
				if (_data_->id > 0) {
					_data_->_tmp17_ = _data_->self->priv->rpc;
					_data_->_tmp18_ = _data_->limit;
					_data_->_state_ = 2;
					dc_rpc_client_batch_set_config (_data_->_tmp17_, "download_limit", _data_->_tmp18_, _data_->id, dc_window_apply_auto_download_limit_ready, _data_);
					return FALSE;
					_state_2:
					dc_rpc_client_batch_set_config_finish (_data_->_tmp17_, _data_->_res_, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
						_json_object_unref0 (_data_->account);
						_g_free0 (_data_->limit);
						_json_array_unref0 (_data_->accounts);
						__vala_JsonNode_free0 (_data_->accounts_node);
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
				}
				_json_object_unref0 (_data_->account);
			}
		}
	}
	_g_free0 (_data_->limit);
	_json_array_unref0 (_data_->accounts);
	__vala_JsonNode_free0 (_data_->accounts_node);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

void
dc_window_switch_account (DcWindow* self,
                          gint acct_id,
                          GAsyncReadyCallback _callback_,
                          gpointer _user_data_)
{
	DcWindowSwitchAccountData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowSwitchAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_switch_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	dc_window_switch_account_co (_data_);
}

gboolean
dc_window_switch_account_finish (DcWindow* self,
                                 GAsyncResult* _res_)
{
	gboolean result;
	DcWindowSwitchAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dc_window_switch_account_ready (GObject* source_object,
                                GAsyncResult* _res_,
                                gpointer _user_data_)
{
	DcWindowSwitchAccountData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_switch_account_co (_data_);
}

static gboolean
dc_window_switch_account_co (DcWindowSwitchAccountData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->acct_id <= 0) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp0_ = _data_->acct_id == _data_->_tmp3_;
	}
	if (_data_->_tmp0_) {
		_data_->result = FALSE;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_select_account (_data_->_tmp4_, _data_->acct_id, dc_window_switch_account_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_select_account_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = _data_->self->priv->rpc;
		dc_rpc_client_set_account_id (_data_->_tmp5_, _data_->acct_id);
		_data_->_state_ = 2;
		dc_window_apply_auto_download_limit (_data_->self, dc_window_switch_account_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_apply_auto_download_limit_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->self->priv->rpc;
		_data_->_state_ = 3;
		dc_rpc_client_start_io_for_all_accounts (_data_->_tmp6_, dc_window_switch_account_ready, _data_);
		return FALSE;
		_state_3:
		dc_rpc_client_start_io_for_all_accounts_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_state_ = 4;
		dc_window_reload_active_account (_data_->self, dc_window_switch_account_ready, _data_);
		return FALSE;
		_state_4:
		dc_window_reload_active_account_finish (_data_->self, _data_->_res_);
		_data_->result = TRUE;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		dc_show_error ((GtkWidget*) _data_->self, _data_->_tmp8_);
		_data_->result = FALSE;
		_g_error_free0 (_data_->e);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		DcWindow* self;
		self = _data8_->self;
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static void
__lambda157_ (Block8Data* _data8_)
{
	DcWindow* self;
	self = _data8_->self;
	if (_data8_->edits_current_account) {
		dc_window_load_profile_avatar (self, NULL, NULL);
	}
}

static void
___lambda157__dc_profile_dialog_profile_updated (DcProfileDialog* _sender,
                                                 gpointer self)
{
	__lambda157_ (self);
}

static void
__lambda158_ (Block8Data* _data8_,
              gint deleted_id)
{
	DcWindow* self;
	self = _data8_->self;
	dc_window_after_profile_deleted (self, deleted_id, _data8_->edits_current_account, NULL, NULL);
}

static void
___lambda158__dc_profile_dialog_account_deleted (DcProfileDialog* _sender,
                                                 gint acct_id,
                                                 gpointer self)
{
	__lambda158_ (self, acct_id);
}

static void
dc_window_show_profile_for_account (DcWindow* self,
                                    gint acct_id)
{
	Block8Data* _data8_;
	DcRpcClient* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	DcProfileDialog* dialog = NULL;
	DcRpcClient* _tmp3_;
	DcSettingsManager* _tmp4_;
	DcEventHandler* _tmp5_;
	DcProfileDialog* _tmp6_;
	DcProfileDialog* _tmp7_;
	DcProfileDialog* _tmp8_;
	DcProfileDialog* _tmp9_;
	g_return_if_fail (self != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	if (acct_id <= 0) {
		block8_data_unref (_data8_);
		_data8_ = NULL;
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = dc_rpc_client_get_account_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_data8_->edits_current_account = acct_id == _tmp2_;
	_tmp3_ = self->priv->rpc;
	_tmp4_ = self->settings;
	_tmp5_ = self->priv->events;
	_tmp6_ = dc_profile_dialog_new (_tmp3_, _tmp4_, _tmp5_, acct_id);
	g_object_ref_sink (_tmp6_);
	dialog = _tmp6_;
	_tmp7_ = dialog;
	g_signal_connect_data (_tmp7_, "profile-updated", (GCallback) ___lambda157__dc_profile_dialog_profile_updated, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp8_ = dialog;
	g_signal_connect_data (_tmp8_, "account-deleted", (GCallback) ___lambda158__dc_profile_dialog_account_deleted, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp9_ = dialog;
	adw_dialog_present ((AdwDialog*) _tmp9_, (GtkWidget*) self);
	_g_object_unref0 (dialog);
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

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

static void
dc_window_after_profile_deleted (DcWindow* self,
                                 gint deleted_id,
                                 gboolean was_current_account,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcWindowAfterProfileDeletedData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowAfterProfileDeletedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_after_profile_deleted_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->deleted_id = deleted_id;
	_data_->was_current_account = was_current_account;
	dc_window_after_profile_deleted_co (_data_);
}

static void
dc_window_after_profile_deleted_finish (DcWindow* self,
                                        GAsyncResult* _res_)
{
	DcWindowAfterProfileDeletedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_after_profile_deleted_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcWindowAfterProfileDeletedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_after_profile_deleted_co (_data_);
}

static gboolean
dc_window_after_profile_deleted_co (DcWindowAfterProfileDeletedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->switched_account = FALSE;
	if (_data_->was_current_account) {
		_data_->_state_ = 1;
		dc_window_switch_to_first_configured_account (_data_->self, _data_->deleted_id, dc_window_after_profile_deleted_ready, _data_);
		return FALSE;
		_state_1:
		_data_->switched_account = dc_window_switch_to_first_configured_account_finish (_data_->self, _data_->_res_);
		if (!_data_->switched_account) {
			_data_->_tmp0_ = _data_->self->priv->rpc;
			dc_rpc_client_set_account_id (_data_->_tmp0_, 0);
			_data_->_state_ = 2;
			dc_window_reload_active_account (_data_->self, dc_window_after_profile_deleted_ready, _data_);
			return FALSE;
			_state_2:
			dc_window_reload_active_account_finish (_data_->self, _data_->_res_);
		}
	}
	_data_->_state_ = 3;
	dc_window_update_unread_indicators (_data_->self, dc_window_after_profile_deleted_ready, _data_);
	return FALSE;
	_state_3:
	dc_window_update_unread_indicators_finish (_data_->self, _data_->_res_);
	if (_data_->switched_account) {
		_data_->_tmp1_ = "Profile deleted; switched profile";
	} else {
		_data_->_tmp1_ = "Profile deleted";
	}
	dc_window_show_toast (_data_->self, _data_->_tmp1_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_switch_to_first_configured_account (DcWindow* self,
                                              gint skip_id,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	DcWindowSwitchToFirstConfiguredAccountData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowSwitchToFirstConfiguredAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_switch_to_first_configured_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->skip_id = skip_id;
	dc_window_switch_to_first_configured_account_co (_data_);
}

static gboolean
dc_window_switch_to_first_configured_account_finish (DcWindow* self,
                                                     GAsyncResult* _res_)
{
	gboolean result;
	DcWindowSwitchToFirstConfiguredAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
dc_window_switch_to_first_configured_account_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_)
{
	DcWindowSwitchToFirstConfiguredAccountData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_switch_to_first_configured_account_co (_data_);
}

static gboolean
dc_window_switch_to_first_configured_account_co (DcWindowSwitchToFirstConfiguredAccountData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_all_accounts (_data_->_tmp0_, dc_window_switch_to_first_configured_account_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = dc_rpc_client_get_all_accounts_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		_data_->accounts_node = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->accounts_node;
		if (_data_->_tmp2_ == NULL) {
			_data_->result = FALSE;
			__vala_JsonNode_free0 (_data_->accounts_node);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp3_ = _data_->accounts_node;
		_data_->_tmp4_ = json_node_get_array (_data_->_tmp3_);
		_data_->_tmp5_ = _json_array_ref0 (_data_->_tmp4_);
		_data_->accounts = _data_->_tmp5_;
		{
			_data_->i = (guint) 0;
			{
				_data_->_tmp6_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp6_) {
						_data_->_tmp7_ = _data_->i;
						_data_->i = _data_->_tmp7_ + 1;
					}
					_data_->_tmp6_ = FALSE;
					_data_->_tmp8_ = _data_->accounts;
					if (!(_data_->i < json_array_get_length (_data_->_tmp8_))) {
						break;
					}
					_data_->_tmp9_ = _data_->accounts;
					_data_->_tmp10_ = json_array_get_object_element (_data_->_tmp9_, _data_->i);
					_data_->_tmp11_ = _json_object_ref0 (_data_->_tmp10_);
					_data_->acct = _data_->_tmp11_;
					_data_->_tmp12_ = _data_->acct;
					_data_->id = (gint) json_object_get_int_member (_data_->_tmp12_, "id");
					if (_data_->id <= 0) {
						_data_->_tmp13_ = TRUE;
					} else {
						_data_->_tmp13_ = _data_->id == _data_->skip_id;
					}
					if (_data_->_tmp13_) {
						_json_object_unref0 (_data_->acct);
						continue;
					}
					_data_->configured = FALSE;
					{
						_data_->_tmp15_ = _data_->self->priv->rpc;
						_data_->_state_ = 2;
						dc_rpc_client_is_configured (_data_->_tmp15_, _data_->id, dc_window_switch_to_first_configured_account_ready, _data_);
						return FALSE;
						_state_2:
						_data_->_tmp14_ = dc_rpc_client_is_configured_finish (_data_->_tmp15_, _data_->_res_, &_data_->_inner_error0_);
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							goto __catch1_g_error;
						}
						_data_->configured = _data_->_tmp14_;
					}
					goto __finally1;
					__catch1_g_error:
					{
						g_clear_error (&_data_->_inner_error0_);
						_json_object_unref0 (_data_->acct);
						continue;
					}
					__finally1:
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_json_object_unref0 (_data_->acct);
						_json_array_unref0 (_data_->accounts);
						__vala_JsonNode_free0 (_data_->accounts_node);
						goto __catch0_g_error;
					}
					if (_data_->configured) {
						_data_->_state_ = 3;
						dc_window_switch_account (_data_->self, _data_->id, dc_window_switch_to_first_configured_account_ready, _data_);
						return FALSE;
						_state_3:
						_data_->_tmp16_ = dc_window_switch_account_finish (_data_->self, _data_->_res_);
					} else {
						_data_->_tmp16_ = FALSE;
					}
					if (_data_->_tmp16_) {
						_data_->result = TRUE;
						_json_object_unref0 (_data_->acct);
						_json_array_unref0 (_data_->accounts);
						__vala_JsonNode_free0 (_data_->accounts_node);
						g_task_return_pointer (_data_->_async_result, _data_, NULL);
						if (_data_->_state_ != 0) {
							while (!g_task_get_completed (_data_->_async_result)) {
								g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
							}
						}
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					_json_object_unref0 (_data_->acct);
				}
			}
		}
		_json_array_unref0 (_data_->accounts);
		__vala_JsonNode_free0 (_data_->accounts_node);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp17_ = _data_->e;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		_data_->_tmp19_ = g_strconcat ("Failed to select another profile: ", _data_->_tmp18_, NULL);
		_data_->_tmp20_ = _data_->_tmp19_;
		dc_window_show_toast (_data_->self, _data_->_tmp20_);
		_g_free0 (_data_->_tmp20_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = FALSE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_load_profile_avatar (DcWindow* self,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DcWindowLoadProfileAvatarData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowLoadProfileAvatarData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_load_profile_avatar_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_load_profile_avatar_co (_data_);
}

static void
dc_window_load_profile_avatar_finish (DcWindow* self,
                                      GAsyncResult* _res_)
{
	DcWindowLoadProfileAvatarData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_load_profile_avatar_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DcWindowLoadProfileAvatarData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_load_profile_avatar_co (_data_);
}

static gboolean
dc_window_load_profile_avatar_co (DcWindowLoadProfileAvatarData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_ <= 0) {
		_data_->_tmp3_ = _data_->self->priv->profile_unread_badge;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp3_, FALSE);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_tmp5_ = _data_->self->priv->rpc;
		_data_->_tmp6_ = dc_rpc_client_get_account_id (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_state_ = 1;
		dc_rpc_client_get_config (_data_->_tmp4_, "displayname", _data_->_tmp7_, dc_window_load_profile_avatar_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp8_ = dc_rpc_client_get_config_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		_data_->name = _data_->_tmp8_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp9_ = _data_->self->priv->rpc;
		_data_->_tmp10_ = _data_->self->priv->rpc;
		_data_->_tmp11_ = dc_rpc_client_get_account_id (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_state_ = 2;
		dc_rpc_client_get_config (_data_->_tmp9_, "selfavatar", _data_->_tmp12_, dc_window_load_profile_avatar_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp13_ = dc_rpc_client_get_config_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
		_data_->avatar = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->name);
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = _data_->avatar;
		_data_->_tmp15_ = g_strdup (_data_->_tmp14_);
		_g_free0 (dc_message_row_self_avatar_path);
		dc_message_row_self_avatar_path = _data_->_tmp15_;
		_data_->_tmp17_ = _data_->name;
		_data_->_tmp16_ = _data_->_tmp17_;
		if (_data_->_tmp16_ == NULL) {
			_data_->_tmp16_ = "";
		}
		_data_->_tmp18_ = _data_->self->priv->profile_avatar;
		adw_avatar_set_text (_data_->_tmp18_, _data_->_tmp16_);
		_data_->_tmp19_ = _data_->self->priv->profile_avatar;
		_data_->_tmp20_ = _data_->avatar;
		_data_->_tmp21_ = dc_load_avatar (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		adw_avatar_set_custom_image (_data_->_tmp19_, (GdkPaintable*) _data_->_tmp22_);
		_g_object_unref0 (_data_->_tmp22_);
		_g_free0 (_data_->avatar);
		_g_free0 (_data_->name);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 3;
	dc_window_update_unread_indicators (_data_->self, dc_window_load_profile_avatar_ready, _data_);
	return FALSE;
	_state_3:
	dc_window_update_unread_indicators_finish (_data_->self, _data_->_res_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
dc_window_update_unread_indicators (DcWindow* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DcWindowUpdateUnreadIndicatorsData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowUpdateUnreadIndicatorsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_update_unread_indicators_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_update_unread_indicators_co (_data_);
}

static void
dc_window_update_unread_indicators_finish (DcWindow* self,
                                           GAsyncResult* _res_)
{
	DcWindowUpdateUnreadIndicatorsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_update_unread_indicators_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DcWindowUpdateUnreadIndicatorsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_update_unread_indicators_co (_data_);
}

static gboolean
dc_window_update_unread_indicators_co (DcWindowUpdateUnreadIndicatorsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->profile_unread_badge;
	if (_data_->_tmp0_ == NULL) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->other_unread = FALSE;
	_data_->_tmp3_ = _data_->self->priv->rpc;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_tmp5_ = dc_rpc_client_get_is_connected (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp2_ = _data_->_tmp6_;
	} else {
		_data_->_tmp2_ = FALSE;
	}
	if (_data_->_tmp2_) {
		_data_->_tmp7_ = _data_->self->priv->rpc;
		_data_->_tmp8_ = dc_rpc_client_get_account_id (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp1_ = _data_->_tmp9_ > 0;
	} else {
		_data_->_tmp1_ = FALSE;
	}
	if (_data_->_tmp1_) {
		{
			_data_->_tmp10_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_get_all_accounts (_data_->_tmp10_, dc_window_update_unread_indicators_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp11_ = dc_rpc_client_get_all_accounts_finish (_data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
			_data_->accounts_node = _data_->_tmp11_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp12_ = _data_->accounts_node;
			if (_data_->_tmp12_ != NULL) {
				_data_->_tmp13_ = _data_->accounts_node;
				_data_->_tmp14_ = json_node_get_array (_data_->_tmp13_);
				_data_->_tmp15_ = _json_array_ref0 (_data_->_tmp14_);
				_data_->accounts = _data_->_tmp15_;
				{
					_data_->i = (guint) 0;
					{
						_data_->_tmp16_ = TRUE;
						while (TRUE) {
							if (!_data_->_tmp16_) {
								_data_->_tmp17_ = _data_->i;
								_data_->i = _data_->_tmp17_ + 1;
							}
							_data_->_tmp16_ = FALSE;
							_data_->_tmp18_ = _data_->accounts;
							if (!(_data_->i < json_array_get_length (_data_->_tmp18_))) {
								break;
							}
							_data_->_tmp19_ = _data_->accounts;
							_data_->_tmp20_ = json_array_get_object_element (_data_->_tmp19_, _data_->i);
							_data_->_tmp21_ = _json_object_ref0 (_data_->_tmp20_);
							_data_->acct = _data_->_tmp21_;
							_data_->_tmp22_ = _data_->acct;
							_data_->id = (gint) json_object_get_int_member (_data_->_tmp22_, "id");
							if (_data_->id <= 0) {
								_data_->_tmp23_ = TRUE;
							} else {
								_data_->_tmp24_ = _data_->self->priv->rpc;
								_data_->_tmp25_ = dc_rpc_client_get_account_id (_data_->_tmp24_);
								_data_->_tmp26_ = _data_->_tmp25_;
								_data_->_tmp23_ = _data_->id == _data_->_tmp26_;
							}
							if (_data_->_tmp23_) {
								_json_object_unref0 (_data_->acct);
								continue;
							}
							_data_->_tmp28_ = _data_->self->priv->rpc;
							_data_->_state_ = 2;
							dc_rpc_client_get_fresh_msg_count (_data_->_tmp28_, _data_->id, dc_window_update_unread_indicators_ready, _data_);
							return FALSE;
							_state_2:
							_data_->_tmp27_ = dc_rpc_client_get_fresh_msg_count_finish (_data_->_tmp28_, _data_->_res_, &_data_->_inner_error0_);
							if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
								_json_object_unref0 (_data_->acct);
								_json_array_unref0 (_data_->accounts);
								__vala_JsonNode_free0 (_data_->accounts_node);
								goto __catch0_g_error;
							}
							if (_data_->_tmp27_ > 0) {
								_data_->other_unread = TRUE;
								_json_object_unref0 (_data_->acct);
								break;
							}
							_json_object_unref0 (_data_->acct);
						}
					}
				}
				_json_array_unref0 (_data_->accounts);
			}
			__vala_JsonNode_free0 (_data_->accounts_node);
		}
		goto __finally0;
		__catch0_g_error:
		{
			g_clear_error (&_data_->_inner_error0_);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp29_ = _data_->self->priv->profile_unread_badge;
	gtk_widget_set_visible ((GtkWidget*) _data_->_tmp29_, _data_->other_unread);
	_data_->_tmp31_ = _data_->self->priv->account_popover;
	if (_data_->_tmp31_ != NULL) {
		_data_->_tmp32_ = _data_->self->priv->account_popover;
		_data_->_tmp30_ = gtk_widget_get_visible ((GtkWidget*) _data_->_tmp32_);
	} else {
		_data_->_tmp30_ = FALSE;
	}
	if (_data_->_tmp30_) {
		_data_->_state_ = 3;
		dc_window_load_account_menu (_data_->self, dc_window_update_unread_indicators_ready, _data_);
		return FALSE;
		_state_3:
		dc_window_load_account_menu_finish (_data_->self, _data_->_res_);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda314_ (DcWindow* self,
              gint contact_id,
              const gchar* email)
{
	g_return_if_fail (email != NULL);
	dc_window_create_chat_by_email (self, email, NULL, NULL);
}

static void
___lambda314__dc_contact_picker_dialog_contact_picked (DcContactPickerDialog* _sender,
                                                       gint contact_id,
                                                       const gchar* email,
                                                       gpointer self)
{
	__lambda314_ ((DcWindow*) self, contact_id, email);
}

static void
dc_window_on_new_chat (DcWindow* self)
{
	DcContactPickerDialog* picker = NULL;
	DcRpcClient* _tmp0_;
	DcContactPickerDialog* _tmp1_;
	DcContactPickerDialog* _tmp2_;
	DcContactPickerDialog* _tmp3_;
	g_return_if_fail (self != NULL);
	if (!dc_window_can_show_account_modal (self)) {
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = dc_contact_picker_dialog_new (_tmp0_, NULL, NULL);
	g_object_ref_sink (_tmp1_);
	picker = _tmp1_;
	_tmp2_ = picker;
	g_signal_connect_object (_tmp2_, "contact-picked", (GCallback) ___lambda314__dc_contact_picker_dialog_contact_picked, self, 0);
	_tmp3_ = picker;
	dc_window_present_modal (self, (AdwDialog*) _tmp3_);
	_g_object_unref0 (picker);
}

static void
dc_window_create_chat_by_email_data_free (gpointer _data)
{
	DcWindowCreateChatByEmailData* _data_;
	_data_ = _data;
	_g_free0 (_data_->email);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowCreateChatByEmailData, _data_);
}

static void
dc_window_create_chat_by_email (DcWindow* self,
                                const gchar* email,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcWindowCreateChatByEmailData* _data_;
	DcWindow* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (email != NULL);
	_data_ = g_slice_new0 (DcWindowCreateChatByEmailData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_create_chat_by_email_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (email);
	_g_free0 (_data_->email);
	_data_->email = _tmp1_;
	dc_window_create_chat_by_email_co (_data_);
}

static void
dc_window_create_chat_by_email_finish (DcWindow* self,
                                       GAsyncResult* _res_)
{
	DcWindowCreateChatByEmailData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_create_chat_by_email_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcWindowCreateChatByEmailData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_create_chat_by_email_co (_data_);
}

static gboolean
dc_window_create_chat_by_email_co (DcWindowCreateChatByEmailData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_ <= 0) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp3_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_or_create_contact (_data_->_tmp3_, _data_->email, dc_window_create_chat_by_email_ready, _data_);
		return FALSE;
		_state_1:
		_data_->contact_id = dc_rpc_client_get_or_create_contact_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_get_or_create_chat_by_contact (_data_->_tmp4_, _data_->contact_id, dc_window_create_chat_by_email_ready, _data_);
		return FALSE;
		_state_2:
		_data_->chat_id = dc_rpc_client_get_or_create_chat_by_contact_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_state_ = 3;
		dc_window_load_chats (_data_->self, dc_window_create_chat_by_email_ready, _data_);
		return FALSE;
		_state_3:
		dc_window_load_chats_finish (_data_->self, _data_->_res_);
		dc_window_select_chat_by_id (_data_->self, _data_->chat_id);
		_data_->_tmp5_ = g_strconcat ("Chat created with ", _data_->email, NULL);
		_data_->_tmp6_ = _data_->_tmp5_;
		dc_window_show_toast (_data_->self, _data_->_tmp6_);
		_g_free0 (_data_->_tmp6_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		_data_->_tmp9_ = g_strconcat ("Failed to create chat: ", _data_->_tmp8_, NULL);
		_data_->_tmp10_ = _data_->_tmp9_;
		dc_window_show_toast (_data_->self, _data_->_tmp10_);
		_g_free0 (_data_->_tmp10_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_on_new_group (DcWindow* self)
{
	g_return_if_fail (self != NULL);
	dc_window_show_group_dialog (self, FALSE);
}

static void
dc_window_on_new_channel (DcWindow* self)
{
	g_return_if_fail (self != NULL);
	dc_window_show_group_dialog (self, TRUE);
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		DcWindow* self;
		self = _data9_->self;
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
__lambda316_ (Block9Data* _data9_,
              gint chat_id)
{
	DcWindow* self;
	self = _data9_->self;
	dc_window_after_group_created (self, chat_id, _data9_->is_channel, NULL, NULL);
}

static void
___lambda316__dc_new_group_dialog_group_created (DcNewGroupDialog* _sender,
                                                 gint chat_id,
                                                 gpointer self)
{
	__lambda316_ (self, chat_id);
}

static void
dc_window_show_group_dialog (DcWindow* self,
                             gboolean is_channel)
{
	Block9Data* _data9_;
	DcNewGroupDialog* dialog = NULL;
	DcRpcClient* _tmp0_;
	DcNewGroupDialog* _tmp1_;
	DcNewGroupDialog* _tmp2_;
	DcNewGroupDialog* _tmp3_;
	g_return_if_fail (self != NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_data9_->is_channel = is_channel;
	if (!dc_window_can_show_account_modal (self)) {
		block9_data_unref (_data9_);
		_data9_ = NULL;
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = dc_new_group_dialog_new (_tmp0_, _data9_->is_channel);
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	_tmp2_ = dialog;
	g_signal_connect_data (_tmp2_, "group-created", (GCallback) ___lambda316__dc_new_group_dialog_group_created, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
	_tmp3_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp3_);
	_g_object_unref0 (dialog);
	block9_data_unref (_data9_);
	_data9_ = NULL;
}

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

static void
dc_window_after_group_created (DcWindow* self,
                               gint chat_id,
                               gboolean is_channel,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DcWindowAfterGroupCreatedData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowAfterGroupCreatedData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_after_group_created_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->is_channel = is_channel;
	dc_window_after_group_created_co (_data_);
}

static void
dc_window_after_group_created_finish (DcWindow* self,
                                      GAsyncResult* _res_)
{
	DcWindowAfterGroupCreatedData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_after_group_created_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DcWindowAfterGroupCreatedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_after_group_created_co (_data_);
}

static gboolean
dc_window_after_group_created_co (DcWindowAfterGroupCreatedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dc_window_load_chats (_data_->self, dc_window_after_group_created_ready, _data_);
	return FALSE;
	_state_1:
	dc_window_load_chats_finish (_data_->self, _data_->_res_);
	dc_window_select_chat_by_id (_data_->self, _data_->chat_id);
	if (_data_->is_channel) {
		_data_->_tmp0_ = "Channel created";
	} else {
		_data_->_tmp0_ = "Group created";
	}
	dc_window_show_toast (_data_->self, _data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
dc_window_scroll_to_message (DcWindow* self,
                             gint msg_id)
{
	DcConversationView* v = NULL;
	DcConversationView* _tmp0_;
	DcConversationView* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_window_current_view (self);
	v = _tmp0_;
	_tmp1_ = v;
	if (_tmp1_ != NULL) {
		DcConversationView* _tmp2_;
		_tmp2_ = v;
		dc_conversation_view_scroll_to_message (_tmp2_, msg_id);
	}
	_g_object_unref0 (v);
}

void
dc_window_open_conversation_message (DcWindow* self,
                                     gint chat_id,
                                     gint msg_id)
{
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gint _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp1_ = dc_window_get_current_chat_id (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != chat_id) {
		_tmp0_ = !dc_window_select_chat_by_id (self, chat_id);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	dc_window_scroll_to_message (self, msg_id);
}

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

void
dc_window_open_media_message (DcWindow* self,
                              gint acct_id,
                              gint chat_id,
                              gint msg_id,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	DcWindowOpenMediaMessageData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowOpenMediaMessageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_open_media_message_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_data_->chat_id = chat_id;
	_data_->msg_id = msg_id;
	dc_window_open_media_message_co (_data_);
}

void
dc_window_open_media_message_finish (DcWindow* self,
                                     GAsyncResult* _res_)
{
	DcWindowOpenMediaMessageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_open_media_message_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	DcWindowOpenMediaMessageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_open_media_message_co (_data_);
}

static gboolean
dc_window_open_media_message_co (DcWindowOpenMediaMessageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dc_window_open_chat_from_notification (_data_->self, _data_->acct_id, _data_->chat_id, dc_window_open_media_message_ready, _data_);
	return FALSE;
	_state_1:
	dc_window_open_chat_from_notification_finish (_data_->self, _data_->_res_);
	_data_->_tmp0_ = dc_window_get_current_chat_id (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_ == _data_->chat_id) {
		dc_window_scroll_to_message (_data_->self, _data_->msg_id);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
dc_window_navigate_voice_playback (DcWindow* self,
                                   gint direction)
{
	DcAudioPlaybackItem* item = NULL;
	DcAudioPlayback* _tmp0_;
	DcAudioPlayback* _tmp1_;
	DcAudioPlaybackItem* _tmp2_;
	DcAudioPlaybackItem* _tmp3_;
	DcAudioPlaybackItem* _tmp4_;
	DcAudioPlaybackItem* _tmp5_;
	gboolean _tmp6_ = FALSE;
	DcAudioPlaybackItem* _tmp7_;
	DcAudioPlaybackItem* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	DcRpcClient* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	DcConversationView* view = NULL;
	GHashTable* _tmp23_;
	DcAudioPlaybackItem* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	gconstpointer _tmp27_;
	DcConversationView* _tmp28_;
	DcConversationView* _tmp29_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_audio_playback_shared ();
	_tmp1_ = _tmp0_;
	_tmp2_ = dc_audio_playback_get_current_item (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp1_);
	item = _tmp5_;
	_tmp7_ = item;
	if (_tmp7_ == NULL) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = direction == 0;
	}
	if (_tmp6_) {
		_g_object_unref0 (item);
		return;
	}
	_tmp8_ = item;
	_tmp9_ = dc_audio_playback_item_get_account_id (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->rpc;
	_tmp12_ = dc_rpc_client_get_account_id (_tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp10_ != _tmp13_) {
		DcAudioPlaybackItem* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		DcAudioPlaybackItem* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		DcAudioPlaybackItem* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		_tmp14_ = item;
		_tmp15_ = dc_audio_playback_item_get_account_id (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = item;
		_tmp18_ = dc_audio_playback_item_get_chat_id (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = item;
		_tmp21_ = dc_audio_playback_item_get_message_id (_tmp20_);
		_tmp22_ = _tmp21_;
		dc_window_navigate_voice_after_open (self, _tmp16_, _tmp19_, _tmp22_, direction, NULL, NULL);
		_g_object_unref0 (item);
		return;
	}
	_tmp23_ = self->priv->views;
	_tmp24_ = item;
	_tmp25_ = dc_audio_playback_item_get_chat_id (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = g_hash_table_lookup (_tmp23_, (gpointer) ((gintptr) _tmp26_));
	_tmp28_ = _g_object_ref0 ((DcConversationView*) _tmp27_);
	view = _tmp28_;
	_tmp29_ = view;
	if (_tmp29_ != NULL) {
		DcConversationView* _tmp30_;
		_tmp30_ = view;
		dc_conversation_view_request_voice_navigation (_tmp30_, direction);
	} else {
		DcAudioPlaybackItem* _tmp31_;
		gint _tmp32_;
		gint _tmp33_;
		DcAudioPlaybackItem* _tmp34_;
		gint _tmp35_;
		gint _tmp36_;
		DcAudioPlaybackItem* _tmp37_;
		gint _tmp38_;
		gint _tmp39_;
		_tmp31_ = item;
		_tmp32_ = dc_audio_playback_item_get_account_id (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = item;
		_tmp35_ = dc_audio_playback_item_get_chat_id (_tmp34_);
		_tmp36_ = _tmp35_;
		_tmp37_ = item;
		_tmp38_ = dc_audio_playback_item_get_message_id (_tmp37_);
		_tmp39_ = _tmp38_;
		dc_window_navigate_voice_after_open (self, _tmp33_, _tmp36_, _tmp39_, direction, NULL, NULL);
	}
	_g_object_unref0 (view);
	_g_object_unref0 (item);
}

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

static void
dc_window_navigate_voice_after_open (DcWindow* self,
                                     gint acct_id,
                                     gint chat_id,
                                     gint msg_id,
                                     gint direction,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcWindowNavigateVoiceAfterOpenData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowNavigateVoiceAfterOpenData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_navigate_voice_after_open_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_data_->chat_id = chat_id;
	_data_->msg_id = msg_id;
	_data_->direction = direction;
	dc_window_navigate_voice_after_open_co (_data_);
}

static void
dc_window_navigate_voice_after_open_finish (DcWindow* self,
                                            GAsyncResult* _res_)
{
	DcWindowNavigateVoiceAfterOpenData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_navigate_voice_after_open_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcWindowNavigateVoiceAfterOpenData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_navigate_voice_after_open_co (_data_);
}

static gboolean
dc_window_navigate_voice_after_open_co (DcWindowNavigateVoiceAfterOpenData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	dc_window_open_media_message (_data_->self, _data_->acct_id, _data_->chat_id, _data_->msg_id, dc_window_navigate_voice_after_open_ready, _data_);
	return FALSE;
	_state_1:
	dc_window_open_media_message_finish (_data_->self, _data_->_res_);
	_data_->_tmp0_ = dc_audio_playback_shared ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = dc_audio_playback_get_current_item (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = _g_object_ref0 (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_g_object_unref0 (_data_->_tmp1_);
	_data_->item = _data_->_tmp5_;
	_data_->_tmp9_ = _data_->item;
	if (_data_->_tmp9_ == NULL) {
		_data_->_tmp8_ = TRUE;
	} else {
		_data_->_tmp10_ = _data_->item;
		_data_->_tmp11_ = dc_audio_playback_item_get_account_id (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp8_ = _data_->_tmp12_ != _data_->acct_id;
	}
	if (_data_->_tmp8_) {
		_data_->_tmp7_ = TRUE;
	} else {
		_data_->_tmp13_ = _data_->item;
		_data_->_tmp14_ = dc_audio_playback_item_get_chat_id (_data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp7_ = _data_->_tmp15_ != _data_->chat_id;
	}
	if (_data_->_tmp7_) {
		_data_->_tmp6_ = TRUE;
	} else {
		_data_->_tmp16_ = _data_->item;
		_data_->_tmp17_ = dc_audio_playback_item_get_message_id (_data_->_tmp16_);
		_data_->_tmp18_ = _data_->_tmp17_;
		_data_->_tmp6_ = _data_->_tmp18_ != _data_->msg_id;
	}
	if (_data_->_tmp6_) {
		_g_object_unref0 (_data_->item);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp19_ = _data_->self->priv->views;
	_data_->_tmp20_ = g_hash_table_lookup (_data_->_tmp19_, (gpointer) ((gintptr) _data_->chat_id));
	_data_->_tmp21_ = _g_object_ref0 ((DcConversationView*) _data_->_tmp20_);
	_data_->view = _data_->_tmp21_;
	_data_->_tmp22_ = _data_->view;
	if (_data_->_tmp22_ != NULL) {
		_data_->_tmp23_ = _data_->view;
		dc_conversation_view_request_voice_navigation (_data_->_tmp23_, _data_->direction);
	}
	_g_object_unref0 (_data_->view);
	_g_object_unref0 (_data_->item);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

void
dc_window_open_chat_from_notification (DcWindow* self,
                                       gint acct_id,
                                       gint chat_id,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	DcWindowOpenChatFromNotificationData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowOpenChatFromNotificationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_open_chat_from_notification_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_data_->chat_id = chat_id;
	dc_window_open_chat_from_notification_co (_data_);
}

void
dc_window_open_chat_from_notification_finish (DcWindow* self,
                                              GAsyncResult* _res_)
{
	DcWindowOpenChatFromNotificationData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_open_chat_from_notification_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	DcWindowOpenChatFromNotificationData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_open_chat_from_notification_co (_data_);
}

static gboolean
dc_window_open_chat_from_notification_co (DcWindowOpenChatFromNotificationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->acct_id > 0) {
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp0_ = _data_->acct_id != _data_->_tmp3_;
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		_data_->_state_ = 1;
		dc_window_switch_account (_data_->self, _data_->acct_id, dc_window_open_chat_from_notification_ready, _data_);
		return FALSE;
		_state_1:
		if (!dc_window_switch_account_finish (_data_->self, _data_->_res_)) {
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	if (_data_->chat_id <= 0) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	if (!dc_window_select_chat_by_id (_data_->self, _data_->chat_id)) {
		_data_->_state_ = 2;
		dc_window_load_chats (_data_->self, dc_window_open_chat_from_notification_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_load_chats_finish (_data_->self, _data_->_res_);
		dc_window_select_chat_by_id (_data_->self, _data_->chat_id);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
__lambda313_ (DcWindow* self)
{
	dc_window_on_new_chat (self);
}

static void
___lambda313__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda313_ ((DcWindow*) self);
}

static void
__lambda315_ (DcWindow* self)
{
	dc_window_on_new_group (self);
}

static void
___lambda315__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda315_ ((DcWindow*) self);
}

static void
__lambda317_ (DcWindow* self)
{
	dc_window_on_new_channel (self);
}

static void
___lambda317__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda317_ ((DcWindow*) self);
}

static void
__lambda318_ (DcWindow* self)
{
	dc_window_show_use_invite_link_dialog (self, NULL);
}

static void
___lambda318__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda318_ ((DcWindow*) self);
}

static void
__lambda323_ (DcWindow* self)
{
	dc_window_load_chats (self, NULL, NULL);
}

static void
___lambda323__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda323_ ((DcWindow*) self);
}

static void
__lambda324_ (DcWindow* self)
{
	dc_window_show_settings_dialog (self);
}

static void
___lambda324__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda324_ ((DcWindow*) self);
}

static void
__lambda389_ (DcWindow* self)
{
	dc_window_show_stickers_dialog (self);
}

static void
___lambda389__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda389_ ((DcWindow*) self);
}

static void
__lambda390_ (DcWindow* self)
{
	dc_window_show_webxdc_apps_dialog (self);
}

static void
___lambda390__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda390_ ((DcWindow*) self);
}

static void
__lambda409_ (DcWindow* self)
{
	dc_window_show_keyboard_shortcuts_dialog (self);
}

static void
___lambda409__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda409_ ((DcWindow*) self);
}

static void
__lambda410_ (DcWindow* self)
{
	dc_window_show_about_dialog (self);
}

static void
___lambda410__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda410_ ((DcWindow*) self);
}

static void
__lambda411_ (DcWindow* self)
{
	dc_window_handle_primary_q (self);
}

static void
___lambda411__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda411_ ((DcWindow*) self);
}

static void
__lambda412_ (DcWindow* self)
{
	dc_window_adjust_font_size (self, 1);
}

static void
___lambda412__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda412_ ((DcWindow*) self);
}

static void
__lambda413_ (DcWindow* self)
{
	dc_window_adjust_font_size (self, -1);
}

static void
___lambda413__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda413_ ((DcWindow*) self);
}

static void
__lambda414_ (DcWindow* self)
{
	DcSettingsManager* _tmp0_;
	_tmp0_ = self->settings;
	dc_settings_manager_save_font_size (_tmp0_, DC_FONT_SIZE_SYSTEM);
}

static void
___lambda414__g_simple_action_activate (GSimpleAction* _sender,
                                        GVariant* parameter,
                                        gpointer self)
{
	__lambda414_ ((DcWindow*) self);
}

static GMenuModel*
dc_window_build_app_menu (DcWindow* self)
{
	GSimpleAction* _tmp0_;
	GSimpleAction* _tmp1_;
	GSimpleAction* _tmp2_;
	GSimpleAction* _tmp3_;
	GSimpleAction* _tmp4_;
	GSimpleAction* _tmp5_;
	GSimpleAction* _tmp6_;
	GSimpleAction* _tmp7_;
	GSimpleAction* _tmp8_;
	GSimpleAction* _tmp9_;
	GSimpleAction* _tmp10_;
	GSimpleAction* _tmp11_;
	GSimpleAction* _tmp12_;
	GSimpleAction* _tmp13_;
	GSimpleAction* _tmp14_;
	GSimpleAction* _tmp15_;
	GSimpleAction* _tmp16_;
	GSimpleAction* _tmp17_;
	GSimpleAction* _tmp18_;
	GSimpleAction* _tmp19_;
	GSimpleAction* _tmp20_;
	GSimpleAction* _tmp21_;
	GSimpleAction* _tmp22_;
	GSimpleAction* _tmp23_;
	GSimpleAction* _tmp24_;
	GSimpleAction* _tmp25_;
	GSimpleAction* _tmp26_;
	GSimpleAction* _tmp27_;
	GMenu* s1 = NULL;
	GMenu* _tmp28_;
	GMenu* s2 = NULL;
	GMenu* _tmp29_;
	GMenu* s3 = NULL;
	GMenu* _tmp30_;
	GMenu* s4 = NULL;
	GMenu* _tmp31_;
	GMenu* menu = NULL;
	GMenu* _tmp32_;
	GMenuModel* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = dc_window_window_action (self, "new-chat");
	_tmp1_ = _tmp0_;
	g_signal_connect_object (_tmp1_, "activate", (GCallback) ___lambda313__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = dc_window_window_action (self, "new-group");
	_tmp3_ = _tmp2_;
	g_signal_connect_object (_tmp3_, "activate", (GCallback) ___lambda315__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = dc_window_window_action (self, "new-channel");
	_tmp5_ = _tmp4_;
	g_signal_connect_object (_tmp5_, "activate", (GCallback) ___lambda317__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = dc_window_window_action (self, "use-invite-link");
	_tmp7_ = _tmp6_;
	g_signal_connect_object (_tmp7_, "activate", (GCallback) ___lambda318__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = dc_window_window_action (self, "refresh");
	_tmp9_ = _tmp8_;
	g_signal_connect_object (_tmp9_, "activate", (GCallback) ___lambda323__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp9_);
	_tmp10_ = dc_window_window_action (self, "settings");
	_tmp11_ = _tmp10_;
	g_signal_connect_object (_tmp11_, "activate", (GCallback) ___lambda324__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = dc_window_window_action (self, "stickers");
	_tmp13_ = _tmp12_;
	g_signal_connect_object (_tmp13_, "activate", (GCallback) ___lambda389__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp13_);
	_tmp14_ = dc_window_window_action (self, "webxdc-apps");
	_tmp15_ = _tmp14_;
	g_signal_connect_object (_tmp15_, "activate", (GCallback) ___lambda390__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp15_);
	_tmp16_ = dc_window_window_action (self, "shortcuts");
	_tmp17_ = _tmp16_;
	g_signal_connect_object (_tmp17_, "activate", (GCallback) ___lambda409__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp17_);
	_tmp18_ = dc_window_window_action (self, "about");
	_tmp19_ = _tmp18_;
	g_signal_connect_object (_tmp19_, "activate", (GCallback) ___lambda410__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp19_);
	_tmp20_ = dc_window_window_action (self, "quit");
	_tmp21_ = _tmp20_;
	g_signal_connect_object (_tmp21_, "activate", (GCallback) ___lambda411__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp21_);
	_tmp22_ = dc_window_window_action (self, "font-increase");
	_tmp23_ = _tmp22_;
	g_signal_connect_object (_tmp23_, "activate", (GCallback) ___lambda412__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp23_);
	_tmp24_ = dc_window_window_action (self, "font-decrease");
	_tmp25_ = _tmp24_;
	g_signal_connect_object (_tmp25_, "activate", (GCallback) ___lambda413__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp25_);
	_tmp26_ = dc_window_window_action (self, "font-reset");
	_tmp27_ = _tmp26_;
	g_signal_connect_object (_tmp27_, "activate", (GCallback) ___lambda414__g_simple_action_activate, self, 0);
	_g_object_unref0 (_tmp27_);
	_tmp28_ = g_menu_new ();
	s1 = _tmp28_;
	g_menu_append (s1, "New Chat", "win.new-chat");
	g_menu_append (s1, "New Group", "win.new-group");
	g_menu_append (s1, "New Channel", "win.new-channel");
	g_menu_append (s1, "Use Invite Link", "win.use-invite-link");
	_tmp29_ = g_menu_new ();
	s2 = _tmp29_;
	g_menu_append (s2, "Stickers", "win.stickers");
	g_menu_append (s2, "Apps", "win.webxdc-apps");
	_tmp30_ = g_menu_new ();
	s3 = _tmp30_;
	g_menu_append (s3, "Settings", "win.settings");
	g_menu_append (s3, "Shortcuts", "win.shortcuts");
	g_menu_append (s3, "About", "win.about");
	_tmp31_ = g_menu_new ();
	s4 = _tmp31_;
	g_menu_append (s4, "Quit", "win.quit");
	_tmp32_ = g_menu_new ();
	menu = _tmp32_;
	g_menu_append_section (menu, NULL, (GMenuModel*) s1);
	g_menu_append_section (menu, NULL, (GMenuModel*) s2);
	g_menu_append_section (menu, NULL, (GMenuModel*) s3);
	g_menu_append_section (menu, NULL, (GMenuModel*) s4);
	result = (GMenuModel*) menu;
	_g_object_unref0 (s4);
	_g_object_unref0 (s3);
	_g_object_unref0 (s2);
	_g_object_unref0 (s1);
	return result;
}

static GSimpleAction*
dc_window_window_action (DcWindow* self,
                         const gchar* name)
{
	GSimpleAction* action = NULL;
	GSimpleAction* _tmp0_;
	GSimpleAction* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = g_simple_action_new (name, NULL);
	action = _tmp0_;
	g_action_map_add_action ((GActionMap*) self, (GAction*) action);
	result = action;
	return result;
}

static void
dc_window_show_about_dialog (DcWindow* self)
{
	AdwAboutDialog* about = NULL;
	AdwAboutDialog* _tmp0_;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (AdwAboutDialog*) adw_about_dialog_new ();
	g_object_ref_sink (_tmp0_);
	about = _tmp0_;
	adw_about_dialog_set_application_name (about, PARLA_APP_DATA_NAME);
	adw_about_dialog_set_application_icon (about, PARLA_APP_DATA_ID);
	adw_about_dialog_set_version (about, PARLA_VERSION);
	adw_about_dialog_set_developer_name (about, PARLA_APP_DATA_DEVELOPER);
	_tmp2_ = parla_app_data_developers (&_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	g_object_set ((GObject*) about, "developers", _tmp3_, NULL);
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
	adw_about_dialog_set_license_type (about, GTK_LICENSE_GPL_3_0);
	adw_about_dialog_set_website (about, PARLA_APP_DATA_WEBSITE);
	adw_about_dialog_set_issue_url (about, PARLA_APP_DATA_ISSUE_URL);
	adw_about_dialog_set_comments (about, PARLA_APP_DATA_COMMENTS);
	adw_about_dialog_set_release_notes_version (about, PARLA_VERSION);
	_tmp4_ = parla_app_data_release_notes ();
	_tmp5_ = _tmp4_;
	adw_about_dialog_set_release_notes (about, _tmp5_);
	_g_free0 (_tmp5_);
	adw_dialog_present ((AdwDialog*) about, (GtkWidget*) self);
	_g_object_unref0 (about);
}

void
dc_window_handle_invite_uri (DcWindow* self,
                             const gchar* uri)
{
	gboolean _tmp0_ = FALSE;
	DcRpcClient* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	dc_window_restore_from_tray (self);
	_tmp1_ = self->priv->rpc;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		DcRpcClient* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = self->priv->rpc;
		_tmp3_ = dc_rpc_client_get_account_id (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ <= 0;
	}
	if (_tmp0_) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup (uri);
		_g_free0 (self->priv->pending_invite_uri);
		self->priv->pending_invite_uri = _tmp5_;
		dc_window_show_toast (self, "Invite link will open once a profile is ready");
		return;
	}
	dc_window_show_use_invite_link_dialog (self, uri);
}

static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		DcWindow* self;
		self = _data10_->self;
		_g_object_unref0 (_data10_->add_btn);
		_g_object_unref0 (_data10_->status);
		_g_object_unref0 (_data10_->entry);
		_g_object_unref0 (_data10_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static void
__lambda319_ (Block10Data* _data10_)
{
	DcWindow* self;
	AdwDialog* _tmp0_;
	self = _data10_->self;
	_tmp0_ = _data10_->dialog;
	adw_dialog_close (_tmp0_);
}

static void
___lambda319__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda319_ (self);
}

static void
__lambda320_ (Block10Data* _data10_)
{
	DcWindow* self;
	AdwDialog* _tmp0_;
	GtkEntry* _tmp1_;
	GtkLabel* _tmp2_;
	GtkButton* _tmp3_;
	self = _data10_->self;
	_tmp0_ = _data10_->dialog;
	_tmp1_ = _data10_->entry;
	_tmp2_ = _data10_->status;
	_tmp3_ = _data10_->add_btn;
	dc_window_use_invite_link (self, _tmp0_, _tmp1_, _tmp2_, _tmp3_, NULL, NULL);
}

static void
___lambda320__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda320_ (self);
}

static void
__lambda321_ (Block10Data* _data10_)
{
	DcWindow* self;
	GtkButton* _tmp0_;
	GtkEntry* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GtkLabel* _tmp8_;
	self = _data10_->self;
	_tmp0_ = _data10_->add_btn;
	_tmp1_ = _data10_->entry;
	_tmp2_ = gtk_editable_get_text ((GtkEditable*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = string_strip (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = strlen (_tmp5_);
	_tmp7_ = _tmp6_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, _tmp7_ > 0);
	_g_free0 (_tmp5_);
	_tmp8_ = _data10_->status;
	gtk_label_set_label (_tmp8_, "");
}

static void
___lambda321__gtk_editable_changed (GtkEditable* _sender,
                                    gpointer self)
{
	__lambda321_ (self);
}

static void
__lambda322_ (Block10Data* _data10_)
{
	DcWindow* self;
	GtkButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data10_->self;
	_tmp0_ = _data10_->add_btn;
	_tmp1_ = gtk_widget_get_sensitive ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		AdwDialog* _tmp3_;
		GtkEntry* _tmp4_;
		GtkLabel* _tmp5_;
		GtkButton* _tmp6_;
		_tmp3_ = _data10_->dialog;
		_tmp4_ = _data10_->entry;
		_tmp5_ = _data10_->status;
		_tmp6_ = _data10_->add_btn;
		dc_window_use_invite_link (self, _tmp3_, _tmp4_, _tmp5_, _tmp6_, NULL, NULL);
	}
}

static void
___lambda322__gtk_entry_activate (GtkEntry* _sender,
                                  gpointer self)
{
	__lambda322_ (self);
}

static void
dc_window_show_use_invite_link_dialog (DcWindow* self,
                                       const gchar* prefill)
{
	Block10Data* _data10_;
	AdwDialog* _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	AdwDialog* _tmp4_;
	AdwDialog* _tmp5_;
	AdwDialog* _tmp6_;
	GtkBox* box = NULL;
	GtkBox* _tmp7_;
	GtkBox* _tmp8_;
	AdwHeaderBar* _tmp9_;
	AdwHeaderBar* _tmp10_;
	GtkBox* content = NULL;
	GtkBox* _tmp11_;
	GtkBox* _tmp12_;
	GtkBox* _tmp13_;
	GtkBox* _tmp14_;
	GtkBox* _tmp15_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp16_;
	GtkLabel* _tmp17_;
	GtkLabel* _tmp18_;
	GtkLabel* _tmp19_;
	GtkLabel* _tmp20_;
	GtkBox* _tmp21_;
	GtkLabel* _tmp22_;
	GtkEntry* _tmp23_;
	GtkEntry* _tmp24_;
	GtkEntry* _tmp25_;
	GtkEntry* _tmp26_;
	GtkBox* _tmp27_;
	GtkEntry* _tmp28_;
	GtkLabel* _tmp29_;
	GtkLabel* _tmp30_;
	GtkLabel* _tmp31_;
	GtkLabel* _tmp32_;
	GtkLabel* _tmp33_;
	GtkBox* _tmp34_;
	GtkLabel* _tmp35_;
	GtkBox* actions = NULL;
	GtkBox* _tmp36_;
	GtkBox* _tmp37_;
	GtkBox* _tmp38_;
	GtkButton* cancel_btn = NULL;
	GtkButton* _tmp39_;
	GtkButton* _tmp40_;
	GtkBox* _tmp41_;
	GtkButton* _tmp42_;
	GtkButton* _tmp43_;
	GtkButton* _tmp44_;
	GtkButton* _tmp45_;
	GtkButton* _tmp46_;
	GtkBox* _tmp47_;
	GtkButton* _tmp48_;
	GtkBox* _tmp49_;
	GtkBox* _tmp50_;
	GtkEntry* _tmp51_;
	GtkEntry* _tmp52_;
	GtkBox* _tmp53_;
	GtkBox* _tmp54_;
	AdwDialog* _tmp55_;
	GtkBox* _tmp56_;
	AdwDialog* _tmp57_;
	gboolean _tmp58_ = FALSE;
	g_return_if_fail (self != NULL);
	_data10_ = g_slice_new0 (Block10Data);
	_data10_->_ref_count_ = 1;
	_data10_->self = g_object_ref (self);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ != NULL) {
		block10_data_unref (_data10_);
		_data10_ = NULL;
		return;
	}
	_tmp1_ = self->priv->rpc;
	_tmp2_ = dc_rpc_client_get_account_id (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ <= 0) {
		dc_window_show_toast (self, "No active profile");
		block10_data_unref (_data10_);
		_data10_ = NULL;
		return;
	}
	_tmp4_ = adw_dialog_new ();
	g_object_ref_sink (_tmp4_);
	_data10_->dialog = _tmp4_;
	_tmp5_ = _data10_->dialog;
	adw_dialog_set_title (_tmp5_, "Use Invite Link");
	_tmp6_ = _data10_->dialog;
	adw_dialog_set_content_width (_tmp6_, 460);
	_tmp7_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp7_);
	box = _tmp7_;
	_tmp8_ = box;
	_tmp9_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp9_);
	_tmp10_ = _tmp9_;
	gtk_box_append (_tmp8_, (GtkWidget*) _tmp10_);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
	g_object_ref_sink (_tmp11_);
	content = _tmp11_;
	_tmp12_ = content;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp12_, 18);
	_tmp13_ = content;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp13_, 18);
	_tmp14_ = content;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp14_, 12);
	_tmp15_ = content;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp15_, 18);
	_tmp16_ = (GtkLabel*) gtk_label_new ("Paste a Delta Chat invite link.");
	g_object_ref_sink (_tmp16_);
	label = _tmp16_;
	_tmp17_ = label;
	gtk_widget_set_halign ((GtkWidget*) _tmp17_, GTK_ALIGN_START);
	_tmp18_ = label;
	gtk_label_set_xalign (_tmp18_, (gfloat) 0);
	_tmp19_ = label;
	gtk_label_set_wrap (_tmp19_, TRUE);
	_tmp20_ = label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp20_, "dim-label");
	_tmp21_ = content;
	_tmp22_ = label;
	gtk_box_append (_tmp21_, (GtkWidget*) _tmp22_);
	_tmp23_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp23_);
	_data10_->entry = _tmp23_;
	_tmp24_ = _data10_->entry;
	gtk_entry_set_placeholder_text (_tmp24_, "https://i.delta.chat/#...");
	_tmp25_ = _data10_->entry;
	gtk_entry_set_input_purpose (_tmp25_, GTK_INPUT_PURPOSE_URL);
	_tmp26_ = _data10_->entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp26_, TRUE);
	_tmp27_ = content;
	_tmp28_ = _data10_->entry;
	gtk_box_append (_tmp27_, (GtkWidget*) _tmp28_);
	_tmp29_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp29_);
	_data10_->status = _tmp29_;
	_tmp30_ = _data10_->status;
	gtk_widget_set_halign ((GtkWidget*) _tmp30_, GTK_ALIGN_START);
	_tmp31_ = _data10_->status;
	gtk_label_set_xalign (_tmp31_, (gfloat) 0);
	_tmp32_ = _data10_->status;
	gtk_label_set_wrap (_tmp32_, TRUE);
	_tmp33_ = _data10_->status;
	gtk_widget_add_css_class ((GtkWidget*) _tmp33_, "dim-label");
	_tmp34_ = content;
	_tmp35_ = _data10_->status;
	gtk_box_append (_tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp36_);
	actions = _tmp36_;
	_tmp37_ = actions;
	gtk_widget_set_halign ((GtkWidget*) _tmp37_, GTK_ALIGN_END);
	_tmp38_ = actions;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp38_, 6);
	_tmp39_ = (GtkButton*) gtk_button_new_with_label ("Cancel");
	g_object_ref_sink (_tmp39_);
	cancel_btn = _tmp39_;
	_tmp40_ = cancel_btn;
	g_signal_connect_data (_tmp40_, "clicked", (GCallback) ___lambda319__gtk_button_clicked, block10_data_ref (_data10_), (GClosureNotify) block10_data_unref, 0);
	_tmp41_ = actions;
	_tmp42_ = cancel_btn;
	gtk_box_append (_tmp41_, (GtkWidget*) _tmp42_);
	_tmp43_ = (GtkButton*) gtk_button_new_with_label ("Add");
	g_object_ref_sink (_tmp43_);
	_data10_->add_btn = _tmp43_;
	_tmp44_ = _data10_->add_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp44_, "suggested-action");
	_tmp45_ = _data10_->add_btn;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp45_, FALSE);
	_tmp46_ = _data10_->add_btn;
	g_signal_connect_data (_tmp46_, "clicked", (GCallback) ___lambda320__gtk_button_clicked, block10_data_ref (_data10_), (GClosureNotify) block10_data_unref, 0);
	_tmp47_ = actions;
	_tmp48_ = _data10_->add_btn;
	gtk_box_append (_tmp47_, (GtkWidget*) _tmp48_);
	_tmp49_ = content;
	_tmp50_ = actions;
	gtk_box_append (_tmp49_, (GtkWidget*) _tmp50_);
	_tmp51_ = _data10_->entry;
	g_signal_connect_data ((GtkEditable*) _tmp51_, "changed", (GCallback) ___lambda321__gtk_editable_changed, block10_data_ref (_data10_), (GClosureNotify) block10_data_unref, 0);
	_tmp52_ = _data10_->entry;
	g_signal_connect_data (_tmp52_, "activate", (GCallback) ___lambda322__gtk_entry_activate, block10_data_ref (_data10_), (GClosureNotify) block10_data_unref, 0);
	_tmp53_ = box;
	_tmp54_ = content;
	gtk_box_append (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = _data10_->dialog;
	_tmp56_ = box;
	adw_dialog_set_child (_tmp55_, (GtkWidget*) _tmp56_);
	_tmp57_ = _data10_->dialog;
	dc_window_present_modal (self, _tmp57_);
	if (prefill != NULL) {
		gchar* _tmp59_;
		gchar* _tmp60_;
		gint _tmp61_;
		gint _tmp62_;
		_tmp59_ = string_strip (prefill);
		_tmp60_ = _tmp59_;
		_tmp61_ = strlen (_tmp60_);
		_tmp62_ = _tmp61_;
		_tmp58_ = _tmp62_ > 0;
		_g_free0 (_tmp60_);
	} else {
		_tmp58_ = FALSE;
	}
	if (_tmp58_) {
		GtkEntry* _tmp63_;
		gchar* _tmp64_;
		gchar* _tmp65_;
		GtkButton* _tmp66_;
		GtkButton* _tmp67_;
		_tmp63_ = _data10_->entry;
		_tmp64_ = string_strip (prefill);
		_tmp65_ = _tmp64_;
		gtk_editable_set_text ((GtkEditable*) _tmp63_, _tmp65_);
		_g_free0 (_tmp65_);
		_tmp66_ = _data10_->add_btn;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp66_, TRUE);
		_tmp67_ = _data10_->add_btn;
		gtk_widget_grab_focus ((GtkWidget*) _tmp67_);
	} else {
		GtkEntry* _tmp68_;
		_tmp68_ = _data10_->entry;
		gtk_widget_grab_focus ((GtkWidget*) _tmp68_);
	}
	_g_object_unref0 (cancel_btn);
	_g_object_unref0 (actions);
	_g_object_unref0 (label);
	_g_object_unref0 (content);
	_g_object_unref0 (box);
	block10_data_unref (_data10_);
	_data10_ = NULL;
}

static void
dc_window_use_invite_link_data_free (gpointer _data)
{
	DcWindowUseInviteLinkData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->dialog);
	_g_object_unref0 (_data_->entry);
	_g_object_unref0 (_data_->status);
	_g_object_unref0 (_data_->add_btn);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWindowUseInviteLinkData, _data_);
}

static void
dc_window_use_invite_link (DcWindow* self,
                           AdwDialog* dialog,
                           GtkEntry* entry,
                           GtkLabel* status,
                           GtkButton* add_btn,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	DcWindowUseInviteLinkData* _data_;
	DcWindow* _tmp0_;
	AdwDialog* _tmp1_;
	GtkEntry* _tmp2_;
	GtkLabel* _tmp3_;
	GtkButton* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (status != NULL);
	g_return_if_fail (add_btn != NULL);
	_data_ = g_slice_new0 (DcWindowUseInviteLinkData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_use_invite_link_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (dialog);
	_g_object_unref0 (_data_->dialog);
	_data_->dialog = _tmp1_;
	_tmp2_ = _g_object_ref0 (entry);
	_g_object_unref0 (_data_->entry);
	_data_->entry = _tmp2_;
	_tmp3_ = _g_object_ref0 (status);
	_g_object_unref0 (_data_->status);
	_data_->status = _tmp3_;
	_tmp4_ = _g_object_ref0 (add_btn);
	_g_object_unref0 (_data_->add_btn);
	_data_->add_btn = _tmp4_;
	dc_window_use_invite_link_co (_data_);
}

static void
dc_window_use_invite_link_finish (DcWindow* self,
                                  GAsyncResult* _res_)
{
	DcWindowUseInviteLinkData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_use_invite_link_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_)
{
	DcWindowUseInviteLinkData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_use_invite_link_co (_data_);
}

static gboolean
dc_window_use_invite_link_co (DcWindowUseInviteLinkData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gtk_editable_get_text ((GtkEditable*) _data_->entry);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = string_strip (_data_->_tmp1_);
	_data_->invite_link = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->invite_link;
	_data_->_tmp4_ = strlen (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	if (_data_->_tmp5_ == 0) {
		_g_free0 (_data_->invite_link);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	gtk_widget_set_sensitive ((GtkWidget*) _data_->add_btn, FALSE);
	gtk_widget_set_sensitive ((GtkWidget*) _data_->entry, FALSE);
	gtk_label_set_label (_data_->status, "Checking invite link…");
	{
		static GQuark _tmp27_label0 = 0;
		static GQuark _tmp27_label1 = 0;
		static GQuark _tmp27_label2 = 0;
		static GQuark _tmp27_label3 = 0;
		static GQuark _tmp27_label4 = 0;
		static GQuark _tmp27_label5 = 0;
		static GQuark _tmp27_label6 = 0;
		static GQuark _tmp27_label7 = 0;
		static GQuark _tmp27_label8 = 0;
		_data_->_tmp6_ = _data_->self->priv->rpc;
		_data_->_tmp7_ = _data_->self->priv->rpc;
		_data_->_tmp8_ = dc_rpc_client_get_account_id (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = _data_->invite_link;
		_data_->_state_ = 1;
		dc_rpc_client_check_qr (_data_->_tmp6_, _data_->_tmp9_, _data_->_tmp10_, dc_window_use_invite_link_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = dc_rpc_client_check_qr_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
		_data_->qr = _data_->_tmp11_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp13_ = _data_->qr;
		if (_data_->_tmp13_ == NULL) {
			_data_->_tmp12_ = TRUE;
		} else {
			_data_->_tmp14_ = _data_->qr;
			_data_->_tmp12_ = !json_object_has_member (_data_->_tmp14_, "kind");
		}
		if (_data_->_tmp12_) {
			gtk_label_set_label (_data_->status, "This is not a valid invite link.");
			_json_object_unref0 (_data_->qr);
			{
				_data_->_tmp15_ = _data_->self->priv->active_modal;
				if (_data_->_tmp15_ == _data_->dialog) {
					gtk_widget_set_sensitive ((GtkWidget*) _data_->entry, TRUE);
					_data_->_tmp16_ = gtk_editable_get_text ((GtkEditable*) _data_->entry);
					_data_->_tmp17_ = _data_->_tmp16_;
					_data_->_tmp18_ = string_strip (_data_->_tmp17_);
					_data_->_tmp19_ = _data_->_tmp18_;
					_data_->_tmp20_ = strlen (_data_->_tmp19_);
					_data_->_tmp21_ = _data_->_tmp20_;
					gtk_widget_set_sensitive ((GtkWidget*) _data_->add_btn, _data_->_tmp21_ > 0);
					_g_free0 (_data_->_tmp19_);
				}
			}
			_g_free0 (_data_->invite_link);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp22_ = _data_->qr;
		_data_->_tmp23_ = json_object_get_string_member (_data_->_tmp22_, "kind");
		_data_->_tmp24_ = g_strdup (_data_->_tmp23_);
		_data_->kind = _data_->_tmp24_;
		_data_->_tmp25_ = _data_->kind;
		_data_->_tmp28_ = 0U;
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_tmp28_ = (NULL == _data_->_tmp26_) ? 0 : g_quark_from_string (_data_->_tmp26_);
		if (((_data_->_tmp28_ == ((0 != _tmp27_label0) ? _tmp27_label0 : (_tmp27_label0 = g_quark_from_static_string ("askVerifyContact")))) || (_data_->_tmp28_ == ((0 != _tmp27_label1) ? _tmp27_label1 : (_tmp27_label1 = g_quark_from_static_string ("askVerifyGroup"))))) || (_data_->_tmp28_ == ((0 != _tmp27_label2) ? _tmp27_label2 : (_tmp27_label2 = g_quark_from_static_string ("askJoinBroadcast"))))) {
			switch (0) {
				default:
				{
					{
						gtk_label_set_label (_data_->status, "Accepting invite link…");
						_data_->_tmp29_ = _data_->self->priv->rpc;
						_data_->_tmp30_ = _data_->self->priv->rpc;
						_data_->_tmp31_ = dc_rpc_client_get_account_id (_data_->_tmp30_);
						_data_->_tmp32_ = _data_->_tmp31_;
						_data_->_tmp33_ = _data_->invite_link;
						_data_->_state_ = 2;
						dc_rpc_client_secure_join (_data_->_tmp29_, _data_->_tmp32_, _data_->_tmp33_, dc_window_use_invite_link_ready, _data_);
						return FALSE;
						_state_2:
						_data_->chat_id = dc_rpc_client_secure_join_finish (_data_->_tmp29_, _data_->_res_, &_data_->_inner_error0_);
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							_g_free0 (_data_->kind);
							_json_object_unref0 (_data_->qr);
							goto __catch0_g_error;
						}
						_data_->_state_ = 3;
						dc_window_load_chats (_data_->self, dc_window_use_invite_link_ready, _data_);
						return FALSE;
						_state_3:
						dc_window_load_chats_finish (_data_->self, _data_->_res_);
						dc_window_select_chat_by_id (_data_->self, _data_->chat_id);
						adw_dialog_close (_data_->dialog);
						dc_window_show_toast (_data_->self, "Invite link accepted");
					}
					break;
				}
			}
		} else if (((_data_->_tmp28_ == ((0 != _tmp27_label3) ? _tmp27_label3 : (_tmp27_label3 = g_quark_from_static_string ("reviveVerifyContact")))) || (_data_->_tmp28_ == ((0 != _tmp27_label4) ? _tmp27_label4 : (_tmp27_label4 = g_quark_from_static_string ("reviveVerifyGroup"))))) || (_data_->_tmp28_ == ((0 != _tmp27_label5) ? _tmp27_label5 : (_tmp27_label5 = g_quark_from_static_string ("reviveJoinBroadcast"))))) {
			switch (0) {
				default:
				{
					gtk_label_set_label (_data_->status, "Activating your invite link…");
					_data_->_tmp34_ = _data_->self->priv->rpc;
					_data_->_tmp35_ = _data_->self->priv->rpc;
					_data_->_tmp36_ = dc_rpc_client_get_account_id (_data_->_tmp35_);
					_data_->_tmp37_ = _data_->_tmp36_;
					_data_->_tmp38_ = _data_->invite_link;
					_data_->_state_ = 4;
					dc_rpc_client_set_config_from_qr (_data_->_tmp34_, _data_->_tmp37_, _data_->_tmp38_, dc_window_use_invite_link_ready, _data_);
					return FALSE;
					_state_4:
					dc_rpc_client_set_config_from_qr_finish (_data_->_tmp34_, _data_->_res_, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_g_free0 (_data_->kind);
						_json_object_unref0 (_data_->qr);
						goto __catch0_g_error;
					}
					gtk_label_set_label (_data_->status, "This is your own invite link. It is now active — " "share it with others so they can join.");
					break;
				}
			}
		} else if (((_data_->_tmp28_ == ((0 != _tmp27_label6) ? _tmp27_label6 : (_tmp27_label6 = g_quark_from_static_string ("withdrawVerifyContact")))) || (_data_->_tmp28_ == ((0 != _tmp27_label7) ? _tmp27_label7 : (_tmp27_label7 = g_quark_from_static_string ("withdrawVerifyGroup"))))) || (_data_->_tmp28_ == ((0 != _tmp27_label8) ? _tmp27_label8 : (_tmp27_label8 = g_quark_from_static_string ("withdrawJoinBroadcast"))))) {
			switch (0) {
				default:
				{
					gtk_label_set_label (_data_->status, "This is your own invite link and it is active. " "Share it with others so they can join.");
					break;
				}
			}
		} else {
			switch (0) {
				default:
				{
					gtk_label_set_label (_data_->status, "This is not a contact, group, or channel invite link.");
					break;
				}
			}
		}
		_g_free0 (_data_->kind);
		_json_object_unref0 (_data_->qr);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp39_ = _data_->e;
		_data_->_tmp40_ = _data_->_tmp39_->message;
		_data_->_tmp41_ = g_strconcat ("Invite link failed: ", _data_->_tmp40_, NULL);
		_data_->_tmp42_ = _data_->_tmp41_;
		gtk_label_set_label (_data_->status, _data_->_tmp42_);
		_g_free0 (_data_->_tmp42_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		_data_->_tmp43_ = _data_->self->priv->active_modal;
		if (_data_->_tmp43_ == _data_->dialog) {
			gtk_widget_set_sensitive ((GtkWidget*) _data_->entry, TRUE);
			_data_->_tmp44_ = gtk_editable_get_text ((GtkEditable*) _data_->entry);
			_data_->_tmp45_ = _data_->_tmp44_;
			_data_->_tmp46_ = string_strip (_data_->_tmp45_);
			_data_->_tmp47_ = _data_->_tmp46_;
			_data_->_tmp48_ = strlen (_data_->_tmp47_);
			_data_->_tmp49_ = _data_->_tmp48_;
			gtk_widget_set_sensitive ((GtkWidget*) _data_->add_btn, _data_->_tmp49_ > 0);
			_g_free0 (_data_->_tmp47_);
		}
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->invite_link);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_free0 (_data_->invite_link);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_show_stickers_dialog (DcWindow* self)
{
	AdwDialog* _tmp0_;
	DcStickerManagerDialog* _tmp1_;
	DcStickerManagerDialog* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ != NULL) {
		return;
	}
	_tmp1_ = dc_sticker_manager_dialog_new (self);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	dc_window_present_modal (self, (AdwDialog*) _tmp2_);
	_g_object_unref0 (_tmp2_);
}

static void
dc_window_show_webxdc_apps_dialog (DcWindow* self)
{
	DcRpcClient* _tmp0_;
	DcWebxdcManagerDialog* _tmp1_;
	DcWebxdcManagerDialog* _tmp2_;
	g_return_if_fail (self != NULL);
	if (!dc_window_can_show_rpc_modal (self)) {
		return;
	}
	_tmp0_ = self->priv->rpc;
	_tmp1_ = dc_webxdc_manager_dialog_new (self, _tmp0_);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	dc_window_present_modal (self, (AdwDialog*) _tmp2_);
	_g_object_unref0 (_tmp2_);
}

static void
__lambda388_ (DcWindow* self)
{
	gboolean _tmp0_ = FALSE;
	DcRpcClient* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	_tmp1_ = self->priv->rpc;
	_tmp2_ = dc_rpc_client_get_is_connected (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		DcSettingsManager* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp4_ = self->settings;
		_tmp5_ = dc_settings_manager_effective_rpc_server_path (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp0_ = _tmp8_ > 0;
		_g_free0 (_tmp6_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		dc_window_try_connect (self, NULL, NULL);
	}
}

static void
___lambda388__adw_dialog_closed (AdwDialog* _sender,
                                 gpointer self)
{
	__lambda388_ ((DcWindow*) self);
}

static void
dc_window_show_settings_dialog (DcWindow* self)
{
	AdwDialog* _tmp0_;
	DcSettingsDialog* dialog = NULL;
	DcRpcClient* _tmp1_;
	DcSettingsDialog* _tmp2_;
	DcSettingsDialog* _tmp3_;
	DcSettingsDialog* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ != NULL) {
		return;
	}
	_tmp1_ = self->priv->rpc;
	_tmp2_ = dc_settings_dialog_new (self, _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	g_signal_connect_object ((AdwDialog*) _tmp3_, "closed", (GCallback) ___lambda388__adw_dialog_closed, self, 0);
	_tmp4_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp4_);
	_g_object_unref0 (dialog);
}

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

void
dc_window_reload_active_account (DcWindow* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcWindowReloadActiveAccountData* _data_;
	DcWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWindowReloadActiveAccountData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_window_reload_active_account_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_window_reload_active_account_co (_data_);
}

void
dc_window_reload_active_account_finish (DcWindow* self,
                                        GAsyncResult* _res_)
{
	DcWindowReloadActiveAccountData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_window_reload_active_account_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcWindowReloadActiveAccountData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_window_reload_active_account_co (_data_);
}

static gboolean
dc_window_reload_active_account_co (DcWindowReloadActiveAccountData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	dc_window_reset_chat_ui (_data_->self);
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_rpc_client_get_account_id (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_ <= 0) {
		dc_window_clear_self_identity (_data_->self);
		_data_->_tmp3_ = _data_->self->priv->profile_avatar;
		adw_avatar_set_text (_data_->_tmp3_, "");
		_data_->_tmp4_ = _data_->self->priv->profile_avatar;
		adw_avatar_set_custom_image (_data_->_tmp4_, NULL);
		_data_->_tmp5_ = _data_->self->priv->profile_unread_badge;
		gtk_widget_set_visible ((GtkWidget*) _data_->_tmp5_, FALSE);
		dc_window_show_empty_status (_data_->self, "avatar-default-symbolic", "No Profile Loaded", "Add or select a profile from the profile menu.", NULL);
		dc_window_set_current_chat_id (_data_->self, 0);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	dc_window_show_empty_status (_data_->self, "parla-welcome", "Parla", "Select a chat to start messaging.", NULL);
	_data_->_state_ = 1;
	dc_window_load_self_identity (_data_->self, dc_window_reload_active_account_ready, _data_);
	return FALSE;
	_state_1:
	dc_window_load_self_identity_finish (_data_->self, _data_->_res_);
	dc_window_set_current_chat_id (_data_->self, 0);
	_data_->_state_ = 2;
	dc_window_load_chats (_data_->self, dc_window_reload_active_account_ready, _data_);
	return FALSE;
	_state_2:
	dc_window_load_chats_finish (_data_->self, _data_->_res_);
	_data_->_state_ = 3;
	dc_window_load_profile_avatar (_data_->self, dc_window_reload_active_account_ready, _data_);
	return FALSE;
	_state_3:
	dc_window_load_profile_avatar_finish (_data_->self, _data_->_res_);
	_data_->_tmp7_ = _data_->self->priv->events;
	if (_data_->_tmp7_ != NULL) {
		_data_->_tmp8_ = _data_->self->priv->events;
		_data_->_tmp9_ = dc_event_handler_get_is_listening (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp6_ = !_data_->_tmp10_;
	} else {
		_data_->_tmp6_ = FALSE;
	}
	if (_data_->_tmp6_) {
		_data_->_tmp11_ = _data_->self->priv->events;
		dc_event_handler_start (_data_->_tmp11_, NULL, NULL);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_window_discard_all_views (DcWindow* self)
{
	GHashTableIter iter = {0};
	GHashTable* _tmp0_;
	gint k = 0;
	DcConversationView* v = NULL;
	GHashTable* _tmp8_;
	gint* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views;
	g_hash_table_iter_init (&iter, _tmp0_);
	while (TRUE) {
		gconstpointer _tmp1_ = NULL;
		gconstpointer _tmp2_ = NULL;
		gboolean _tmp3_;
		DcConversationView* _tmp4_;
		DcConversationView* _tmp5_;
		GtkStack* _tmp6_;
		DcConversationView* _tmp7_;
		_tmp3_ = g_hash_table_iter_next (&iter, (gpointer*) (&_tmp1_), (gpointer*) (&_tmp2_));
		k = (gint) ((gintptr) _tmp1_);
		_g_object_unref0 (v);
		_tmp4_ = _g_object_ref0 ((DcConversationView*) _tmp2_);
		v = _tmp4_;
		if (!_tmp3_) {
			break;
		}
		_tmp5_ = v;
		dc_conversation_view_close (_tmp5_);
		_tmp6_ = self->priv->content_stack;
		_tmp7_ = v;
		gtk_stack_remove (_tmp6_, (GtkWidget*) _tmp7_);
	}
	_tmp8_ = self->priv->views;
	g_hash_table_remove_all (_tmp8_);
	_tmp9_ = g_new0 (gint, 0);
	self->priv->view_recency = (g_free (self->priv->view_recency), NULL);
	self->priv->view_recency = _tmp9_;
	self->priv->view_recency_length1 = 0;
	self->priv->_view_recency_size_ = self->priv->view_recency_length1;
	_g_object_unref0 (v);
}

static void
dc_window_real_dispose (GObject* base)
{
	DcWindow * self;
	self = (DcWindow*) base;
	dc_window_discard_all_views (self);
	G_OBJECT_CLASS (dc_window_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_window_get_type (), AdwApplicationWindow));
}

static void
dc_window_mark_all_views_messages_stale (DcWindow* self)
{
	GHashTableIter iter = {0};
	GHashTable* _tmp0_;
	gint k = 0;
	DcConversationView* v = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views;
	g_hash_table_iter_init (&iter, _tmp0_);
	while (TRUE) {
		gconstpointer _tmp1_ = NULL;
		gconstpointer _tmp2_ = NULL;
		gboolean _tmp3_;
		DcConversationView* _tmp4_;
		DcConversationView* _tmp5_;
		_tmp3_ = g_hash_table_iter_next (&iter, (gpointer*) (&_tmp1_), (gpointer*) (&_tmp2_));
		k = (gint) ((gintptr) _tmp1_);
		_g_object_unref0 (v);
		_tmp4_ = _g_object_ref0 ((DcConversationView*) _tmp2_);
		v = _tmp4_;
		if (!_tmp3_) {
			break;
		}
		_tmp5_ = v;
		dc_conversation_view_mark_messages_stale (_tmp5_);
	}
	_g_object_unref0 (v);
}

static void
dc_window_toggle_sidebar_button (DcWindow* self)
{
	AdwOverlaySplitView* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->split_view;
	_tmp1_ = adw_overlay_split_view_get_collapsed (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		dc_window_toggle_collapsed_sidebar (self);
	} else {
		dc_window_toggle_sidebar_visibility (self);
	}
}

static void
dc_window_toggle_collapsed_sidebar (DcWindow* self)
{
	AdwOverlaySplitView* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcSettingsManager* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->split_view;
	_tmp1_ = adw_overlay_split_view_get_show_sidebar (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		AdwOverlaySplitView* _tmp3_;
		_tmp3_ = self->priv->split_view;
		adw_overlay_split_view_set_show_sidebar (_tmp3_, FALSE);
		return;
	}
	_tmp4_ = self->settings;
	dc_settings_manager_save_sidebar_mode (_tmp4_, DC_SIDEBAR_MODE_FULL);
	dc_window_apply_sidebar_mode (self, TRUE);
}

static void
dc_window_toggle_sidebar_visibility (DcWindow* self)
{
	AdwOverlaySplitView* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcSidebarMode _tmp3_ = 0;
	DcSettingsManager* _tmp4_;
	DcSidebarMode _tmp5_;
	DcSidebarMode _tmp6_;
	DcSettingsManager* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->split_view;
	_tmp1_ = adw_overlay_split_view_get_collapsed (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		dc_window_toggle_collapsed_sidebar (self);
		return;
	}
	_tmp4_ = self->settings;
	_tmp5_ = dc_settings_manager_get_sidebar_mode (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == DC_SIDEBAR_MODE_HIDDEN) {
		_tmp3_ = DC_SIDEBAR_MODE_FULL;
	} else {
		_tmp3_ = DC_SIDEBAR_MODE_HIDDEN;
	}
	_tmp7_ = self->settings;
	dc_settings_manager_save_sidebar_mode (_tmp7_, _tmp3_);
	dc_window_apply_sidebar_mode (self, TRUE);
}

static void
dc_window_toggle_sidebar_width (DcWindow* self)
{
	DcSidebarMode _tmp0_ = 0;
	DcSettingsManager* _tmp1_;
	DcSidebarMode _tmp2_;
	DcSidebarMode _tmp3_;
	DcSettingsManager* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->settings;
	_tmp2_ = dc_settings_manager_get_sidebar_mode (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == DC_SIDEBAR_MODE_COMPACT) {
		_tmp0_ = DC_SIDEBAR_MODE_FULL;
	} else {
		_tmp0_ = DC_SIDEBAR_MODE_COMPACT;
	}
	_tmp4_ = self->settings;
	dc_settings_manager_save_sidebar_mode (_tmp4_, _tmp0_);
	dc_window_apply_sidebar_mode (self, TRUE);
}

static void
dc_window_apply_sidebar_mode (DcWindow* self,
                              gboolean update_visibility)
{
	DcSidebarMode mode = 0;
	DcSettingsManager* _tmp0_;
	DcSidebarMode _tmp1_;
	DcSidebarMode _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->settings;
	_tmp1_ = dc_settings_manager_get_sidebar_mode (_tmp0_);
	_tmp2_ = _tmp1_;
	mode = _tmp2_;
	switch (mode) {
		case DC_SIDEBAR_MODE_FULL:
		{
			AdwOverlaySplitView* _tmp4_;
			gdouble _tmp5_ = 0.0;
			AdwOverlaySplitView* _tmp6_;
			gboolean _tmp7_;
			gboolean _tmp8_;
			AdwOverlaySplitView* _tmp9_;
			gdouble _tmp10_ = 0.0;
			AdwOverlaySplitView* _tmp11_;
			gboolean _tmp12_;
			gboolean _tmp13_;
			AdwOverlaySplitView* _tmp14_;
			AdwOverlaySplitView* _tmp15_;
			GtkBox* _tmp16_;
			GtkSearchEntry* _tmp17_;
			GtkMenuButton* _tmp18_;
			AdwWindowTitle* _tmp19_;
			AdwWindowTitle* _tmp20_;
			GtkButton* _tmp21_;
			GtkButton* _tmp22_;
			gchar* _tmp23_;
			gchar* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			if (update_visibility) {
				AdwOverlaySplitView* _tmp3_;
				_tmp3_ = self->priv->split_view;
				adw_overlay_split_view_set_show_sidebar (_tmp3_, TRUE);
			}
			_tmp4_ = self->priv->split_view;
			adw_overlay_split_view_set_sidebar_width_unit (_tmp4_, ADW_LENGTH_UNIT_SP);
			_tmp6_ = self->priv->split_view;
			_tmp7_ = adw_overlay_split_view_get_collapsed (_tmp6_);
			_tmp8_ = _tmp7_;
			if (_tmp8_) {
				_tmp5_ = DC_WINDOW_COLLAPSED_SIDEBAR_MIN_WIDTH;
			} else {
				_tmp5_ = DC_WINDOW_FULL_SIDEBAR_MIN_WIDTH;
			}
			_tmp9_ = self->priv->split_view;
			adw_overlay_split_view_set_min_sidebar_width (_tmp9_, _tmp5_);
			_tmp11_ = self->priv->split_view;
			_tmp12_ = adw_overlay_split_view_get_collapsed (_tmp11_);
			_tmp13_ = _tmp12_;
			if (_tmp13_) {
				_tmp10_ = DC_WINDOW_COLLAPSED_SIDEBAR_MAX_WIDTH;
			} else {
				_tmp10_ = DC_WINDOW_FULL_SIDEBAR_MAX_WIDTH;
			}
			_tmp14_ = self->priv->split_view;
			adw_overlay_split_view_set_max_sidebar_width (_tmp14_, _tmp10_);
			_tmp15_ = self->priv->split_view;
			adw_overlay_split_view_set_sidebar_width_fraction (_tmp15_, 0.32);
			_tmp16_ = self->priv->sidebar_box;
			gtk_widget_remove_css_class ((GtkWidget*) _tmp16_, "sidebar-compact");
			_tmp17_ = self->priv->search_entry;
			gtk_widget_set_visible ((GtkWidget*) _tmp17_, TRUE);
			_tmp18_ = self->priv->sidebar_menu_button;
			gtk_widget_set_visible ((GtkWidget*) _tmp18_, TRUE);
			_tmp19_ = self->priv->sidebar_title;
			gtk_widget_set_visible ((GtkWidget*) _tmp19_, TRUE);
			_tmp20_ = self->priv->sidebar_title;
			adw_window_title_set_title (_tmp20_, "Parla");
			dc_window_set_compact_header_chrome (self, FALSE);
			_tmp21_ = self->priv->sidebar_toggle_btn;
			gtk_button_set_icon_name (_tmp21_, "sidebar-show-symbolic");
			_tmp22_ = self->priv->sidebar_toggle_btn;
			_tmp23_ = dc_platform_primary_shortcut_text ("S");
			_tmp24_ = _tmp23_;
			_tmp25_ = g_strdup_printf ("Hide Sidebar (%s)", _tmp24_);
			_tmp26_ = _tmp25_;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp22_, _tmp26_);
			_g_free0 (_tmp26_);
			_g_free0 (_tmp24_);
			break;
		}
		case DC_SIDEBAR_MODE_COMPACT:
		{
			AdwOverlaySplitView* _tmp28_;
			AdwOverlaySplitView* _tmp29_;
			AdwOverlaySplitView* _tmp30_;
			AdwOverlaySplitView* _tmp31_;
			GtkBox* _tmp32_;
			GtkSearchEntry* _tmp33_;
			GtkMenuButton* _tmp34_;
			AdwWindowTitle* _tmp35_;
			AdwWindowTitle* _tmp36_;
			GtkButton* _tmp37_;
			GtkButton* _tmp38_;
			gchar* _tmp39_;
			gchar* _tmp40_;
			gchar* _tmp41_;
			gchar* _tmp42_;
			if (update_visibility) {
				AdwOverlaySplitView* _tmp27_;
				_tmp27_ = self->priv->split_view;
				adw_overlay_split_view_set_show_sidebar (_tmp27_, TRUE);
			}
			_tmp28_ = self->priv->split_view;
			adw_overlay_split_view_set_sidebar_width_unit (_tmp28_, ADW_LENGTH_UNIT_PX);
			_tmp29_ = self->priv->split_view;
			adw_overlay_split_view_set_min_sidebar_width (_tmp29_, DC_WINDOW_COMPACT_SIDEBAR_WIDTH);
			_tmp30_ = self->priv->split_view;
			adw_overlay_split_view_set_max_sidebar_width (_tmp30_, DC_WINDOW_COMPACT_SIDEBAR_WIDTH);
			_tmp31_ = self->priv->split_view;
			adw_overlay_split_view_set_sidebar_width_fraction (_tmp31_, 0.0);
			_tmp32_ = self->priv->sidebar_box;
			gtk_widget_add_css_class ((GtkWidget*) _tmp32_, "sidebar-compact");
			_tmp33_ = self->priv->search_entry;
			gtk_widget_set_visible ((GtkWidget*) _tmp33_, FALSE);
			_tmp34_ = self->priv->sidebar_menu_button;
			gtk_widget_set_visible ((GtkWidget*) _tmp34_, FALSE);
			_tmp35_ = self->priv->sidebar_title;
			gtk_widget_set_visible ((GtkWidget*) _tmp35_, FALSE);
			_tmp36_ = self->priv->sidebar_title;
			adw_window_title_set_title (_tmp36_, "");
			dc_window_set_compact_header_chrome (self, TRUE);
			_tmp37_ = self->priv->sidebar_toggle_btn;
			gtk_button_set_icon_name (_tmp37_, "sidebar-show-symbolic");
			_tmp38_ = self->priv->sidebar_toggle_btn;
			_tmp39_ = dc_platform_primary_shortcut_text ("S");
			_tmp40_ = _tmp39_;
			_tmp41_ = g_strdup_printf ("Hide Sidebar (%s)", _tmp40_);
			_tmp42_ = _tmp41_;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp38_, _tmp42_);
			_g_free0 (_tmp42_);
			_g_free0 (_tmp40_);
			break;
		}
		case DC_SIDEBAR_MODE_HIDDEN:
		{
			AdwOverlaySplitView* _tmp44_;
			gdouble _tmp45_ = 0.0;
			AdwOverlaySplitView* _tmp46_;
			gboolean _tmp47_;
			gboolean _tmp48_;
			AdwOverlaySplitView* _tmp49_;
			gdouble _tmp50_ = 0.0;
			AdwOverlaySplitView* _tmp51_;
			gboolean _tmp52_;
			gboolean _tmp53_;
			AdwOverlaySplitView* _tmp54_;
			AdwOverlaySplitView* _tmp55_;
			GtkBox* _tmp56_;
			GtkSearchEntry* _tmp57_;
			GtkMenuButton* _tmp58_;
			AdwWindowTitle* _tmp59_;
			AdwWindowTitle* _tmp60_;
			GtkButton* _tmp61_;
			GtkButton* _tmp62_;
			gchar* _tmp63_;
			gchar* _tmp64_;
			gchar* _tmp65_;
			gchar* _tmp66_;
			if (update_visibility) {
				AdwOverlaySplitView* _tmp43_;
				_tmp43_ = self->priv->split_view;
				adw_overlay_split_view_set_show_sidebar (_tmp43_, FALSE);
			}
			_tmp44_ = self->priv->split_view;
			adw_overlay_split_view_set_sidebar_width_unit (_tmp44_, ADW_LENGTH_UNIT_SP);
			_tmp46_ = self->priv->split_view;
			_tmp47_ = adw_overlay_split_view_get_collapsed (_tmp46_);
			_tmp48_ = _tmp47_;
			if (_tmp48_) {
				_tmp45_ = DC_WINDOW_COLLAPSED_SIDEBAR_MIN_WIDTH;
			} else {
				_tmp45_ = DC_WINDOW_FULL_SIDEBAR_MIN_WIDTH;
			}
			_tmp49_ = self->priv->split_view;
			adw_overlay_split_view_set_min_sidebar_width (_tmp49_, _tmp45_);
			_tmp51_ = self->priv->split_view;
			_tmp52_ = adw_overlay_split_view_get_collapsed (_tmp51_);
			_tmp53_ = _tmp52_;
			if (_tmp53_) {
				_tmp50_ = DC_WINDOW_COLLAPSED_SIDEBAR_MAX_WIDTH;
			} else {
				_tmp50_ = DC_WINDOW_FULL_SIDEBAR_MAX_WIDTH;
			}
			_tmp54_ = self->priv->split_view;
			adw_overlay_split_view_set_max_sidebar_width (_tmp54_, _tmp50_);
			_tmp55_ = self->priv->split_view;
			adw_overlay_split_view_set_sidebar_width_fraction (_tmp55_, 0.32);
			_tmp56_ = self->priv->sidebar_box;
			gtk_widget_remove_css_class ((GtkWidget*) _tmp56_, "sidebar-compact");
			_tmp57_ = self->priv->search_entry;
			gtk_widget_set_visible ((GtkWidget*) _tmp57_, TRUE);
			_tmp58_ = self->priv->sidebar_menu_button;
			gtk_widget_set_visible ((GtkWidget*) _tmp58_, TRUE);
			_tmp59_ = self->priv->sidebar_title;
			gtk_widget_set_visible ((GtkWidget*) _tmp59_, TRUE);
			_tmp60_ = self->priv->sidebar_title;
			adw_window_title_set_title (_tmp60_, "Parla");
			dc_window_set_compact_header_chrome (self, FALSE);
			_tmp61_ = self->priv->sidebar_toggle_btn;
			gtk_button_set_icon_name (_tmp61_, "sidebar-show-symbolic");
			_tmp62_ = self->priv->sidebar_toggle_btn;
			_tmp63_ = dc_platform_primary_shortcut_text ("S");
			_tmp64_ = _tmp63_;
			_tmp65_ = g_strdup_printf ("Show Sidebar (%s)", _tmp64_);
			_tmp66_ = _tmp65_;
			gtk_widget_set_tooltip_text ((GtkWidget*) _tmp62_, _tmp66_);
			_g_free0 (_tmp66_);
			_g_free0 (_tmp64_);
			break;
		}
		default:
		break;
	}
	dc_window_apply_compact_to_rows (self, mode == DC_SIDEBAR_MODE_COMPACT);
	dc_window_update_archived_toggle (self);
}

static void
dc_window_set_compact_header_chrome (DcWindow* self,
                                     gboolean compact)
{
	AdwHeaderBar* _tmp0_;
	AdwHeaderBar* _tmp1_;
	g_return_if_fail (self != NULL);
	if (!dc_platform_is_macos ()) {
		return;
	}
	_tmp0_ = self->priv->sidebar_header;
	adw_header_bar_set_show_start_title_buttons (_tmp0_, !compact);
	_tmp1_ = self->priv->sidebar_header;
	adw_header_bar_set_show_end_title_buttons (_tmp1_, !compact);
}

static void
dc_window_apply_compact_to_rows (DcWindow* self,
                                 gboolean compact)
{
	gint idx = 0;
	GtkListBoxRow* row = NULL;
	g_return_if_fail (self != NULL);
	idx = 0;
	while (TRUE) {
		GtkListBox* _tmp0_;
		GtkListBoxRow* _tmp1_;
		GtkListBoxRow* _tmp2_;
		GtkListBoxRow* _tmp3_;
		DcChatRow* chat_row = NULL;
		GtkListBoxRow* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		DcChatRow* _tmp7_;
		DcChatRow* _tmp8_;
		gint _tmp10_;
		_tmp0_ = self->priv->chat_listbox;
		_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, idx);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		_g_object_unref0 (row);
		row = _tmp2_;
		_tmp3_ = row;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = row;
		_tmp5_ = gtk_list_box_row_get_child (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp6_) ? ((DcChatRow*) _tmp6_) : NULL);
		chat_row = _tmp7_;
		_tmp8_ = chat_row;
		if (_tmp8_ != NULL) {
			DcChatRow* _tmp9_;
			_tmp9_ = chat_row;
			dc_chat_row_set_compact (_tmp9_, compact);
		}
		_tmp10_ = idx;
		idx = _tmp10_ + 1;
		_g_object_unref0 (chat_row);
	}
	_g_object_unref0 (row);
}

static gchar*
g_unichar_to_string (gunichar self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	g_unichar_to_utf8 (self, str);
	result = str;
	return result;
}

static gboolean
dc_window_on_window_key_pressed (DcWindow* self,
                                 guint keyval,
                                 guint keycode,
                                 GdkModifierType state)
{
	DcImageViewer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	DcVideoPlayer* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp34_ = FALSE;
	guint lower_key = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->image_viewer;
	_tmp1_ = dc_image_viewer_get_visible (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		DcImageViewer* _tmp3_;
		_tmp3_ = self->priv->image_viewer;
		result = dc_image_viewer_handle_key (_tmp3_, keyval);
		return result;
	}
	_tmp4_ = self->priv->video_player;
	_tmp5_ = dc_video_player_get_visible (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		DcVideoPlayer* _tmp7_;
		_tmp7_ = self->priv->video_player;
		result = dc_video_player_handle_key (_tmp7_, keyval);
		return result;
	}
	if (keyval != GDK_KEY_Escape) {
		_tmp8_ = !dc_window_is_modifier_keyval (keyval);
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		self->priv->escape_armed = FALSE;
	}
	if (keyval == GDK_KEY_Escape) {
		DcConversationView* v = NULL;
		DcConversationView* _tmp9_;
		gboolean dismissed = FALSE;
		gboolean _tmp19_ = FALSE;
		gboolean _tmp22_ = FALSE;
		gboolean _tmp23_ = FALSE;
		DcConversationView* _tmp32_;
		_tmp9_ = dc_window_current_view (self);
		v = _tmp9_;
		dismissed = FALSE;
		{
			GtkWidget* w = NULL;
			GtkWidget* _tmp10_;
			GtkWidget* _tmp11_;
			g_object_get ((GtkWindow*) self, "focus-widget", &_tmp10_, NULL);
			_tmp11_ = _tmp10_;
			w = _tmp11_;
			{
				gboolean _tmp12_ = FALSE;
				_tmp12_ = TRUE;
				while (TRUE) {
					GtkWidget* _tmp16_;
					GtkWidget* _tmp17_;
					if (!_tmp12_) {
						GtkWidget* _tmp13_;
						GtkWidget* _tmp14_;
						GtkWidget* _tmp15_;
						_tmp13_ = w;
						_tmp14_ = gtk_widget_get_parent (_tmp13_);
						_tmp15_ = _g_object_ref0 (_tmp14_);
						_g_object_unref0 (w);
						w = _tmp15_;
					}
					_tmp12_ = FALSE;
					_tmp16_ = w;
					if (!(_tmp16_ != NULL)) {
						break;
					}
					_tmp17_ = w;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, adw_dialog_get_type ())) {
						GtkWidget* _tmp18_;
						_tmp18_ = w;
						adw_dialog_close (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, adw_dialog_get_type (), AdwDialog));
						dismissed = TRUE;
						break;
					}
				}
			}
			_g_object_unref0 (w);
		}
		if (!dismissed) {
			AdwDialog* _tmp20_;
			_tmp20_ = self->priv->active_modal;
			_tmp19_ = _tmp20_ != NULL;
		} else {
			_tmp19_ = FALSE;
		}
		if (_tmp19_) {
			AdwDialog* _tmp21_;
			_tmp21_ = self->priv->active_modal;
			adw_dialog_close (_tmp21_);
			dismissed = TRUE;
		}
		if (!dismissed) {
			DcConversationView* _tmp24_;
			_tmp24_ = v;
			_tmp23_ = _tmp24_ != NULL;
		} else {
			_tmp23_ = FALSE;
		}
		if (_tmp23_) {
			DcConversationView* _tmp25_;
			_tmp25_ = v;
			_tmp22_ = dc_conversation_view_close_search_if_active (_tmp25_);
		} else {
			_tmp22_ = FALSE;
		}
		if (_tmp22_) {
			dismissed = TRUE;
		}
		if (dismissed) {
			self->priv->escape_armed = FALSE;
		} else {
			gboolean _tmp26_ = FALSE;
			DcConversationView* _tmp27_;
			_tmp27_ = v;
			if (_tmp27_ != NULL) {
				DcConversationView* _tmp28_;
				_tmp28_ = v;
				_tmp26_ = dc_conversation_view_has_active_compose_mode (_tmp28_);
			} else {
				_tmp26_ = FALSE;
			}
			if (_tmp26_) {
				gboolean _tmp29_ = FALSE;
				if (self->priv->escape_armed) {
					_tmp29_ = TRUE;
				} else {
					DcConversationView* _tmp30_;
					_tmp30_ = v;
					_tmp29_ = dc_conversation_view_compose_entry_has_focus (_tmp30_);
				}
				if (_tmp29_) {
					DcConversationView* _tmp31_;
					_tmp31_ = v;
					dc_conversation_view_cancel_active_compose_mode (_tmp31_);
					self->priv->escape_armed = FALSE;
				} else {
					self->priv->escape_armed = TRUE;
				}
			} else {
				self->priv->escape_armed = FALSE;
			}
		}
		_tmp32_ = v;
		if (_tmp32_ != NULL) {
			DcConversationView* _tmp33_;
			_tmp33_ = v;
			dc_conversation_view_focus_entry (_tmp33_);
		}
		result = TRUE;
		_g_object_unref0 (v);
		return result;
	}
	if (dc_window_is_typeahead_key (keyval, state)) {
		_tmp34_ = !dc_window_focus_in_text_or_overlay (self);
	} else {
		_tmp34_ = FALSE;
	}
	if (_tmp34_) {
		DcConversationView* v = NULL;
		DcConversationView* _tmp35_;
		DcConversationView* _tmp36_;
		_tmp35_ = dc_window_current_view (self);
		v = _tmp35_;
		_tmp36_ = v;
		if (_tmp36_ != NULL) {
			gunichar uc = 0U;
			uc = (gunichar) gdk_keyval_to_unicode (keyval);
			if (uc != ((gunichar) 0)) {
				DcConversationView* _tmp37_;
				gchar* _tmp38_;
				gchar* _tmp39_;
				_tmp37_ = v;
				_tmp38_ = g_unichar_to_string (uc);
				_tmp39_ = _tmp38_;
				dc_conversation_view_type_into_entry (_tmp37_, _tmp39_);
				_g_free0 (_tmp39_);
				result = TRUE;
				_g_object_unref0 (v);
				return result;
			}
		}
		_g_object_unref0 (v);
	}
	if (!dc_platform_has_primary_modifier (state)) {
		result = FALSE;
		return result;
	}
	lower_key = gdk_keyval_to_lower (keyval);
	switch (lower_key) {
		case GDK_KEY_Page_Up:
		case GDK_KEY_KP_Page_Up:
		{
			result = dc_window_select_adjacent_chat (self, -1);
			return result;
		}
		case GDK_KEY_Page_Down:
		case GDK_KEY_KP_Page_Down:
		{
			result = dc_window_select_adjacent_chat (self, 1);
			return result;
		}
		case GDK_KEY_Tab:
		case GDK_KEY_ISO_Left_Tab:
		case GDK_KEY_KP_Tab:
		{
			gint _tmp40_ = 0;
			gboolean _tmp41_ = FALSE;
			if ((state & GDK_SHIFT_MASK) != 0) {
				_tmp41_ = TRUE;
			} else {
				_tmp41_ = keyval == GDK_KEY_ISO_Left_Tab;
			}
			if (_tmp41_) {
				_tmp40_ = -1;
			} else {
				_tmp40_ = 1;
			}
			result = dc_window_select_adjacent_chat (self, _tmp40_);
			return result;
		}
		case GDK_KEY_a:
		{
			if ((state & GDK_SHIFT_MASK) == 0) {
				result = FALSE;
				return result;
			}
			dc_window_show_account_menu (self);
			result = TRUE;
			return result;
		}
		case GDK_KEY_n:
		{
			dc_window_on_new_chat (self);
			result = TRUE;
			return result;
		}
		case GDK_KEY_g:
		{
			if ((state & GDK_SHIFT_MASK) != 0) {
				dc_window_on_new_channel (self);
			} else {
				dc_window_on_new_group (self);
			}
			result = TRUE;
			return result;
		}
		case GDK_KEY_comma:
		{
			dc_window_show_settings_dialog (self);
			result = TRUE;
			return result;
		}
		case GDK_KEY_plus:
		case GDK_KEY_equal:
		case GDK_KEY_KP_Add:
		case GDK_KEY_KP_Equal:
		{
			dc_window_adjust_font_size (self, 1);
			result = TRUE;
			return result;
		}
		case GDK_KEY_minus:
		case GDK_KEY_KP_Subtract:
		{
			dc_window_adjust_font_size (self, -1);
			result = TRUE;
			return result;
		}
		case GDK_KEY_0:
		case GDK_KEY_KP_0:
		{
			DcSettingsManager* _tmp42_;
			_tmp42_ = self->settings;
			dc_settings_manager_save_font_size (_tmp42_, DC_FONT_SIZE_SYSTEM);
			result = TRUE;
			return result;
		}
		case GDK_KEY_f:
		{
			if ((state & GDK_SHIFT_MASK) != 0) {
				dc_window_focus_contact_search (self);
			} else {
				dc_window_toggle_message_search (self);
			}
			result = TRUE;
			return result;
		}
		case GDK_KEY_k:
		{
			dc_window_show_quick_switch_dialog (self);
			result = TRUE;
			return result;
		}
		case GDK_KEY_l:
		{
			DcConversationView* v = NULL;
			DcConversationView* _tmp43_;
			DcConversationView* _tmp44_;
			DcConversationView* _tmp45_;
			_tmp43_ = dc_window_current_view (self);
			v = _tmp43_;
			_tmp44_ = v;
			if (_tmp44_ == NULL) {
				result = FALSE;
				_g_object_unref0 (v);
				return result;
			}
			_tmp45_ = v;
			dc_conversation_view_focus_entry (_tmp45_);
			result = TRUE;
			_g_object_unref0 (v);
			return result;
		}
		case GDK_KEY_r:
		{
			dc_window_refresh_current_chat (self);
			result = TRUE;
			return result;
		}
		case GDK_KEY_i:
		{
			gboolean _tmp46_ = FALSE;
			gint _tmp47_;
			gint _tmp48_;
			_tmp47_ = dc_window_get_current_chat_id (self);
			_tmp48_ = _tmp47_;
			if (_tmp48_ > 0) {
				DcChatContextMenu* _tmp49_;
				_tmp49_ = self->priv->chat_menu;
				_tmp46_ = _tmp49_ != NULL;
			} else {
				_tmp46_ = FALSE;
			}
			if (_tmp46_) {
				DcChatContextMenu* _tmp50_;
				gint _tmp51_;
				gint _tmp52_;
				_tmp50_ = self->priv->chat_menu;
				_tmp51_ = dc_window_get_current_chat_id (self);
				_tmp52_ = _tmp51_;
				dc_chat_context_menu_show_info (_tmp50_, _tmp52_);
			}
			result = TRUE;
			return result;
		}
		case GDK_KEY_m:
		{
			dc_window_show_gallery_dialog (self);
			result = TRUE;
			return result;
		}
		case GDK_KEY_s:
		{
			if ((state & GDK_SHIFT_MASK) != 0) {
				dc_window_toggle_sidebar_width (self);
			} else {
				dc_window_toggle_sidebar_visibility (self);
			}
			result = TRUE;
			return result;
		}
		case GDK_KEY_w:
		{
			dc_window_handle_primary_w (self);
			result = TRUE;
			return result;
		}
		case GDK_KEY_q:
		{
			dc_window_handle_primary_q (self);
			result = TRUE;
			return result;
		}
		default:
		break;
	}
	result = FALSE;
	return result;
}

static void
dc_window_adjust_font_size (DcWindow* self,
                            gint delta)
{
	gint next_size = 0;
	DcSettingsManager* _tmp0_;
	DcSettingsManager* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->settings;
	next_size = dc_settings_manager_clamp_font_size (dc_settings_manager_effective_font_size (_tmp0_) + delta);
	_tmp1_ = self->settings;
	dc_settings_manager_save_font_size (_tmp1_, next_size);
}

static gboolean
dc_window_on_chat_scroll (DcWindow* self,
                          GtkEventControllerScroll* scroll,
                          gdouble dx,
                          gdouble dy)
{
	gint _tmp0_ = 0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (scroll != NULL, FALSE);
	if (!dc_platform_has_primary_modifier (gtk_event_controller_get_current_event_state ((GtkEventController*) scroll))) {
		result = FALSE;
		return result;
	}
	if (dy == ((gdouble) 0)) {
		result = FALSE;
		return result;
	}
	if (dy < ((gdouble) 0)) {
		_tmp0_ = 1;
	} else {
		_tmp0_ = -1;
	}
	dc_window_adjust_font_size (self, _tmp0_);
	result = TRUE;
	return result;
}

static gboolean
dc_window_is_typeahead_key (guint keyval,
                            GdkModifierType state)
{
	GdkModifierType mods = 0U;
	guint uc = 0U;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	mods = state & (((GDK_CONTROL_MASK | GDK_ALT_MASK) | GDK_SUPER_MASK) | GDK_META_MASK);
	if (mods != 0) {
		result = FALSE;
		return result;
	}
	uc = (guint) gdk_keyval_to_unicode (keyval);
	if (uc > ((guint) 0x20)) {
		_tmp0_ = uc != ((guint) 0x7f);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
dc_window_is_modifier_keyval (guint keyval)
{
	gboolean result;
	switch (keyval) {
		case GDK_KEY_Shift_L:
		case GDK_KEY_Shift_R:
		case GDK_KEY_Control_L:
		case GDK_KEY_Control_R:
		case GDK_KEY_Alt_L:
		case GDK_KEY_Alt_R:
		case GDK_KEY_Meta_L:
		case GDK_KEY_Meta_R:
		case GDK_KEY_Super_L:
		case GDK_KEY_Super_R:
		case GDK_KEY_Caps_Lock:
		{
			result = TRUE;
			return result;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
}

static gboolean
dc_window_focus_in_text_or_overlay (DcWindow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		GtkWidget* w = NULL;
		GtkWidget* _tmp0_;
		GtkWidget* _tmp1_;
		g_object_get ((GtkWindow*) self, "focus-widget", &_tmp0_, NULL);
		_tmp1_ = _tmp0_;
		w = _tmp1_;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				GtkWidget* _tmp6_;
				gboolean _tmp7_ = FALSE;
				GtkWidget* _tmp8_;
				gboolean _tmp10_ = FALSE;
				GtkWidget* _tmp11_;
				if (!_tmp2_) {
					GtkWidget* _tmp3_;
					GtkWidget* _tmp4_;
					GtkWidget* _tmp5_;
					_tmp3_ = w;
					_tmp4_ = gtk_widget_get_parent (_tmp3_);
					_tmp5_ = _g_object_ref0 (_tmp4_);
					_g_object_unref0 (w);
					w = _tmp5_;
				}
				_tmp2_ = FALSE;
				_tmp6_ = w;
				if (!(_tmp6_ != NULL)) {
					break;
				}
				_tmp8_ = w;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, gtk_editable_get_type ())) {
					_tmp7_ = TRUE;
				} else {
					GtkWidget* _tmp9_;
					_tmp9_ = w;
					_tmp7_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, gtk_text_view_get_type ());
				}
				if (_tmp7_) {
					result = TRUE;
					_g_object_unref0 (w);
					return result;
				}
				_tmp11_ = w;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, gtk_popover_get_type ())) {
					_tmp10_ = TRUE;
				} else {
					GtkWidget* _tmp12_;
					_tmp12_ = w;
					_tmp10_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, adw_dialog_get_type ());
				}
				if (_tmp10_) {
					result = TRUE;
					_g_object_unref0 (w);
					return result;
				}
			}
		}
		_g_object_unref0 (w);
	}
	result = FALSE;
	return result;
}

static void
dc_window_focus_contact_search (DcWindow* self)
{
	DcSettingsManager* _tmp0_;
	DcSidebarMode _tmp1_;
	DcSidebarMode _tmp2_;
	GtkSearchEntry* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->settings;
	_tmp1_ = dc_settings_manager_get_sidebar_mode (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != DC_SIDEBAR_MODE_FULL) {
		DcSettingsManager* _tmp3_;
		_tmp3_ = self->settings;
		dc_settings_manager_save_sidebar_mode (_tmp3_, DC_SIDEBAR_MODE_FULL);
		dc_window_apply_sidebar_mode (self, TRUE);
	} else {
		AdwOverlaySplitView* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = self->priv->split_view;
		_tmp5_ = adw_overlay_split_view_get_show_sidebar (_tmp4_);
		_tmp6_ = _tmp5_;
		if (!_tmp6_) {
			AdwOverlaySplitView* _tmp7_;
			_tmp7_ = self->priv->split_view;
			adw_overlay_split_view_set_show_sidebar (_tmp7_, TRUE);
		}
	}
	_tmp8_ = self->priv->search_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp8_);
}

static void
dc_window_toggle_message_search (DcWindow* self)
{
	DcConversationView* v = NULL;
	DcConversationView* _tmp0_;
	DcConversationView* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dc_window_current_view (self);
	v = _tmp0_;
	_tmp1_ = v;
	if (_tmp1_ != NULL) {
		DcConversationView* _tmp2_;
		_tmp2_ = v;
		dc_conversation_view_toggle_search (_tmp2_);
	}
	_g_object_unref0 (v);
}

static void
dc_window_refresh_current_chat (DcWindow* self)
{
	gint _tmp0_;
	gint _tmp1_;
	g_return_if_fail (self != NULL);
	dc_window_request_reload_chats (self);
	_tmp0_ = dc_window_get_current_chat_id (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ > 0) {
		dc_window_request_messages_reload (self);
	}
}

static void
dc_window_show_account_menu (DcWindow* self)
{
	AdwDialog* _tmp0_;
	GtkPopover* _tmp1_;
	GtkMenuButton* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ != NULL) {
		return;
	}
	self->priv->focus_current_account_on_menu_load = TRUE;
	_tmp1_ = self->priv->account_popover;
	if (gtk_widget_get_visible ((GtkWidget*) _tmp1_)) {
		dc_window_focus_current_account_menu_row_if_requested (self);
		return;
	}
	_tmp2_ = self->priv->account_menu_button;
	gtk_menu_button_popup (_tmp2_);
}

static gboolean
dc_window_select_adjacent_chat (DcWindow* self,
                                gint delta)
{
	gint row_count = 0;
	gint current_index = 0;
	GtkListBoxRow* row = NULL;
	gint target_index = 0;
	GtkListBox* _tmp17_;
	GtkListBoxRow* _tmp18_;
	GtkListBoxRow* _tmp19_;
	GtkListBoxRow* _tmp20_;
	DcChatRow* chat_row = NULL;
	GtkListBoxRow* _tmp21_;
	GtkWidget* _tmp22_;
	GtkWidget* _tmp23_;
	DcChatRow* _tmp24_;
	DcChatRow* _tmp25_;
	DcChatRow* _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	row_count = 0;
	current_index = -1;
	while (TRUE) {
		GtkListBox* _tmp0_;
		GtkListBoxRow* _tmp1_;
		GtkListBoxRow* _tmp2_;
		GtkListBoxRow* _tmp3_;
		DcChatRow* chat_row = NULL;
		GtkListBoxRow* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		DcChatRow* _tmp7_;
		gboolean _tmp8_ = FALSE;
		DcChatRow* _tmp9_;
		gint _tmp15_;
		_tmp0_ = self->priv->chat_listbox;
		_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, row_count);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		_g_object_unref0 (row);
		row = _tmp2_;
		_tmp3_ = row;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = row;
		_tmp5_ = gtk_list_box_row_get_child (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp6_) ? ((DcChatRow*) _tmp6_) : NULL);
		chat_row = _tmp7_;
		_tmp9_ = chat_row;
		if (_tmp9_ != NULL) {
			DcChatRow* _tmp10_;
			gint _tmp11_;
			gint _tmp12_;
			gint _tmp13_;
			gint _tmp14_;
			_tmp10_ = chat_row;
			_tmp11_ = dc_chat_row_get_chat_id (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = dc_window_get_current_chat_id (self);
			_tmp14_ = _tmp13_;
			_tmp8_ = _tmp12_ == _tmp14_;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			current_index = row_count;
		}
		_tmp15_ = row_count;
		row_count = _tmp15_ + 1;
		_g_object_unref0 (chat_row);
	}
	if (row_count == 0) {
		result = FALSE;
		_g_object_unref0 (row);
		return result;
	}
	if (row_count == 1) {
		result = TRUE;
		_g_object_unref0 (row);
		return result;
	}
	if (current_index < 0) {
		gint _tmp16_ = 0;
		if (delta > 0) {
			_tmp16_ = 0;
		} else {
			_tmp16_ = row_count - 1;
		}
		target_index = _tmp16_;
	} else {
		target_index = current_index + delta;
		if (target_index < 0) {
			target_index = row_count - 1;
		} else {
			if (target_index >= row_count) {
				target_index = 0;
			}
		}
	}
	_tmp17_ = self->priv->chat_listbox;
	_tmp18_ = gtk_list_box_get_row_at_index (_tmp17_, target_index);
	_tmp19_ = _g_object_ref0 (_tmp18_);
	_g_object_unref0 (row);
	row = _tmp19_;
	_tmp20_ = row;
	if (_tmp20_ == NULL) {
		result = FALSE;
		_g_object_unref0 (row);
		return result;
	}
	_tmp21_ = row;
	_tmp22_ = gtk_list_box_row_get_child (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp23_) ? ((DcChatRow*) _tmp23_) : NULL);
	chat_row = _tmp24_;
	_tmp25_ = chat_row;
	if (_tmp25_ == NULL) {
		result = FALSE;
		_g_object_unref0 (chat_row);
		_g_object_unref0 (row);
		return result;
	}
	_tmp26_ = chat_row;
	_tmp27_ = dc_chat_row_get_chat_id (_tmp26_);
	_tmp28_ = _tmp27_;
	result = dc_window_select_chat_by_id (self, _tmp28_);
	_g_object_unref0 (chat_row);
	_g_object_unref0 (row);
	return result;
}

static void
__lambda429_ (DcWindow* self,
              gint chat_id)
{
	dc_window_select_chat_by_id (self, chat_id);
}

static void
___lambda429__dc_quick_switch_dialog_chat_selected (DcQuickSwitchDialog* _sender,
                                                    gint chat_id,
                                                    gpointer self)
{
	__lambda429_ ((DcWindow*) self, chat_id);
}

static void
dc_window_show_quick_switch_dialog (DcWindow* self)
{
	GListStore* _tmp0_;
	DcQuickSwitchDialog* dialog = NULL;
	GListStore* _tmp1_;
	DcQuickSwitchDialog* _tmp2_;
	DcQuickSwitchDialog* _tmp3_;
	DcQuickSwitchDialog* _tmp4_;
	DcQuickSwitchDialog* _tmp5_;
	g_return_if_fail (self != NULL);
	if (!dc_window_can_show_account_modal (self)) {
		return;
	}
	_tmp0_ = self->priv->_chat_store;
	if (g_list_model_get_n_items ((GListModel*) _tmp0_) == ((guint) 0)) {
		return;
	}
	_tmp1_ = self->priv->_chat_store;
	_tmp2_ = dc_quick_switch_dialog_new (_tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	g_signal_connect_object (_tmp3_, "chat-selected", (GCallback) ___lambda429__dc_quick_switch_dialog_chat_selected, self, 0);
	_tmp4_ = dialog;
	dc_window_present_modal (self, (AdwDialog*) _tmp4_);
	_tmp5_ = dialog;
	dc_quick_switch_dialog_focus_entry (_tmp5_);
	_g_object_unref0 (dialog);
}

gboolean
dc_window_current_chat_is_group (DcWindow* self)
{
	DcChatEntry* entry = NULL;
	GListStore* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	DcChatEntry* _tmp3_;
	gboolean _tmp4_ = FALSE;
	DcChatEntry* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_chat_store;
	_tmp1_ = dc_window_get_current_chat_id (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = dc_find_chat_entry (_tmp0_, _tmp2_);
	entry = _tmp3_;
	_tmp5_ = entry;
	if (_tmp5_ != NULL) {
		DcChatEntry* _tmp6_;
		DcChatKind _tmp7_;
		DcChatKind _tmp8_;
		_tmp6_ = entry;
		_tmp7_ = dc_chat_entry_get_kind (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_ == DC_CHAT_KIND_GROUP;
	} else {
		_tmp4_ = FALSE;
	}
	result = _tmp4_;
	_g_object_unref0 (entry);
	return result;
}

gboolean
dc_window_select_chat_by_id (DcWindow* self,
                             gint chat_id)
{
	gint idx = 0;
	GtkListBoxRow* row = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	idx = 0;
	while (TRUE) {
		GtkListBox* _tmp0_;
		GtkListBoxRow* _tmp1_;
		GtkListBoxRow* _tmp2_;
		GtkListBoxRow* _tmp3_;
		DcChatRow* chat_row = NULL;
		GtkListBoxRow* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		DcChatRow* _tmp7_;
		gboolean _tmp8_ = FALSE;
		DcChatRow* _tmp9_;
		gint _tmp16_;
		_tmp0_ = self->priv->chat_listbox;
		_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, idx);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		_g_object_unref0 (row);
		row = _tmp2_;
		_tmp3_ = row;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = row;
		_tmp5_ = gtk_list_box_row_get_child (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _g_object_ref0 (DC_IS_CHAT_ROW (_tmp6_) ? ((DcChatRow*) _tmp6_) : NULL);
		chat_row = _tmp7_;
		_tmp9_ = chat_row;
		if (_tmp9_ != NULL) {
			DcChatRow* _tmp10_;
			gint _tmp11_;
			gint _tmp12_;
			_tmp10_ = chat_row;
			_tmp11_ = dc_chat_row_get_chat_id (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp8_ = _tmp12_ == chat_id;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			GtkListBox* _tmp13_;
			GtkListBoxRow* _tmp14_;
			GtkListBoxRow* _tmp15_;
			_tmp13_ = self->priv->chat_listbox;
			_tmp14_ = row;
			gtk_list_box_select_row (_tmp13_, _tmp14_);
			_tmp15_ = row;
			dc_window_on_chat_selected (self, _tmp15_);
			result = TRUE;
			_g_object_unref0 (chat_row);
			_g_object_unref0 (row);
			return result;
		}
		_tmp16_ = idx;
		idx = _tmp16_ + 1;
		_g_object_unref0 (chat_row);
	}
	result = FALSE;
	_g_object_unref0 (row);
	return result;
}

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_window_shortcut_accelerator (const gchar* accelerator)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (accelerator != NULL, NULL);
	_tmp0_ = dc_platform_primary_accelerator_prefix ();
	_tmp1_ = _tmp0_;
	_tmp2_ = string_replace (accelerator, "<Primary>", _tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static gchar*
dc_window_shortcut_label_text (const gchar* accelerator)
{
	guint key = 0U;
	GdkModifierType mods = 0U;
	gchar* resolved = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	guint _tmp2_ = 0U;
	GdkModifierType _tmp3_ = 0U;
	gboolean _tmp4_;
	gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (accelerator != NULL, NULL);
	_tmp0_ = dc_window_shortcut_accelerator (accelerator);
	resolved = _tmp0_;
	_tmp1_ = resolved;
	_tmp4_ = gtk_accelerator_parse (_tmp1_, &_tmp2_, &_tmp3_);
	key = _tmp2_;
	mods = _tmp3_;
	if (!_tmp4_) {
		result = resolved;
		return result;
	}
	_tmp5_ = gtk_accelerator_get_label (key, mods);
	result = _tmp5_;
	_g_free0 (resolved);
	return result;
}

static void
dc_window_show_keyboard_shortcuts_dialog (DcWindow* self)
{
	AdwDialog* _tmp0_;
	AdwDialog* dialog = NULL;
	AdwDialog* _tmp1_;
	AdwDialog* _tmp2_;
	AdwDialog* _tmp3_;
	AdwDialog* _tmp4_;
	GtkBox* box = NULL;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	AdwHeaderBar* _tmp7_;
	AdwHeaderBar* _tmp8_;
	GtkScrolledWindow* scroller = NULL;
	GtkScrolledWindow* _tmp9_;
	GtkScrolledWindow* _tmp10_;
	GtkScrolledWindow* _tmp11_;
	GtkScrolledWindow* _tmp12_;
	GtkScrolledWindow* _tmp13_;
	GtkListBox* list = NULL;
	GtkListBox* _tmp14_;
	GtkListBox* _tmp15_;
	GtkListBox* _tmp16_;
	GtkListBox* _tmp17_;
	GtkListBox* _tmp18_;
	GtkListBox* _tmp19_;
	GtkListBox* _tmp20_;
	AdwActionRow* wheel_row = NULL;
	AdwActionRow* _tmp36_;
	AdwActionRow* _tmp37_;
	GtkLabel* wheel_lbl = NULL;
	gchar* _tmp38_;
	gchar* _tmp39_;
	GtkLabel* _tmp40_;
	GtkLabel* _tmp41_;
	GtkLabel* _tmp42_;
	GtkLabel* _tmp43_;
	AdwActionRow* _tmp44_;
	GtkLabel* _tmp45_;
	GtkListBox* _tmp46_;
	AdwActionRow* _tmp47_;
	AdwActionRow* emoji_row = NULL;
	AdwActionRow* _tmp48_;
	AdwActionRow* _tmp49_;
	GtkLabel* emoji_lbl = NULL;
	GtkLabel* _tmp50_;
	GtkLabel* _tmp51_;
	GtkLabel* _tmp52_;
	AdwActionRow* _tmp53_;
	GtkLabel* _tmp54_;
	GtkListBox* _tmp55_;
	AdwActionRow* _tmp56_;
	GtkScrolledWindow* _tmp57_;
	GtkListBox* _tmp58_;
	GtkBox* _tmp59_;
	GtkScrolledWindow* _tmp60_;
	AdwDialog* _tmp61_;
	GtkBox* _tmp62_;
	AdwDialog* _tmp63_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->active_modal;
	if (_tmp0_ != NULL) {
		return;
	}
	_tmp1_ = adw_dialog_new ();
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	_tmp2_ = dialog;
	adw_dialog_set_title (_tmp2_, "Shortcuts");
	_tmp3_ = dialog;
	adw_dialog_set_content_width (_tmp3_, 400);
	_tmp4_ = dialog;
	adw_dialog_set_content_height (_tmp4_, 380);
	_tmp5_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp5_);
	box = _tmp5_;
	_tmp6_ = box;
	_tmp7_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp7_);
	_tmp8_ = _tmp7_;
	gtk_box_append (_tmp6_, (GtkWidget*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp9_);
	scroller = _tmp9_;
	_tmp10_ = scroller;
	g_object_set (_tmp10_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp11_ = scroller;
	g_object_set (_tmp11_, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	_tmp12_ = scroller;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp12_, TRUE);
	_tmp13_ = scroller;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp13_, TRUE);
	_tmp14_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp14_);
	list = _tmp14_;
	_tmp15_ = list;
	gtk_list_box_set_selection_mode (_tmp15_, GTK_SELECTION_NONE);
	_tmp16_ = list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp16_, "boxed-list");
	_tmp17_ = list;
	_tmp18_ = list;
	_tmp19_ = list;
	_tmp20_ = list;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp20_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp19_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp18_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp17_, 12);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp21_ = FALSE;
			_tmp21_ = TRUE;
			while (TRUE) {
				AdwActionRow* row = NULL;
				AdwActionRow* _tmp22_;
				AdwActionRow* _tmp23_;
				const gchar* _tmp24_;
				GtkLabel* lbl = NULL;
				const gchar* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				GtkLabel* _tmp28_;
				GtkLabel* _tmp29_;
				GtkLabel* _tmp30_;
				GtkLabel* _tmp31_;
				AdwActionRow* _tmp32_;
				GtkLabel* _tmp33_;
				GtkListBox* _tmp34_;
				AdwActionRow* _tmp35_;
				if (!_tmp21_) {
					i += 2;
				}
				_tmp21_ = FALSE;
				if (!((i + 1) < G_N_ELEMENTS (DC_WINDOW_SHORTCUTS))) {
					break;
				}
				_tmp22_ = (AdwActionRow*) adw_action_row_new ();
				g_object_ref_sink (_tmp22_);
				row = _tmp22_;
				_tmp23_ = row;
				_tmp24_ = DC_WINDOW_SHORTCUTS[i];
				adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp23_, _tmp24_);
				_tmp25_ = DC_WINDOW_SHORTCUTS[i + 1];
				_tmp26_ = dc_window_shortcut_label_text (_tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = (GtkLabel*) gtk_label_new (_tmp27_);
				g_object_ref_sink (_tmp28_);
				_tmp29_ = _tmp28_;
				_g_free0 (_tmp27_);
				lbl = _tmp29_;
				_tmp30_ = lbl;
				gtk_widget_set_valign ((GtkWidget*) _tmp30_, GTK_ALIGN_CENTER);
				_tmp31_ = lbl;
				gtk_widget_add_css_class ((GtkWidget*) _tmp31_, "dim-label");
				_tmp32_ = row;
				_tmp33_ = lbl;
				adw_action_row_add_suffix (_tmp32_, (GtkWidget*) _tmp33_);
				_tmp34_ = list;
				_tmp35_ = row;
				gtk_list_box_append (_tmp34_, (GtkWidget*) _tmp35_);
				_g_object_unref0 (lbl);
				_g_object_unref0 (row);
			}
		}
	}
	_tmp36_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp36_);
	wheel_row = _tmp36_;
	_tmp37_ = wheel_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp37_, "Change font size");
	_tmp38_ = dc_platform_primary_shortcut_text ("Mouse Wheel");
	_tmp39_ = _tmp38_;
	_tmp40_ = (GtkLabel*) gtk_label_new (_tmp39_);
	g_object_ref_sink (_tmp40_);
	_tmp41_ = _tmp40_;
	_g_free0 (_tmp39_);
	wheel_lbl = _tmp41_;
	_tmp42_ = wheel_lbl;
	gtk_widget_set_valign ((GtkWidget*) _tmp42_, GTK_ALIGN_CENTER);
	_tmp43_ = wheel_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp43_, "dim-label");
	_tmp44_ = wheel_row;
	_tmp45_ = wheel_lbl;
	adw_action_row_add_suffix (_tmp44_, (GtkWidget*) _tmp45_);
	_tmp46_ = list;
	_tmp47_ = wheel_row;
	gtk_list_box_append (_tmp46_, (GtkWidget*) _tmp47_);
	_tmp48_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp48_);
	emoji_row = _tmp48_;
	_tmp49_ = emoji_row;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp49_, "Emoji picker");
	_tmp50_ = (GtkLabel*) gtk_label_new ("::");
	g_object_ref_sink (_tmp50_);
	emoji_lbl = _tmp50_;
	_tmp51_ = emoji_lbl;
	gtk_widget_set_valign ((GtkWidget*) _tmp51_, GTK_ALIGN_CENTER);
	_tmp52_ = emoji_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp52_, "dim-label");
	_tmp53_ = emoji_row;
	_tmp54_ = emoji_lbl;
	adw_action_row_add_suffix (_tmp53_, (GtkWidget*) _tmp54_);
	_tmp55_ = list;
	_tmp56_ = emoji_row;
	gtk_list_box_append (_tmp55_, (GtkWidget*) _tmp56_);
	_tmp57_ = scroller;
	_tmp58_ = list;
	gtk_scrolled_window_set_child (_tmp57_, (GtkWidget*) _tmp58_);
	_tmp59_ = box;
	_tmp60_ = scroller;
	gtk_box_append (_tmp59_, (GtkWidget*) _tmp60_);
	_tmp61_ = dialog;
	_tmp62_ = box;
	adw_dialog_set_child (_tmp61_, (GtkWidget*) _tmp62_);
	_tmp63_ = dialog;
	dc_window_present_modal (self, _tmp63_);
	_g_object_unref0 (emoji_lbl);
	_g_object_unref0 (emoji_row);
	_g_object_unref0 (wheel_lbl);
	_g_object_unref0 (wheel_row);
	_g_object_unref0 (list);
	_g_object_unref0 (scroller);
	_g_object_unref0 (box);
	_g_object_unref0 (dialog);
}

AdwToast*
dc_window_show_action_toast (DcWindow* self,
                             const gchar* message,
                             const gchar* button_label)
{
	AdwToast* toast = NULL;
	AdwToast* _tmp0_;
	AdwToast* _tmp1_;
	AdwToast* _tmp2_;
	AdwToastOverlay* _tmp3_ = NULL;
	AdwDialog* _tmp4_;
	AdwToastOverlay* modal_toasts = NULL;
	AdwToastOverlay* _tmp8_;
	AdwToastOverlay* _tmp9_ = NULL;
	AdwToastOverlay* _tmp10_;
	AdwToast* _tmp12_;
	AdwToast* _tmp13_;
	AdwToast* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (message != NULL, NULL);
	g_return_val_if_fail (button_label != NULL, NULL);
	_tmp0_ = adw_toast_new (message);
	toast = _tmp0_;
	_tmp1_ = toast;
	adw_toast_set_timeout (_tmp1_, (guint) 6);
	_tmp2_ = toast;
	adw_toast_set_button_label (_tmp2_, button_label);
	_tmp4_ = self->priv->active_modal;
	if (_tmp4_ != NULL) {
		AdwDialog* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		_tmp5_ = self->priv->active_modal;
		_tmp6_ = adw_dialog_get_child (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp3_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, adw_toast_overlay_get_type ()) ? ((AdwToastOverlay*) _tmp7_) : NULL;
	} else {
		_tmp3_ = NULL;
	}
	_tmp8_ = _g_object_ref0 (_tmp3_);
	modal_toasts = _tmp8_;
	_tmp10_ = modal_toasts;
	_tmp9_ = _tmp10_;
	if (_tmp9_ == NULL) {
		AdwToastOverlay* _tmp11_;
		_tmp11_ = self->priv->toast_overlay;
		_tmp9_ = _tmp11_;
	}
	_tmp12_ = toast;
	_tmp13_ = _g_object_ref0 (_tmp12_);
	adw_toast_overlay_add_toast (_tmp9_, _tmp13_);
	result = toast;
	_g_object_unref0 (modal_toasts);
	return result;
}

void
dc_window_show_toast (DcWindow* self,
                      const gchar* message)
{
	AdwToast* toast = NULL;
	AdwToast* _tmp0_;
	AdwToast* _tmp1_;
	AdwToastOverlay* _tmp2_ = NULL;
	AdwDialog* _tmp3_;
	AdwToastOverlay* modal_toasts = NULL;
	AdwToastOverlay* _tmp7_;
	AdwToastOverlay* _tmp8_ = NULL;
	AdwToastOverlay* _tmp9_;
	AdwToast* _tmp11_;
	AdwToast* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = adw_toast_new (message);
	toast = _tmp0_;
	_tmp1_ = toast;
	adw_toast_set_timeout (_tmp1_, (guint) 4);
	_tmp3_ = self->priv->active_modal;
	if (_tmp3_ != NULL) {
		AdwDialog* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		_tmp4_ = self->priv->active_modal;
		_tmp5_ = adw_dialog_get_child (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp2_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, adw_toast_overlay_get_type ()) ? ((AdwToastOverlay*) _tmp6_) : NULL;
	} else {
		_tmp2_ = NULL;
	}
	_tmp7_ = _g_object_ref0 (_tmp2_);
	modal_toasts = _tmp7_;
	_tmp9_ = modal_toasts;
	_tmp8_ = _tmp9_;
	if (_tmp8_ == NULL) {
		AdwToastOverlay* _tmp10_;
		_tmp10_ = self->priv->toast_overlay;
		_tmp8_ = _tmp10_;
	}
	_tmp11_ = toast;
	_tmp12_ = _g_object_ref0 (_tmp11_);
	adw_toast_overlay_add_toast (_tmp8_, _tmp12_);
	_g_object_unref0 (modal_toasts);
	_g_object_unref0 (toast);
}

static GtkRevealer*
dc_window_build_connection_banner (DcWindow* self)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkImage* icon = NULL;
	GtkImage* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp3_;
	GtkLabel* _tmp4_;
	GtkRevealer* _tmp5_;
	GtkRevealer* _tmp6_;
	GtkRevealer* _tmp7_;
	GtkRevealer* _tmp8_;
	GtkRevealer* _tmp9_;
	GtkRevealer* _tmp10_;
	GtkRevealer* _tmp11_;
	GtkRevealer* _tmp12_;
	GtkRevealer* _tmp13_;
	GtkRevealer* _tmp14_;
	GtkRevealer* _tmp15_;
	GtkRevealer* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) box, "connection-banner");
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name ("network-offline-symbolic");
	g_object_ref_sink (_tmp1_);
	icon = _tmp1_;
	gtk_image_set_pixel_size (icon, 14);
	gtk_box_append (box, (GtkWidget*) icon);
	_tmp2_ = (GtkLabel*) gtk_label_new ("Not connected");
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->connection_banner_label);
	self->priv->connection_banner_label = _tmp2_;
	_tmp3_ = self->priv->connection_banner_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp3_, "connection-banner-label");
	_tmp4_ = self->priv->connection_banner_label;
	gtk_box_append (box, (GtkWidget*) _tmp4_);
	_tmp5_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->connection_banner);
	self->priv->connection_banner = _tmp5_;
	_tmp6_ = self->priv->connection_banner;
	gtk_revealer_set_child (_tmp6_, (GtkWidget*) box);
	_tmp7_ = self->priv->connection_banner;
	gtk_revealer_set_reveal_child (_tmp7_, FALSE);
	_tmp8_ = self->priv->connection_banner;
	gtk_revealer_set_transition_type (_tmp8_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	_tmp9_ = self->priv->connection_banner;
	gtk_revealer_set_transition_duration (_tmp9_, (guint) 200);
	_tmp10_ = self->priv->connection_banner;
	gtk_widget_set_halign ((GtkWidget*) _tmp10_, GTK_ALIGN_CENTER);
	_tmp11_ = self->priv->connection_banner;
	gtk_widget_set_valign ((GtkWidget*) _tmp11_, GTK_ALIGN_START);
	_tmp12_ = self->priv->connection_banner;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp12_, 8);
	_tmp13_ = self->priv->connection_banner;
	gtk_widget_set_can_target ((GtkWidget*) _tmp13_, FALSE);
	_tmp14_ = self->priv->connection_banner;
	_tmp15_ = _g_object_ref0 (_tmp14_);
	result = _tmp15_;
	_g_object_unref0 (icon);
	_g_object_unref0 (box);
	return result;
}

void
dc_window_set_connection_status (DcWindow* self,
                                 gboolean connected,
                                 const gchar* reason)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connection_banner;
	if (_tmp0_ == NULL) {
		return;
	}
	if (connected) {
		GtkRevealer* _tmp1_;
		_tmp1_ = self->priv->connection_banner;
		gtk_revealer_set_reveal_child (_tmp1_, FALSE);
	} else {
		const gchar* _tmp2_ = NULL;
		GtkLabel* _tmp3_;
		GtkRevealer* _tmp4_;
		_tmp2_ = reason;
		if (_tmp2_ == NULL) {
			_tmp2_ = "Not connected";
		}
		_tmp3_ = self->priv->connection_banner_label;
		gtk_label_set_label (_tmp3_, _tmp2_);
		_tmp4_ = self->priv->connection_banner;
		gtk_revealer_set_reveal_child (_tmp4_, TRUE);
	}
}

GListStore*
dc_window_get_chat_store (DcWindow* self)
{
	GListStore* result;
	GListStore* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_chat_store;
	result = _tmp0_;
	return result;
}

static void
dc_window_set_chat_store (DcWindow* self,
                          GListStore* value)
{
	GListStore* old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_window_get_chat_store (self);
	if (old_value != value) {
		GListStore* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_chat_store);
		self->priv->_chat_store = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dc_window_properties[DC_WINDOW_CHAT_STORE_PROPERTY]);
	}
}

gint
dc_window_get_current_chat_id (DcWindow* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_current_chat_id;
	return result;
}

static void
dc_window_set_current_chat_id (DcWindow* self,
                               gint value)
{
	DcEventHandler* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->_current_chat_id = value;
	_tmp0_ = self->priv->events;
	if (_tmp0_ != NULL) {
		DcEventHandler* _tmp1_;
		_tmp1_ = self->priv->events;
		dc_event_handler_set_active_chat_id (_tmp1_, value);
	}
	dc_window_update_conversation_header_actions (self);
	dc_window_sync_webxdc_chat_visibility (self);
	g_object_notify_by_pspec ((GObject *) self, dc_window_properties[DC_WINDOW_CURRENT_CHAT_ID_PROPERTY]);
}

static DcWindowPendingNotification*
dc_window_pending_notification_construct (GType object_type)
{
	DcWindowPendingNotification* self = NULL;
	self = (DcWindowPendingNotification*) g_type_create_instance (object_type);
	return self;
}

static DcWindowPendingNotification*
dc_window_pending_notification_new (void)
{
	return dc_window_pending_notification_construct (DC_WINDOW_TYPE_PENDING_NOTIFICATION);
}

static void
dc_window_value_pending_notification_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
dc_window_value_pending_notification_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		dc_window_pending_notification_unref (value->data[0].v_pointer);
	}
}

static void
dc_window_value_pending_notification_copy_value (const GValue* src_value,
                                                 GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = dc_window_pending_notification_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
dc_window_value_pending_notification_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
dc_window_value_pending_notification_collect_value (GValue* value,
                                                    guint n_collect_values,
                                                    GTypeCValue* collect_values,
                                                    guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		DcWindowPendingNotification * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = dc_window_pending_notification_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
dc_window_value_pending_notification_lcopy_value (const GValue* value,
                                                  guint n_collect_values,
                                                  GTypeCValue* collect_values,
                                                  guint collect_flags)
{
	DcWindowPendingNotification ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = dc_window_pending_notification_ref (value->data[0].v_pointer);
	}
	return NULL;
}

static GParamSpec*
dc_window_param_spec_pending_notification (const gchar* name,
                                           const gchar* nick,
                                           const gchar* blurb,
                                           GType object_type,
                                           GParamFlags flags)
{
	DcWindowParamSpecPendingNotification* spec;
	g_return_val_if_fail (g_type_is_a (object_type, DC_WINDOW_TYPE_PENDING_NOTIFICATION), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

static gpointer
dc_window_value_get_pending_notification (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DC_WINDOW_TYPE_PENDING_NOTIFICATION), NULL);
	return value->data[0].v_pointer;
}

static void
dc_window_value_set_pending_notification (GValue* value,
                                          gpointer v_object)
{
	DcWindowPendingNotification * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DC_WINDOW_TYPE_PENDING_NOTIFICATION));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DC_WINDOW_TYPE_PENDING_NOTIFICATION));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		dc_window_pending_notification_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dc_window_pending_notification_unref (old);
	}
}

static void
dc_window_value_take_pending_notification (GValue* value,
                                           gpointer v_object)
{
	DcWindowPendingNotification * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DC_WINDOW_TYPE_PENDING_NOTIFICATION));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DC_WINDOW_TYPE_PENDING_NOTIFICATION));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dc_window_pending_notification_unref (old);
	}
}

static void
dc_window_pending_notification_class_init (DcWindowPendingNotificationClass * klass,
                                           gpointer klass_data)
{
	dc_window_pending_notification_parent_class = g_type_class_peek_parent (klass);
	((DcWindowPendingNotificationClass *) klass)->finalize = dc_window_pending_notification_finalize;
}

static void
dc_window_pending_notification_instance_init (DcWindowPendingNotification * self,
                                              gpointer klass)
{
	self->ref_count = 1;
}

static void
dc_window_pending_notification_finalize (DcWindowPendingNotification * obj)
{
	DcWindowPendingNotification * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_WINDOW_TYPE_PENDING_NOTIFICATION, DcWindowPendingNotification);
	g_signal_handlers_destroy (self);
	_g_free0 (self->reaction);
}

static GType
dc_window_pending_notification_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { dc_window_value_pending_notification_init, dc_window_value_pending_notification_free_value, dc_window_value_pending_notification_copy_value, dc_window_value_pending_notification_peek_pointer, "p", dc_window_value_pending_notification_collect_value, "p", dc_window_value_pending_notification_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (DcWindowPendingNotificationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_window_pending_notification_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcWindowPendingNotification), 0, (GInstanceInitFunc) dc_window_pending_notification_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType dc_window_pending_notification_type_id;
	dc_window_pending_notification_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DcWindowPendingNotification", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return dc_window_pending_notification_type_id;
}

static GType
dc_window_pending_notification_get_type (void)
{
	static volatile gsize dc_window_pending_notification_type_id__once = 0;
	if (g_once_init_enter (&dc_window_pending_notification_type_id__once)) {
		GType dc_window_pending_notification_type_id;
		dc_window_pending_notification_type_id = dc_window_pending_notification_get_type_once ();
		g_once_init_leave (&dc_window_pending_notification_type_id__once, dc_window_pending_notification_type_id);
	}
	return dc_window_pending_notification_type_id__once;
}

static gpointer
dc_window_pending_notification_ref (gpointer instance)
{
	DcWindowPendingNotification * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

static void
dc_window_pending_notification_unref (gpointer instance)
{
	DcWindowPendingNotification * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		DC_WINDOW_PENDING_NOTIFICATION_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static Block11Data*
block11_data_ref (Block11Data* _data11_)
{
	g_atomic_int_inc (&_data11_->_ref_count_);
	return _data11_;
}

static void
block11_data_unref (void * _userdata_)
{
	Block11Data* _data11_;
	_data11_ = (Block11Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
		DcWindow* self;
		self = _data11_->self;
		_g_object_unref0 (_data11_->style_manager);
		_g_object_unref0 (self);
		g_slice_free (Block11Data, _data11_);
	}
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static void
_dc_window_handle_native_file_drop_dc_native_file_drop_target_path_dropped (DcNativeFileDropTarget* _sender,
                                                                            const gchar* path,
                                                                            gdouble x,
                                                                            gdouble y,
                                                                            gpointer self)
{
	dc_window_handle_native_file_drop ((DcWindow*) self, path, x, y);
}

static void
_dc_window___lambda430_ (Block11Data* _data11_)
{
	DcWindow* self;
	AdwStyleManager* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data11_->self;
	_tmp0_ = _data11_->style_manager;
	_tmp1_ = adw_style_manager_get_dark (_tmp0_);
	_tmp2_ = _tmp1_;
	dc_syntax_highlight_dark_mode = _tmp2_;
	dc_window_rebuild_current_chat_view (self);
}

static void
__dc_window___lambda430__g_object_notify (GObject* _sender,
                                          GParamSpec* pspec,
                                          gpointer self)
{
	_dc_window___lambda430_ (self);
}

static void
_dc_window___lambda431_ (DcWindow* self)
{
	DcSettingsManager* _tmp0_;
	DcMessageStyle _tmp1_;
	DcMessageStyle _tmp2_;
	DcSettingsManager* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	_tmp0_ = self->settings;
	_tmp1_ = dc_settings_manager_get_message_style (_tmp0_);
	_tmp2_ = _tmp1_;
	dc_message_row_style = _tmp2_;
	_tmp3_ = self->settings;
	_tmp4_ = dc_settings_manager_get_animate_stickers (_tmp3_);
	_tmp5_ = _tmp4_;
	dc_message_row_animate_stickers = _tmp5_;
	dc_window_apply_current_appearance (self);
	dc_window_rebuild_current_chat_view (self);
}

static void
__dc_window___lambda431__dc_settings_manager_appearance_changed (DcSettingsManager* _sender,
                                                                 gpointer self)
{
	_dc_window___lambda431_ ((DcWindow*) self);
}

static void
_dc_window___lambda432_ (DcWindow* self)
{
	dc_window_queue_font_update (self);
}

static void
__dc_window___lambda432__dc_settings_manager_font_changed (DcSettingsManager* _sender,
                                                           gpointer self)
{
	_dc_window___lambda432_ ((DcWindow*) self);
}

static gboolean
_dc_window_on_close_request_gtk_window_close_request (GtkWindow* _sender,
                                                      gpointer self)
{
	gboolean result;
	result = dc_window_on_close_request ((DcWindow*) self);
	return result;
}

static void
_dc_window___lambda433_ (DcWindow* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_object_get ((GtkWindow*) self, "is-active", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		dc_window_on_window_focused (self);
	}
}

static void
__dc_window___lambda433__g_object_notify (GObject* _sender,
                                          GParamSpec* pspec,
                                          gpointer self)
{
	_dc_window___lambda433_ ((DcWindow*) self);
}

static void
_dc_window_sync_tray_g_object_notify (GObject* _sender,
                                      GParamSpec* pspec,
                                      gpointer self)
{
	dc_window_sync_tray ((DcWindow*) self);
}

static void
_dc_window___lambda434_ (DcWindow* self)
{
	DcTrayIcon* _tmp0_;
	_tmp0_ = self->priv->tray;
	if (_tmp0_ != NULL) {
		DcTrayIcon* _tmp1_;
		gboolean _tmp2_;
		gboolean _tmp3_;
		_tmp1_ = self->priv->tray;
		_tmp2_ = gtk_widget_get_visible ((GtkWidget*) self);
		_tmp3_ = _tmp2_;
		dc_tray_icon_set_window_visible (_tmp1_, _tmp3_);
	}
	dc_window_sync_webxdc_chat_visibility (self);
}

static void
__dc_window___lambda434__g_object_notify (GObject* _sender,
                                          GParamSpec* pspec,
                                          gpointer self)
{
	_dc_window___lambda434_ ((DcWindow*) self);
}

static gboolean
_dc_window___lambda435_ (DcWindow* self)
{
	gboolean result;
	dc_window_try_connect (self, NULL, NULL);
	dc_window_sync_tray (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
__dc_window___lambda435__gsource_func (gpointer self)
{
	gboolean result;
	result = _dc_window___lambda435_ ((DcWindow*) self);
	return result;
}

static GObject *
dc_window_constructor (GType type,
                       guint n_construct_properties,
                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DcWindow * self;
	Block11Data* _data11_;
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	GHashFunc _tmp2_;
	GEqualFunc _tmp3_;
	GHashTable* _tmp4_;
	DcSettingsManager* _tmp5_;
	DcSettingsManager* _tmp6_;
	DcImageViewer* _tmp7_;
	DcImageViewer* _tmp8_;
	DcVideoPlayer* _tmp9_;
	DcVideoPlayer* _tmp10_;
	DcNativeFileDropTarget* _tmp11_;
	DcNativeFileDropTarget* _tmp12_;
	DcSettingsManager* _tmp13_;
	DcMessageStyle _tmp14_;
	DcMessageStyle _tmp15_;
	DcSettingsManager* _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	AdwStyleManager* _tmp19_;
	AdwStyleManager* _tmp20_;
	AdwStyleManager* _tmp21_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	AdwStyleManager* _tmp24_;
	DcSettingsManager* _tmp25_;
	DcSettingsManager* _tmp26_;
	DcSettingsManager* _tmp27_;
	parent_class = G_OBJECT_CLASS (dc_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_WINDOW, DcWindow);
	_data11_ = g_slice_new0 (Block11Data);
	_data11_->_ref_count_ = 1;
	_data11_->self = g_object_ref (self);
	_tmp0_ = g_list_store_new (DC_TYPE_CHAT_ENTRY);
	_tmp1_ = _tmp0_;
	dc_window_set_chat_store (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = g_direct_hash;
	_tmp3_ = g_direct_equal;
	_tmp4_ = g_hash_table_new_full (_tmp2_, _tmp3_, NULL, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->views);
	self->priv->views = _tmp4_;
	_tmp5_ = dc_settings_manager_new ();
	_g_object_unref0 (self->settings);
	self->settings = _tmp5_;
	_tmp6_ = self->settings;
	dc_settings_manager_load (_tmp6_);
	_tmp7_ = dc_image_viewer_new ();
	_g_object_unref0 (self->priv->image_viewer);
	self->priv->image_viewer = _tmp7_;
	_tmp8_ = self->priv->image_viewer;
	dc_image_viewer_set_window (_tmp8_, self);
	_tmp9_ = dc_video_player_new ();
	_g_object_unref0 (self->priv->video_player);
	self->priv->video_player = _tmp9_;
	_tmp10_ = self->priv->video_player;
	dc_video_player_set_window (_tmp10_, self);
	gtk_widget_add_css_class ((GtkWidget*) self, "parla-custom-bg");
	dc_window_build_ui (self);
	_tmp11_ = dc_native_file_drop_target_new ((GtkWidget*) self);
	_g_object_unref0 (self->priv->native_file_drop_target);
	self->priv->native_file_drop_target = _tmp11_;
	_tmp12_ = self->priv->native_file_drop_target;
	g_signal_connect_object (_tmp12_, "path-dropped", (GCallback) _dc_window_handle_native_file_drop_dc_native_file_drop_target_path_dropped, self, 0);
	_tmp13_ = self->settings;
	_tmp14_ = dc_settings_manager_get_message_style (_tmp13_);
	_tmp15_ = _tmp14_;
	dc_message_row_style = _tmp15_;
	_tmp16_ = self->settings;
	_tmp17_ = dc_settings_manager_get_animate_stickers (_tmp16_);
	_tmp18_ = _tmp17_;
	dc_message_row_animate_stickers = _tmp18_;
	dc_window_apply_current_appearance (self);
	_tmp19_ = adw_style_manager_get_default ();
	_tmp20_ = _g_object_ref0 (_tmp19_);
	_data11_->style_manager = _tmp20_;
	_tmp21_ = _data11_->style_manager;
	_tmp22_ = adw_style_manager_get_dark (_tmp21_);
	_tmp23_ = _tmp22_;
	dc_syntax_highlight_dark_mode = _tmp23_;
	_tmp24_ = _data11_->style_manager;
	g_signal_connect_data ((GObject*) _tmp24_, "notify::dark", (GCallback) __dc_window___lambda430__g_object_notify, block11_data_ref (_data11_), (GClosureNotify) block11_data_unref, 0);
	_tmp25_ = self->settings;
	g_signal_connect_object (_tmp25_, "appearance-changed", (GCallback) __dc_window___lambda431__dc_settings_manager_appearance_changed, self, 0);
	_tmp26_ = self->settings;
	g_signal_connect_object (_tmp26_, "font-changed", (GCallback) __dc_window___lambda432__dc_settings_manager_font_changed, self, 0);
	g_signal_connect_object ((GtkWindow*) self, "close-request", (GCallback) _dc_window_on_close_request_gtk_window_close_request, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::is-active", (GCallback) __dc_window___lambda433__g_object_notify, self, 0);
	_tmp27_ = self->settings;
	g_signal_connect_object ((GObject*) _tmp27_, "notify::minimize-to-tray", (GCallback) _dc_window_sync_tray_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::visible", (GCallback) __dc_window___lambda434__g_object_notify, self, 0);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __dc_window___lambda435__gsource_func, g_object_ref (self), g_object_unref);
	block11_data_unref (_data11_);
	_data11_ = NULL;
	return obj;
}

static void
dc_window_class_init (DcWindowClass * klass,
                      gpointer klass_data)
{
	dc_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcWindow_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dc_window_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = dc_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = dc_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_WINDOW_CHAT_STORE_PROPERTY, dc_window_properties[DC_WINDOW_CHAT_STORE_PROPERTY] = g_param_spec_object ("chat-store", "chat-store", "chat-store", g_list_store_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_WINDOW_CURRENT_CHAT_ID_PROPERTY, dc_window_properties[DC_WINDOW_CURRENT_CHAT_ID_PROPERTY] = g_param_spec_int ("current-chat-id", "current-chat-id", "current-chat-id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dc_window_instance_init (DcWindow * self,
                         gpointer klass)
{
	gint* _tmp0_;
	gchar** _tmp1_;
	GHashFunc _tmp2_;
	GEqualFunc _tmp3_;
	GHashTable* _tmp4_;
	GPtrArray* _tmp5_;
	self->priv = dc_window_get_instance_private (self);
	self->priv->showing_archived = FALSE;
	self->priv->archived_count = 0;
	_tmp0_ = g_new0 (gint, 0);
	self->priv->view_recency = _tmp0_;
	self->priv->view_recency_length1 = 0;
	self->priv->_view_recency_size_ = self->priv->view_recency_length1;
	self->priv->account_menu_state = NULL;
	self->priv->account_menu_load_gen = 0;
	self->priv->focus_current_account_on_menu_load = FALSE;
	_tmp1_ = g_new0 (gchar*, 0 + 1);
	self->priv->self_mention_keys_cache = _tmp1_;
	self->priv->self_mention_keys_cache_length1 = 0;
	self->priv->_self_mention_keys_cache_size_ = self->priv->self_mention_keys_cache_length1;
	_tmp2_ = g_direct_hash;
	_tmp3_ = g_direct_equal;
	_tmp4_ = g_hash_table_new_full (_tmp2_, _tmp3_, NULL, NULL);
	self->priv->mentioned_chats = _tmp4_;
	self->priv->_current_chat_id = 0;
	self->priv->suppress_reselect_scroll = FALSE;
	self->priv->suppress_chat_selection = FALSE;
	self->priv->reconnecting_rpc = FALSE;
	_tmp5_ = g_ptr_array_new_full ((guint) 0, _dc_window_pending_notification_unref0_);
	self->priv->pending_notifications = _tmp5_;
	self->priv->notification_flush_timer = (guint) 0;
	self->priv->font_update_source = (guint) 0;
	self->priv->active_modal = NULL;
	self->priv->pending_invite_uri = NULL;
	self->priv->tray = NULL;
	self->priv->held_in_background = FALSE;
	self->priv->quit_requested = FALSE;
	self->priv->escape_armed = FALSE;
}

static void
dc_window_finalize (GObject * obj)
{
	DcWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_WINDOW, DcWindow);
	_g_object_unref0 (self->priv->toast_overlay);
	_g_object_unref0 (self->priv->split_view);
	_g_object_unref0 (self->priv->sidebar_header);
	_g_object_unref0 (self->priv->content_header);
	_g_object_unref0 (self->priv->content_title_label);
	_g_object_unref0 (self->priv->content_mute_icon);
	_g_object_unref0 (self->priv->search_entry);
	_g_object_unref0 (self->priv->sidebar_box);
	_g_object_unref0 (self->priv->sidebar_toggle_btn);
	_g_object_unref0 (self->priv->message_search_btn);
	_g_object_unref0 (self->priv->gallery_btn);
	_g_object_unref0 (self->priv->sidebar_menu_button);
	_g_object_unref0 (self->priv->sidebar_title);
	_g_object_unref0 (self->priv->chat_listbox);
	_g_object_unref0 (self->priv->_chat_store);
	_g_object_unref0 (self->priv->archived_toggle_btn);
	_g_object_unref0 (self->priv->archived_btn_content);
	_g_hash_table_unref0 (self->priv->views);
	self->priv->view_recency = (g_free (self->priv->view_recency), NULL);
	_g_object_unref0 (self->priv->empty_status);
	_g_object_unref0 (self->priv->content_stack);
	_g_object_unref0 (self->priv->connection_banner);
	_g_object_unref0 (self->priv->connection_banner_label);
	_g_object_unref0 (self->priv->account_menu_button);
	_g_object_unref0 (self->priv->profile_avatar);
	_g_object_unref0 (self->priv->profile_unread_badge);
	_g_object_unref0 (self->priv->account_popover);
	_g_object_unref0 (self->priv->account_menu_list);
	_g_free0 (self->priv->account_menu_state);
	self->priv->self_mention_keys_cache = (_vala_array_free (self->priv->self_mention_keys_cache, self->priv->self_mention_keys_cache_length1, (GDestroyNotify) g_free), NULL);
	_g_hash_table_unref0 (self->priv->mentioned_chats);
	_g_object_unref0 (self->settings);
	_g_object_unref0 (self->priv->image_viewer);
	_g_object_unref0 (self->priv->video_player);
	_g_object_unref0 (self->priv->events);
	_g_object_unref0 (self->priv->chat_menu);
	_g_ptr_array_unref0 (self->priv->pending_notifications);
	_g_object_unref0 (self->priv->active_modal);
	_g_free0 (self->priv->pending_invite_uri);
	_g_object_unref0 (self->priv->tray);
	_g_object_unref0 (self->priv->native_file_drop_target);
	G_OBJECT_CLASS (dc_window_parent_class)->finalize (obj);
}

static GType
dc_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcWindow), 0, (GInstanceInitFunc) dc_window_instance_init, NULL };
	GType dc_window_type_id;
	dc_window_type_id = g_type_register_static (adw_application_window_get_type (), "DcWindow", &g_define_type_info, 0);
	DcWindow_private_offset = g_type_add_instance_private (dc_window_type_id, sizeof (DcWindowPrivate));
	return dc_window_type_id;
}

GType
dc_window_get_type (void)
{
	static volatile gsize dc_window_type_id__once = 0;
	if (g_once_init_enter (&dc_window_type_id__once)) {
		GType dc_window_type_id;
		dc_window_type_id = dc_window_get_type_once ();
		g_once_init_leave (&dc_window_type_id__once, dc_window_type_id);
	}
	return dc_window_type_id__once;
}

static void
_vala_dc_window_get_property (GObject * object,
                              guint property_id,
                              GValue * value,
                              GParamSpec * pspec)
{
	DcWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_WINDOW, DcWindow);
	switch (property_id) {
		case DC_WINDOW_CHAT_STORE_PROPERTY:
		g_value_set_object (value, dc_window_get_chat_store (self));
		break;
		case DC_WINDOW_CURRENT_CHAT_ID_PROPERTY:
		g_value_set_int (value, dc_window_get_current_chat_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_window_set_property (GObject * object,
                              guint property_id,
                              const GValue * value,
                              GParamSpec * pspec)
{
	DcWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_WINDOW, DcWindow);
	switch (property_id) {
		case DC_WINDOW_CHAT_STORE_PROPERTY:
		dc_window_set_chat_store (self, g_value_get_object (value));
		break;
		case DC_WINDOW_CURRENT_CHAT_ID_PROPERTY:
		dc_window_set_current_chat_id (self, g_value_get_int (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);
}

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

