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

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

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

#define DC_TYPE_FILE_DROP_TARGET (dc_file_drop_target_get_type ())
#define DC_FILE_DROP_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_FILE_DROP_TARGET, DcFileDropTarget))
#define DC_FILE_DROP_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_FILE_DROP_TARGET, DcFileDropTargetClass))
#define DC_IS_FILE_DROP_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_FILE_DROP_TARGET))
#define DC_IS_FILE_DROP_TARGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_FILE_DROP_TARGET))
#define DC_FILE_DROP_TARGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_FILE_DROP_TARGET, DcFileDropTargetClass))

typedef struct _DcFileDropTarget DcFileDropTarget;
typedef struct _DcFileDropTargetClass DcFileDropTargetClass;
enum  {
	DC_CHAT_ROW_0_PROPERTY,
	DC_CHAT_ROW_CHAT_ID_PROPERTY,
	DC_CHAT_ROW_NUM_PROPERTIES
};
static GParamSpec* dc_chat_row_properties[DC_CHAT_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
enum  {
	DC_CHAT_ROW_ACCEPT_FILE_DROP_SIGNAL,
	DC_CHAT_ROW_FILE_DROPPED_SIGNAL,
	DC_CHAT_ROW_FILE_DROP_FAILED_SIGNAL,
	DC_CHAT_ROW_NUM_SIGNALS
};
static guint dc_chat_row_signals[DC_CHAT_ROW_NUM_SIGNALS] = {0};

#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;
typedef struct _DcChatContextMenuPrivate DcChatContextMenuPrivate;

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

typedef struct _DcWindow DcWindow;
typedef struct _DcWindowClass DcWindowClass;

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

typedef struct _DcRpcClient DcRpcClient;
typedef struct _DcRpcClientClass DcRpcClientClass;
enum  {
	DC_CHAT_CONTEXT_MENU_0_PROPERTY,
	DC_CHAT_CONTEXT_MENU_NUM_PROPERTIES
};
static GParamSpec* dc_chat_context_menu_properties[DC_CHAT_CONTEXT_MENU_NUM_PROPERTIES];
typedef struct _Block15Data Block15Data;

#define DC_TYPE_POPOVER_BUTTON (dc_popover_button_get_type ())
#define DC_POPOVER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_POPOVER_BUTTON, DcPopoverButton))
#define DC_POPOVER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_POPOVER_BUTTON, DcPopoverButtonClass))
#define DC_IS_POPOVER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_POPOVER_BUTTON))
#define DC_IS_POPOVER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_POPOVER_BUTTON))
#define DC_POPOVER_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_POPOVER_BUTTON, DcPopoverButtonClass))

typedef struct _DcPopoverButton DcPopoverButton;
typedef struct _DcPopoverButtonClass DcPopoverButtonClass;
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 _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DcChatContextMenuTogglePinData DcChatContextMenuTogglePinData;
typedef struct _Block16Data Block16Data;
typedef struct _DcChatContextMenuToggleArchiveData DcChatContextMenuToggleArchiveData;
typedef struct _DcChatContextMenuSetMuteStateData DcChatContextMenuSetMuteStateData;
typedef struct _DcChatContextMenuSetUnreadStateData DcChatContextMenuSetUnreadStateData;

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

#define DC_TYPE_CHAT_INFO_DIALOG (dc_chat_info_dialog_get_type ())
#define DC_CHAT_INFO_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CHAT_INFO_DIALOG, DcChatInfoDialog))
#define DC_CHAT_INFO_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CHAT_INFO_DIALOG, DcChatInfoDialogClass))
#define DC_IS_CHAT_INFO_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CHAT_INFO_DIALOG))
#define DC_IS_CHAT_INFO_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CHAT_INFO_DIALOG))
#define DC_CHAT_INFO_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CHAT_INFO_DIALOG, DcChatInfoDialogClass))

typedef struct _DcChatInfoDialog DcChatInfoDialog;
typedef struct _DcChatInfoDialogClass DcChatInfoDialogClass;
typedef struct _DcChatContextMenuConfirmClearHistoryData DcChatContextMenuConfirmClearHistoryData;
typedef struct _DcChatContextMenuConfirmLeaveData DcChatContextMenuConfirmLeaveData;
typedef struct _DcChatContextMenuDoLeaveData DcChatContextMenuDoLeaveData;
typedef struct _DcChatContextMenuConfirmDeleteData DcChatContextMenuConfirmDeleteData;
typedef struct _DcChatContextMenuDoClearHistoryData DcChatContextMenuDoClearHistoryData;
typedef struct _DcChatContextMenuDoDeleteData DcChatContextMenuDoDeleteData;

struct _DcChatRow {
	GtkBox parent_instance;
	DcChatRowPrivate * priv;
};

struct _DcChatRowClass {
	GtkBoxClass parent_class;
};

struct _DcChatRowPrivate {
	gint _chat_id;
	GtkBox* mid_box;
	GtkOverlay* avatar_overlay;
	GtkLabel* badge_label;
	GtkLabel* compact_unread_dot;
	GtkLabel* compact_unread_count;
	GtkImage* compact_pin_icon;
	gboolean has_unread;
	gboolean is_muted;
	gboolean is_pinned;
	gboolean is_request;
	gboolean has_mention;
	gint unread_count;
	gboolean compact;
	DcFileDropTarget* file_drop_target;
};

struct _DcChatContextMenu {
	GObject parent_instance;
	DcChatContextMenuPrivate * priv;
};

struct _DcChatContextMenuClass {
	GObjectClass parent_class;
};

struct _DcChatContextMenuPrivate {
	DcWindow* window;
	DcRpcClient* rpc;
	GListStore* chat_store;
};

struct _Block15Data {
	int _ref_count_;
	DcChatContextMenu* self;
	gboolean is_pinned;
	gboolean is_archived;
	gboolean is_muted;
	gboolean has_unread;
	gint chat_id;
};

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

struct _Block16Data {
	int _ref_count_;
	DcChatContextMenu* self;
	gint chat_id;
	gpointer _async_data_;
};

struct _DcChatContextMenuToggleArchiveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	gboolean currently_archived;
	Block16Data* _data16_;
	DcChatEntry* entry;
	GListStore* _tmp0_;
	DcChatEntry* _tmp1_;
	gboolean _tmp2_;
	DcChatEntry* _tmp3_;
	DcChatEntry* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gboolean already_muted;
	const gchar* _tmp7_;
	DcRpcClient* _tmp8_;
	DcWindow* _tmp9_;
	DcWindow* _tmp10_;
	AdwToast* toast;
	DcWindow* _tmp11_;
	AdwToast* _tmp12_;
	AdwToast* _tmp13_;
	DcWindow* _tmp14_;
	GError* e;
	DcWindow* _tmp15_;
	GError* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	GError* _inner_error0_;
};

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

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

struct _Block17Data {
	int _ref_count_;
	DcChatContextMenu* self;
	gint chat_id;
};

struct _DcChatContextMenuConfirmClearHistoryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	gchar* chat_name;
	gchar* _tmp0_;
	DcChatEntry* entry;
	GListStore* _tmp1_;
	DcChatEntry* _tmp2_;
	DcChatEntry* _tmp3_;
	DcChatEntry* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	DcWindow* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
};

struct _DcChatContextMenuConfirmLeaveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	gchar* chat_name;
	gchar* _tmp0_;
	DcChatEntry* entry;
	GListStore* _tmp1_;
	DcChatEntry* _tmp2_;
	DcChatEntry* _tmp3_;
	DcChatEntry* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	DcWindow* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
};

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

struct _DcChatContextMenuConfirmDeleteData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	gchar* chat_name;
	gchar* _tmp0_;
	DcChatEntry* entry;
	GListStore* _tmp1_;
	DcChatEntry* _tmp2_;
	DcChatEntry* _tmp3_;
	DcChatEntry* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	DcWindow* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
};

struct _DcChatContextMenuDoClearHistoryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	gboolean for_all;
	gint* ids;
	DcRpcClient* _tmp0_;
	DcRpcClient* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint* _tmp5_;
	gint ids_length1;
	gint _ids_size_;
	gint* _tmp6_;
	gint _tmp6__length1;
	DcRpcClient* _tmp7_;
	gint* _tmp8_;
	gint _tmp8__length1;
	DcRpcClient* _tmp9_;
	gint* _tmp10_;
	gint _tmp10__length1;
	DcWindow* _tmp11_;
	const gchar* _tmp12_;
	DcWindow* _tmp13_;
	DcWindow* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	DcWindow* _tmp17_;
	DcWindow* _tmp18_;
	GError* e;
	DcWindow* _tmp19_;
	GError* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	GError* _inner_error0_;
};

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

static gint DcChatRow_private_offset;
static gpointer dc_chat_row_parent_class = NULL;
static gint DcChatContextMenu_private_offset;
static gpointer dc_chat_context_menu_parent_class = NULL;

VALA_EXTERN GType dc_chat_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcChatRow, g_object_unref)
VALA_EXTERN GType dc_file_drop_target_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcFileDropTarget, g_object_unref)
VALA_EXTERN GType dc_chat_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcChatEntry, g_object_unref)
VALA_EXTERN DcChatRow* dc_chat_row_new (DcChatEntry* entry);
VALA_EXTERN DcChatRow* dc_chat_row_construct (GType object_type,
                                  DcChatEntry* entry);
VALA_EXTERN gint dc_chat_entry_get_id (DcChatEntry* self);
static void dc_chat_row_set_chat_id (DcChatRow* self,
                              gint value);
VALA_EXTERN gint dc_chat_entry_get_unread_count (DcChatEntry* self);
VALA_EXTERN gboolean dc_chat_entry_get_is_contact_request (DcChatEntry* self);
VALA_EXTERN gboolean dc_chat_entry_get_is_muted (DcChatEntry* self);
VALA_EXTERN gboolean dc_chat_entry_get_is_pinned (DcChatEntry* self);
VALA_EXTERN gboolean dc_chat_entry_get_has_mention (DcChatEntry* self);
VALA_EXTERN GtkWidget* dc_presence_avatar (gint size,
                               const gchar* text,
                               const gchar* path,
                               gboolean online,
                               const gchar* avatar_css,
                               const gchar* ring_css);
VALA_EXTERN const gchar* dc_chat_entry_get_name (DcChatEntry* self);
VALA_EXTERN const gchar* dc_chat_entry_get_avatar_path (DcChatEntry* self);
VALA_EXTERN gboolean dc_chat_entry_get_was_seen_recently (DcChatEntry* self);
static gchar* dc_chat_row_format_time (gint64 timestamp);
VALA_EXTERN gint64 dc_chat_entry_get_timestamp (DcChatEntry* self);
VALA_EXTERN gchar* dc_message_row_spread_adjacent_emoji (const gchar* raw);
static gchar* dc_chat_row_format_preview (DcChatEntry* entry);
VALA_EXTERN DcFileDropTarget* dc_file_drop_target_new (GtkWidget* widget,
                                           const gchar* active_css_class);
VALA_EXTERN DcFileDropTarget* dc_file_drop_target_construct (GType object_type,
                                                 GtkWidget* widget,
                                                 const gchar* active_css_class);
static gboolean __lambda92_ (DcChatRow* self);
static gboolean ___lambda92__dc_file_drop_target_accept (DcFileDropTarget* _sender,
                                                  gpointer self);
static void __lambda93_ (DcChatRow* self,
                  const gchar* path,
                  const gchar* name);
static void ___lambda93__dc_file_drop_target_dropped (DcFileDropTarget* _sender,
                                               const gchar* path,
                                               const gchar* name,
                                               gpointer self);
static void __lambda94_ (DcChatRow* self,
                  const gchar* message);
static void ___lambda94__dc_file_drop_target_failed (DcFileDropTarget* _sender,
                                              const gchar* message,
                                              gpointer self);
VALA_EXTERN void dc_chat_row_set_compact (DcChatRow* self,
                              gboolean compact);
VALA_EXTERN const gchar* dc_chat_entry_get_last_message (DcChatEntry* self);
VALA_EXTERN gchar* dc_markdown_single_line_preview (const gchar* input,
                                        gint max_chars);
VALA_EXTERN const gchar* dc_chat_entry_get_summary_prefix (DcChatEntry* self);
VALA_EXTERN gint dc_chat_row_get_chat_id (DcChatRow* self);
static void g_cclosure_user_marshal_BOOLEAN__VOID (GClosure * closure,
                                            GValue * return_value,
                                            guint n_param_values,
                                            const GValue * param_values,
                                            gpointer invocation_hint,
                                            gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void dc_chat_row_finalize (GObject * obj);
static GType dc_chat_row_get_type_once (void);
static void _vala_dc_chat_row_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec);
static void _vala_dc_chat_row_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec);
VALA_EXTERN GType dc_chat_context_menu_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcChatContextMenu, g_object_unref)
VALA_EXTERN GType dc_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWindow, g_object_unref)
VALA_EXTERN GType dc_rpc_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcRpcClient, g_object_unref)
VALA_EXTERN 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);
VALA_EXTERN void dc_chat_context_menu_show (DcChatContextMenu* self,
                                gint chat_id,
                                gdouble x,
                                gdouble y,
                                GtkWidget* parent);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
VALA_EXTERN DcChatEntry* dc_find_chat_entry (GListStore* store,
                                 gint chat_id);
VALA_EXTERN gboolean dc_chat_entry_get_is_archived (DcChatEntry* self);
VALA_EXTERN GType dc_popover_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcPopoverButton, g_object_unref)
static DcPopoverButton* dc_chat_context_menu_append_menu_button (GtkBox* box,
                                                          GtkPopover* popover,
                                                          const gchar* label,
                                                          gboolean destructive,
                                                          gboolean sensitive);
static void ___lambda197_ (Block15Data* _data15_);
static void dc_chat_context_menu_toggle_pin (DcChatContextMenu* self,
                                      gint chat_id,
                                      gboolean currently_pinned,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static void dc_chat_context_menu_toggle_pin_finish (DcChatContextMenu* self,
                                             GAsyncResult* _res_);
static void ____lambda197__dc_popover_button_selected (DcPopoverButton* _sender,
                                                gpointer self);
static void __lambda198_ (Block15Data* _data15_);
static void dc_chat_context_menu_toggle_archive (DcChatContextMenu* self,
                                          gint chat_id,
                                          gboolean currently_archived,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_chat_context_menu_toggle_archive_finish (DcChatContextMenu* self,
                                                 GAsyncResult* _res_);
static void ___lambda198__dc_popover_button_selected (DcPopoverButton* _sender,
                                               gpointer self);
static void ___lambda200_ (Block15Data* _data15_);
static void dc_chat_context_menu_set_mute_state (DcChatContextMenu* self,
                                          gint chat_id,
                                          gboolean mute,
                                          const gchar* done_message,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_chat_context_menu_set_mute_state_finish (DcChatContextMenu* self,
                                                 GAsyncResult* _res_);
static void ____lambda200__dc_popover_button_selected (DcPopoverButton* _sender,
                                                gpointer self);
VALA_EXTERN gint dc_window_get_current_chat_id (DcWindow* self);
static void __lambda201_ (Block15Data* _data15_);
static void dc_chat_context_menu_set_unread_state (DcChatContextMenu* self,
                                            gint chat_id,
                                            gboolean unread,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void dc_chat_context_menu_set_unread_state_finish (DcChatContextMenu* self,
                                                   GAsyncResult* _res_);
static void ___lambda201__dc_popover_button_selected (DcPopoverButton* _sender,
                                               gpointer self);
static void __lambda202_ (Block15Data* _data15_);
static void dc_chat_context_menu_show_media (DcChatContextMenu* self,
                                      gint chat_id);
static void ___lambda202__dc_popover_button_selected (DcPopoverButton* _sender,
                                               gpointer self);
static void __lambda251_ (Block15Data* _data15_);
VALA_EXTERN void dc_chat_context_menu_show_info (DcChatContextMenu* self,
                                     gint chat_id);
static void ___lambda251__dc_popover_button_selected (DcPopoverButton* _sender,
                                               gpointer self);
static void __lambda287_ (Block15Data* _data15_);
static void dc_chat_context_menu_confirm_clear_history (DcChatContextMenu* self,
                                                 gint chat_id,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static void dc_chat_context_menu_confirm_clear_history_finish (DcChatContextMenu* self,
                                                        GAsyncResult* _res_);
static void ___lambda287__dc_popover_button_selected (DcPopoverButton* _sender,
                                               gpointer self);
VALA_EXTERN GType dc_chat_kind_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DcChatKind dc_chat_entry_get_kind (DcChatEntry* self);
static void ___lambda288_ (Block15Data* _data15_);
static void dc_chat_context_menu_confirm_leave (DcChatContextMenu* self,
                                         gint chat_id,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dc_chat_context_menu_confirm_leave_finish (DcChatContextMenu* self,
                                                GAsyncResult* _res_);
static void ____lambda288__dc_popover_button_selected (DcPopoverButton* _sender,
                                                gpointer self);
static void __lambda289_ (Block15Data* _data15_);
static void dc_chat_context_menu_confirm_delete (DcChatContextMenu* self,
                                          gint chat_id,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_chat_context_menu_confirm_delete_finish (DcChatContextMenu* self,
                                                 GAsyncResult* _res_);
static void ___lambda289__dc_popover_button_selected (DcPopoverButton* _sender,
                                               gpointer self);
VALA_EXTERN void dc_unparent_on_close (GtkPopover* popover);
VALA_EXTERN DcPopoverButton* dc_popover_button_new (GtkPopover* popover,
                                        const gchar* label,
                                        gboolean destructive,
                                        gboolean hexpand);
VALA_EXTERN DcPopoverButton* dc_popover_button_construct (GType object_type,
                                              GtkPopover* popover,
                                              const gchar* label,
                                              gboolean destructive,
                                              gboolean hexpand);
static void dc_chat_context_menu_toggle_pin_data_free (gpointer _data);
static gboolean dc_chat_context_menu_toggle_pin_co (DcChatContextMenuTogglePinData* _data_);
VALA_EXTERN void dc_rpc_client_set_chat_visibility (DcRpcClient* self,
                                        gint chat_id,
                                        const gchar* visibility,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_set_chat_visibility_finish (DcRpcClient* self,
                                               GAsyncResult* _res_,
                                               GError** error);
static void dc_chat_context_menu_toggle_pin_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
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_);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
static void dc_chat_context_menu_toggle_archive_data_free (gpointer _data);
static gboolean dc_chat_context_menu_toggle_archive_co (DcChatContextMenuToggleArchiveData* _data_);
static Block16Data* block16_data_ref (Block16Data* _data16_);
static void block16_data_unref (void * _userdata_);
static void dc_chat_context_menu_toggle_archive_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
VALA_EXTERN AdwToast* dc_window_show_action_toast (DcWindow* self,
                                       const gchar* message,
                                       const gchar* button_label);
static void _____lambda199_ (Block16Data* _data16_);
static void ______lambda199__adw_toast_button_clicked (AdwToast* _sender,
                                                gpointer self);
static void dc_chat_context_menu_set_mute_state_data_free (gpointer _data);
static gboolean dc_chat_context_menu_set_mute_state_co (DcChatContextMenuSetMuteStateData* _data_);
VALA_EXTERN void dc_rpc_client_set_chat_mute_duration (DcRpcClient* self,
                                           gint chat_id,
                                           gint seconds,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_set_chat_mute_duration_finish (DcRpcClient* self,
                                                  GAsyncResult* _res_,
                                                  GError** error);
static void dc_chat_context_menu_set_mute_state_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
VALA_EXTERN void dc_window_request_reload_chats (DcWindow* self);
static void dc_chat_context_menu_set_unread_state_data_free (gpointer _data);
static gboolean dc_chat_context_menu_set_unread_state_co (DcChatContextMenuSetUnreadStateData* _data_);
VALA_EXTERN void dc_rpc_client_markfresh_chat (DcRpcClient* self,
                                   gint chat_id,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_markfresh_chat_finish (DcRpcClient* self,
                                          GAsyncResult* _res_,
                                          GError** error);
static void dc_chat_context_menu_set_unread_state_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
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);
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);
static Block17Data* block17_data_ref (Block17Data* _data17_);
static void block17_data_unref (void * _userdata_);
VALA_EXTERN GType dc_chat_info_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcChatInfoDialog, g_object_unref)
VALA_EXTERN DcChatInfoDialog* dc_chat_info_dialog_new (DcWindow* window,
                                           DcRpcClient* rpc,
                                           gint chat_id);
VALA_EXTERN DcChatInfoDialog* dc_chat_info_dialog_construct (GType object_type,
                                                 DcWindow* window,
                                                 DcRpcClient* rpc,
                                                 gint chat_id);
static void __lambda284_ (DcChatContextMenu* self,
                   gint cid);
VALA_EXTERN void dc_window_clear_chat_view (DcWindow* self);
static void ___lambda284__dc_chat_info_dialog_chat_deleted (DcChatInfoDialog* _sender,
                                                     gint chat_id,
                                                     gpointer self);
static void __lambda285_ (Block17Data* _data17_);
VALA_EXTERN void dc_window_request_messages_reload (DcWindow* self);
static void ___lambda285__dc_chat_info_dialog_chat_changed (DcChatInfoDialog* _sender,
                                                     gpointer self);
static void __lambda286_ (DcChatContextMenu* self,
                   gint cid);
static void ___lambda286__dc_chat_info_dialog_contact_blocked (DcChatInfoDialog* _sender,
                                                        gint chat_id,
                                                        gpointer self);
static void dc_chat_context_menu_confirm_clear_history_data_free (gpointer _data);
static gboolean dc_chat_context_menu_confirm_clear_history_co (DcChatContextMenuConfirmClearHistoryData* _data_);
VALA_EXTERN void dc_confirm_action (GtkWidget* parent,
                        const gchar* title,
                        const gchar* body,
                        const gchar* action_id,
                        const gchar* action_label,
                        GAsyncReadyCallback _callback_,
                        gpointer _user_data_);
VALA_EXTERN gboolean dc_confirm_action_finish (GAsyncResult* _res_);
static void dc_chat_context_menu_confirm_clear_history_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
static void dc_chat_context_menu_do_clear_history (DcChatContextMenu* self,
                                            gint chat_id,
                                            gboolean for_all,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void dc_chat_context_menu_do_clear_history_finish (DcChatContextMenu* self,
                                                   GAsyncResult* _res_);
static void dc_chat_context_menu_confirm_leave_data_free (gpointer _data);
static gboolean dc_chat_context_menu_confirm_leave_co (DcChatContextMenuConfirmLeaveData* _data_);
static void dc_chat_context_menu_confirm_leave_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void dc_chat_context_menu_do_leave (DcChatContextMenu* self,
                                    gint chat_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void dc_chat_context_menu_do_leave_finish (DcChatContextMenu* self,
                                           GAsyncResult* _res_);
static void dc_chat_context_menu_do_leave_data_free (gpointer _data);
static gboolean dc_chat_context_menu_do_leave_co (DcChatContextMenuDoLeaveData* _data_);
VALA_EXTERN void dc_rpc_client_leave_group (DcRpcClient* self,
                                gint chat_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_leave_group_finish (DcRpcClient* self,
                                       GAsyncResult* _res_,
                                       GError** error);
static void dc_chat_context_menu_do_leave_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_chat (DcRpcClient* self,
                                gint chat_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_chat_finish (DcRpcClient* self,
                                       GAsyncResult* _res_,
                                       GError** error);
static void dc_chat_context_menu_confirm_delete_data_free (gpointer _data);
static gboolean dc_chat_context_menu_confirm_delete_co (DcChatContextMenuConfirmDeleteData* _data_);
static void dc_chat_context_menu_confirm_delete_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void dc_chat_context_menu_do_delete (DcChatContextMenu* self,
                                     gint chat_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void dc_chat_context_menu_do_delete_finish (DcChatContextMenu* self,
                                            GAsyncResult* _res_);
static void dc_chat_context_menu_do_clear_history_data_free (gpointer _data);
static gboolean dc_chat_context_menu_do_clear_history_co (DcChatContextMenuDoClearHistoryData* _data_);
VALA_EXTERN void dc_chat_message_ids_for_clear (DcRpcClient* rpc,
                                    gint account_id,
                                    gint chat_id,
                                    gboolean for_all,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN gint* dc_chat_message_ids_for_clear_finish (GAsyncResult* _res_,
                                            gint* result_length1,
                                            GError** error);
VALA_EXTERN gint dc_rpc_client_get_account_id (DcRpcClient* self);
static void dc_chat_context_menu_do_clear_history_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages_for_all (DcRpcClient* self,
                                            gint* msg_ids,
                                            gint msg_ids_length1,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages_for_all_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
VALA_EXTERN void dc_rpc_client_delete_messages (DcRpcClient* self,
                                    gint* msg_ids,
                                    gint msg_ids_length1,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_delete_messages_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static void dc_chat_context_menu_do_delete_data_free (gpointer _data);
static gboolean dc_chat_context_menu_do_delete_co (DcChatContextMenuDoDeleteData* _data_);
static void dc_chat_context_menu_do_delete_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_);
static void dc_chat_context_menu_finalize (GObject * obj);
static GType dc_chat_context_menu_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dc_chat_row_get_instance_private (DcChatRow* self)
{
	return G_STRUCT_MEMBER_P (self, DcChatRow_private_offset);
}

static gboolean
__lambda92_ (DcChatRow* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_signal_emit (self, dc_chat_row_signals[DC_CHAT_ROW_ACCEPT_FILE_DROP_SIGNAL], 0, &_tmp0_);
	result = _tmp0_;
	return result;
}

static gboolean
___lambda92__dc_file_drop_target_accept (DcFileDropTarget* _sender,
                                         gpointer self)
{
	gboolean result;
	result = __lambda92_ ((DcChatRow*) self);
	return result;
}

static void
__lambda93_ (DcChatRow* self,
             const gchar* path,
             const gchar* name)
{
	g_return_if_fail (path != NULL);
	g_return_if_fail (name != NULL);
	g_signal_emit (self, dc_chat_row_signals[DC_CHAT_ROW_FILE_DROPPED_SIGNAL], 0, path, name);
}

static void
___lambda93__dc_file_drop_target_dropped (DcFileDropTarget* _sender,
                                          const gchar* path,
                                          const gchar* name,
                                          gpointer self)
{
	__lambda93_ ((DcChatRow*) self, path, name);
}

static void
__lambda94_ (DcChatRow* self,
             const gchar* message)
{
	g_return_if_fail (message != NULL);
	g_signal_emit (self, dc_chat_row_signals[DC_CHAT_ROW_FILE_DROP_FAILED_SIGNAL], 0, message);
}

static void
___lambda94__dc_file_drop_target_failed (DcFileDropTarget* _sender,
                                         const gchar* message,
                                         gpointer self)
{
	__lambda94_ ((DcChatRow*) self, message);
}

DcChatRow*
dc_chat_row_construct (GType object_type,
                       DcChatEntry* entry)
{
	DcChatRow * self = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	GtkWidget* avatar = NULL;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	GtkWidget* _tmp23_;
	GtkOverlay* _tmp24_;
	GtkOverlay* _tmp25_;
	GtkWidget* _tmp26_;
	GtkOverlay* _tmp27_;
	GtkOverlay* _tmp28_;
	GtkOverlay* _tmp57_;
	GtkBox* _tmp58_;
	GtkBox* _tmp59_;
	GtkBox* _tmp60_;
	GtkBox* top = NULL;
	GtkBox* _tmp61_;
	GtkLabel* name_label = NULL;
	const gchar* _tmp72_;
	const gchar* _tmp73_;
	GtkLabel* _tmp74_;
	GtkLabel* _tmp75_;
	GtkLabel* _tmp77_;
	GtkLabel* _tmp78_;
	GtkLabel* _tmp79_;
	GtkLabel* _tmp80_;
	GtkBox* _tmp81_;
	GtkLabel* _tmp82_;
	GtkLabel* time_label = NULL;
	gint64 _tmp94_;
	gint64 _tmp95_;
	gchar* _tmp96_;
	gchar* _tmp97_;
	GtkLabel* _tmp98_;
	GtkLabel* _tmp99_;
	GtkLabel* _tmp100_;
	GtkLabel* _tmp101_;
	GtkBox* _tmp102_;
	GtkLabel* _tmp103_;
	GtkBox* _tmp104_;
	GtkBox* _tmp105_;
	GtkBox* bot = NULL;
	GtkBox* _tmp106_;
	GtkLabel* preview_label = NULL;
	gchar* _tmp107_;
	gchar* _tmp108_;
	gchar* _tmp109_;
	gchar* _tmp110_;
	GtkLabel* _tmp111_;
	GtkLabel* _tmp112_;
	GtkLabel* _tmp114_;
	GtkLabel* _tmp115_;
	GtkLabel* _tmp116_;
	GtkLabel* _tmp117_;
	GtkLabel* _tmp118_;
	GtkBox* _tmp119_;
	GtkLabel* _tmp120_;
	GtkBox* _tmp136_;
	GtkBox* _tmp137_;
	GtkBox* _tmp138_;
	DcFileDropTarget* _tmp139_;
	DcFileDropTarget* _tmp140_;
	DcFileDropTarget* _tmp141_;
	DcFileDropTarget* _tmp142_;
	g_return_val_if_fail (entry != NULL, NULL);
	self = (DcChatRow*) g_object_new (object_type, "orientation", GTK_ORIENTATION_HORIZONTAL, "spacing", 10, NULL);
	_tmp0_ = dc_chat_entry_get_id (entry);
	_tmp1_ = _tmp0_;
	dc_chat_row_set_chat_id (self, _tmp1_);
	_tmp3_ = dc_chat_entry_get_unread_count (entry);
	_tmp4_ = _tmp3_;
	if (_tmp4_ > 0) {
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp5_ = dc_chat_entry_get_is_contact_request (entry);
		_tmp6_ = _tmp5_;
		_tmp2_ = !_tmp6_;
	} else {
		_tmp2_ = FALSE;
	}
	self->priv->has_unread = _tmp2_;
	_tmp7_ = dc_chat_entry_get_is_muted (entry);
	_tmp8_ = _tmp7_;
	self->priv->is_muted = _tmp8_;
	_tmp9_ = dc_chat_entry_get_is_pinned (entry);
	_tmp10_ = _tmp9_;
	self->priv->is_pinned = _tmp10_;
	_tmp11_ = dc_chat_entry_get_is_contact_request (entry);
	_tmp12_ = _tmp11_;
	self->priv->is_request = _tmp12_;
	_tmp13_ = dc_chat_entry_get_has_mention (entry);
	_tmp14_ = _tmp13_;
	self->priv->has_mention = _tmp14_;
	_tmp15_ = dc_chat_entry_get_unread_count (entry);
	_tmp16_ = _tmp15_;
	self->priv->unread_count = _tmp16_;
	gtk_widget_add_css_class ((GtkWidget*) self, "chat-row");
	if (self->priv->has_mention) {
		gtk_widget_add_css_class ((GtkWidget*) self, "chat-row-mention");
	}
	gtk_widget_set_margin_start ((GtkWidget*) self, 8);
	gtk_widget_set_margin_end ((GtkWidget*) self, 8);
	gtk_widget_set_margin_top ((GtkWidget*) self, 4);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 4);
	_tmp17_ = dc_chat_entry_get_name (entry);
	_tmp18_ = _tmp17_;
	_tmp19_ = dc_chat_entry_get_avatar_path (entry);
	_tmp20_ = _tmp19_;
	_tmp21_ = dc_chat_entry_get_was_seen_recently (entry);
	_tmp22_ = _tmp21_;
	_tmp23_ = dc_presence_avatar (40, _tmp18_, _tmp20_, _tmp22_, NULL, "list-presence-avatar-ring");
	avatar = _tmp23_;
	_tmp24_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->avatar_overlay);
	self->priv->avatar_overlay = _tmp24_;
	_tmp25_ = self->priv->avatar_overlay;
	_tmp26_ = avatar;
	gtk_overlay_set_child (_tmp25_, _tmp26_);
	_tmp27_ = self->priv->avatar_overlay;
	gtk_widget_set_valign ((GtkWidget*) _tmp27_, GTK_ALIGN_CENTER);
	_tmp28_ = self->priv->avatar_overlay;
	gtk_widget_set_halign ((GtkWidget*) _tmp28_, GTK_ALIGN_CENTER);
	if (self->priv->is_request) {
		GtkLabel* _tmp29_;
		GtkLabel* _tmp30_;
		GtkLabel* _tmp31_;
		GtkLabel* _tmp32_;
		GtkLabel* _tmp33_;
		GtkOverlay* _tmp34_;
		GtkLabel* _tmp35_;
		_tmp29_ = (GtkLabel*) gtk_label_new ("!");
		g_object_ref_sink (_tmp29_);
		_g_object_unref0 (self->priv->compact_unread_dot);
		self->priv->compact_unread_dot = _tmp29_;
		_tmp30_ = self->priv->compact_unread_dot;
		gtk_widget_add_css_class ((GtkWidget*) _tmp30_, "compact-request-marker");
		_tmp31_ = self->priv->compact_unread_dot;
		gtk_widget_set_halign ((GtkWidget*) _tmp31_, GTK_ALIGN_END);
		_tmp32_ = self->priv->compact_unread_dot;
		gtk_widget_set_valign ((GtkWidget*) _tmp32_, GTK_ALIGN_START);
		_tmp33_ = self->priv->compact_unread_dot;
		gtk_widget_set_visible ((GtkWidget*) _tmp33_, FALSE);
		_tmp34_ = self->priv->avatar_overlay;
		_tmp35_ = self->priv->compact_unread_dot;
		gtk_overlay_add_overlay (_tmp34_, (GtkWidget*) _tmp35_);
	} else {
		if (self->priv->has_unread) {
			gchar* _tmp36_ = NULL;
			gchar* txt = NULL;
			gchar* _tmp39_;
			const gchar* _tmp40_;
			GtkLabel* _tmp41_;
			const gchar* _tmp42_ = NULL;
			GtkLabel* _tmp43_;
			GtkLabel* _tmp44_;
			GtkLabel* _tmp45_;
			GtkLabel* _tmp46_;
			GtkOverlay* _tmp47_;
			GtkLabel* _tmp48_;
			if (self->priv->unread_count > 99) {
				gchar* _tmp37_;
				_tmp37_ = g_strdup ("99+");
				_g_free0 (_tmp36_);
				_tmp36_ = _tmp37_;
			} else {
				gchar* _tmp38_;
				_tmp38_ = g_strdup_printf ("%i", self->priv->unread_count);
				_g_free0 (_tmp36_);
				_tmp36_ = _tmp38_;
			}
			_tmp39_ = _tmp36_;
			_tmp36_ = NULL;
			txt = _tmp39_;
			_tmp40_ = txt;
			_tmp41_ = (GtkLabel*) gtk_label_new (_tmp40_);
			g_object_ref_sink (_tmp41_);
			_g_object_unref0 (self->priv->compact_unread_count);
			self->priv->compact_unread_count = _tmp41_;
			if (self->priv->is_muted) {
				_tmp42_ = "compact-unread-badge-muted";
			} else {
				_tmp42_ = "compact-unread-badge";
			}
			_tmp43_ = self->priv->compact_unread_count;
			gtk_widget_add_css_class ((GtkWidget*) _tmp43_, _tmp42_);
			_tmp44_ = self->priv->compact_unread_count;
			gtk_widget_set_halign ((GtkWidget*) _tmp44_, GTK_ALIGN_END);
			_tmp45_ = self->priv->compact_unread_count;
			gtk_widget_set_valign ((GtkWidget*) _tmp45_, GTK_ALIGN_START);
			_tmp46_ = self->priv->compact_unread_count;
			gtk_widget_set_visible ((GtkWidget*) _tmp46_, FALSE);
			_tmp47_ = self->priv->avatar_overlay;
			_tmp48_ = self->priv->compact_unread_count;
			gtk_overlay_add_overlay (_tmp47_, (GtkWidget*) _tmp48_);
			_g_free0 (txt);
			_g_free0 (_tmp36_);
		}
	}
	if (self->priv->is_pinned) {
		GtkImage* _tmp49_;
		GtkImage* _tmp50_;
		GtkImage* _tmp51_;
		GtkImage* _tmp52_;
		GtkImage* _tmp53_;
		GtkImage* _tmp54_;
		GtkOverlay* _tmp55_;
		GtkImage* _tmp56_;
		_tmp49_ = (GtkImage*) gtk_image_new_from_icon_name ("view-pin-symbolic");
		g_object_ref_sink (_tmp49_);
		_g_object_unref0 (self->priv->compact_pin_icon);
		self->priv->compact_pin_icon = _tmp49_;
		_tmp50_ = self->priv->compact_pin_icon;
		gtk_image_set_pixel_size (_tmp50_, 12);
		_tmp51_ = self->priv->compact_pin_icon;
		gtk_widget_add_css_class ((GtkWidget*) _tmp51_, "compact-pin-marker");
		_tmp52_ = self->priv->compact_pin_icon;
		gtk_widget_set_halign ((GtkWidget*) _tmp52_, GTK_ALIGN_END);
		_tmp53_ = self->priv->compact_pin_icon;
		gtk_widget_set_valign ((GtkWidget*) _tmp53_, GTK_ALIGN_END);
		_tmp54_ = self->priv->compact_pin_icon;
		gtk_widget_set_visible ((GtkWidget*) _tmp54_, FALSE);
		_tmp55_ = self->priv->avatar_overlay;
		_tmp56_ = self->priv->compact_pin_icon;
		gtk_overlay_add_overlay (_tmp55_, (GtkWidget*) _tmp56_);
	}
	_tmp57_ = self->priv->avatar_overlay;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp57_);
	_tmp58_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	g_object_ref_sink (_tmp58_);
	_g_object_unref0 (self->priv->mid_box);
	self->priv->mid_box = _tmp58_;
	_tmp59_ = self->priv->mid_box;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp59_, TRUE);
	_tmp60_ = self->priv->mid_box;
	gtk_widget_set_valign ((GtkWidget*) _tmp60_, GTK_ALIGN_CENTER);
	_tmp61_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp61_);
	top = _tmp61_;
	if (self->priv->has_unread) {
		GtkLabel* dot = NULL;
		GtkLabel* _tmp62_;
		const gchar* _tmp63_ = NULL;
		GtkLabel* _tmp64_;
		GtkBox* _tmp65_;
		GtkLabel* _tmp66_;
		_tmp62_ = (GtkLabel*) gtk_label_new ("●");
		g_object_ref_sink (_tmp62_);
		dot = _tmp62_;
		if (self->priv->is_muted) {
			_tmp63_ = "unread-dot-muted";
		} else {
			_tmp63_ = "unread-dot";
		}
		_tmp64_ = dot;
		gtk_widget_add_css_class ((GtkWidget*) _tmp64_, _tmp63_);
		_tmp65_ = top;
		_tmp66_ = dot;
		gtk_box_append (_tmp65_, (GtkWidget*) _tmp66_);
		_g_object_unref0 (dot);
	}
	if (self->priv->has_mention) {
		GtkLabel* at = NULL;
		GtkLabel* _tmp67_;
		GtkLabel* _tmp68_;
		GtkLabel* _tmp69_;
		GtkBox* _tmp70_;
		GtkLabel* _tmp71_;
		_tmp67_ = (GtkLabel*) gtk_label_new ("@");
		g_object_ref_sink (_tmp67_);
		at = _tmp67_;
		_tmp68_ = at;
		gtk_widget_add_css_class ((GtkWidget*) _tmp68_, "mention-marker");
		_tmp69_ = at;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp69_, "You were mentioned");
		_tmp70_ = top;
		_tmp71_ = at;
		gtk_box_append (_tmp70_, (GtkWidget*) _tmp71_);
		_g_object_unref0 (at);
	}
	_tmp72_ = dc_chat_entry_get_name (entry);
	_tmp73_ = _tmp72_;
	_tmp74_ = (GtkLabel*) gtk_label_new (_tmp73_);
	g_object_ref_sink (_tmp74_);
	name_label = _tmp74_;
	_tmp75_ = name_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp75_, "heading");
	if (self->priv->has_unread) {
		GtkLabel* _tmp76_;
		_tmp76_ = name_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp76_, "unread-name");
	}
	_tmp77_ = name_label;
	gtk_label_set_ellipsize (_tmp77_, PANGO_ELLIPSIZE_END);
	_tmp78_ = name_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp78_, TRUE);
	_tmp79_ = name_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp79_, GTK_ALIGN_START);
	_tmp80_ = name_label;
	gtk_label_set_xalign (_tmp80_, (gfloat) 0);
	_tmp81_ = top;
	_tmp82_ = name_label;
	gtk_box_append (_tmp81_, (GtkWidget*) _tmp82_);
	if (self->priv->is_muted) {
		GtkImage* mute_icon = NULL;
		GtkImage* _tmp83_;
		GtkImage* _tmp84_;
		GtkImage* _tmp85_;
		GtkImage* _tmp86_;
		GtkBox* _tmp87_;
		GtkImage* _tmp88_;
		_tmp83_ = (GtkImage*) gtk_image_new_from_icon_name ("notifications-disabled-symbolic");
		g_object_ref_sink (_tmp83_);
		mute_icon = _tmp83_;
		_tmp84_ = mute_icon;
		gtk_image_set_pixel_size (_tmp84_, 12);
		_tmp85_ = mute_icon;
		gtk_widget_add_css_class ((GtkWidget*) _tmp85_, "dim-label");
		_tmp86_ = mute_icon;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp86_, "Notifications muted");
		_tmp87_ = top;
		_tmp88_ = mute_icon;
		gtk_box_append (_tmp87_, (GtkWidget*) _tmp88_);
		_g_object_unref0 (mute_icon);
	}
	if (self->priv->is_pinned) {
		GtkLabel* pin_label = NULL;
		GtkLabel* _tmp89_;
		GtkLabel* _tmp90_;
		GtkLabel* _tmp91_;
		GtkBox* _tmp92_;
		GtkLabel* _tmp93_;
		_tmp89_ = (GtkLabel*) gtk_label_new ("📌");
		g_object_ref_sink (_tmp89_);
		pin_label = _tmp89_;
		_tmp90_ = pin_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp90_, "dim-label");
		_tmp91_ = pin_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp91_, "caption");
		_tmp92_ = top;
		_tmp93_ = pin_label;
		gtk_box_append (_tmp92_, (GtkWidget*) _tmp93_);
		_g_object_unref0 (pin_label);
	}
	_tmp94_ = dc_chat_entry_get_timestamp (entry);
	_tmp95_ = _tmp94_;
	_tmp96_ = dc_chat_row_format_time (_tmp95_);
	_tmp97_ = _tmp96_;
	_tmp98_ = (GtkLabel*) gtk_label_new (_tmp97_);
	g_object_ref_sink (_tmp98_);
	_tmp99_ = _tmp98_;
	_g_free0 (_tmp97_);
	time_label = _tmp99_;
	_tmp100_ = time_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp100_, "dim-label");
	_tmp101_ = time_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp101_, "caption");
	_tmp102_ = top;
	_tmp103_ = time_label;
	gtk_box_append (_tmp102_, (GtkWidget*) _tmp103_);
	_tmp104_ = self->priv->mid_box;
	_tmp105_ = top;
	gtk_box_append (_tmp104_, (GtkWidget*) _tmp105_);
	_tmp106_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp106_);
	bot = _tmp106_;
	_tmp107_ = dc_chat_row_format_preview (entry);
	_tmp108_ = _tmp107_;
	_tmp109_ = dc_message_row_spread_adjacent_emoji (_tmp108_);
	_tmp110_ = _tmp109_;
	_tmp111_ = (GtkLabel*) gtk_label_new (_tmp110_);
	g_object_ref_sink (_tmp111_);
	_tmp112_ = _tmp111_;
	_g_free0 (_tmp110_);
	_g_free0 (_tmp108_);
	preview_label = _tmp112_;
	if (!self->priv->has_unread) {
		GtkLabel* _tmp113_;
		_tmp113_ = preview_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp113_, "dim-label");
	}
	_tmp114_ = preview_label;
	gtk_label_set_ellipsize (_tmp114_, PANGO_ELLIPSIZE_END);
	_tmp115_ = preview_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp115_, TRUE);
	_tmp116_ = preview_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp116_, GTK_ALIGN_START);
	_tmp117_ = preview_label;
	gtk_label_set_xalign (_tmp117_, (gfloat) 0);
	_tmp118_ = preview_label;
	gtk_label_set_max_width_chars (_tmp118_, 30);
	_tmp119_ = bot;
	_tmp120_ = preview_label;
	gtk_box_append (_tmp119_, (GtkWidget*) _tmp120_);
	if (self->priv->is_request) {
		GtkLabel* _tmp121_;
		GtkLabel* _tmp122_;
		GtkLabel* _tmp123_;
		GtkLabel* _tmp124_;
		GtkBox* _tmp125_;
		GtkLabel* _tmp126_;
		_tmp121_ = (GtkLabel*) gtk_label_new ("Request");
		g_object_ref_sink (_tmp121_);
		_g_object_unref0 (self->priv->badge_label);
		self->priv->badge_label = _tmp121_;
		_tmp122_ = self->priv->badge_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp122_, "contact-request-badge");
		_tmp123_ = self->priv->badge_label;
		gtk_widget_set_halign ((GtkWidget*) _tmp123_, GTK_ALIGN_END);
		_tmp124_ = self->priv->badge_label;
		gtk_widget_set_valign ((GtkWidget*) _tmp124_, GTK_ALIGN_CENTER);
		_tmp125_ = bot;
		_tmp126_ = self->priv->badge_label;
		gtk_box_append (_tmp125_, (GtkWidget*) _tmp126_);
	} else {
		if (self->priv->has_unread) {
			gchar* _tmp127_;
			gchar* _tmp128_;
			GtkLabel* _tmp129_;
			const gchar* _tmp130_ = NULL;
			GtkLabel* _tmp131_;
			GtkLabel* _tmp132_;
			GtkLabel* _tmp133_;
			GtkBox* _tmp134_;
			GtkLabel* _tmp135_;
			_tmp127_ = g_strdup_printf ("%i", self->priv->unread_count);
			_tmp128_ = _tmp127_;
			_tmp129_ = (GtkLabel*) gtk_label_new (_tmp128_);
			g_object_ref_sink (_tmp129_);
			_g_object_unref0 (self->priv->badge_label);
			self->priv->badge_label = _tmp129_;
			_g_free0 (_tmp128_);
			if (self->priv->is_muted) {
				_tmp130_ = "unread-badge-muted";
			} else {
				_tmp130_ = "unread-badge";
			}
			_tmp131_ = self->priv->badge_label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp131_, _tmp130_);
			_tmp132_ = self->priv->badge_label;
			gtk_widget_set_halign ((GtkWidget*) _tmp132_, GTK_ALIGN_END);
			_tmp133_ = self->priv->badge_label;
			gtk_widget_set_valign ((GtkWidget*) _tmp133_, GTK_ALIGN_CENTER);
			_tmp134_ = bot;
			_tmp135_ = self->priv->badge_label;
			gtk_box_append (_tmp134_, (GtkWidget*) _tmp135_);
		}
	}
	_tmp136_ = self->priv->mid_box;
	_tmp137_ = bot;
	gtk_box_append (_tmp136_, (GtkWidget*) _tmp137_);
	_tmp138_ = self->priv->mid_box;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp138_);
	_tmp139_ = dc_file_drop_target_new ((GtkWidget*) self, "chat-drop-active");
	_g_object_unref0 (self->priv->file_drop_target);
	self->priv->file_drop_target = _tmp139_;
	_tmp140_ = self->priv->file_drop_target;
	g_signal_connect_object (_tmp140_, "accept", (GCallback) ___lambda92__dc_file_drop_target_accept, self, 0);
	_tmp141_ = self->priv->file_drop_target;
	g_signal_connect_object (_tmp141_, "dropped", (GCallback) ___lambda93__dc_file_drop_target_dropped, self, 0);
	_tmp142_ = self->priv->file_drop_target;
	g_signal_connect_object (_tmp142_, "failed", (GCallback) ___lambda94__dc_file_drop_target_failed, self, 0);
	_g_object_unref0 (preview_label);
	_g_object_unref0 (bot);
	_g_object_unref0 (time_label);
	_g_object_unref0 (name_label);
	_g_object_unref0 (top);
	_g_object_unref0 (avatar);
	return self;
}

DcChatRow*
dc_chat_row_new (DcChatEntry* entry)
{
	return dc_chat_row_construct (DC_TYPE_CHAT_ROW, entry);
}

void
dc_chat_row_set_compact (DcChatRow* self,
                         gboolean compact)
{
	GtkBox* _tmp0_;
	GtkOverlay* _tmp1_;
	GtkLabel* _tmp2_;
	GtkLabel* _tmp4_;
	GtkImage* _tmp6_;
	g_return_if_fail (self != NULL);
	if (self->priv->compact == compact) {
		return;
	}
	self->priv->compact = compact;
	_tmp0_ = self->priv->mid_box;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, !compact);
	_tmp1_ = self->priv->avatar_overlay;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, compact);
	if (compact) {
		gtk_widget_set_margin_start ((GtkWidget*) self, 0);
		gtk_widget_set_margin_end ((GtkWidget*) self, 0);
		gtk_widget_set_margin_top ((GtkWidget*) self, 2);
		gtk_widget_set_margin_bottom ((GtkWidget*) self, 2);
		gtk_widget_add_css_class ((GtkWidget*) self, "chat-row-compact");
	} else {
		gtk_widget_set_margin_start ((GtkWidget*) self, 8);
		gtk_widget_set_margin_end ((GtkWidget*) self, 8);
		gtk_widget_set_margin_top ((GtkWidget*) self, 4);
		gtk_widget_set_margin_bottom ((GtkWidget*) self, 4);
		gtk_widget_remove_css_class ((GtkWidget*) self, "chat-row-compact");
	}
	_tmp2_ = self->priv->compact_unread_dot;
	if (_tmp2_ != NULL) {
		GtkLabel* _tmp3_;
		_tmp3_ = self->priv->compact_unread_dot;
		gtk_widget_set_visible ((GtkWidget*) _tmp3_, compact);
	}
	_tmp4_ = self->priv->compact_unread_count;
	if (_tmp4_ != NULL) {
		GtkLabel* _tmp5_;
		_tmp5_ = self->priv->compact_unread_count;
		gtk_widget_set_visible ((GtkWidget*) _tmp5_, compact);
	}
	_tmp6_ = self->priv->compact_pin_icon;
	if (_tmp6_ != NULL) {
		GtkImage* _tmp7_;
		_tmp7_ = self->priv->compact_pin_icon;
		gtk_widget_set_visible ((GtkWidget*) _tmp7_, compact);
	}
}

static gchar*
dc_chat_row_format_preview (DcChatEntry* entry)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* preview = NULL;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* result;
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp1_ = dc_chat_entry_get_last_message (entry);
	_tmp2_ = _tmp1_;
	_tmp0_ = _tmp2_;
	if (_tmp0_ == NULL) {
		_tmp0_ = "";
	}
	_tmp3_ = dc_markdown_single_line_preview (_tmp0_, 0);
	preview = _tmp3_;
	_tmp5_ = dc_chat_entry_get_summary_prefix (entry);
	_tmp6_ = _tmp5_;
	if (_tmp6_ != NULL) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp7_ = dc_chat_entry_get_summary_prefix (entry);
		_tmp8_ = _tmp7_;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp4_ = _tmp10_ > 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		const gchar* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		gchar* _tmp20_;
		_tmp11_ = preview;
		_tmp12_ = strlen (_tmp11_);
		_tmp13_ = _tmp12_;
		if (_tmp13_ > 0) {
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			_tmp14_ = dc_chat_entry_get_summary_prefix (entry);
			_tmp15_ = _tmp14_;
			_tmp16_ = preview;
			_tmp17_ = g_strdup_printf ("%s: %s", _tmp15_, _tmp16_);
			result = _tmp17_;
			_g_free0 (preview);
			return result;
		}
		_tmp18_ = dc_chat_entry_get_summary_prefix (entry);
		_tmp19_ = _tmp18_;
		_tmp20_ = g_strdup (_tmp19_);
		result = _tmp20_;
		_g_free0 (preview);
		return result;
	}
	result = preview;
	return result;
}

static gchar*
dc_chat_row_format_time (gint64 timestamp)
{
	GDateTime* now = NULL;
	GDateTime* _tmp1_;
	GDateTime* dt = NULL;
	GDateTime* _tmp2_;
	gboolean _tmp3_ = FALSE;
	GDateTime* _tmp4_;
	GDateTime* _tmp5_;
	gint diff = 0;
	GDateTime* _tmp10_;
	GDateTime* _tmp11_;
	GDateTime* _tmp14_;
	gchar* _tmp15_;
	gchar* result;
	if (timestamp <= ((gint64) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("");
		result = _tmp0_;
		return result;
	}
	_tmp1_ = g_date_time_new_now_local ();
	now = _tmp1_;
	_tmp2_ = g_date_time_new_from_unix_local (timestamp);
	dt = _tmp2_;
	_tmp4_ = now;
	_tmp5_ = dt;
	if (g_date_time_get_year (_tmp4_) == g_date_time_get_year (_tmp5_)) {
		GDateTime* _tmp6_;
		GDateTime* _tmp7_;
		_tmp6_ = now;
		_tmp7_ = dt;
		_tmp3_ = g_date_time_get_day_of_year (_tmp6_) == g_date_time_get_day_of_year (_tmp7_);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		GDateTime* _tmp8_;
		gchar* _tmp9_;
		_tmp8_ = dt;
		_tmp9_ = g_date_time_format (_tmp8_, "%H:%M");
		result = _tmp9_;
		_g_date_time_unref0 (dt);
		_g_date_time_unref0 (now);
		return result;
	}
	_tmp10_ = now;
	_tmp11_ = dt;
	diff = (gint) (g_date_time_to_unix (_tmp10_) - g_date_time_to_unix (_tmp11_));
	if (diff < (7 * 86400)) {
		GDateTime* _tmp12_;
		gchar* _tmp13_;
		_tmp12_ = dt;
		_tmp13_ = g_date_time_format (_tmp12_, "%a");
		result = _tmp13_;
		_g_date_time_unref0 (dt);
		_g_date_time_unref0 (now);
		return result;
	}
	_tmp14_ = dt;
	_tmp15_ = g_date_time_format (_tmp14_, "%d/%m/%y");
	result = _tmp15_;
	_g_date_time_unref0 (dt);
	_g_date_time_unref0 (now);
	return result;
}

gint
dc_chat_row_get_chat_id (DcChatRow* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_chat_id;
	return result;
}

static void
dc_chat_row_set_chat_id (DcChatRow* self,
                         gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = dc_chat_row_get_chat_id (self);
	if (old_value != value) {
		self->priv->_chat_id = value;
		g_object_notify_by_pspec ((GObject *) self, dc_chat_row_properties[DC_CHAT_ROW_CHAT_ID_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_BOOLEAN__VOID (GClosure * closure,
                                       GValue * return_value,
                                       guint n_param_values,
                                       const GValue * param_values,
                                       gpointer invocation_hint,
                                       gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, gpointer data2);
	register GMarshalFunc_BOOLEAN__VOID callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 1);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__VOID) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, data2);
	g_value_set_boolean (return_value, v_return);
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer data1, const char* arg_1, const char* arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), data2);
}

static void
dc_chat_row_class_init (DcChatRowClass * klass,
                        gpointer klass_data)
{
	dc_chat_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcChatRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dc_chat_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dc_chat_row_set_property;
	G_OBJECT_CLASS (klass)->finalize = dc_chat_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DC_CHAT_ROW_CHAT_ID_PROPERTY, dc_chat_row_properties[DC_CHAT_ROW_CHAT_ID_PROPERTY] = g_param_spec_int ("chat-id", "chat-id", "chat-id", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	dc_chat_row_signals[DC_CHAT_ROW_ACCEPT_FILE_DROP_SIGNAL] = g_signal_new ("accept-file-drop", DC_TYPE_CHAT_ROW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0);
	dc_chat_row_signals[DC_CHAT_ROW_FILE_DROPPED_SIGNAL] = g_signal_new ("file-dropped", DC_TYPE_CHAT_ROW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
	dc_chat_row_signals[DC_CHAT_ROW_FILE_DROP_FAILED_SIGNAL] = g_signal_new ("file-drop-failed", DC_TYPE_CHAT_ROW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
dc_chat_row_instance_init (DcChatRow * self,
                           gpointer klass)
{
	self->priv = dc_chat_row_get_instance_private (self);
	self->priv->badge_label = NULL;
	self->priv->compact_unread_dot = NULL;
	self->priv->compact_unread_count = NULL;
	self->priv->compact_pin_icon = NULL;
	self->priv->compact = FALSE;
}

static void
dc_chat_row_finalize (GObject * obj)
{
	DcChatRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_CHAT_ROW, DcChatRow);
	_g_object_unref0 (self->priv->mid_box);
	_g_object_unref0 (self->priv->avatar_overlay);
	_g_object_unref0 (self->priv->badge_label);
	_g_object_unref0 (self->priv->compact_unread_dot);
	_g_object_unref0 (self->priv->compact_unread_count);
	_g_object_unref0 (self->priv->compact_pin_icon);
	_g_object_unref0 (self->priv->file_drop_target);
	G_OBJECT_CLASS (dc_chat_row_parent_class)->finalize (obj);
}

/**
     * A single row in the chat list sidebar.
     * Shows avatar placeholder, chat name, last message preview, time, and unread badge.
     * Can switch between full and compact (avatar-only) presentations.
     */
static GType
dc_chat_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcChatRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_chat_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcChatRow), 0, (GInstanceInitFunc) dc_chat_row_instance_init, NULL };
	GType dc_chat_row_type_id;
	dc_chat_row_type_id = g_type_register_static (gtk_box_get_type (), "DcChatRow", &g_define_type_info, 0);
	DcChatRow_private_offset = g_type_add_instance_private (dc_chat_row_type_id, sizeof (DcChatRowPrivate));
	return dc_chat_row_type_id;
}

GType
dc_chat_row_get_type (void)
{
	static volatile gsize dc_chat_row_type_id__once = 0;
	if (g_once_init_enter (&dc_chat_row_type_id__once)) {
		GType dc_chat_row_type_id;
		dc_chat_row_type_id = dc_chat_row_get_type_once ();
		g_once_init_leave (&dc_chat_row_type_id__once, dc_chat_row_type_id);
	}
	return dc_chat_row_type_id__once;
}

static void
_vala_dc_chat_row_get_property (GObject * object,
                                guint property_id,
                                GValue * value,
                                GParamSpec * pspec)
{
	DcChatRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_CHAT_ROW, DcChatRow);
	switch (property_id) {
		case DC_CHAT_ROW_CHAT_ID_PROPERTY:
		g_value_set_int (value, dc_chat_row_get_chat_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dc_chat_row_set_property (GObject * object,
                                guint property_id,
                                const GValue * value,
                                GParamSpec * pspec)
{
	DcChatRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DC_TYPE_CHAT_ROW, DcChatRow);
	switch (property_id) {
		case DC_CHAT_ROW_CHAT_ID_PROPERTY:
		dc_chat_row_set_chat_id (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
dc_chat_context_menu_get_instance_private (DcChatContextMenu* self)
{
	return G_STRUCT_MEMBER_P (self, DcChatContextMenu_private_offset);
}

DcChatContextMenu*
dc_chat_context_menu_construct (GType object_type,
                                DcWindow* window,
                                DcRpcClient* rpc,
                                GListStore* chat_store)
{
	DcChatContextMenu * self = NULL;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	g_return_val_if_fail (chat_store != NULL, NULL);
	self = (DcChatContextMenu*) g_object_new (object_type, NULL);
	self->priv->window = window;
	self->priv->rpc = rpc;
	self->priv->chat_store = chat_store;
	return self;
}

DcChatContextMenu*
dc_chat_context_menu_new (DcWindow* window,
                          DcRpcClient* rpc,
                          GListStore* chat_store)
{
	return dc_chat_context_menu_construct (DC_TYPE_CHAT_CONTEXT_MENU, window, rpc, chat_store);
}

static Block15Data*
block15_data_ref (Block15Data* _data15_)
{
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}

static void
block15_data_unref (void * _userdata_)
{
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		DcChatContextMenu* self;
		self = _data15_->self;
		_g_object_unref0 (self);
		g_slice_free (Block15Data, _data15_);
	}
}

static void
___lambda197_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_toggle_pin (self, _data15_->chat_id, _data15_->is_pinned, NULL, NULL);
}

static void
____lambda197__dc_popover_button_selected (DcPopoverButton* _sender,
                                           gpointer self)
{
	___lambda197_ (self);
}

static void
__lambda198_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_toggle_archive (self, _data15_->chat_id, _data15_->is_archived, NULL, NULL);
}

static void
___lambda198__dc_popover_button_selected (DcPopoverButton* _sender,
                                          gpointer self)
{
	__lambda198_ (self);
}

static void
___lambda200_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_set_mute_state (self, _data15_->chat_id, !_data15_->is_muted, NULL, NULL, NULL);
}

static void
____lambda200__dc_popover_button_selected (DcPopoverButton* _sender,
                                           gpointer self)
{
	___lambda200_ (self);
}

static void
__lambda201_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_set_unread_state (self, _data15_->chat_id, !_data15_->has_unread, NULL, NULL);
}

static void
___lambda201__dc_popover_button_selected (DcPopoverButton* _sender,
                                          gpointer self)
{
	__lambda201_ (self);
}

static void
__lambda202_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_show_media (self, _data15_->chat_id);
}

static void
___lambda202__dc_popover_button_selected (DcPopoverButton* _sender,
                                          gpointer self)
{
	__lambda202_ (self);
}

static void
__lambda251_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_show_info (self, _data15_->chat_id);
}

static void
___lambda251__dc_popover_button_selected (DcPopoverButton* _sender,
                                          gpointer self)
{
	__lambda251_ (self);
}

static void
__lambda287_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_confirm_clear_history (self, _data15_->chat_id, NULL, NULL);
}

static void
___lambda287__dc_popover_button_selected (DcPopoverButton* _sender,
                                          gpointer self)
{
	__lambda287_ (self);
}

static void
___lambda288_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_confirm_leave (self, _data15_->chat_id, NULL, NULL);
}

static void
____lambda288__dc_popover_button_selected (DcPopoverButton* _sender,
                                           gpointer self)
{
	___lambda288_ (self);
}

static void
__lambda289_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_confirm_delete (self, _data15_->chat_id, NULL, NULL);
}

static void
___lambda289__dc_popover_button_selected (DcPopoverButton* _sender,
                                          gpointer self)
{
	__lambda289_ (self);
}

void
dc_chat_context_menu_show (DcChatContextMenu* self,
                           gint chat_id,
                           gdouble x,
                           gdouble y,
                           GtkWidget* parent)
{
	Block15Data* _data15_;
	DcChatEntry* entry = NULL;
	GListStore* _tmp0_;
	DcChatEntry* _tmp1_;
	DcChatEntry* _tmp2_;
	GtkPopover* popover = NULL;
	GtkPopover* _tmp15_;
	GtkPopover* _tmp16_;
	GtkPopover* _tmp17_;
	GtkPopover* _tmp18_;
	GdkRectangle _tmp19_ = {0};
	GtkBox* box = NULL;
	GtkBox* _tmp20_;
	GtkBox* _tmp21_;
	const gchar* _tmp27_ = NULL;
	GtkBox* _tmp28_;
	GtkPopover* _tmp29_;
	DcPopoverButton* _tmp30_;
	DcPopoverButton* _tmp31_;
	const gchar* _tmp37_ = NULL;
	gboolean _tmp38_ = FALSE;
	GtkBox* _tmp42_;
	GtkPopover* _tmp43_;
	DcPopoverButton* _tmp44_;
	DcPopoverButton* _tmp45_;
	GtkBox* _tmp46_;
	GtkPopover* _tmp47_;
	DcPopoverButton* _tmp48_;
	DcPopoverButton* _tmp49_;
	GtkBox* _tmp50_;
	GtkPopover* _tmp51_;
	DcPopoverButton* _tmp52_;
	DcPopoverButton* _tmp53_;
	GtkBox* _tmp54_;
	GtkSeparator* _tmp55_;
	GtkSeparator* _tmp56_;
	GtkBox* _tmp57_;
	GtkPopover* _tmp58_;
	DcPopoverButton* _tmp59_;
	DcPopoverButton* _tmp60_;
	gboolean _tmp61_ = FALSE;
	DcChatEntry* _tmp62_;
	GtkBox* _tmp70_;
	GtkPopover* _tmp71_;
	DcPopoverButton* _tmp72_;
	DcPopoverButton* _tmp73_;
	GtkPopover* _tmp74_;
	GtkBox* _tmp75_;
	GtkPopover* _tmp76_;
	GtkPopover* _tmp77_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	_data15_ = g_slice_new0 (Block15Data);
	_data15_->_ref_count_ = 1;
	_data15_->self = g_object_ref (self);
	_data15_->chat_id = chat_id;
	_data15_->is_pinned = FALSE;
	_data15_->is_archived = FALSE;
	_data15_->is_muted = FALSE;
	_data15_->has_unread = FALSE;
	_tmp0_ = self->priv->chat_store;
	_tmp1_ = dc_find_chat_entry (_tmp0_, _data15_->chat_id);
	entry = _tmp1_;
	_tmp2_ = entry;
	if (_tmp2_ != NULL) {
		DcChatEntry* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		DcChatEntry* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		DcChatEntry* _tmp9_;
		gboolean _tmp10_;
		gboolean _tmp11_;
		DcChatEntry* _tmp12_;
		gint _tmp13_;
		gint _tmp14_;
		_tmp3_ = entry;
		_tmp4_ = dc_chat_entry_get_is_pinned (_tmp3_);
		_tmp5_ = _tmp4_;
		_data15_->is_pinned = _tmp5_;
		_tmp6_ = entry;
		_tmp7_ = dc_chat_entry_get_is_archived (_tmp6_);
		_tmp8_ = _tmp7_;
		_data15_->is_archived = _tmp8_;
		_tmp9_ = entry;
		_tmp10_ = dc_chat_entry_get_is_muted (_tmp9_);
		_tmp11_ = _tmp10_;
		_data15_->is_muted = _tmp11_;
		_tmp12_ = entry;
		_tmp13_ = dc_chat_entry_get_unread_count (_tmp12_);
		_tmp14_ = _tmp13_;
		_data15_->has_unread = _tmp14_ > 0;
	}
	_tmp15_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp15_);
	popover = _tmp15_;
	_tmp16_ = popover;
	gtk_popover_set_has_arrow (_tmp16_, FALSE);
	_tmp17_ = popover;
	gtk_widget_set_parent ((GtkWidget*) _tmp17_, parent);
	_tmp18_ = popover;
	_tmp19_.x = (gint) x;
	_tmp19_.y = (gint) y;
	_tmp19_.width = 1;
	_tmp19_.height = 1;
	gtk_popover_set_pointing_to (_tmp18_, &_tmp19_);
	_tmp20_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp20_);
	box = _tmp20_;
	_tmp21_ = box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp21_, "menu");
	if (!_data15_->is_archived) {
		const gchar* _tmp22_ = NULL;
		GtkBox* _tmp23_;
		GtkPopover* _tmp24_;
		DcPopoverButton* _tmp25_;
		DcPopoverButton* _tmp26_;
		if (_data15_->is_pinned) {
			_tmp22_ = "Unpin";
		} else {
			_tmp22_ = "Pin";
		}
		_tmp23_ = box;
		_tmp24_ = popover;
		_tmp25_ = dc_chat_context_menu_append_menu_button (_tmp23_, _tmp24_, _tmp22_, FALSE, TRUE);
		_tmp26_ = _tmp25_;
		g_signal_connect_data (_tmp26_, "selected", (GCallback) ____lambda197__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
		_g_object_unref0 (_tmp26_);
	}
	if (_data15_->is_archived) {
		_tmp27_ = "Unarchive";
	} else {
		_tmp27_ = "Archive";
	}
	_tmp28_ = box;
	_tmp29_ = popover;
	_tmp30_ = dc_chat_context_menu_append_menu_button (_tmp28_, _tmp29_, _tmp27_, FALSE, TRUE);
	_tmp31_ = _tmp30_;
	g_signal_connect_data (_tmp31_, "selected", (GCallback) ___lambda198__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_g_object_unref0 (_tmp31_);
	if (_data15_->is_archived) {
		const gchar* _tmp32_ = NULL;
		GtkBox* _tmp33_;
		GtkPopover* _tmp34_;
		DcPopoverButton* _tmp35_;
		DcPopoverButton* _tmp36_;
		if (_data15_->is_muted) {
			_tmp32_ = "Unmute";
		} else {
			_tmp32_ = "Mute";
		}
		_tmp33_ = box;
		_tmp34_ = popover;
		_tmp35_ = dc_chat_context_menu_append_menu_button (_tmp33_, _tmp34_, _tmp32_, FALSE, TRUE);
		_tmp36_ = _tmp35_;
		g_signal_connect_data (_tmp36_, "selected", (GCallback) ____lambda200__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
		_g_object_unref0 (_tmp36_);
	}
	if (_data15_->has_unread) {
		_tmp37_ = "Mark as read";
	} else {
		_tmp37_ = "Mark as unread";
	}
	if (_data15_->has_unread) {
		_tmp38_ = TRUE;
	} else {
		DcWindow* _tmp39_;
		gint _tmp40_;
		gint _tmp41_;
		_tmp39_ = self->priv->window;
		_tmp40_ = dc_window_get_current_chat_id (_tmp39_);
		_tmp41_ = _tmp40_;
		_tmp38_ = _data15_->chat_id != _tmp41_;
	}
	_tmp42_ = box;
	_tmp43_ = popover;
	_tmp44_ = dc_chat_context_menu_append_menu_button (_tmp42_, _tmp43_, _tmp37_, FALSE, _tmp38_);
	_tmp45_ = _tmp44_;
	g_signal_connect_data (_tmp45_, "selected", (GCallback) ___lambda201__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_g_object_unref0 (_tmp45_);
	_tmp46_ = box;
	_tmp47_ = popover;
	_tmp48_ = dc_chat_context_menu_append_menu_button (_tmp46_, _tmp47_, "View Media", FALSE, TRUE);
	_tmp49_ = _tmp48_;
	g_signal_connect_data (_tmp49_, "selected", (GCallback) ___lambda202__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_g_object_unref0 (_tmp49_);
	_tmp50_ = box;
	_tmp51_ = popover;
	_tmp52_ = dc_chat_context_menu_append_menu_button (_tmp50_, _tmp51_, "Details…", FALSE, TRUE);
	_tmp53_ = _tmp52_;
	g_signal_connect_data (_tmp53_, "selected", (GCallback) ___lambda251__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_g_object_unref0 (_tmp53_);
	_tmp54_ = box;
	_tmp55_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp55_);
	_tmp56_ = _tmp55_;
	gtk_box_append (_tmp54_, (GtkWidget*) _tmp56_);
	_g_object_unref0 (_tmp56_);
	_tmp57_ = box;
	_tmp58_ = popover;
	_tmp59_ = dc_chat_context_menu_append_menu_button (_tmp57_, _tmp58_, "Clear Chat…", TRUE, TRUE);
	_tmp60_ = _tmp59_;
	g_signal_connect_data (_tmp60_, "selected", (GCallback) ___lambda287__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_g_object_unref0 (_tmp60_);
	_tmp62_ = entry;
	if (_tmp62_ != NULL) {
		DcChatEntry* _tmp63_;
		DcChatKind _tmp64_;
		DcChatKind _tmp65_;
		_tmp63_ = entry;
		_tmp64_ = dc_chat_entry_get_kind (_tmp63_);
		_tmp65_ = _tmp64_;
		_tmp61_ = _tmp65_ == DC_CHAT_KIND_GROUP;
	} else {
		_tmp61_ = FALSE;
	}
	if (_tmp61_) {
		GtkBox* _tmp66_;
		GtkPopover* _tmp67_;
		DcPopoverButton* _tmp68_;
		DcPopoverButton* _tmp69_;
		_tmp66_ = box;
		_tmp67_ = popover;
		_tmp68_ = dc_chat_context_menu_append_menu_button (_tmp66_, _tmp67_, "Leave…", TRUE, TRUE);
		_tmp69_ = _tmp68_;
		g_signal_connect_data (_tmp69_, "selected", (GCallback) ____lambda288__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
		_g_object_unref0 (_tmp69_);
	}
	_tmp70_ = box;
	_tmp71_ = popover;
	_tmp72_ = dc_chat_context_menu_append_menu_button (_tmp70_, _tmp71_, "Delete…", TRUE, TRUE);
	_tmp73_ = _tmp72_;
	g_signal_connect_data (_tmp73_, "selected", (GCallback) ___lambda289__dc_popover_button_selected, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_g_object_unref0 (_tmp73_);
	_tmp74_ = popover;
	_tmp75_ = box;
	gtk_popover_set_child (_tmp74_, (GtkWidget*) _tmp75_);
	_tmp76_ = popover;
	dc_unparent_on_close (_tmp76_);
	_tmp77_ = popover;
	gtk_popover_popup (_tmp77_);
	_g_object_unref0 (box);
	_g_object_unref0 (popover);
	_g_object_unref0 (entry);
	block15_data_unref (_data15_);
	_data15_ = NULL;
}

static DcPopoverButton*
dc_chat_context_menu_append_menu_button (GtkBox* box,
                                         GtkPopover* popover,
                                         const gchar* label,
                                         gboolean destructive,
                                         gboolean sensitive)
{
	DcPopoverButton* btn = NULL;
	DcPopoverButton* _tmp0_;
	DcPopoverButton* result;
	g_return_val_if_fail (box != NULL, NULL);
	g_return_val_if_fail (popover != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	_tmp0_ = dc_popover_button_new (popover, label, destructive, FALSE);
	g_object_ref_sink (_tmp0_);
	btn = _tmp0_;
	gtk_widget_set_sensitive ((GtkWidget*) btn, sensitive);
	gtk_box_append (box, (GtkWidget*) btn);
	result = btn;
	return result;
}

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

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

static void
dc_chat_context_menu_toggle_pin (DcChatContextMenu* self,
                                 gint chat_id,
                                 gboolean currently_pinned,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcChatContextMenuTogglePinData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuTogglePinData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_toggle_pin_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->currently_pinned = currently_pinned;
	dc_chat_context_menu_toggle_pin_co (_data_);
}

static void
dc_chat_context_menu_toggle_pin_finish (DcChatContextMenu* self,
                                        GAsyncResult* _res_)
{
	DcChatContextMenuTogglePinData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_toggle_pin_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcChatContextMenuTogglePinData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_toggle_pin_co (_data_);
}

static gboolean
dc_chat_context_menu_toggle_pin_co (DcChatContextMenuTogglePinData* _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_->currently_pinned) {
			_data_->_tmp0_ = "Normal";
		} else {
			_data_->_tmp0_ = "Pinned";
		}
		_data_->_tmp1_ = g_strdup (_data_->_tmp0_);
		_data_->visibility = _data_->_tmp1_;
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_set_chat_visibility (_data_->_tmp2_, _data_->chat_id, _data_->visibility, dc_chat_context_menu_toggle_pin_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_set_chat_visibility_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->visibility);
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->self->priv->window;
		_data_->_state_ = 2;
		dc_window_load_chats (_data_->_tmp3_, dc_chat_context_menu_toggle_pin_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_load_chats_finish (_data_->_tmp3_, _data_->_res_);
		_g_free0 (_data_->visibility);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->self->priv->window;
		_data_->_tmp5_ = _data_->e;
		_data_->_tmp6_ = _data_->_tmp5_->message;
		_data_->_tmp7_ = g_strconcat ("Failed to update pin: ", _data_->_tmp6_, NULL);
		_data_->_tmp8_ = _data_->_tmp7_;
		dc_window_show_toast (_data_->_tmp4_, _data_->_tmp8_);
		_g_free0 (_data_->_tmp8_);
		_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_chat_context_menu_toggle_archive_data_free (gpointer _data)
{
	DcChatContextMenuToggleArchiveData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuToggleArchiveData, _data_);
}

static void
dc_chat_context_menu_toggle_archive (DcChatContextMenu* self,
                                     gint chat_id,
                                     gboolean currently_archived,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcChatContextMenuToggleArchiveData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuToggleArchiveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_toggle_archive_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->currently_archived = currently_archived;
	dc_chat_context_menu_toggle_archive_co (_data_);
}

static void
dc_chat_context_menu_toggle_archive_finish (DcChatContextMenu* self,
                                            GAsyncResult* _res_)
{
	DcChatContextMenuToggleArchiveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block16Data*
block16_data_ref (Block16Data* _data16_)
{
	g_atomic_int_inc (&_data16_->_ref_count_);
	return _data16_;
}

static void
block16_data_unref (void * _userdata_)
{
	Block16Data* _data16_;
	_data16_ = (Block16Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
		DcChatContextMenu* self;
		self = _data16_->self;
		_g_object_unref0 (self);
		g_slice_free (Block16Data, _data16_);
	}
}

static void
dc_chat_context_menu_toggle_archive_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcChatContextMenuToggleArchiveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_toggle_archive_co (_data_);
}

static void
_____lambda199_ (Block16Data* _data16_)
{
	DcChatContextMenu* self;
	self = _data16_->self;
	dc_chat_context_menu_set_mute_state (self, _data16_->chat_id, TRUE, "Muted. Chat will stay archived.", NULL, NULL);
}

static void
______lambda199__adw_toast_button_clicked (AdwToast* _sender,
                                           gpointer self)
{
	_____lambda199_ (self);
}

static gboolean
dc_chat_context_menu_toggle_archive_co (DcChatContextMenuToggleArchiveData* _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_->_data16_ = g_slice_new0 (Block16Data);
	_data_->_data16_->_ref_count_ = 1;
	_data_->_data16_->self = g_object_ref (_data_->self);
	_data_->_data16_->chat_id = _data_->chat_id;
	_data_->_data16_->_async_data_ = _data_;
	_data_->_tmp0_ = _data_->self->priv->chat_store;
	_data_->_tmp1_ = dc_find_chat_entry (_data_->_tmp0_, _data_->_data16_->chat_id);
	_data_->entry = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->entry;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->entry;
		_data_->_tmp5_ = dc_chat_entry_get_is_muted (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp2_ = _data_->_tmp6_;
	} else {
		_data_->_tmp2_ = FALSE;
	}
	_data_->already_muted = _data_->_tmp2_;
	{
		if (_data_->currently_archived) {
			_data_->_tmp7_ = "Normal";
		} else {
			_data_->_tmp7_ = "Archived";
		}
		_data_->_tmp8_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_set_chat_visibility (_data_->_tmp8_, _data_->_data16_->chat_id, _data_->_tmp7_, dc_chat_context_menu_toggle_archive_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_set_chat_visibility_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->currently_archived) {
			_data_->_tmp9_ = _data_->self->priv->window;
			dc_window_show_toast (_data_->_tmp9_, "Chat unarchived");
		} else {
			if (_data_->already_muted) {
				_data_->_tmp10_ = _data_->self->priv->window;
				dc_window_show_toast (_data_->_tmp10_, "Chat archived");
			} else {
				_data_->_tmp11_ = _data_->self->priv->window;
				_data_->_tmp12_ = dc_window_show_action_toast (_data_->_tmp11_, "Chat archived. New messages will unarchive it.", "Mute");
				_data_->toast = _data_->_tmp12_;
				_data_->_tmp13_ = _data_->toast;
				g_signal_connect_data (_data_->_tmp13_, "button-clicked", (GCallback) ______lambda199__adw_toast_button_clicked, block16_data_ref (_data_->_data16_), (GClosureNotify) block16_data_unref, 0);
				_g_object_unref0 (_data_->toast);
			}
		}
		_data_->_tmp14_ = _data_->self->priv->window;
		_data_->_state_ = 2;
		dc_window_load_chats (_data_->_tmp14_, dc_chat_context_menu_toggle_archive_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_load_chats_finish (_data_->_tmp14_, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp15_ = _data_->self->priv->window;
		_data_->_tmp16_ = _data_->e;
		_data_->_tmp17_ = _data_->_tmp16_->message;
		_data_->_tmp18_ = g_strconcat ("Failed to update archive: ", _data_->_tmp17_, NULL);
		_data_->_tmp19_ = _data_->_tmp18_;
		dc_window_show_toast (_data_->_tmp15_, _data_->_tmp19_);
		_g_free0 (_data_->_tmp19_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->entry);
		block16_data_unref (_data_->_data16_);
		_data_->_data16_ = 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_object_unref0 (_data_->entry);
	block16_data_unref (_data_->_data16_);
	_data_->_data16_ = 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_chat_context_menu_set_mute_state_data_free (gpointer _data)
{
	DcChatContextMenuSetMuteStateData* _data_;
	_data_ = _data;
	_g_free0 (_data_->done_message);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuSetMuteStateData, _data_);
}

static void
dc_chat_context_menu_set_mute_state (DcChatContextMenu* self,
                                     gint chat_id,
                                     gboolean mute,
                                     const gchar* done_message,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcChatContextMenuSetMuteStateData* _data_;
	DcChatContextMenu* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuSetMuteStateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_set_mute_state_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->mute = mute;
	_tmp1_ = g_strdup (done_message);
	_g_free0 (_data_->done_message);
	_data_->done_message = _tmp1_;
	dc_chat_context_menu_set_mute_state_co (_data_);
}

static void
dc_chat_context_menu_set_mute_state_finish (DcChatContextMenu* self,
                                            GAsyncResult* _res_)
{
	DcChatContextMenuSetMuteStateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_set_mute_state_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcChatContextMenuSetMuteStateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_set_mute_state_co (_data_);
}

static gboolean
dc_chat_context_menu_set_mute_state_co (DcChatContextMenuSetMuteStateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		if (_data_->mute) {
			_data_->_tmp0_ = -1;
		} else {
			_data_->_tmp0_ = 0;
		}
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_set_chat_mute_duration (_data_->_tmp1_, _data_->chat_id, _data_->_tmp0_, dc_chat_context_menu_set_mute_state_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_set_chat_mute_duration_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->done_message;
		if (_data_->_tmp2_ == NULL) {
			if (_data_->mute) {
				_data_->_tmp3_ = "Chat muted";
			} else {
				_data_->_tmp3_ = "Chat unmuted";
			}
			_data_->_tmp2_ = _data_->_tmp3_;
		}
		_data_->_tmp4_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp4_, _data_->_tmp2_);
		_data_->_tmp5_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp5_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp6_ = _data_->self->priv->window;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		_data_->_tmp9_ = g_strconcat ("Failed to update mute: ", _data_->_tmp8_, NULL);
		_data_->_tmp10_ = _data_->_tmp9_;
		dc_window_show_toast (_data_->_tmp6_, _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_chat_context_menu_set_unread_state_data_free (gpointer _data)
{
	DcChatContextMenuSetUnreadStateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuSetUnreadStateData, _data_);
}

static void
dc_chat_context_menu_set_unread_state (DcChatContextMenu* self,
                                       gint chat_id,
                                       gboolean unread,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	DcChatContextMenuSetUnreadStateData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuSetUnreadStateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_set_unread_state_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->unread = unread;
	dc_chat_context_menu_set_unread_state_co (_data_);
}

static void
dc_chat_context_menu_set_unread_state_finish (DcChatContextMenu* self,
                                              GAsyncResult* _res_)
{
	DcChatContextMenuSetUnreadStateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_set_unread_state_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	DcChatContextMenuSetUnreadStateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_set_unread_state_co (_data_);
}

static gboolean
dc_chat_context_menu_set_unread_state_co (DcChatContextMenuSetUnreadStateData* _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_->unread) {
			_data_->_tmp0_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_markfresh_chat (_data_->_tmp0_, _data_->chat_id, dc_chat_context_menu_set_unread_state_ready, _data_);
			return FALSE;
			_state_1:
			dc_rpc_client_markfresh_chat_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			_data_->_tmp1_ = _data_->self->priv->rpc;
			_data_->_state_ = 2;
			dc_rpc_client_marknoticed_chat (_data_->_tmp1_, _data_->chat_id, dc_chat_context_menu_set_unread_state_ready, _data_);
			return FALSE;
			_state_2:
			dc_rpc_client_marknoticed_chat_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		_data_->_tmp2_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp2_);
		if (_data_->unread) {
			_data_->_tmp3_ = "Marked unread";
		} else {
			_data_->_tmp3_ = "Marked read";
		}
		_data_->_tmp4_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp4_, _data_->_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = _data_->self->priv->window;
		_data_->_tmp6_ = _data_->e;
		_data_->_tmp7_ = _data_->_tmp6_->message;
		_data_->_tmp8_ = g_strconcat ("Failed to update unread marker: ", _data_->_tmp7_, NULL);
		_data_->_tmp9_ = _data_->_tmp8_;
		dc_window_show_toast (_data_->_tmp5_, _data_->_tmp9_);
		_g_free0 (_data_->_tmp9_);
		_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_chat_context_menu_show_media (DcChatContextMenu* self,
                                 gint chat_id)
{
	DcChatEntry* entry = NULL;
	GListStore* _tmp0_;
	DcChatEntry* _tmp1_;
	const gchar* _tmp2_ = NULL;
	DcChatEntry* _tmp3_;
	DcGalleryDialog* dialog = NULL;
	DcWindow* _tmp7_;
	DcRpcClient* _tmp8_;
	DcGalleryDialog* _tmp9_;
	DcWindow* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->chat_store;
	_tmp1_ = dc_find_chat_entry (_tmp0_, chat_id);
	entry = _tmp1_;
	_tmp3_ = entry;
	if (_tmp3_ != NULL) {
		DcChatEntry* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp4_ = entry;
		_tmp5_ = dc_chat_entry_get_name (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp2_ = _tmp6_;
	} else {
		_tmp2_ = NULL;
	}
	_tmp7_ = self->priv->window;
	_tmp8_ = self->priv->rpc;
	_tmp9_ = dc_gallery_dialog_new (_tmp7_, _tmp8_, chat_id, _tmp2_);
	g_object_ref_sink (_tmp9_);
	dialog = _tmp9_;
	_tmp10_ = self->priv->window;
	adw_dialog_present ((AdwDialog*) dialog, (GtkWidget*) _tmp10_);
	_g_object_unref0 (dialog);
	_g_object_unref0 (entry);
}

static Block17Data*
block17_data_ref (Block17Data* _data17_)
{
	g_atomic_int_inc (&_data17_->_ref_count_);
	return _data17_;
}

static void
block17_data_unref (void * _userdata_)
{
	Block17Data* _data17_;
	_data17_ = (Block17Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
		DcChatContextMenu* self;
		self = _data17_->self;
		_g_object_unref0 (self);
		g_slice_free (Block17Data, _data17_);
	}
}

static void
__lambda284_ (DcChatContextMenu* self,
              gint cid)
{
	DcWindow* _tmp0_;
	DcWindow* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	DcWindow* _tmp5_;
	_tmp0_ = self->priv->window;
	dc_window_show_toast (_tmp0_, "Chat deleted");
	_tmp1_ = self->priv->window;
	_tmp2_ = dc_window_get_current_chat_id (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == cid) {
		DcWindow* _tmp4_;
		_tmp4_ = self->priv->window;
		dc_window_clear_chat_view (_tmp4_);
	}
	_tmp5_ = self->priv->window;
	dc_window_request_reload_chats (_tmp5_);
}

static void
___lambda284__dc_chat_info_dialog_chat_deleted (DcChatInfoDialog* _sender,
                                                gint chat_id,
                                                gpointer self)
{
	__lambda284_ ((DcChatContextMenu*) self, chat_id);
}

static void
__lambda285_ (Block17Data* _data17_)
{
	DcChatContextMenu* self;
	DcWindow* _tmp0_;
	DcWindow* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	self = _data17_->self;
	_tmp0_ = self->priv->window;
	dc_window_request_reload_chats (_tmp0_);
	_tmp1_ = self->priv->window;
	_tmp2_ = dc_window_get_current_chat_id (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == _data17_->chat_id) {
		DcWindow* _tmp4_;
		_tmp4_ = self->priv->window;
		dc_window_request_messages_reload (_tmp4_);
	}
}

static void
___lambda285__dc_chat_info_dialog_chat_changed (DcChatInfoDialog* _sender,
                                                gpointer self)
{
	__lambda285_ (self);
}

static void
__lambda286_ (DcChatContextMenu* self,
              gint cid)
{
	DcWindow* _tmp0_;
	DcWindow* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	DcWindow* _tmp5_;
	_tmp0_ = self->priv->window;
	dc_window_show_toast (_tmp0_, "Contact blocked");
	_tmp1_ = self->priv->window;
	_tmp2_ = dc_window_get_current_chat_id (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == cid) {
		DcWindow* _tmp4_;
		_tmp4_ = self->priv->window;
		dc_window_clear_chat_view (_tmp4_);
	}
	_tmp5_ = self->priv->window;
	dc_window_request_reload_chats (_tmp5_);
}

static void
___lambda286__dc_chat_info_dialog_contact_blocked (DcChatInfoDialog* _sender,
                                                   gint chat_id,
                                                   gpointer self)
{
	__lambda286_ ((DcChatContextMenu*) self, chat_id);
}

void
dc_chat_context_menu_show_info (DcChatContextMenu* self,
                                gint chat_id)
{
	Block17Data* _data17_;
	DcChatInfoDialog* dialog = NULL;
	DcWindow* _tmp0_;
	DcRpcClient* _tmp1_;
	DcChatInfoDialog* _tmp2_;
	DcWindow* _tmp3_;
	g_return_if_fail (self != NULL);
	_data17_ = g_slice_new0 (Block17Data);
	_data17_->_ref_count_ = 1;
	_data17_->self = g_object_ref (self);
	_data17_->chat_id = chat_id;
	_tmp0_ = self->priv->window;
	_tmp1_ = self->priv->rpc;
	_tmp2_ = dc_chat_info_dialog_new (_tmp0_, _tmp1_, _data17_->chat_id);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	g_signal_connect_object (dialog, "chat-deleted", (GCallback) ___lambda284__dc_chat_info_dialog_chat_deleted, self, 0);
	g_signal_connect_data (dialog, "chat-changed", (GCallback) ___lambda285__dc_chat_info_dialog_chat_changed, block17_data_ref (_data17_), (GClosureNotify) block17_data_unref, 0);
	g_signal_connect_object (dialog, "contact-blocked", (GCallback) ___lambda286__dc_chat_info_dialog_contact_blocked, self, 0);
	_tmp3_ = self->priv->window;
	adw_dialog_present ((AdwDialog*) dialog, (GtkWidget*) _tmp3_);
	_g_object_unref0 (dialog);
	block17_data_unref (_data17_);
	_data17_ = NULL;
}

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

static void
dc_chat_context_menu_confirm_clear_history (DcChatContextMenu* self,
                                            gint chat_id,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	DcChatContextMenuConfirmClearHistoryData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuConfirmClearHistoryData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_confirm_clear_history_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_chat_context_menu_confirm_clear_history_co (_data_);
}

static void
dc_chat_context_menu_confirm_clear_history_finish (DcChatContextMenu* self,
                                                   GAsyncResult* _res_)
{
	DcChatContextMenuConfirmClearHistoryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_confirm_clear_history_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	DcChatContextMenuConfirmClearHistoryData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_confirm_clear_history_co (_data_);
}

static gboolean
dc_chat_context_menu_confirm_clear_history_co (DcChatContextMenuConfirmClearHistoryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup ("this chat");
	_data_->chat_name = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->chat_store;
	_data_->_tmp2_ = dc_find_chat_entry (_data_->_tmp1_, _data_->chat_id);
	_data_->entry = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->entry;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->entry;
		_data_->_tmp5_ = dc_chat_entry_get_name (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
		_g_free0 (_data_->chat_name);
		_data_->chat_name = _data_->_tmp7_;
	}
	_data_->_tmp8_ = _data_->self->priv->window;
	_data_->_tmp9_ = _data_->chat_name;
	_data_->_tmp10_ = g_strdup_printf ("Remove all messages in \"%s\" from this device? The chat will stay in " \
"your conversation list.", _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_state_ = 1;
	dc_confirm_action ((GtkWidget*) _data_->_tmp8_, "Clear Chat", _data_->_tmp11_, "clear", "Clear Chat", dc_chat_context_menu_confirm_clear_history_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp12_ = dc_confirm_action_finish (_data_->_res_);
	_g_free0 (_data_->_tmp11_);
	if (_data_->_tmp12_) {
		dc_chat_context_menu_do_clear_history (_data_->self, _data_->chat_id, FALSE, NULL, NULL);
	}
	_g_object_unref0 (_data_->entry);
	_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_chat_context_menu_confirm_leave_data_free (gpointer _data)
{
	DcChatContextMenuConfirmLeaveData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuConfirmLeaveData, _data_);
}

static void
dc_chat_context_menu_confirm_leave (DcChatContextMenu* self,
                                    gint chat_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DcChatContextMenuConfirmLeaveData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuConfirmLeaveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_confirm_leave_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_chat_context_menu_confirm_leave_co (_data_);
}

static void
dc_chat_context_menu_confirm_leave_finish (DcChatContextMenu* self,
                                           GAsyncResult* _res_)
{
	DcChatContextMenuConfirmLeaveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_confirm_leave_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DcChatContextMenuConfirmLeaveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_confirm_leave_co (_data_);
}

static gboolean
dc_chat_context_menu_confirm_leave_co (DcChatContextMenuConfirmLeaveData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup ("this chat");
	_data_->chat_name = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->chat_store;
	_data_->_tmp2_ = dc_find_chat_entry (_data_->_tmp1_, _data_->chat_id);
	_data_->entry = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->entry;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->entry;
		_data_->_tmp5_ = dc_chat_entry_get_name (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
		_g_free0 (_data_->chat_name);
		_data_->chat_name = _data_->_tmp7_;
	}
	_data_->_tmp8_ = _data_->self->priv->window;
	_data_->_tmp9_ = _data_->chat_name;
	_data_->_tmp10_ = g_strdup_printf ("Leave \"%s\"? You will stop receiving messages and the chat will be re" \
"moved from your list.", _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_state_ = 1;
	dc_confirm_action ((GtkWidget*) _data_->_tmp8_, "Leave Group", _data_->_tmp11_, "leave", "Leave", dc_chat_context_menu_confirm_leave_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp12_ = dc_confirm_action_finish (_data_->_res_);
	_g_free0 (_data_->_tmp11_);
	if (_data_->_tmp12_) {
		dc_chat_context_menu_do_leave (_data_->self, _data_->chat_id, NULL, NULL);
	}
	_g_object_unref0 (_data_->entry);
	_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_chat_context_menu_do_leave_data_free (gpointer _data)
{
	DcChatContextMenuDoLeaveData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuDoLeaveData, _data_);
}

static void
dc_chat_context_menu_do_leave (DcChatContextMenu* self,
                               gint chat_id,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DcChatContextMenuDoLeaveData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuDoLeaveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_do_leave_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_chat_context_menu_do_leave_co (_data_);
}

static void
dc_chat_context_menu_do_leave_finish (DcChatContextMenu* self,
                                      GAsyncResult* _res_)
{
	DcChatContextMenuDoLeaveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_do_leave_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DcChatContextMenuDoLeaveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_do_leave_co (_data_);
}

static gboolean
dc_chat_context_menu_do_leave_co (DcChatContextMenuDoLeaveData* _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_leave_group (_data_->_tmp0_, _data_->chat_id, dc_chat_context_menu_do_leave_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_leave_group_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_delete_chat (_data_->_tmp1_, _data_->chat_id, dc_chat_context_menu_do_leave_ready, _data_);
		return FALSE;
		_state_2:
		dc_rpc_client_delete_chat_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp2_, "You left the chat");
		_data_->_tmp3_ = _data_->self->priv->window;
		_data_->_tmp4_ = dc_window_get_current_chat_id (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		if (_data_->_tmp5_ == _data_->chat_id) {
			_data_->_tmp6_ = _data_->self->priv->window;
			dc_window_clear_chat_view (_data_->_tmp6_);
		}
		_data_->_tmp7_ = _data_->self->priv->window;
		_data_->_state_ = 3;
		dc_window_load_chats (_data_->_tmp7_, dc_chat_context_menu_do_leave_ready, _data_);
		return FALSE;
		_state_3:
		dc_window_load_chats_finish (_data_->_tmp7_, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp8_ = _data_->self->priv->window;
		_data_->_tmp9_ = _data_->e;
		_data_->_tmp10_ = _data_->_tmp9_->message;
		_data_->_tmp11_ = g_strconcat ("Leave failed: ", _data_->_tmp10_, NULL);
		_data_->_tmp12_ = _data_->_tmp11_;
		dc_window_show_toast (_data_->_tmp8_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_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_chat_context_menu_confirm_delete_data_free (gpointer _data)
{
	DcChatContextMenuConfirmDeleteData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuConfirmDeleteData, _data_);
}

static void
dc_chat_context_menu_confirm_delete (DcChatContextMenu* self,
                                     gint chat_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcChatContextMenuConfirmDeleteData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuConfirmDeleteData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_confirm_delete_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_chat_context_menu_confirm_delete_co (_data_);
}

static void
dc_chat_context_menu_confirm_delete_finish (DcChatContextMenu* self,
                                            GAsyncResult* _res_)
{
	DcChatContextMenuConfirmDeleteData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_confirm_delete_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcChatContextMenuConfirmDeleteData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_confirm_delete_co (_data_);
}

static gboolean
dc_chat_context_menu_confirm_delete_co (DcChatContextMenuConfirmDeleteData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup ("this chat");
	_data_->chat_name = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->chat_store;
	_data_->_tmp2_ = dc_find_chat_entry (_data_->_tmp1_, _data_->chat_id);
	_data_->entry = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->entry;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->entry;
		_data_->_tmp5_ = dc_chat_entry_get_name (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
		_g_free0 (_data_->chat_name);
		_data_->chat_name = _data_->_tmp7_;
	}
	_data_->_tmp8_ = _data_->self->priv->window;
	_data_->_tmp9_ = _data_->chat_name;
	_data_->_tmp10_ = g_strdup_printf ("Remove \"%s\" from your conversation list? You may still receive new m" \
"essages if you are a member.", _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_state_ = 1;
	dc_confirm_action ((GtkWidget*) _data_->_tmp8_, "Delete Chat", _data_->_tmp11_, "delete", "Delete", dc_chat_context_menu_confirm_delete_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp12_ = dc_confirm_action_finish (_data_->_res_);
	_g_free0 (_data_->_tmp11_);
	if (_data_->_tmp12_) {
		dc_chat_context_menu_do_delete (_data_->self, _data_->chat_id, NULL, NULL);
	}
	_g_object_unref0 (_data_->entry);
	_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_chat_context_menu_do_clear_history_data_free (gpointer _data)
{
	DcChatContextMenuDoClearHistoryData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuDoClearHistoryData, _data_);
}

static void
dc_chat_context_menu_do_clear_history (DcChatContextMenu* self,
                                       gint chat_id,
                                       gboolean for_all,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	DcChatContextMenuDoClearHistoryData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuDoClearHistoryData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_do_clear_history_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->for_all = for_all;
	dc_chat_context_menu_do_clear_history_co (_data_);
}

static void
dc_chat_context_menu_do_clear_history_finish (DcChatContextMenu* self,
                                              GAsyncResult* _res_)
{
	DcChatContextMenuDoClearHistoryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_do_clear_history_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	DcChatContextMenuDoClearHistoryData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_do_clear_history_co (_data_);
}

static gboolean
dc_chat_context_menu_do_clear_history_co (DcChatContextMenuDoClearHistoryData* _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_ = _data_->self->priv->rpc;
		_data_->_tmp2_ = dc_rpc_client_get_account_id (_data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = 0;
		_data_->_state_ = 1;
		dc_chat_message_ids_for_clear (_data_->_tmp0_, _data_->_tmp3_, _data_->chat_id, _data_->for_all, dc_chat_context_menu_do_clear_history_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = dc_chat_message_ids_for_clear_finish (_data_->_res_, &_data_->_tmp4_, &_data_->_inner_error0_);
		_data_->ids = _data_->_tmp5_;
		_data_->ids_length1 = _data_->_tmp4_;
		_data_->_ids_size_ = _data_->ids_length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->ids;
		_data_->_tmp6__length1 = _data_->ids_length1;
		if (_data_->_tmp6__length1 > 0) {
			if (_data_->for_all) {
				_data_->_tmp7_ = _data_->self->priv->rpc;
				_data_->_tmp8_ = _data_->ids;
				_data_->_tmp8__length1 = _data_->ids_length1;
				_data_->_state_ = 2;
				dc_rpc_client_delete_messages_for_all (_data_->_tmp7_, _data_->_tmp8_, (gint) _data_->_tmp8__length1, dc_chat_context_menu_do_clear_history_ready, _data_);
				return FALSE;
				_state_2:
				dc_rpc_client_delete_messages_for_all_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_data_->ids = (g_free (_data_->ids), NULL);
					goto __catch0_g_error;
				}
			} else {
				_data_->_tmp9_ = _data_->self->priv->rpc;
				_data_->_tmp10_ = _data_->ids;
				_data_->_tmp10__length1 = _data_->ids_length1;
				_data_->_state_ = 3;
				dc_rpc_client_delete_messages (_data_->_tmp9_, _data_->_tmp10_, (gint) _data_->_tmp10__length1, dc_chat_context_menu_do_clear_history_ready, _data_);
				return FALSE;
				_state_3:
				dc_rpc_client_delete_messages_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_data_->ids = (g_free (_data_->ids), NULL);
					goto __catch0_g_error;
				}
			}
		} else {
			if (_data_->for_all) {
				_data_->_tmp11_ = _data_->self->priv->window;
				dc_window_show_toast (_data_->_tmp11_, "No sent messages to clear for everyone");
				_data_->ids = (g_free (_data_->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;
			}
		}
		if (_data_->for_all) {
			_data_->_tmp12_ = "Sent messages cleared for everyone";
		} else {
			_data_->_tmp12_ = "Chat cleared";
		}
		_data_->_tmp13_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp13_, _data_->_tmp12_);
		_data_->_tmp14_ = _data_->self->priv->window;
		_data_->_tmp15_ = dc_window_get_current_chat_id (_data_->_tmp14_);
		_data_->_tmp16_ = _data_->_tmp15_;
		if (_data_->_tmp16_ == _data_->chat_id) {
			_data_->_tmp17_ = _data_->self->priv->window;
			dc_window_request_messages_reload (_data_->_tmp17_);
		}
		_data_->_tmp18_ = _data_->self->priv->window;
		dc_window_request_reload_chats (_data_->_tmp18_);
		_data_->ids = (g_free (_data_->ids), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp19_ = _data_->self->priv->window;
		_data_->_tmp20_ = _data_->e;
		_data_->_tmp21_ = _data_->_tmp20_->message;
		_data_->_tmp22_ = g_strconcat ("Clear failed: ", _data_->_tmp21_, NULL);
		_data_->_tmp23_ = _data_->_tmp22_;
		dc_window_show_toast (_data_->_tmp19_, _data_->_tmp23_);
		_g_free0 (_data_->_tmp23_);
		_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_chat_context_menu_do_delete_data_free (gpointer _data)
{
	DcChatContextMenuDoDeleteData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuDoDeleteData, _data_);
}

static void
dc_chat_context_menu_do_delete (DcChatContextMenu* self,
                                gint chat_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcChatContextMenuDoDeleteData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuDoDeleteData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_chat_context_menu_do_delete_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_chat_context_menu_do_delete_co (_data_);
}

static void
dc_chat_context_menu_do_delete_finish (DcChatContextMenu* self,
                                       GAsyncResult* _res_)
{
	DcChatContextMenuDoDeleteData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_chat_context_menu_do_delete_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_)
{
	DcChatContextMenuDoDeleteData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_do_delete_co (_data_);
}

static gboolean
dc_chat_context_menu_do_delete_co (DcChatContextMenuDoDeleteData* _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_delete_chat (_data_->_tmp0_, _data_->chat_id, dc_chat_context_menu_do_delete_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_delete_chat_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp1_ = _data_->self->priv->window;
		dc_window_show_toast (_data_->_tmp1_, "Chat deleted");
		_data_->_tmp2_ = _data_->self->priv->window;
		_data_->_tmp3_ = dc_window_get_current_chat_id (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		if (_data_->_tmp4_ == _data_->chat_id) {
			_data_->_tmp5_ = _data_->self->priv->window;
			dc_window_clear_chat_view (_data_->_tmp5_);
		}
		_data_->_tmp6_ = _data_->self->priv->window;
		_data_->_state_ = 2;
		dc_window_load_chats (_data_->_tmp6_, dc_chat_context_menu_do_delete_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_load_chats_finish (_data_->_tmp6_, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->self->priv->window;
		_data_->_tmp8_ = _data_->e;
		_data_->_tmp9_ = _data_->_tmp8_->message;
		_data_->_tmp10_ = g_strconcat ("Delete failed: ", _data_->_tmp9_, NULL);
		_data_->_tmp11_ = _data_->_tmp10_;
		dc_window_show_toast (_data_->_tmp7_, _data_->_tmp11_);
		_g_free0 (_data_->_tmp11_);
		_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_chat_context_menu_class_init (DcChatContextMenuClass * klass,
                                 gpointer klass_data)
{
	dc_chat_context_menu_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcChatContextMenu_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dc_chat_context_menu_finalize;
}

static void
dc_chat_context_menu_instance_init (DcChatContextMenu * self,
                                    gpointer klass)
{
	self->priv = dc_chat_context_menu_get_instance_private (self);
}

static void
dc_chat_context_menu_finalize (GObject * obj)
{
	DcChatContextMenu * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_CHAT_CONTEXT_MENU, DcChatContextMenu);
	G_OBJECT_CLASS (dc_chat_context_menu_parent_class)->finalize (obj);
}

static GType
dc_chat_context_menu_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcChatContextMenuClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_chat_context_menu_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcChatContextMenu), 0, (GInstanceInitFunc) dc_chat_context_menu_instance_init, NULL };
	GType dc_chat_context_menu_type_id;
	dc_chat_context_menu_type_id = g_type_register_static (G_TYPE_OBJECT, "DcChatContextMenu", &g_define_type_info, 0);
	DcChatContextMenu_private_offset = g_type_add_instance_private (dc_chat_context_menu_type_id, sizeof (DcChatContextMenuPrivate));
	return dc_chat_context_menu_type_id;
}

GType
dc_chat_context_menu_get_type (void)
{
	static volatile gsize dc_chat_context_menu_type_id__once = 0;
	if (g_once_init_enter (&dc_chat_context_menu_type_id__once)) {
		GType dc_chat_context_menu_type_id;
		dc_chat_context_menu_type_id = dc_chat_context_menu_get_type_once ();
		g_once_init_leave (&dc_chat_context_menu_type_id__once, dc_chat_context_menu_type_id);
	}
	return dc_chat_context_menu_type_id__once;
}

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

