/* 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 <adwaita.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>
#include <gio/gio.h>
#include <json-glib/json-glib.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;
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)))

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

#define DC_TYPE_CONTACT (dc_contact_get_type ())
#define DC_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_CONTACT, DcContact))
#define DC_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_CONTACT, DcContactClass))
#define DC_IS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_CONTACT))
#define DC_IS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_CONTACT))
#define DC_CONTACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_CONTACT, DcContactClass))

typedef struct _DcContact DcContact;
typedef struct _DcContactClass DcContactClass;
typedef struct _Block12Data Block12Data;
typedef struct _DcChatContextMenuShowLoadedData DcChatContextMenuShowLoadedData;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
typedef struct _DcChatContextMenuLoadDmContactData DcChatContextMenuLoadDmContactData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DcChatContextMenuTogglePinData DcChatContextMenuTogglePinData;
typedef struct _Block13Data Block13Data;

#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 _DcChatContextMenuShowInfoData DcChatContextMenuShowInfoData;
typedef struct _Block14Data Block14Data;
typedef void (*DcVoidFunc) (gpointer user_data);
typedef struct _DcChatContextMenuBlockContactData DcChatContextMenuBlockContactData;
typedef struct _DcChatContextMenuUnblockContactData DcChatContextMenuUnblockContactData;
typedef struct _Block15Data Block15Data;
typedef struct _DcChatContextMenuConfirmDeleteData DcChatContextMenuConfirmDeleteData;
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;
	gint unread_count;
	gboolean compact;
};

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

struct _DcChatContextMenuClass {
	GObjectClass parent_class;
};

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

struct _Block11Data {
	int _ref_count_;
	DcChatContextMenu* self;
	gboolean is_pinned;
	GtkPopover* popover;
	gint chat_id;
	gpointer _async_data_;
};

struct _Block12Data {
	int _ref_count_;
	Block11Data * _data11_;
	DcContact* contact;
};

struct _DcChatContextMenuShowLoadedData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	gdouble x;
	gdouble y;
	GtkWidget* parent;
	Block11Data* _data11_;
	DcChatEntry* entry;
	GListStore* _tmp0_;
	DcChatEntry* _tmp1_;
	DcChatEntry* _tmp2_;
	DcChatEntry* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	DcContact* dm_contact;
	DcContact* _tmp6_;
	DcContact* _tmp7_;
	DcContact* _tmp8_;
	GtkPopover* _tmp9_;
	GtkPopover* _tmp10_;
	GtkPopover* _tmp11_;
	GtkPopover* _tmp12_;
	GdkRectangle _tmp13_;
	GtkBox* box;
	GtkBox* _tmp14_;
	GtkBox* _tmp15_;
	const gchar* _tmp16_;
	GtkButton* pin_btn;
	GtkButton* _tmp17_;
	GtkButton* _tmp18_;
	GtkBox* _tmp19_;
	GtkButton* _tmp20_;
	GtkButton* info_btn;
	GtkButton* _tmp21_;
	GtkButton* _tmp22_;
	GtkBox* _tmp23_;
	GtkButton* _tmp24_;
	DcContact* _tmp25_;
	Block12Data* _data12_;
	DcContact* _tmp26_;
	DcContact* _tmp27_;
	const gchar* _tmp28_;
	DcContact* _tmp29_;
	gboolean _tmp30_;
	gboolean _tmp31_;
	GtkButton* block_btn;
	GtkButton* _tmp32_;
	DcContact* _tmp33_;
	gboolean _tmp34_;
	gboolean _tmp35_;
	GtkButton* _tmp36_;
	GtkButton* _tmp37_;
	GtkBox* _tmp38_;
	GtkButton* _tmp39_;
	GtkButton* del_btn;
	GtkButton* _tmp40_;
	GtkBox* _tmp41_;
	GtkPopover* _tmp42_;
	GtkBox* _tmp43_;
	GtkPopover* _tmp44_;
	GtkPopover* _tmp45_;
	GError* _inner_error0_;
};

struct _DcChatContextMenuLoadDmContactData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	DcContact* result;
	JsonObject* chat;
	DcRpcClient* _tmp0_;
	JsonObject* _tmp1_;
	JsonObject* _tmp2_;
	gchar* _tmp3_;
	JsonObject* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* chat_type;
	gchar* _tmp7_;
	gboolean is_self_talk;
	JsonObject* _tmp8_;
	gboolean is_device_chat;
	JsonObject* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	const gchar* _tmp12_;
	JsonObject* _tmp13_;
	JsonArray* ids;
	JsonObject* _tmp14_;
	JsonArray* _tmp15_;
	JsonArray* _tmp16_;
	gboolean _tmp17_;
	JsonArray* _tmp18_;
	JsonArray* _tmp19_;
	gint contact_id;
	JsonArray* _tmp20_;
	JsonObject* obj;
	DcRpcClient* _tmp21_;
	JsonObject* _tmp22_;
	JsonObject* _tmp23_;
	JsonObject* _tmp24_;
	DcContact* _tmp25_;
	GError* _inner_error0_;
};

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 _Block13Data {
	int _ref_count_;
	DcChatContextMenu* self;
	gint chat_id;
	gpointer _async_data_;
};

struct _DcChatContextMenuShowInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	Block13Data* _data13_;
	DcChatInfoDialog* dialog;
	DcRpcClient* _tmp0_;
	DcChatInfoDialog* _tmp1_;
	DcWindow* _tmp2_;
};

struct _Block14Data {
	int _ref_count_;
	DcChatContextMenu* self;
	gint chat_id;
	DcContact* contact;
};

struct _DcChatContextMenuBlockContactData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	gint contact_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_;
};

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

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

struct _DcChatContextMenuConfirmDeleteData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcChatContextMenu* self;
	gint chat_id;
	Block15Data* _data15_;
	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_;
};

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_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 const gchar* dc_chat_entry_get_name (DcChatEntry* self);
VALA_EXTERN GdkTexture* dc_load_avatar (const gchar* path);
VALA_EXTERN const gchar* dc_chat_entry_get_avatar_path (DcChatEntry* self);
static gchar* dc_chat_row_format_time (gint64 timestamp);
VALA_EXTERN gint64 dc_chat_entry_get_timestamp (DcChatEntry* self);
static gchar* dc_chat_row_format_preview (DcChatEntry* entry);
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 const gchar* dc_chat_entry_get_summary_prefix (DcChatEntry* self);
VALA_EXTERN gint dc_chat_row_get_chat_id (DcChatRow* self);
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 void dc_chat_context_menu_show_loaded (DcChatContextMenu* self,
                                       gint chat_id,
                                       gdouble x,
                                       gdouble y,
                                       GtkWidget* parent,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
static void dc_chat_context_menu_show_loaded_finish (DcChatContextMenu* self,
                                              GAsyncResult* _res_);
static void dc_chat_context_menu_show_loaded_data_free (gpointer _data);
static gboolean dc_chat_context_menu_show_loaded_co (DcChatContextMenuShowLoadedData* _data_);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
VALA_EXTERN DcChatEntry* dc_find_chat_entry (GListStore* store,
                                 gint chat_id);
VALA_EXTERN GType dc_contact_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcContact, g_object_unref)
static void dc_chat_context_menu_load_dm_contact (DcChatContextMenu* self,
                                           gint chat_id,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static DcContact* dc_chat_context_menu_load_dm_contact_finish (DcChatContextMenu* self,
                                                        GAsyncResult* _res_,
                                                        GError** error);
static void dc_chat_context_menu_show_loaded_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static GtkButton* dc_chat_context_menu_make_menu_button (const gchar* label);
static void __lambda99_ (Block11Data* _data11_);
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 ___lambda99__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda100_ (Block11Data* _data11_);
static void dc_chat_context_menu_show_info (DcChatContextMenu* self,
                                     gint chat_id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void dc_chat_context_menu_show_info_finish (DcChatContextMenu* self,
                                            GAsyncResult* _res_);
static void ___lambda100__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static Block12Data* block12_data_ref (Block12Data* _data12_);
static void block12_data_unref (void * _userdata_);
VALA_EXTERN gboolean dc_contact_get_is_blocked (DcContact* self);
static void ___lambda129_ (Block12Data* _data12_);
static void dc_chat_context_menu_unblock_contact (DcChatContextMenu* self,
                                           gint chat_id,
                                           gint contact_id,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void dc_chat_context_menu_unblock_contact_finish (DcChatContextMenu* self,
                                                  GAsyncResult* _res_);
VALA_EXTERN gint dc_contact_get_id (DcContact* self);
static void dc_chat_context_menu_confirm_block_contact (DcChatContextMenu* self,
                                                 gint chat_id,
                                                 DcContact* contact);
static void ____lambda129__gtk_button_clicked (GtkButton* _sender,
                                        gpointer self);
static void __lambda131_ (Block11Data* _data11_);
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 ___lambda131__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda133_ (Block11Data* _data11_);
static void ___lambda133__gtk_popover_closed (GtkPopover* _sender,
                                       gpointer self);
static void dc_chat_context_menu_load_dm_contact_data_free (gpointer _data);
static gboolean dc_chat_context_menu_load_dm_contact_co (DcChatContextMenuLoadDmContactData* _data_);
VALA_EXTERN void dc_rpc_client_get_full_chat_by_id (DcRpcClient* self,
                                        gint chat_id,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_full_chat_by_id_finish (DcRpcClient* self,
                                                      GAsyncResult* _res_,
                                                      GError** error);
static void dc_chat_context_menu_load_dm_contact_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN gchar* dc_json_str (JsonObject* obj,
                    const gchar* key);
VALA_EXTERN gboolean dc_json_bool (JsonObject* obj,
                       const gchar* key);
VALA_EXTERN void dc_rpc_client_get_contact (DcRpcClient* self,
                                gint contact_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_contact_finish (DcRpcClient* self,
                                              GAsyncResult* _res_,
                                              GError** error);
VALA_EXTERN DcContact* dc_rpc_parsers_parse_contact (gint contact_id,
                                         JsonObject* obj);
static gchar* dc_chat_context_menu_contact_label (DcContact* contact);
VALA_EXTERN const gchar* dc_contact_get_display_name (DcContact* self);
VALA_EXTERN const gchar* dc_contact_get_address (DcContact* self);
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_show_info_data_free (gpointer _data);
static gboolean dc_chat_context_menu_show_info_co (DcChatContextMenuShowInfoData* _data_);
static Block13Data* block13_data_ref (Block13Data* _data13_);
static void block13_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 (DcRpcClient* rpc,
                                           gint chat_id);
VALA_EXTERN DcChatInfoDialog* dc_chat_info_dialog_construct (GType object_type,
                                                 DcRpcClient* rpc,
                                                 gint chat_id);
static void __lambda126_ (DcChatContextMenu* self,
                   gint cid);
VALA_EXTERN gint dc_window_get_current_chat_id (DcWindow* self);
VALA_EXTERN void dc_window_clear_chat_view (DcWindow* self);
VALA_EXTERN void dc_window_request_reload_chats (DcWindow* self);
static void ___lambda126__dc_chat_info_dialog_chat_deleted (DcChatInfoDialog* _sender,
                                                     gint chat_id,
                                                     gpointer self);
static void __lambda127_ (Block13Data* _data13_);
VALA_EXTERN void dc_window_request_messages_reload (DcWindow* self);
static void ___lambda127__dc_chat_info_dialog_chat_changed (DcChatInfoDialog* _sender,
                                                     gpointer self);
static void __lambda128_ (DcChatContextMenu* self,
                   gint cid);
static void ___lambda128__dc_chat_info_dialog_contact_blocked (DcChatInfoDialog* _sender,
                                                        gint chat_id,
                                                        gpointer self);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
VALA_EXTERN void dc_confirm_action (GtkWidget* parent,
                        const gchar* title,
                        const gchar* body,
                        const gchar* action_id,
                        const gchar* action_label,
                        DcVoidFunc on_confirm,
                        gpointer on_confirm_target,
                        GDestroyNotify on_confirm_target_destroy_notify);
static void __lambda130_ (Block14Data* _data14_);
static void dc_chat_context_menu_block_contact (DcChatContextMenu* self,
                                         gint chat_id,
                                         gint contact_id,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void dc_chat_context_menu_block_contact_finish (DcChatContextMenu* self,
                                                GAsyncResult* _res_);
static void ___lambda130__dc_void_func (gpointer self);
static void dc_chat_context_menu_block_contact_data_free (gpointer _data);
static gboolean dc_chat_context_menu_block_contact_co (DcChatContextMenuBlockContactData* _data_);
VALA_EXTERN void dc_rpc_client_block_contact (DcRpcClient* self,
                                  gint contact_id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_block_contact_finish (DcRpcClient* self,
                                         GAsyncResult* _res_,
                                         GError** error);
static void dc_chat_context_menu_block_contact_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void dc_chat_context_menu_unblock_contact_data_free (gpointer _data);
static gboolean dc_chat_context_menu_unblock_contact_co (DcChatContextMenuUnblockContactData* _data_);
VALA_EXTERN void dc_rpc_client_unblock_contact (DcRpcClient* self,
                                    gint contact_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_unblock_contact_finish (DcRpcClient* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static void dc_chat_context_menu_unblock_contact_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void dc_chat_context_menu_confirm_delete_data_free (gpointer _data);
static gboolean dc_chat_context_menu_confirm_delete_co (DcChatContextMenuConfirmDeleteData* _data_);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
VALA_EXTERN void dc_confirm_delete_options (GtkWidget* parent,
                                const gchar* title,
                                const gchar* body,
                                DcVoidFunc on_delete_for_me,
                                gpointer on_delete_for_me_target,
                                GDestroyNotify on_delete_for_me_target_destroy_notify,
                                DcVoidFunc on_delete_for_everyone,
                                gpointer on_delete_for_everyone_target,
                                GDestroyNotify on_delete_for_everyone_target_destroy_notify);
static void __lambda132_ (Block15Data* _data15_);
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 ___lambda132__dc_void_func (gpointer self);
static void dc_chat_context_menu_do_delete_data_free (gpointer _data);
static gboolean dc_chat_context_menu_do_delete_co (DcChatContextMenuDoDeleteData* _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_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
dc_chat_row_get_instance_private (DcChatRow* self)
{
	return G_STRUCT_MEMBER_P (self, DcChatRow_private_offset);
}

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_;
	gint _tmp13_;
	gint _tmp14_;
	AdwAvatar* avatar = NULL;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	AdwAvatar* _tmp17_;
	AdwAvatar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	GdkTexture* _tmp21_;
	GdkTexture* _tmp22_;
	GtkOverlay* _tmp23_;
	GtkOverlay* _tmp24_;
	AdwAvatar* _tmp25_;
	GtkOverlay* _tmp26_;
	GtkOverlay* _tmp27_;
	GtkOverlay* _tmp56_;
	GtkBox* _tmp57_;
	GtkBox* _tmp58_;
	GtkBox* _tmp59_;
	GtkBox* top = NULL;
	GtkBox* _tmp60_;
	GtkLabel* name_label = NULL;
	const gchar* _tmp66_;
	const gchar* _tmp67_;
	GtkLabel* _tmp68_;
	GtkLabel* _tmp69_;
	GtkLabel* _tmp71_;
	GtkLabel* _tmp72_;
	GtkLabel* _tmp73_;
	GtkLabel* _tmp74_;
	GtkBox* _tmp75_;
	GtkLabel* _tmp76_;
	GtkLabel* time_label = NULL;
	gint64 _tmp82_;
	gint64 _tmp83_;
	gchar* _tmp84_;
	gchar* _tmp85_;
	GtkLabel* _tmp86_;
	GtkLabel* _tmp87_;
	GtkLabel* _tmp88_;
	GtkLabel* _tmp89_;
	GtkBox* _tmp90_;
	GtkLabel* _tmp91_;
	GtkBox* _tmp92_;
	GtkBox* _tmp93_;
	GtkBox* bot = NULL;
	GtkBox* _tmp94_;
	GtkLabel* preview_label = NULL;
	gchar* _tmp95_;
	gchar* _tmp96_;
	GtkLabel* _tmp97_;
	GtkLabel* _tmp98_;
	GtkLabel* _tmp100_;
	GtkLabel* _tmp101_;
	GtkLabel* _tmp102_;
	GtkLabel* _tmp103_;
	GtkLabel* _tmp104_;
	GtkBox* _tmp105_;
	GtkLabel* _tmp106_;
	GtkBox* _tmp122_;
	GtkBox* _tmp123_;
	GtkBox* _tmp124_;
	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_unread_count (entry);
	_tmp14_ = _tmp13_;
	self->priv->unread_count = _tmp14_;
	gtk_widget_add_css_class ((GtkWidget*) self, "chat-row");
	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);
	_tmp15_ = dc_chat_entry_get_name (entry);
	_tmp16_ = _tmp15_;
	_tmp17_ = (AdwAvatar*) adw_avatar_new (40, _tmp16_, TRUE);
	g_object_ref_sink (_tmp17_);
	avatar = _tmp17_;
	_tmp18_ = avatar;
	_tmp19_ = dc_chat_entry_get_avatar_path (entry);
	_tmp20_ = _tmp19_;
	_tmp21_ = dc_load_avatar (_tmp20_);
	_tmp22_ = _tmp21_;
	adw_avatar_set_custom_image (_tmp18_, (GdkPaintable*) _tmp22_);
	_g_object_unref0 (_tmp22_);
	_tmp23_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp23_);
	_g_object_unref0 (self->priv->avatar_overlay);
	self->priv->avatar_overlay = _tmp23_;
	_tmp24_ = self->priv->avatar_overlay;
	_tmp25_ = avatar;
	gtk_overlay_set_child (_tmp24_, (GtkWidget*) _tmp25_);
	_tmp26_ = self->priv->avatar_overlay;
	gtk_widget_set_valign ((GtkWidget*) _tmp26_, GTK_ALIGN_CENTER);
	_tmp27_ = self->priv->avatar_overlay;
	gtk_widget_set_halign ((GtkWidget*) _tmp27_, GTK_ALIGN_CENTER);
	if (self->priv->is_request) {
		GtkLabel* _tmp28_;
		GtkLabel* _tmp29_;
		GtkLabel* _tmp30_;
		GtkLabel* _tmp31_;
		GtkLabel* _tmp32_;
		GtkOverlay* _tmp33_;
		GtkLabel* _tmp34_;
		_tmp28_ = (GtkLabel*) gtk_label_new ("!");
		g_object_ref_sink (_tmp28_);
		_g_object_unref0 (self->priv->compact_unread_dot);
		self->priv->compact_unread_dot = _tmp28_;
		_tmp29_ = self->priv->compact_unread_dot;
		gtk_widget_add_css_class ((GtkWidget*) _tmp29_, "compact-request-marker");
		_tmp30_ = self->priv->compact_unread_dot;
		gtk_widget_set_halign ((GtkWidget*) _tmp30_, GTK_ALIGN_END);
		_tmp31_ = self->priv->compact_unread_dot;
		gtk_widget_set_valign ((GtkWidget*) _tmp31_, GTK_ALIGN_START);
		_tmp32_ = self->priv->compact_unread_dot;
		gtk_widget_set_visible ((GtkWidget*) _tmp32_, FALSE);
		_tmp33_ = self->priv->avatar_overlay;
		_tmp34_ = self->priv->compact_unread_dot;
		gtk_overlay_add_overlay (_tmp33_, (GtkWidget*) _tmp34_);
	} else {
		if (self->priv->has_unread) {
			gchar* _tmp35_ = NULL;
			gchar* txt = NULL;
			gchar* _tmp38_;
			const gchar* _tmp39_;
			GtkLabel* _tmp40_;
			const gchar* _tmp41_ = NULL;
			GtkLabel* _tmp42_;
			GtkLabel* _tmp43_;
			GtkLabel* _tmp44_;
			GtkLabel* _tmp45_;
			GtkOverlay* _tmp46_;
			GtkLabel* _tmp47_;
			if (self->priv->unread_count > 99) {
				gchar* _tmp36_;
				_tmp36_ = g_strdup ("99+");
				_g_free0 (_tmp35_);
				_tmp35_ = _tmp36_;
			} else {
				gchar* _tmp37_;
				_tmp37_ = g_strdup_printf ("%i", self->priv->unread_count);
				_g_free0 (_tmp35_);
				_tmp35_ = _tmp37_;
			}
			_tmp38_ = _tmp35_;
			_tmp35_ = NULL;
			txt = _tmp38_;
			_tmp39_ = txt;
			_tmp40_ = (GtkLabel*) gtk_label_new (_tmp39_);
			g_object_ref_sink (_tmp40_);
			_g_object_unref0 (self->priv->compact_unread_count);
			self->priv->compact_unread_count = _tmp40_;
			if (self->priv->is_muted) {
				_tmp41_ = "compact-unread-badge-muted";
			} else {
				_tmp41_ = "compact-unread-badge";
			}
			_tmp42_ = self->priv->compact_unread_count;
			gtk_widget_add_css_class ((GtkWidget*) _tmp42_, _tmp41_);
			_tmp43_ = self->priv->compact_unread_count;
			gtk_widget_set_halign ((GtkWidget*) _tmp43_, GTK_ALIGN_END);
			_tmp44_ = self->priv->compact_unread_count;
			gtk_widget_set_valign ((GtkWidget*) _tmp44_, GTK_ALIGN_START);
			_tmp45_ = self->priv->compact_unread_count;
			gtk_widget_set_visible ((GtkWidget*) _tmp45_, FALSE);
			_tmp46_ = self->priv->avatar_overlay;
			_tmp47_ = self->priv->compact_unread_count;
			gtk_overlay_add_overlay (_tmp46_, (GtkWidget*) _tmp47_);
			_g_free0 (txt);
			_g_free0 (_tmp35_);
		}
	}
	if (self->priv->is_pinned) {
		GtkImage* _tmp48_;
		GtkImage* _tmp49_;
		GtkImage* _tmp50_;
		GtkImage* _tmp51_;
		GtkImage* _tmp52_;
		GtkImage* _tmp53_;
		GtkOverlay* _tmp54_;
		GtkImage* _tmp55_;
		_tmp48_ = (GtkImage*) gtk_image_new_from_icon_name ("view-pin-symbolic");
		g_object_ref_sink (_tmp48_);
		_g_object_unref0 (self->priv->compact_pin_icon);
		self->priv->compact_pin_icon = _tmp48_;
		_tmp49_ = self->priv->compact_pin_icon;
		gtk_image_set_pixel_size (_tmp49_, 12);
		_tmp50_ = self->priv->compact_pin_icon;
		gtk_widget_add_css_class ((GtkWidget*) _tmp50_, "compact-pin-marker");
		_tmp51_ = self->priv->compact_pin_icon;
		gtk_widget_set_halign ((GtkWidget*) _tmp51_, GTK_ALIGN_END);
		_tmp52_ = self->priv->compact_pin_icon;
		gtk_widget_set_valign ((GtkWidget*) _tmp52_, GTK_ALIGN_END);
		_tmp53_ = self->priv->compact_pin_icon;
		gtk_widget_set_visible ((GtkWidget*) _tmp53_, FALSE);
		_tmp54_ = self->priv->avatar_overlay;
		_tmp55_ = self->priv->compact_pin_icon;
		gtk_overlay_add_overlay (_tmp54_, (GtkWidget*) _tmp55_);
	}
	_tmp56_ = self->priv->avatar_overlay;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp56_);
	_tmp57_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	g_object_ref_sink (_tmp57_);
	_g_object_unref0 (self->priv->mid_box);
	self->priv->mid_box = _tmp57_;
	_tmp58_ = self->priv->mid_box;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp58_, TRUE);
	_tmp59_ = self->priv->mid_box;
	gtk_widget_set_valign ((GtkWidget*) _tmp59_, GTK_ALIGN_CENTER);
	_tmp60_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp60_);
	top = _tmp60_;
	if (self->priv->has_unread) {
		GtkLabel* dot = NULL;
		GtkLabel* _tmp61_;
		const gchar* _tmp62_ = NULL;
		GtkLabel* _tmp63_;
		GtkBox* _tmp64_;
		GtkLabel* _tmp65_;
		_tmp61_ = (GtkLabel*) gtk_label_new ("●");
		g_object_ref_sink (_tmp61_);
		dot = _tmp61_;
		if (self->priv->is_muted) {
			_tmp62_ = "unread-dot-muted";
		} else {
			_tmp62_ = "unread-dot";
		}
		_tmp63_ = dot;
		gtk_widget_add_css_class ((GtkWidget*) _tmp63_, _tmp62_);
		_tmp64_ = top;
		_tmp65_ = dot;
		gtk_box_append (_tmp64_, (GtkWidget*) _tmp65_);
		_g_object_unref0 (dot);
	}
	_tmp66_ = dc_chat_entry_get_name (entry);
	_tmp67_ = _tmp66_;
	_tmp68_ = (GtkLabel*) gtk_label_new (_tmp67_);
	g_object_ref_sink (_tmp68_);
	name_label = _tmp68_;
	_tmp69_ = name_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp69_, "heading");
	if (self->priv->has_unread) {
		GtkLabel* _tmp70_;
		_tmp70_ = name_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp70_, "unread-name");
	}
	_tmp71_ = name_label;
	gtk_label_set_ellipsize (_tmp71_, PANGO_ELLIPSIZE_END);
	_tmp72_ = name_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp72_, TRUE);
	_tmp73_ = name_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp73_, GTK_ALIGN_START);
	_tmp74_ = name_label;
	gtk_label_set_xalign (_tmp74_, (gfloat) 0);
	_tmp75_ = top;
	_tmp76_ = name_label;
	gtk_box_append (_tmp75_, (GtkWidget*) _tmp76_);
	if (self->priv->is_pinned) {
		GtkLabel* pin_label = NULL;
		GtkLabel* _tmp77_;
		GtkLabel* _tmp78_;
		GtkLabel* _tmp79_;
		GtkBox* _tmp80_;
		GtkLabel* _tmp81_;
		_tmp77_ = (GtkLabel*) gtk_label_new ("📌");
		g_object_ref_sink (_tmp77_);
		pin_label = _tmp77_;
		_tmp78_ = pin_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp78_, "dim-label");
		_tmp79_ = pin_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp79_, "caption");
		_tmp80_ = top;
		_tmp81_ = pin_label;
		gtk_box_append (_tmp80_, (GtkWidget*) _tmp81_);
		_g_object_unref0 (pin_label);
	}
	_tmp82_ = dc_chat_entry_get_timestamp (entry);
	_tmp83_ = _tmp82_;
	_tmp84_ = dc_chat_row_format_time (_tmp83_);
	_tmp85_ = _tmp84_;
	_tmp86_ = (GtkLabel*) gtk_label_new (_tmp85_);
	g_object_ref_sink (_tmp86_);
	_tmp87_ = _tmp86_;
	_g_free0 (_tmp85_);
	time_label = _tmp87_;
	_tmp88_ = time_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp88_, "dim-label");
	_tmp89_ = time_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp89_, "caption");
	_tmp90_ = top;
	_tmp91_ = time_label;
	gtk_box_append (_tmp90_, (GtkWidget*) _tmp91_);
	_tmp92_ = self->priv->mid_box;
	_tmp93_ = top;
	gtk_box_append (_tmp92_, (GtkWidget*) _tmp93_);
	_tmp94_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp94_);
	bot = _tmp94_;
	_tmp95_ = dc_chat_row_format_preview (entry);
	_tmp96_ = _tmp95_;
	_tmp97_ = (GtkLabel*) gtk_label_new (_tmp96_);
	g_object_ref_sink (_tmp97_);
	_tmp98_ = _tmp97_;
	_g_free0 (_tmp96_);
	preview_label = _tmp98_;
	if (!self->priv->has_unread) {
		GtkLabel* _tmp99_;
		_tmp99_ = preview_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp99_, "dim-label");
	}
	_tmp100_ = preview_label;
	gtk_label_set_ellipsize (_tmp100_, PANGO_ELLIPSIZE_END);
	_tmp101_ = preview_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp101_, TRUE);
	_tmp102_ = preview_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp102_, GTK_ALIGN_START);
	_tmp103_ = preview_label;
	gtk_label_set_xalign (_tmp103_, (gfloat) 0);
	_tmp104_ = preview_label;
	gtk_label_set_max_width_chars (_tmp104_, 30);
	_tmp105_ = bot;
	_tmp106_ = preview_label;
	gtk_box_append (_tmp105_, (GtkWidget*) _tmp106_);
	if (self->priv->is_request) {
		GtkLabel* _tmp107_;
		GtkLabel* _tmp108_;
		GtkLabel* _tmp109_;
		GtkLabel* _tmp110_;
		GtkBox* _tmp111_;
		GtkLabel* _tmp112_;
		_tmp107_ = (GtkLabel*) gtk_label_new ("Request");
		g_object_ref_sink (_tmp107_);
		_g_object_unref0 (self->priv->badge_label);
		self->priv->badge_label = _tmp107_;
		_tmp108_ = self->priv->badge_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp108_, "contact-request-badge");
		_tmp109_ = self->priv->badge_label;
		gtk_widget_set_halign ((GtkWidget*) _tmp109_, GTK_ALIGN_END);
		_tmp110_ = self->priv->badge_label;
		gtk_widget_set_valign ((GtkWidget*) _tmp110_, GTK_ALIGN_CENTER);
		_tmp111_ = bot;
		_tmp112_ = self->priv->badge_label;
		gtk_box_append (_tmp111_, (GtkWidget*) _tmp112_);
	} else {
		if (self->priv->has_unread) {
			gchar* _tmp113_;
			gchar* _tmp114_;
			GtkLabel* _tmp115_;
			const gchar* _tmp116_ = NULL;
			GtkLabel* _tmp117_;
			GtkLabel* _tmp118_;
			GtkLabel* _tmp119_;
			GtkBox* _tmp120_;
			GtkLabel* _tmp121_;
			_tmp113_ = g_strdup_printf ("%i", self->priv->unread_count);
			_tmp114_ = _tmp113_;
			_tmp115_ = (GtkLabel*) gtk_label_new (_tmp114_);
			g_object_ref_sink (_tmp115_);
			_g_object_unref0 (self->priv->badge_label);
			self->priv->badge_label = _tmp115_;
			_g_free0 (_tmp114_);
			if (self->priv->is_muted) {
				_tmp116_ = "unread-badge-muted";
			} else {
				_tmp116_ = "unread-badge";
			}
			_tmp117_ = self->priv->badge_label;
			gtk_widget_add_css_class ((GtkWidget*) _tmp117_, _tmp116_);
			_tmp118_ = self->priv->badge_label;
			gtk_widget_set_halign ((GtkWidget*) _tmp118_, GTK_ALIGN_END);
			_tmp119_ = self->priv->badge_label;
			gtk_widget_set_valign ((GtkWidget*) _tmp119_, GTK_ALIGN_CENTER);
			_tmp120_ = bot;
			_tmp121_ = self->priv->badge_label;
			gtk_box_append (_tmp120_, (GtkWidget*) _tmp121_);
		}
	}
	_tmp122_ = self->priv->mid_box;
	_tmp123_ = bot;
	gtk_box_append (_tmp122_, (GtkWidget*) _tmp123_);
	_tmp124_ = self->priv->mid_box;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp124_);
	_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_ = g_strdup (_tmp0_);
	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
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));
}

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

void
dc_chat_context_menu_show (DcChatContextMenu* self,
                           gint chat_id,
                           gdouble x,
                           gdouble y,
                           GtkWidget* parent)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	dc_chat_context_menu_show_loaded (self, chat_id, x, y, parent, NULL, NULL);
}

static void
dc_chat_context_menu_show_loaded_data_free (gpointer _data)
{
	DcChatContextMenuShowLoadedData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->parent);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuShowLoadedData, _data_);
}

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

static void
dc_chat_context_menu_show_loaded (DcChatContextMenu* self,
                                  gint chat_id,
                                  gdouble x,
                                  gdouble y,
                                  GtkWidget* parent,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	DcChatContextMenuShowLoadedData* _data_;
	DcChatContextMenu* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuShowLoadedData);
	_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_show_loaded_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->x = x;
	_data_->y = y;
	_tmp1_ = _g_object_ref0 (parent);
	_g_object_unref0 (_data_->parent);
	_data_->parent = _tmp1_;
	dc_chat_context_menu_show_loaded_co (_data_);
}

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

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

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

static void
dc_chat_context_menu_show_loaded_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	DcChatContextMenuShowLoadedData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_show_loaded_co (_data_);
}

static void
__lambda99_ (Block11Data* _data11_)
{
	DcChatContextMenu* self;
	GtkPopover* _tmp0_;
	self = _data11_->self;
	_tmp0_ = _data11_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_chat_context_menu_toggle_pin (self, _data11_->chat_id, _data11_->is_pinned, NULL, NULL);
}

static void
___lambda99__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda99_ (self);
}

static void
__lambda100_ (Block11Data* _data11_)
{
	DcChatContextMenu* self;
	GtkPopover* _tmp0_;
	self = _data11_->self;
	_tmp0_ = _data11_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_chat_context_menu_show_info (self, _data11_->chat_id, NULL, NULL);
}

static void
___lambda100__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda100_ (self);
}

static Block12Data*
block12_data_ref (Block12Data* _data12_)
{
	g_atomic_int_inc (&_data12_->_ref_count_);
	return _data12_;
}

static void
block12_data_unref (void * _userdata_)
{
	Block12Data* _data12_;
	_data12_ = (Block12Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data12_->_ref_count_)) {
		DcChatContextMenu* self;
		self = _data12_->_data11_->self;
		_g_object_unref0 (_data12_->contact);
		block11_data_unref (_data12_->_data11_);
		_data12_->_data11_ = NULL;
		g_slice_free (Block12Data, _data12_);
	}
}

static void
___lambda129_ (Block12Data* _data12_)
{
	Block11Data* _data11_;
	DcChatContextMenu* self;
	GtkPopover* _tmp0_;
	DcContact* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	_data11_ = _data12_->_data11_;
	self = _data11_->self;
	_tmp0_ = _data11_->popover;
	gtk_popover_popdown (_tmp0_);
	_tmp1_ = _data12_->contact;
	_tmp2_ = dc_contact_get_is_blocked (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		DcContact* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		_tmp4_ = _data12_->contact;
		_tmp5_ = dc_contact_get_id (_tmp4_);
		_tmp6_ = _tmp5_;
		dc_chat_context_menu_unblock_contact (self, _data11_->chat_id, _tmp6_, NULL, NULL);
	} else {
		DcContact* _tmp7_;
		_tmp7_ = _data12_->contact;
		dc_chat_context_menu_confirm_block_contact (self, _data11_->chat_id, _tmp7_);
	}
}

static void
____lambda129__gtk_button_clicked (GtkButton* _sender,
                                   gpointer self)
{
	___lambda129_ (self);
}

static void
__lambda131_ (Block11Data* _data11_)
{
	DcChatContextMenu* self;
	GtkPopover* _tmp0_;
	self = _data11_->self;
	_tmp0_ = _data11_->popover;
	gtk_popover_popdown (_tmp0_);
	dc_chat_context_menu_confirm_delete (self, _data11_->chat_id, NULL, NULL);
}

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

static void
__lambda133_ (Block11Data* _data11_)
{
	DcChatContextMenu* self;
	GtkPopover* _tmp0_;
	self = _data11_->self;
	_tmp0_ = _data11_->popover;
	gtk_widget_unparent ((GtkWidget*) _tmp0_);
}

static void
___lambda133__gtk_popover_closed (GtkPopover* _sender,
                                  gpointer self)
{
	__lambda133_ (self);
}

static gboolean
dc_chat_context_menu_show_loaded_co (DcChatContextMenuShowLoadedData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data11_ = g_slice_new0 (Block11Data);
	_data_->_data11_->_ref_count_ = 1;
	_data_->_data11_->self = g_object_ref (_data_->self);
	_data_->_data11_->chat_id = _data_->chat_id;
	_data_->_data11_->_async_data_ = _data_;
	_data_->_data11_->is_pinned = FALSE;
	_data_->_tmp0_ = _data_->self->priv->chat_store;
	_data_->_tmp1_ = dc_find_chat_entry (_data_->_tmp0_, _data_->_data11_->chat_id);
	_data_->entry = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->entry;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->entry;
		_data_->_tmp4_ = dc_chat_entry_get_is_pinned (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_data11_->is_pinned = _data_->_tmp5_;
	}
	_data_->dm_contact = NULL;
	{
		_data_->_state_ = 1;
		dc_chat_context_menu_load_dm_contact (_data_->self, _data_->_data11_->chat_id, dc_chat_context_menu_show_loaded_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp7_ = dc_chat_context_menu_load_dm_contact_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp6_ = _data_->_tmp7_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp8_ = _data_->_tmp6_;
		_data_->_tmp6_ = NULL;
		_g_object_unref0 (_data_->dm_contact);
		_data_->dm_contact = _data_->_tmp8_;
		_g_object_unref0 (_data_->_tmp6_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_g_object_unref0 (_data_->dm_contact);
		_data_->dm_contact = NULL;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->dm_contact);
		_g_object_unref0 (_data_->entry);
		block11_data_unref (_data_->_data11_);
		_data_->_data11_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp9_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_data_->_tmp9_);
	_data_->_data11_->popover = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->_data11_->popover;
	gtk_popover_set_has_arrow (_data_->_tmp10_, FALSE);
	_data_->_tmp11_ = _data_->_data11_->popover;
	gtk_widget_set_parent ((GtkWidget*) _data_->_tmp11_, _data_->parent);
	_data_->_tmp12_ = _data_->_data11_->popover;
	memset (&_data_->_tmp13_, 0, sizeof (GdkRectangle));
	_data_->_tmp13_.x = (gint) _data_->x;
	_data_->_tmp13_.y = (gint) _data_->y;
	_data_->_tmp13_.width = 1;
	_data_->_tmp13_.height = 1;
	gtk_popover_set_pointing_to (_data_->_tmp12_, &_data_->_tmp13_);
	_data_->_tmp14_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_data_->_tmp14_);
	_data_->box = _data_->_tmp14_;
	_data_->_tmp15_ = _data_->box;
	gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp15_, "menu");
	if (_data_->_data11_->is_pinned) {
		_data_->_tmp16_ = "Unpin";
	} else {
		_data_->_tmp16_ = "Pin";
	}
	_data_->_tmp17_ = dc_chat_context_menu_make_menu_button (_data_->_tmp16_);
	_data_->pin_btn = _data_->_tmp17_;
	_data_->_tmp18_ = _data_->pin_btn;
	g_signal_connect_data (_data_->_tmp18_, "clicked", (GCallback) ___lambda99__gtk_button_clicked, block11_data_ref (_data_->_data11_), (GClosureNotify) block11_data_unref, 0);
	_data_->_tmp19_ = _data_->box;
	_data_->_tmp20_ = _data_->pin_btn;
	gtk_box_append (_data_->_tmp19_, (GtkWidget*) _data_->_tmp20_);
	_data_->_tmp21_ = dc_chat_context_menu_make_menu_button ("Chat Info");
	_data_->info_btn = _data_->_tmp21_;
	_data_->_tmp22_ = _data_->info_btn;
	g_signal_connect_data (_data_->_tmp22_, "clicked", (GCallback) ___lambda100__gtk_button_clicked, block11_data_ref (_data_->_data11_), (GClosureNotify) block11_data_unref, 0);
	_data_->_tmp23_ = _data_->box;
	_data_->_tmp24_ = _data_->info_btn;
	gtk_box_append (_data_->_tmp23_, (GtkWidget*) _data_->_tmp24_);
	_data_->_tmp25_ = _data_->dm_contact;
	if (_data_->_tmp25_ != NULL) {
		_data_->_data12_ = g_slice_new0 (Block12Data);
		_data_->_data12_->_ref_count_ = 1;
		_data_->_data12_->_data11_ = block11_data_ref (_data_->_data11_);
		_data_->_tmp26_ = _data_->dm_contact;
		_data_->_tmp27_ = _g_object_ref0 (_data_->_tmp26_);
		_data_->_data12_->contact = _data_->_tmp27_;
		_data_->_tmp29_ = _data_->_data12_->contact;
		_data_->_tmp30_ = dc_contact_get_is_blocked (_data_->_tmp29_);
		_data_->_tmp31_ = _data_->_tmp30_;
		if (_data_->_tmp31_) {
			_data_->_tmp28_ = "Unblock contact";
		} else {
			_data_->_tmp28_ = "Block contact…";
		}
		_data_->_tmp32_ = dc_chat_context_menu_make_menu_button (_data_->_tmp28_);
		_data_->block_btn = _data_->_tmp32_;
		_data_->_tmp33_ = _data_->_data12_->contact;
		_data_->_tmp34_ = dc_contact_get_is_blocked (_data_->_tmp33_);
		_data_->_tmp35_ = _data_->_tmp34_;
		if (!_data_->_tmp35_) {
			_data_->_tmp36_ = _data_->block_btn;
			gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp36_, "destructive-action");
		}
		_data_->_tmp37_ = _data_->block_btn;
		g_signal_connect_data (_data_->_tmp37_, "clicked", (GCallback) ____lambda129__gtk_button_clicked, block12_data_ref (_data_->_data12_), (GClosureNotify) block12_data_unref, 0);
		_data_->_tmp38_ = _data_->box;
		_data_->_tmp39_ = _data_->block_btn;
		gtk_box_append (_data_->_tmp38_, (GtkWidget*) _data_->_tmp39_);
		_g_object_unref0 (_data_->block_btn);
		block12_data_unref (_data_->_data12_);
		_data_->_data12_ = NULL;
	}
	_data_->_tmp40_ = dc_chat_context_menu_make_menu_button ("Delete…");
	_data_->del_btn = _data_->_tmp40_;
	g_signal_connect_data (_data_->del_btn, "clicked", (GCallback) ___lambda131__gtk_button_clicked, block11_data_ref (_data_->_data11_), (GClosureNotify) block11_data_unref, 0);
	_data_->_tmp41_ = _data_->box;
	gtk_box_append (_data_->_tmp41_, (GtkWidget*) _data_->del_btn);
	_data_->_tmp42_ = _data_->_data11_->popover;
	_data_->_tmp43_ = _data_->box;
	gtk_popover_set_child (_data_->_tmp42_, (GtkWidget*) _data_->_tmp43_);
	_data_->_tmp44_ = _data_->_data11_->popover;
	g_signal_connect_data (_data_->_tmp44_, "closed", (GCallback) ___lambda133__gtk_popover_closed, block11_data_ref (_data_->_data11_), (GClosureNotify) block11_data_unref, 0);
	_data_->_tmp45_ = _data_->_data11_->popover;
	gtk_popover_popup (_data_->_tmp45_);
	_g_object_unref0 (_data_->del_btn);
	_g_object_unref0 (_data_->info_btn);
	_g_object_unref0 (_data_->pin_btn);
	_g_object_unref0 (_data_->box);
	_g_object_unref0 (_data_->dm_contact);
	_g_object_unref0 (_data_->entry);
	block11_data_unref (_data_->_data11_);
	_data_->_data11_ = 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_load_dm_contact_data_free (gpointer _data)
{
	DcChatContextMenuLoadDmContactData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuLoadDmContactData, _data_);
}

static void
dc_chat_context_menu_load_dm_contact (DcChatContextMenu* self,
                                      gint chat_id,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcChatContextMenuLoadDmContactData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuLoadDmContactData);
	_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_load_dm_contact_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_chat_context_menu_load_dm_contact_co (_data_);
}

static DcContact*
dc_chat_context_menu_load_dm_contact_finish (DcChatContextMenu* self,
                                             GAsyncResult* _res_,
                                             GError** error)
{
	DcContact* result;
	DcChatContextMenuLoadDmContactData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
dc_chat_context_menu_load_dm_contact_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcChatContextMenuLoadDmContactData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_load_dm_contact_co (_data_);
}

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

static gboolean
dc_chat_context_menu_load_dm_contact_co (DcChatContextMenuLoadDmContactData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_state_ = 1;
	dc_rpc_client_get_full_chat_by_id (_data_->_tmp0_, _data_->chat_id, dc_chat_context_menu_load_dm_contact_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = dc_rpc_client_get_full_chat_by_id_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
	_data_->chat = _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->chat;
	if (_data_->_tmp2_ == NULL) {
		_data_->result = NULL;
		_json_object_unref0 (_data_->chat);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->chat;
	_data_->_tmp5_ = dc_json_str (_data_->_tmp4_, "chatType");
	_data_->_tmp3_ = _data_->_tmp5_;
	if (_data_->_tmp3_ == NULL) {
		_data_->_tmp6_ = g_strdup ("");
		_g_free0 (_data_->_tmp3_);
		_data_->_tmp3_ = _data_->_tmp6_;
	}
	_data_->_tmp7_ = _data_->_tmp3_;
	_data_->_tmp3_ = NULL;
	_data_->chat_type = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->chat;
	_data_->is_self_talk = dc_json_bool (_data_->_tmp8_, "isSelfTalk");
	_data_->_tmp9_ = _data_->chat;
	_data_->is_device_chat = dc_json_bool (_data_->_tmp9_, "isDeviceChat");
	_data_->_tmp12_ = _data_->chat_type;
	if (g_strcmp0 (_data_->_tmp12_, "Single") != 0) {
		_data_->_tmp11_ = TRUE;
	} else {
		_data_->_tmp11_ = _data_->is_self_talk;
	}
	if (_data_->_tmp11_) {
		_data_->_tmp10_ = TRUE;
	} else {
		_data_->_tmp10_ = _data_->is_device_chat;
	}
	if (_data_->_tmp10_) {
		_data_->result = NULL;
		_g_free0 (_data_->chat_type);
		_g_free0 (_data_->_tmp3_);
		_json_object_unref0 (_data_->chat);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp13_ = _data_->chat;
	if (!json_object_has_member (_data_->_tmp13_, "contactIds")) {
		_data_->result = NULL;
		_g_free0 (_data_->chat_type);
		_g_free0 (_data_->_tmp3_);
		_json_object_unref0 (_data_->chat);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp14_ = _data_->chat;
	_data_->_tmp15_ = json_object_get_array_member (_data_->_tmp14_, "contactIds");
	_data_->_tmp16_ = _json_array_ref0 (_data_->_tmp15_);
	_data_->ids = _data_->_tmp16_;
	_data_->_tmp18_ = _data_->ids;
	if (_data_->_tmp18_ == NULL) {
		_data_->_tmp17_ = TRUE;
	} else {
		_data_->_tmp19_ = _data_->ids;
		_data_->_tmp17_ = json_array_get_length (_data_->_tmp19_) == ((guint) 0);
	}
	if (_data_->_tmp17_) {
		_data_->result = NULL;
		_json_array_unref0 (_data_->ids);
		_g_free0 (_data_->chat_type);
		_g_free0 (_data_->_tmp3_);
		_json_object_unref0 (_data_->chat);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp20_ = _data_->ids;
	_data_->contact_id = (gint) json_array_get_int_element (_data_->_tmp20_, (guint) 0);
	if (_data_->contact_id <= 1) {
		_data_->result = NULL;
		_json_array_unref0 (_data_->ids);
		_g_free0 (_data_->chat_type);
		_g_free0 (_data_->_tmp3_);
		_json_object_unref0 (_data_->chat);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp21_ = _data_->self->priv->rpc;
	_data_->_state_ = 2;
	dc_rpc_client_get_contact (_data_->_tmp21_, _data_->contact_id, dc_chat_context_menu_load_dm_contact_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp22_ = dc_rpc_client_get_contact_finish (_data_->_tmp21_, _data_->_res_, &_data_->_inner_error0_);
	_data_->obj = _data_->_tmp22_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_json_array_unref0 (_data_->ids);
		_g_free0 (_data_->chat_type);
		_g_free0 (_data_->_tmp3_);
		_json_object_unref0 (_data_->chat);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp23_ = _data_->obj;
	if (_data_->_tmp23_ == NULL) {
		_data_->result = NULL;
		_json_object_unref0 (_data_->obj);
		_json_array_unref0 (_data_->ids);
		_g_free0 (_data_->chat_type);
		_g_free0 (_data_->_tmp3_);
		_json_object_unref0 (_data_->chat);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp24_ = _data_->obj;
	_data_->_tmp25_ = dc_rpc_parsers_parse_contact (_data_->contact_id, _data_->_tmp24_);
	_data_->result = _data_->_tmp25_;
	_json_object_unref0 (_data_->obj);
	_json_array_unref0 (_data_->ids);
	_g_free0 (_data_->chat_type);
	_g_free0 (_data_->_tmp3_);
	_json_object_unref0 (_data_->chat);
	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 gchar*
dc_chat_context_menu_contact_label (DcContact* contact)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gchar* _tmp14_;
	gchar* result;
	g_return_val_if_fail (contact != NULL, NULL);
	_tmp0_ = dc_contact_get_display_name (contact);
	_tmp1_ = _tmp0_;
	_tmp2_ = strlen (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ > 0) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = dc_contact_get_display_name (contact);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strdup (_tmp5_);
		result = _tmp6_;
		return result;
	}
	_tmp7_ = dc_contact_get_address (contact);
	_tmp8_ = _tmp7_;
	_tmp9_ = strlen (_tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_ > 0) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp11_ = dc_contact_get_address (contact);
		_tmp12_ = _tmp11_;
		_tmp13_ = g_strdup (_tmp12_);
		result = _tmp13_;
		return result;
	}
	_tmp14_ = g_strdup ("contact");
	result = _tmp14_;
	return result;
}

static GtkButton*
dc_chat_context_menu_make_menu_button (const gchar* label)
{
	GtkButton* btn = NULL;
	GtkButton* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* _tmp4_;
	GtkButton* result;
	g_return_val_if_fail (label != NULL, NULL);
	_tmp0_ = (GtkButton*) gtk_button_new_with_label (label);
	g_object_ref_sink (_tmp0_);
	btn = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) btn, "flat");
	_tmp1_ = gtk_button_get_child (btn);
	_tmp2_ = _tmp1_;
	gtk_label_set_xalign (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_label_get_type (), GtkLabel), (gfloat) 0);
	_tmp3_ = gtk_button_get_child (btn);
	_tmp4_ = _tmp3_;
	gtk_widget_set_halign ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, gtk_label_get_type (), GtkLabel), GTK_ALIGN_START);
	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 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_show_info_data_free (gpointer _data)
{
	DcChatContextMenuShowInfoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuShowInfoData, _data_);
}

static void
dc_chat_context_menu_show_info (DcChatContextMenu* self,
                                gint chat_id,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	DcChatContextMenuShowInfoData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuShowInfoData);
	_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_show_info_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	dc_chat_context_menu_show_info_co (_data_);
}

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

static Block13Data*
block13_data_ref (Block13Data* _data13_)
{
	g_atomic_int_inc (&_data13_->_ref_count_);
	return _data13_;
}

static void
block13_data_unref (void * _userdata_)
{
	Block13Data* _data13_;
	_data13_ = (Block13Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data13_->_ref_count_)) {
		DcChatContextMenu* self;
		self = _data13_->self;
		_g_object_unref0 (self);
		g_slice_free (Block13Data, _data13_);
	}
}

static void
__lambda126_ (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
___lambda126__dc_chat_info_dialog_chat_deleted (DcChatInfoDialog* _sender,
                                                gint chat_id,
                                                gpointer self)
{
	__lambda126_ ((DcChatContextMenu*) self, chat_id);
}

static void
__lambda127_ (Block13Data* _data13_)
{
	DcChatContextMenu* self;
	DcWindow* _tmp0_;
	DcWindow* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	self = _data13_->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_ == _data13_->chat_id) {
		DcWindow* _tmp4_;
		_tmp4_ = self->priv->window;
		dc_window_request_messages_reload (_tmp4_);
	}
}

static void
___lambda127__dc_chat_info_dialog_chat_changed (DcChatInfoDialog* _sender,
                                                gpointer self)
{
	__lambda127_ (self);
}

static void
__lambda128_ (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
___lambda128__dc_chat_info_dialog_contact_blocked (DcChatInfoDialog* _sender,
                                                   gint chat_id,
                                                   gpointer self)
{
	__lambda128_ ((DcChatContextMenu*) self, chat_id);
}

static gboolean
dc_chat_context_menu_show_info_co (DcChatContextMenuShowInfoData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data13_ = g_slice_new0 (Block13Data);
	_data_->_data13_->_ref_count_ = 1;
	_data_->_data13_->self = g_object_ref (_data_->self);
	_data_->_data13_->chat_id = _data_->chat_id;
	_data_->_data13_->_async_data_ = _data_;
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_chat_info_dialog_new (_data_->_tmp0_, _data_->_data13_->chat_id);
	g_object_ref_sink (_data_->_tmp1_);
	_data_->dialog = _data_->_tmp1_;
	g_signal_connect_object (_data_->dialog, "chat-deleted", (GCallback) ___lambda126__dc_chat_info_dialog_chat_deleted, _data_->self, 0);
	g_signal_connect_data (_data_->dialog, "chat-changed", (GCallback) ___lambda127__dc_chat_info_dialog_chat_changed, block13_data_ref (_data_->_data13_), (GClosureNotify) block13_data_unref, 0);
	g_signal_connect_object (_data_->dialog, "contact-blocked", (GCallback) ___lambda128__dc_chat_info_dialog_contact_blocked, _data_->self, 0);
	_data_->_tmp2_ = _data_->self->priv->window;
	adw_dialog_present ((AdwDialog*) _data_->dialog, (GtkWidget*) _data_->_tmp2_);
	_g_object_unref0 (_data_->dialog);
	block13_data_unref (_data_->_data13_);
	_data_->_data13_ = 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 Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		DcChatContextMenu* self;
		self = _data14_->self;
		_g_object_unref0 (_data14_->contact);
		_g_object_unref0 (self);
		g_slice_free (Block14Data, _data14_);
	}
}

static void
__lambda130_ (Block14Data* _data14_)
{
	DcChatContextMenu* self;
	gint _tmp0_;
	gint _tmp1_;
	self = _data14_->self;
	_tmp0_ = dc_contact_get_id (_data14_->contact);
	_tmp1_ = _tmp0_;
	dc_chat_context_menu_block_contact (self, _data14_->chat_id, _tmp1_, NULL, NULL);
}

static void
___lambda130__dc_void_func (gpointer self)
{
	__lambda130_ (self);
}

static void
dc_chat_context_menu_confirm_block_contact (DcChatContextMenu* self,
                                            gint chat_id,
                                            DcContact* contact)
{
	Block14Data* _data14_;
	DcContact* _tmp0_;
	gchar* label = NULL;
	gchar* _tmp1_;
	DcWindow* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (contact != NULL);
	_data14_ = g_slice_new0 (Block14Data);
	_data14_->_ref_count_ = 1;
	_data14_->self = g_object_ref (self);
	_data14_->chat_id = chat_id;
	_tmp0_ = _g_object_ref0 (contact);
	_g_object_unref0 (_data14_->contact);
	_data14_->contact = _tmp0_;
	_tmp1_ = dc_chat_context_menu_contact_label (_data14_->contact);
	label = _tmp1_;
	_tmp2_ = self->priv->window;
	_tmp3_ = g_strdup_printf ("Block \"%s\"? You will no longer receive messages from this contact.", label);
	_tmp4_ = _tmp3_;
	dc_confirm_action ((GtkWidget*) _tmp2_, "Block Contact", _tmp4_, "block", "Block", ___lambda130__dc_void_func, block14_data_ref (_data14_), block14_data_unref);
	_g_free0 (_tmp4_);
	_g_free0 (label);
	block14_data_unref (_data14_);
	_data14_ = NULL;
}

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

static void
dc_chat_context_menu_block_contact (DcChatContextMenu* self,
                                    gint chat_id,
                                    gint contact_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DcChatContextMenuBlockContactData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuBlockContactData);
	_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_block_contact_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->contact_id = contact_id;
	dc_chat_context_menu_block_contact_co (_data_);
}

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

static void
dc_chat_context_menu_block_contact_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	DcChatContextMenuBlockContactData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_block_contact_co (_data_);
}

static gboolean
dc_chat_context_menu_block_contact_co (DcChatContextMenuBlockContactData* _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_block_contact (_data_->_tmp0_, _data_->contact_id, dc_chat_context_menu_block_contact_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_block_contact_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_, "Contact blocked");
		_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_block_contact_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 ("Failed to block contact: ", _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_unblock_contact_data_free (gpointer _data)
{
	DcChatContextMenuUnblockContactData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (DcChatContextMenuUnblockContactData, _data_);
}

static void
dc_chat_context_menu_unblock_contact (DcChatContextMenu* self,
                                      gint chat_id,
                                      gint contact_id,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcChatContextMenuUnblockContactData* _data_;
	DcChatContextMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcChatContextMenuUnblockContactData);
	_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_unblock_contact_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->chat_id = chat_id;
	_data_->contact_id = contact_id;
	dc_chat_context_menu_unblock_contact_co (_data_);
}

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

static void
dc_chat_context_menu_unblock_contact_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcChatContextMenuUnblockContactData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_chat_context_menu_unblock_contact_co (_data_);
}

static gboolean
dc_chat_context_menu_unblock_contact_co (DcChatContextMenuUnblockContactData* _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_unblock_contact (_data_->_tmp0_, _data_->contact_id, dc_chat_context_menu_unblock_contact_ready, _data_);
		return FALSE;
		_state_1:
		dc_rpc_client_unblock_contact_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_, "Contact unblocked");
		_data_->_tmp2_ = _data_->self->priv->window;
		_data_->_state_ = 2;
		dc_window_load_chats (_data_->_tmp2_, dc_chat_context_menu_unblock_contact_ready, _data_);
		return FALSE;
		_state_2:
		dc_window_load_chats_finish (_data_->_tmp2_, _data_->_res_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp3_ = _data_->self->priv->window;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		_data_->_tmp6_ = g_strconcat ("Failed to unblock contact: ", _data_->_tmp5_, NULL);
		_data_->_tmp7_ = _data_->_tmp6_;
		dc_window_show_toast (_data_->_tmp3_, _data_->_tmp7_);
		_g_free0 (_data_->_tmp7_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
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 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
__lambda132_ (Block15Data* _data15_)
{
	DcChatContextMenu* self;
	self = _data15_->self;
	dc_chat_context_menu_do_delete (self, _data15_->chat_id, NULL, NULL);
}

static void
___lambda132__dc_void_func (gpointer self)
{
	__lambda132_ (self);
}

static gboolean
dc_chat_context_menu_confirm_delete_co (DcChatContextMenuConfirmDeleteData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data15_ = g_slice_new0 (Block15Data);
	_data_->_data15_->_ref_count_ = 1;
	_data_->_data15_->self = g_object_ref (_data_->self);
	_data_->_data15_->chat_id = _data_->chat_id;
	_data_->_data15_->_async_data_ = _data_;
	_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_->_data15_->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 chat list? You may still receive messages if y" \
"ou are a member.", _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	dc_confirm_delete_options ((GtkWidget*) _data_->_tmp8_, "Delete Chat?", _data_->_tmp11_, ___lambda132__dc_void_func, block15_data_ref (_data_->_data15_), block15_data_unref, NULL, NULL, NULL);
	_g_free0 (_data_->_tmp11_);
	_g_object_unref0 (_data_->entry);
	_g_free0 (_data_->chat_name);
	block15_data_unref (_data_->_data15_);
	_data_->_data15_ = 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_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;
}

