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

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <gdk/gdk.h>
#include <glib/gstdio.h>
#include <float.h>
#include <math.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_WEBXDC_MANAGER_DIALOG (dc_webxdc_manager_dialog_get_type ())
#define DC_WEBXDC_MANAGER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_WEBXDC_MANAGER_DIALOG, DcWebxdcManagerDialog))
#define DC_WEBXDC_MANAGER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_WEBXDC_MANAGER_DIALOG, DcWebxdcManagerDialogClass))
#define DC_IS_WEBXDC_MANAGER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_WEBXDC_MANAGER_DIALOG))
#define DC_IS_WEBXDC_MANAGER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_WEBXDC_MANAGER_DIALOG))
#define DC_WEBXDC_MANAGER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_WEBXDC_MANAGER_DIALOG, DcWebxdcManagerDialogClass))

typedef struct _DcWebxdcManagerDialog DcWebxdcManagerDialog;
typedef struct _DcWebxdcManagerDialogClass DcWebxdcManagerDialogClass;
typedef struct _DcWebxdcManagerDialogPrivate DcWebxdcManagerDialogPrivate;

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

#define DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY (dc_webxdc_manager_dialog_app_entry_get_type ())
#define DC_WEBXDC_MANAGER_DIALOG_APP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY, DcWebxdcManagerDialogAppEntry))
#define DC_WEBXDC_MANAGER_DIALOG_APP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY, DcWebxdcManagerDialogAppEntryClass))
#define DC_WEBXDC_MANAGER_DIALOG_IS_APP_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY))
#define DC_WEBXDC_MANAGER_DIALOG_IS_APP_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY))
#define DC_WEBXDC_MANAGER_DIALOG_APP_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY, DcWebxdcManagerDialogAppEntryClass))

typedef struct _DcWebxdcManagerDialogAppEntry DcWebxdcManagerDialogAppEntry;
typedef struct _DcWebxdcManagerDialogAppEntryClass DcWebxdcManagerDialogAppEntryClass;
enum  {
	DC_WEBXDC_MANAGER_DIALOG_0_PROPERTY,
	DC_WEBXDC_MANAGER_DIALOG_NUM_PROPERTIES
};
static GParamSpec* dc_webxdc_manager_dialog_properties[DC_WEBXDC_MANAGER_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _DcWebxdcManagerDialogAppEntryPrivate DcWebxdcManagerDialogAppEntryPrivate;

#define DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE (dc_webxdc_manager_dialog_app_instance_get_type ())
#define DC_WEBXDC_MANAGER_DIALOG_APP_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE, DcWebxdcManagerDialogAppInstance))
#define DC_WEBXDC_MANAGER_DIALOG_APP_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE, DcWebxdcManagerDialogAppInstanceClass))
#define DC_WEBXDC_MANAGER_DIALOG_IS_APP_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE))
#define DC_WEBXDC_MANAGER_DIALOG_IS_APP_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE))
#define DC_WEBXDC_MANAGER_DIALOG_APP_INSTANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE, DcWebxdcManagerDialogAppInstanceClass))

typedef struct _DcWebxdcManagerDialogAppInstance DcWebxdcManagerDialogAppInstance;
typedef struct _DcWebxdcManagerDialogAppInstanceClass DcWebxdcManagerDialogAppInstanceClass;

#define DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER (dc_webxdc_manager_dialog_app_user_get_type ())
#define DC_WEBXDC_MANAGER_DIALOG_APP_USER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER, DcWebxdcManagerDialogAppUser))
#define DC_WEBXDC_MANAGER_DIALOG_APP_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER, DcWebxdcManagerDialogAppUserClass))
#define DC_WEBXDC_MANAGER_DIALOG_IS_APP_USER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER))
#define DC_WEBXDC_MANAGER_DIALOG_IS_APP_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER))
#define DC_WEBXDC_MANAGER_DIALOG_APP_USER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER, DcWebxdcManagerDialogAppUserClass))

typedef struct _DcWebxdcManagerDialogAppUser DcWebxdcManagerDialogAppUser;
typedef struct _DcWebxdcManagerDialogAppUserClass DcWebxdcManagerDialogAppUserClass;
typedef struct _Block21Data Block21Data;
typedef struct _DcWebxdcManagerDialogAppInstancePrivate DcWebxdcManagerDialogAppInstancePrivate;

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

typedef struct _DcMessage DcMessage;
typedef struct _DcMessageClass DcMessageClass;
typedef struct _DcWebxdcManagerDialogReloadData DcWebxdcManagerDialogReloadData;

#define DC_TYPE_PARAMS (dc_params_get_type ())
#define DC_PARAMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DC_TYPE_PARAMS, DcParams))
#define DC_PARAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DC_TYPE_PARAMS, DcParamsClass))
#define DC_IS_PARAMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DC_TYPE_PARAMS))
#define DC_IS_PARAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DC_TYPE_PARAMS))
#define DC_PARAMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DC_TYPE_PARAMS, DcParamsClass))

typedef struct _DcParams DcParams;
typedef struct _DcParamsClass DcParamsClass;
typedef struct _DcWebxdcManagerDialogCollectAccountAppsData DcWebxdcManagerDialogCollectAccountAppsData;
typedef struct _DcWebxdcManagerDialogAccountChatMediaData DcWebxdcManagerDialogAccountChatMediaData;
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
typedef struct _DcWebxdcManagerDialogMergeInfoData DcWebxdcManagerDialogMergeInfoData;
typedef struct _DcWebxdcManagerDialogLookupChatData DcWebxdcManagerDialogLookupChatData;
typedef struct _DcWebxdcManagerDialogAppUserPrivate DcWebxdcManagerDialogAppUserPrivate;
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
typedef struct _Block82Data Block82Data;
typedef struct _Block83Data Block83Data;
typedef struct _Block84Data Block84Data;
typedef struct _Block85Data Block85Data;
typedef struct _Block86Data Block86Data;
typedef struct _Block87Data Block87Data;
typedef struct _Block88Data Block88Data;

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

typedef struct _DcPopoverButton DcPopoverButton;
typedef struct _DcPopoverButtonClass DcPopoverButtonClass;
typedef struct _DcWebxdcManagerDialogSaveAppData DcWebxdcManagerDialogSaveAppData;
typedef struct _Block89Data Block89Data;

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

typedef struct _DcContactPickerDialog DcContactPickerDialog;
typedef struct _DcContactPickerDialogClass DcContactPickerDialogClass;
typedef struct _DcWebxdcManagerDialogSendAndRunData DcWebxdcManagerDialogSendAndRunData;
typedef struct _Block90Data Block90Data;
enum  {
	DC_WEBXDC_MANAGER_DIALOG_APP_INSTANCE_0_PROPERTY,
	DC_WEBXDC_MANAGER_DIALOG_APP_INSTANCE_NUM_PROPERTIES
};
static GParamSpec* dc_webxdc_manager_dialog_app_instance_properties[DC_WEBXDC_MANAGER_DIALOG_APP_INSTANCE_NUM_PROPERTIES];
enum  {
	DC_WEBXDC_MANAGER_DIALOG_APP_USER_0_PROPERTY,
	DC_WEBXDC_MANAGER_DIALOG_APP_USER_NUM_PROPERTIES
};
static GParamSpec* dc_webxdc_manager_dialog_app_user_properties[DC_WEBXDC_MANAGER_DIALOG_APP_USER_NUM_PROPERTIES];
enum  {
	DC_WEBXDC_MANAGER_DIALOG_APP_ENTRY_0_PROPERTY,
	DC_WEBXDC_MANAGER_DIALOG_APP_ENTRY_NUM_PROPERTIES
};
static GParamSpec* dc_webxdc_manager_dialog_app_entry_properties[DC_WEBXDC_MANAGER_DIALOG_APP_ENTRY_NUM_PROPERTIES];

struct _DcWebxdcManagerDialog {
	AdwDialog parent_instance;
	DcWebxdcManagerDialogPrivate * priv;
};

struct _DcWebxdcManagerDialogClass {
	AdwDialogClass parent_class;
};

struct _DcWebxdcManagerDialogPrivate {
	DcWindow* app_window;
	DcRpcClient* rpc;
	AdwNavigationView* nav;
	GtkSearchEntry* search_entry;
	GtkListBox* app_list;
	GtkStack* stack;
	AdwStatusPage* empty_page;
	GPtrArray* apps;
	GHashTable* favorites;
	guint load_generation;
};

struct _DcWebxdcManagerDialogAppEntry {
	GObject parent_instance;
	DcWebxdcManagerDialogAppEntryPrivate * priv;
	gchar* key;
	gchar* name;
	GdkTexture* icon;
	gchar* summary;
	gchar* document;
	gchar* source_code_url;
	gboolean internet_access;
	gchar* author;
	gint64 created;
	gboolean favorite;
	GPtrArray* instances;
	GPtrArray* users;
};

struct _DcWebxdcManagerDialogAppEntryClass {
	GObjectClass parent_class;
};

struct _Block21Data {
	int _ref_count_;
	GPtrArray* self;
	GCompareFunc compare_func;
};

struct _DcWebxdcManagerDialogAppInstance {
	GObject parent_instance;
	DcWebxdcManagerDialogAppInstancePrivate * priv;
	gint account_id;
	gchar* account_label;
	DcMessage* msg;
	gchar* chat_name;
	gchar* chat_avatar;
};

struct _DcWebxdcManagerDialogAppInstanceClass {
	GObjectClass parent_class;
};

struct _DcWebxdcManagerDialogReloadData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWebxdcManagerDialog* self;
	guint gen;
	guint _tmp0_;
	GtkStack* _tmp1_;
	GPtrArray* found;
	GPtrArray* _tmp2_;
	GHashTable* by_key;
	GHashFunc _tmp3_;
	GEqualFunc _tmp4_;
	GHashTable* _tmp5_;
	JsonNode* accounts_node;
	DcRpcClient* _tmp6_;
	JsonNode* _tmp7_;
	JsonNode* _tmp8_;
	JsonArray* accounts;
	JsonNode* _tmp9_;
	JsonArray* _tmp10_;
	JsonArray* _tmp11_;
	guint i;
	gboolean _tmp12_;
	guint _tmp13_;
	JsonArray* _tmp14_;
	JsonObject* acct;
	JsonArray* _tmp15_;
	JsonObject* _tmp16_;
	JsonObject* _tmp17_;
	JsonObject* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gboolean _tmp21_;
	JsonObject* _tmp22_;
	GHashTable* _tmp23_;
	GPtrArray* _tmp24_;
	GError* e;
	GError* _tmp25_;
	const gchar* _tmp26_;
	guint _vala1_i;
	gboolean _tmp27_;
	guint _tmp28_;
	GPtrArray* _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
	DcWebxdcManagerDialogAppEntry* entry;
	GPtrArray* _tmp32_;
	gconstpointer _tmp33_;
	DcWebxdcManagerDialogAppEntry* _tmp34_;
	DcWebxdcManagerDialogAppEntry* _tmp35_;
	GHashTable* _tmp36_;
	DcWebxdcManagerDialogAppEntry* _tmp37_;
	const gchar* _tmp38_;
	DcWebxdcManagerDialogAppEntry* _tmp39_;
	GPtrArray* _tmp40_;
	GPtrArray* _tmp41_;
	GPtrArray* _tmp42_;
	GError* _inner_error0_;
};

struct _DcWebxdcManagerDialogCollectAccountAppsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWebxdcManagerDialog* self;
	JsonObject* acct;
	GHashTable* by_key;
	GPtrArray* found;
	gint acct_id;
	gchar* self_addr;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* account_label;
	gchar* _tmp8_;
	gint* msg_ids;
	gint msg_ids_length1;
	gint _msg_ids_size_;
	JsonObject* map;
	gint* _tmp9_;
	gint _tmp10_;
	gint* _tmp11_;
	gint _tmp9__length1;
	gint __tmp9__size_;
	gint* _tmp12_;
	gint _tmp12__length1;
	gint* _tmp13_;
	gint _tmp13__length1;
	JsonObject* _tmp14_;
	DcRpcClient* _tmp15_;
	gint* _tmp16_;
	gint _tmp16__length1;
	JsonObject* _tmp17_;
	JsonObject* _tmp18_;
	GError* e;
	GError* _tmp19_;
	const gchar* _tmp20_;
	JsonObject* _tmp21_;
	GHashTable* chat_names;
	GHashFunc _tmp22_;
	GEqualFunc _tmp23_;
	GHashTable* _tmp24_;
	GHashTable* chat_avatars;
	GHashFunc _tmp25_;
	GEqualFunc _tmp26_;
	GHashTable* _tmp27_;
	gint* _tmp28_;
	gint _tmp28__length1;
	gint* msg_id_collection;
	gint msg_id_collection_length1;
	gint _msg_id_collection_size_;
	gint msg_id_it;
	gint msg_id;
	gchar* mkey;
	gchar* _tmp29_;
	JsonObject* _tmp30_;
	const gchar* _tmp31_;
	JsonNode* node;
	JsonObject* _tmp32_;
	const gchar* _tmp33_;
	JsonNode* _tmp34_;
	JsonNode* _tmp35_;
	gboolean _tmp36_;
	JsonNode* _tmp37_;
	JsonNode* _tmp38_;
	JsonObject* obj;
	JsonNode* _tmp39_;
	JsonObject* _tmp40_;
	JsonObject* _tmp41_;
	JsonObject* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gboolean _tmp45_;
	DcMessage* msg;
	JsonObject* _tmp46_;
	const gchar* _tmp47_;
	DcMessage* _tmp48_;
	DcMessage* _tmp49_;
	JsonObject* info;
	JsonNode* res;
	DcRpcClient* _tmp50_;
	DcParams* _tmp51_;
	DcParams* _tmp52_;
	DcParams* _tmp53_;
	DcParams* _tmp54_;
	DcMessage* _tmp55_;
	gint _tmp56_;
	gint _tmp57_;
	DcParams* _tmp58_;
	DcParams* _tmp59_;
	JsonNode* _tmp60_;
	JsonNode* _tmp61_;
	JsonNode* _tmp62_;
	JsonNode* _tmp63_;
	JsonNode* _tmp64_;
	JsonObject* _tmp65_;
	JsonObject* _tmp66_;
	GError* _vala1_e;
	DcMessage* _tmp67_;
	gint _tmp68_;
	gint _tmp69_;
	GError* _tmp70_;
	const gchar* _tmp71_;
	gchar* _tmp72_;
	JsonObject* _tmp73_;
	gchar* _tmp74_;
	JsonObject* _tmp75_;
	gchar* _tmp76_;
	gchar* _tmp77_;
	gchar* _tmp78_;
	gchar* _tmp79_;
	gchar* name;
	gchar* _tmp80_;
	const gchar* _tmp81_;
	gint _tmp82_;
	gint _tmp83_;
	DcMessage* _tmp84_;
	gchar* _tmp85_;
	const gchar* _tmp86_;
	gchar* _tmp87_;
	gchar* _tmp88_;
	gboolean _tmp89_;
	const gchar* _tmp90_;
	const gchar* _tmp91_;
	gint _tmp92_;
	gint _tmp93_;
	gchar* _tmp94_;
	gchar* key;
	const gchar* _tmp95_;
	gchar* _tmp96_;
	DcWebxdcManagerDialogAppEntry* entry;
	const gchar* _tmp97_;
	gconstpointer _tmp98_;
	DcWebxdcManagerDialogAppEntry* _tmp99_;
	DcWebxdcManagerDialogAppEntry* _tmp100_;
	DcWebxdcManagerDialogAppEntry* _tmp101_;
	DcWebxdcManagerDialogAppEntry* _tmp102_;
	const gchar* _tmp103_;
	gchar* _tmp104_;
	DcWebxdcManagerDialogAppEntry* _tmp105_;
	const gchar* _tmp106_;
	gchar* _tmp107_;
	const gchar* _tmp108_;
	gchar* _tmp109_;
	DcWebxdcManagerDialogAppEntry* _tmp110_;
	DcWebxdcManagerDialogAppEntry* _tmp111_;
	DcWebxdcManagerDialogAppEntry* _tmp112_;
	DcWebxdcManagerDialogAppEntry* _tmp113_;
	JsonObject* _tmp114_;
	DcWebxdcManagerDialogAppEntry* _tmp115_;
	DcMessage* _tmp116_;
	gint _tmp117_;
	gint _tmp118_;
	JsonObject* _tmp119_;
	gboolean _tmp120_;
	DcWebxdcManagerDialogAppEntry* _tmp121_;
	gboolean _tmp122_;
	DcMessage* _tmp123_;
	gint64 _tmp124_;
	gint64 _tmp125_;
	DcMessage* _tmp126_;
	gint64 _tmp127_;
	gint64 _tmp128_;
	DcWebxdcManagerDialogAppEntry* _tmp129_;
	DcWebxdcManagerDialogAppEntry* _tmp130_;
	DcMessage* _tmp131_;
	gint64 _tmp132_;
	gint64 _tmp133_;
	DcWebxdcManagerDialogAppEntry* _tmp134_;
	DcMessage* _tmp135_;
	gchar* _tmp136_;
	DcWebxdcManagerDialogAppInstance* inst;
	DcWebxdcManagerDialogAppInstance* _tmp137_;
	DcWebxdcManagerDialogAppInstance* _tmp138_;
	DcWebxdcManagerDialogAppInstance* _tmp139_;
	const gchar* _tmp140_;
	gchar* _tmp141_;
	DcWebxdcManagerDialogAppInstance* _tmp142_;
	DcMessage* _tmp143_;
	DcMessage* _tmp144_;
	DcMessage* _tmp145_;
	gint _tmp146_;
	gint _tmp147_;
	GHashTable* _tmp148_;
	GHashTable* _tmp149_;
	gchar* _tmp150_;
	GHashTable* _tmp151_;
	DcMessage* _tmp152_;
	gint _tmp153_;
	gint _tmp154_;
	gconstpointer _tmp155_;
	gchar* _tmp156_;
	DcMessage* _tmp157_;
	gint _tmp158_;
	gint _tmp159_;
	gchar* _tmp160_;
	DcWebxdcManagerDialogAppInstance* _tmp161_;
	gchar* _tmp162_;
	DcWebxdcManagerDialogAppInstance* _tmp163_;
	GHashTable* _tmp164_;
	DcMessage* _tmp165_;
	gint _tmp166_;
	gint _tmp167_;
	gconstpointer _tmp168_;
	gchar* _tmp169_;
	DcWebxdcManagerDialogAppEntry* _tmp170_;
	GPtrArray* _tmp171_;
	DcWebxdcManagerDialogAppInstance* _tmp172_;
	DcWebxdcManagerDialogAppInstance* _tmp173_;
	DcWebxdcManagerDialogAppEntry* _tmp174_;
	DcMessage* _tmp175_;
	GError* _inner_error0_;
};

struct _DcWebxdcManagerDialogAccountChatMediaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWebxdcManagerDialog* self;
	gint acct_id;
	gint* result;
	gint result_length1;
	JsonNode* _result_;
	DcRpcClient* _tmp0_;
	DcParams* _tmp1_;
	DcParams* _tmp2_;
	DcParams* _tmp3_;
	DcParams* _tmp4_;
	DcParams* _tmp5_;
	DcParams* _tmp6_;
	DcParams* _tmp7_;
	DcParams* _tmp8_;
	DcParams* _tmp9_;
	DcParams* _tmp10_;
	DcParams* _tmp11_;
	DcParams* _tmp12_;
	JsonNode* _tmp13_;
	JsonNode* _tmp14_;
	JsonNode* _tmp15_;
	JsonNode* _tmp16_;
	gboolean _tmp17_;
	gint* _tmp18_;
	gint* _tmp19_;
	gint _tmp19__length1;
	JsonArray* arr;
	JsonArray* _tmp20_;
	JsonArray* _tmp21_;
	gint* ids;
	JsonArray* _tmp22_;
	gint* _tmp23_;
	gint ids_length1;
	gint _ids_size_;
	guint i;
	gboolean _tmp24_;
	guint _tmp25_;
	JsonArray* _tmp26_;
	gint* _tmp27_;
	gint _tmp27__length1;
	JsonArray* _tmp28_;
	gint* _tmp29_;
	gint _tmp29__length1;
	GError* _inner_error0_;
};

struct _DcWebxdcManagerDialogMergeInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppEntry* entry;
	gint acct_id;
	gint msg_id;
	JsonObject* info;
	const gchar* _tmp0_;
	gchar* summary;
	gchar* _tmp1_;
	gboolean _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* document;
	gchar* _tmp10_;
	gboolean _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* url;
	gchar* _tmp19_;
	gboolean _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	GdkTexture* _tmp27_;
	gchar* icon_name;
	gchar* _tmp28_;
	gboolean _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	gint _tmp32_;
	gint _tmp33_;
	JsonNode* blob;
	DcRpcClient* _tmp34_;
	DcParams* _tmp35_;
	DcParams* _tmp36_;
	DcParams* _tmp37_;
	DcParams* _tmp38_;
	DcParams* _tmp39_;
	DcParams* _tmp40_;
	const gchar* _tmp41_;
	DcParams* _tmp42_;
	DcParams* _tmp43_;
	JsonNode* _tmp44_;
	JsonNode* _tmp45_;
	JsonNode* _tmp46_;
	JsonNode* _tmp47_;
	GdkTexture* _tmp48_;
	JsonNode* _tmp49_;
	const gchar* _tmp50_;
	gsize _tmp51_;
	guchar* _tmp52_;
	guchar* _tmp53_;
	gint _tmp53__length1;
	GBytes* _tmp54_;
	GBytes* _tmp55_;
	GdkTexture* _tmp56_;
	GdkTexture* _tmp57_;
	GdkTexture* _tmp58_;
	GError* e;
	GError* _tmp59_;
	const gchar* _tmp60_;
	GError* _inner_error0_;
};

struct _DcWebxdcManagerDialogLookupChatData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWebxdcManagerDialog* self;
	gint acct_id;
	gint chat_id;
	GHashTable* names;
	GHashTable* avatars;
	gconstpointer _tmp0_;
	JsonObject* chat;
	DcRpcClient* _tmp1_;
	JsonObject* _tmp2_;
	JsonObject* _tmp3_;
	gchar* name;
	JsonObject* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* avatar;
	JsonObject* _tmp13_;
	gchar* _tmp14_;
	gboolean _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	GError* e;
	GError* _tmp22_;
	const gchar* _tmp23_;
	GError* _inner_error0_;
};

struct _DcWebxdcManagerDialogAppUser {
	GObject parent_instance;
	DcWebxdcManagerDialogAppUserPrivate * priv;
	gchar* key;
	gchar* name;
	gchar* avatar_path;
};

struct _DcWebxdcManagerDialogAppUserClass {
	GObjectClass parent_class;
};

struct _Block82Data {
	int _ref_count_;
	DcWebxdcManagerDialog* self;
	gchar** keys;
	gint keys_length1;
	gint _keys_size_;
};

struct _Block83Data {
	int _ref_count_;
	GHashTable* self;
	GFunc func;
	gpointer func_target;
};

struct _Block84Data {
	int _ref_count_;
	DcWebxdcManagerDialog* self;
	GtkToggleButton* star;
	DcWebxdcManagerDialogAppEntry* entry;
};

struct _Block85Data {
	int _ref_count_;
	DcWebxdcManagerDialog* self;
	GtkToggleButton* star;
	GtkButton* run_btn;
	DcWebxdcManagerDialogAppEntry* entry;
};

struct _Block86Data {
	int _ref_count_;
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppInstance* inst;
};

struct _Block87Data {
	int _ref_count_;
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppEntry* entry;
};

struct _Block88Data {
	int _ref_count_;
	Block87Data * _data87_;
	DcWebxdcManagerDialogAppInstance* inst;
};

struct _DcWebxdcManagerDialogSaveAppData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppEntry* entry;
	DcWebxdcManagerDialogAppInstance* inst;
	DcWebxdcManagerDialogAppInstance* _tmp0_;
	DcWebxdcManagerDialogAppInstance* _tmp1_;
	DcWindow* _tmp2_;
	DcWindow* _tmp3_;
	DcWebxdcManagerDialogAppInstance* _tmp4_;
	DcMessage* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	DcWebxdcManagerDialogAppInstance* _tmp8_;
	DcMessage* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
};

struct _Block89Data {
	int _ref_count_;
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppInstance* inst;
};

struct _DcWebxdcManagerDialogSendAndRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppInstance* inst;
	gint contact_id;
	gchar* email;
	gint _tmp0_;
	DcRpcClient* _tmp1_;
	gint chat_id;
	DcRpcClient* _tmp2_;
	gint msg_id;
	DcRpcClient* _tmp3_;
	DcMessage* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	DcMessage* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	DcWindow* _tmp10_;
	DcWindow* _tmp11_;
	DcMessage* sent;
	DcRpcClient* _tmp12_;
	DcMessage* _tmp13_;
	DcMessage* _tmp14_;
	DcWindow* _tmp15_;
	DcRpcClient* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	DcMessage* _tmp19_;
	GError* e;
	GError* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	GError* _inner_error0_;
};

struct _Block90Data {
	int _ref_count_;
	DcWebxdcManagerDialog* self;
	GtkUriLauncher* launcher;
};

static gint DcWebxdcManagerDialog_private_offset;
static gpointer dc_webxdc_manager_dialog_parent_class = NULL;
static gpointer dc_webxdc_manager_dialog_app_instance_parent_class = NULL;
static gpointer dc_webxdc_manager_dialog_app_user_parent_class = NULL;
static gpointer dc_webxdc_manager_dialog_app_entry_parent_class = NULL;

VALA_EXTERN GType dc_webxdc_manager_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWebxdcManagerDialog, g_object_unref)
VALA_EXTERN GType dc_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)
static GType dc_webxdc_manager_dialog_app_entry_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWebxdcManagerDialogAppEntry, g_object_unref)
static void _g_object_unref0_ (gpointer var);
VALA_EXTERN DcWebxdcManagerDialog* dc_webxdc_manager_dialog_new (DcWindow* window,
                                                     DcRpcClient* rpc);
VALA_EXTERN DcWebxdcManagerDialog* dc_webxdc_manager_dialog_construct (GType object_type,
                                                           DcWindow* window,
                                                           DcRpcClient* rpc);
static GHashTable* dc_webxdc_manager_dialog_load_favorites (void);
static void __lambda391_ (DcWebxdcManagerDialog* self);
static void dc_webxdc_manager_dialog_rebuild_list (DcWebxdcManagerDialog* self);
static void ___lambda391__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                    gpointer self);
VALA_EXTERN void dc_install_escape_close (AdwDialog* dialog);
static void dc_webxdc_manager_dialog_reload (DcWebxdcManagerDialog* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static void dc_webxdc_manager_dialog_reload_finish (DcWebxdcManagerDialog* self,
                                             GAsyncResult* _res_);
static void dc_webxdc_manager_dialog_reload_data_free (gpointer _data);
static gboolean dc_webxdc_manager_dialog_reload_co (DcWebxdcManagerDialogReloadData* _data_);
static void _g_free0_ (gpointer var);
VALA_EXTERN void dc_rpc_client_get_all_accounts (DcRpcClient* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN JsonNode* dc_rpc_client_get_all_accounts_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void dc_webxdc_manager_dialog_reload_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN gchar* dc_json_str (JsonObject* obj,
                    const gchar* key);
static void dc_webxdc_manager_dialog_collect_account_apps (DcWebxdcManagerDialog* self,
                                                    JsonObject* acct,
                                                    GHashTable* by_key,
                                                    GPtrArray* found,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static void dc_webxdc_manager_dialog_collect_account_apps_finish (DcWebxdcManagerDialog* self,
                                                           GAsyncResult* _res_);
static GType dc_webxdc_manager_dialog_app_instance_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWebxdcManagerDialogAppInstance, g_object_unref)
static GType dc_webxdc_manager_dialog_app_user_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcWebxdcManagerDialogAppUser, g_object_unref)
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static gint ___lambda0__gcompare_data_func (gconstpointer a,
                                     gconstpointer b,
                                     gpointer self);
static gint _____lambda402_ (DcWebxdcManagerDialogAppInstance* a,
                      DcWebxdcManagerDialogAppInstance* b);
VALA_EXTERN GType dc_message_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcMessage, g_object_unref)
VALA_EXTERN gint64 dc_message_get_timestamp (DcMessage* self);
static gint ______lambda402__gcompare_func (gconstpointer a,
                                     gconstpointer b);
static void dc_webxdc_manager_dialog_collect_account_apps_data_free (gpointer _data);
static gboolean dc_webxdc_manager_dialog_collect_account_apps_co (DcWebxdcManagerDialogCollectAccountAppsData* _data_);
VALA_EXTERN gint64 dc_json_int (JsonObject* obj,
                    const gchar* key,
                    gint64 fallback);
static void dc_webxdc_manager_dialog_account_chat_media (DcWebxdcManagerDialog* self,
                                                  gint acct_id,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
static gint* dc_webxdc_manager_dialog_account_chat_media_finish (DcWebxdcManagerDialog* self,
                                                          GAsyncResult* _res_,
                                                          gint* result_length1,
                                                          GError** error);
static void dc_webxdc_manager_dialog_collect_account_apps_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_get_messages_for (DcRpcClient* self,
                                     gint acct_id,
                                     gint* msg_ids,
                                     gint msg_ids_length1,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_messages_for_finish (DcRpcClient* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static JsonNode* _vala_JsonNode_copy (JsonNode* self);
VALA_EXTERN DcMessage* dc_rpc_parsers_parse_message (JsonObject* obj,
                                         const gchar* self_email);
VALA_EXTERN gboolean dc_message_is_webxdc (DcMessage* self);
VALA_EXTERN void dc_rpc_client_call (DcRpcClient* self,
                         const gchar* method,
                         JsonNode* params,
                         GAsyncReadyCallback _callback_,
                         gpointer _user_data_);
VALA_EXTERN JsonNode* dc_rpc_client_call_finish (DcRpcClient* self,
                                     GAsyncResult* _res_,
                                     GError** error);
VALA_EXTERN GType dc_params_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcParams, g_object_unref)
VALA_EXTERN DcParams* dc_params_begin (void);
VALA_EXTERN DcParams* dc_params_add_int (DcParams* self,
                             gint v);
VALA_EXTERN gint dc_message_get_id (DcMessage* self);
VALA_EXTERN JsonNode* dc_params_build (DcParams* self);
VALA_EXTERN gchar* dc_message_display_file_name (DcMessage* self,
                                     const gchar* fallback);
static DcWebxdcManagerDialogAppEntry* dc_webxdc_manager_dialog_app_entry_new (void);
static DcWebxdcManagerDialogAppEntry* dc_webxdc_manager_dialog_app_entry_construct (GType object_type);
static void dc_webxdc_manager_dialog_merge_info (DcWebxdcManagerDialog* self,
                                          DcWebxdcManagerDialogAppEntry* entry,
                                          gint acct_id,
                                          gint msg_id,
                                          JsonObject* info,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void dc_webxdc_manager_dialog_merge_info_finish (DcWebxdcManagerDialog* self,
                                                 GAsyncResult* _res_);
static gchar* dc_webxdc_manager_dialog_sender_label (DcMessage* msg);
static DcWebxdcManagerDialogAppInstance* dc_webxdc_manager_dialog_app_instance_new (void);
static DcWebxdcManagerDialogAppInstance* dc_webxdc_manager_dialog_app_instance_construct (GType object_type);
static void dc_webxdc_manager_dialog_lookup_chat (DcWebxdcManagerDialog* self,
                                           gint acct_id,
                                           gint chat_id,
                                           GHashTable* names,
                                           GHashTable* avatars,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static void dc_webxdc_manager_dialog_lookup_chat_finish (DcWebxdcManagerDialog* self,
                                                  GAsyncResult* _res_);
VALA_EXTERN gint dc_message_get_chat_id (DcMessage* self);
static void dc_webxdc_manager_dialog_add_user (DcWebxdcManagerDialog* self,
                                        DcWebxdcManagerDialogAppEntry* entry,
                                        gint acct_id,
                                        DcMessage* msg);
static void dc_webxdc_manager_dialog_account_chat_media_data_free (gpointer _data);
static gboolean dc_webxdc_manager_dialog_account_chat_media_co (DcWebxdcManagerDialogAccountChatMediaData* _data_);
VALA_EXTERN DcParams* dc_params_add_null (DcParams* self);
VALA_EXTERN DcParams* dc_params_add_string (DcParams* self,
                                const gchar* v);
static void dc_webxdc_manager_dialog_account_chat_media_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void dc_webxdc_manager_dialog_merge_info_data_free (gpointer _data);
static gboolean dc_webxdc_manager_dialog_merge_info_co (DcWebxdcManagerDialogMergeInfoData* _data_);
VALA_EXTERN gboolean dc_json_bool (JsonObject* obj,
                       const gchar* key);
static void dc_webxdc_manager_dialog_merge_info_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void dc_webxdc_manager_dialog_lookup_chat_data_free (gpointer _data);
static gboolean dc_webxdc_manager_dialog_lookup_chat_co (DcWebxdcManagerDialogLookupChatData* _data_);
VALA_EXTERN void dc_rpc_client_get_full_chat_by_id_for (DcRpcClient* self,
                                            gint acct_id,
                                            gint chat_id,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN JsonObject* dc_rpc_client_get_full_chat_by_id_for_finish (DcRpcClient* self,
                                                          GAsyncResult* _res_,
                                                          GError** error);
static void dc_webxdc_manager_dialog_lookup_chat_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
VALA_EXTERN gboolean dc_message_get_is_outgoing (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_sender_name (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_sender_address (DcMessage* self);
VALA_EXTERN gint dc_message_get_sender_contact_id (DcMessage* self);
static DcWebxdcManagerDialogAppUser* dc_webxdc_manager_dialog_app_user_new (void);
static DcWebxdcManagerDialogAppUser* dc_webxdc_manager_dialog_app_user_construct (GType object_type);
VALA_EXTERN const gchar* dc_message_get_sender_avatar_path (DcMessage* self);
static gchar* dc_webxdc_manager_dialog_favorites_path (void);
static void dc_webxdc_manager_dialog_save_favorites (DcWebxdcManagerDialog* self);
static Block82Data* block82_data_ref (Block82Data* _data82_);
static void block82_data_unref (void * _userdata_);
static Block83Data* block83_data_ref (Block83Data* _data83_);
static void block83_data_unref (void * _userdata_);
static void ___lambda2__gh_func (gconstpointer key,
                          gconstpointer value,
                          gpointer self);
static void __lambda394_ (Block82Data* _data82_,
                   const gchar* key);
static void _vala_array_add53 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void ___lambda394__gfunc (gconstpointer data,
                          gpointer self);
static void dc_webxdc_manager_dialog_set_favorite (DcWebxdcManagerDialog* self,
                                            DcWebxdcManagerDialogAppEntry* entry,
                                            gboolean favorite);
static gboolean __lambda395_ (DcWebxdcManagerDialog* self);
static gboolean ___lambda395__gsource_func (gpointer self);
static GtkToggleButton* dc_webxdc_manager_dialog_star_button (DcWebxdcManagerDialogAppEntry* entry);
VALA_EXTERN void dc_clear_listbox (GtkListBox* lb);
static gint __lambda392_ (DcWebxdcManagerDialogAppEntry* a,
                   DcWebxdcManagerDialogAppEntry* b);
static gint ___lambda392__gcompare_func (gconstpointer a,
                                  gconstpointer b);
static GtkWidget* dc_webxdc_manager_dialog_build_app_row (DcWebxdcManagerDialog* self,
                                                   DcWebxdcManagerDialogAppEntry* entry);
static Block84Data* block84_data_ref (Block84Data* _data84_);
static void block84_data_unref (void * _userdata_);
static gchar* dc_webxdc_manager_dialog_count_label (guint n,
                                             const gchar* noun);
static GtkWidget* dc_webxdc_manager_dialog_app_icon (DcWebxdcManagerDialog* self,
                                              DcWebxdcManagerDialogAppEntry* entry,
                                              gint size);
static GtkWidget* dc_webxdc_manager_dialog_users_cluster (DcWebxdcManagerDialog* self,
                                                   DcWebxdcManagerDialogAppEntry* entry,
                                                   gint size,
                                                   gint max);
static void __lambda393_ (Block84Data* _data84_);
static void ___lambda393__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                              gpointer self);
static void __lambda396_ (Block84Data* _data84_);
static void dc_webxdc_manager_dialog_push_details (DcWebxdcManagerDialog* self,
                                            DcWebxdcManagerDialogAppEntry* entry);
static void ___lambda396__adw_action_row_activated (AdwActionRow* _sender,
                                             gpointer self);
VALA_EXTERN GdkTexture* dc_load_avatar (const gchar* path);
static Block85Data* block85_data_ref (Block85Data* _data85_);
static void block85_data_unref (void * _userdata_);
static GtkWidget* dc_webxdc_manager_dialog_detail_line (const gchar* text);
VALA_EXTERN gchar* dc_format_date_time (gint64 ts);
static void __lambda397_ (Block85Data* _data85_);
static void ___lambda397__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                              gpointer self);
static void __lambda398_ (Block85Data* _data85_);
static void dc_webxdc_manager_dialog_show_run_menu (DcWebxdcManagerDialog* self,
                                             GtkWidget* anchor,
                                             DcWebxdcManagerDialogAppEntry* entry);
static void ___lambda398__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda403_ (Block85Data* _data85_);
static void dc_webxdc_manager_dialog_pick_contact_and_send (DcWebxdcManagerDialog* self,
                                                     DcWebxdcManagerDialogAppEntry* entry);
static void ___lambda403__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda404_ (Block85Data* _data85_);
static void dc_webxdc_manager_dialog_save_app (DcWebxdcManagerDialog* self,
                                        DcWebxdcManagerDialogAppEntry* entry,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static void dc_webxdc_manager_dialog_save_app_finish (DcWebxdcManagerDialog* self,
                                               GAsyncResult* _res_);
static void ___lambda404__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static AdwActionRow* dc_webxdc_manager_dialog_info_row (const gchar* title,
                                                 const gchar* subtitle);
static void ___lambda405_ (Block85Data* _data85_);
static void dc_webxdc_manager_dialog_open_url (DcWebxdcManagerDialog* self,
                                        const gchar* url);
static void ____lambda405__adw_action_row_activated (AdwActionRow* _sender,
                                              gpointer self);
static GtkWidget* dc_webxdc_manager_dialog_section (const gchar* heading,
                                             GtkWidget* child);
static GtkWidget* dc_webxdc_manager_dialog_build_instance_row (DcWebxdcManagerDialog* self,
                                                        DcWebxdcManagerDialogAppInstance* inst);
static Block86Data* block86_data_ref (Block86Data* _data86_);
static void block86_data_unref (void * _userdata_);
VALA_EXTERN GtkWidget* dc_presence_avatar (gint size,
                               const gchar* text,
                               const gchar* path,
                               gboolean online,
                               const gchar* avatar_css,
                               const gchar* ring_css);
VALA_EXTERN gboolean dc_webxdc_is_running (gint msg_id);
VALA_EXTERN gint dc_rpc_client_get_account_id (DcRpcClient* self);
static void __lambda407_ (Block86Data* _data86_);
static void dc_webxdc_manager_dialog_launch (DcWebxdcManagerDialog* self,
                                      DcWebxdcManagerDialogAppInstance* inst);
static void ___lambda407__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda408_ (Block86Data* _data86_);
static void ___lambda408__adw_action_row_activated (AdwActionRow* _sender,
                                             gpointer self);
static Block87Data* block87_data_ref (Block87Data* _data87_);
static void block87_data_unref (void * _userdata_);
VALA_EXTERN GtkPopover* dc_popover_menu (GtkWidget* parent,
                             gdouble x,
                             gdouble y,
                             GtkBox** vbox);
static Block88Data* block88_data_ref (Block88Data* _data88_);
static void block88_data_unref (void * _userdata_);
VALA_EXTERN GType dc_popover_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcPopoverButton, g_object_unref)
VALA_EXTERN DcPopoverButton* dc_popover_button_new (GtkPopover* popover,
                                        const gchar* label,
                                        gboolean destructive,
                                        gboolean hexpand);
VALA_EXTERN DcPopoverButton* dc_popover_button_construct (GType object_type,
                                              GtkPopover* popover,
                                              const gchar* label,
                                              gboolean destructive,
                                              gboolean hexpand);
static void _____lambda399_ (Block88Data* _data88_);
static void ______lambda399__dc_popover_button_selected (DcPopoverButton* _sender,
                                                  gpointer self);
static void __lambda400_ (Block87Data* _data87_);
static void ___lambda400__dc_popover_button_selected (DcPopoverButton* _sender,
                                               gpointer self);
VALA_EXTERN void dc_window_run_webxdc_instance (DcWindow* self,
                                    gint acct_id,
                                    DcMessage* msg,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN gboolean dc_window_run_webxdc_instance_finish (DcWindow* self,
                                               GAsyncResult* _res_);
static DcWebxdcManagerDialogAppInstance* dc_webxdc_manager_dialog_local_instance (DcWebxdcManagerDialog* self,
                                                                           DcWebxdcManagerDialogAppEntry* entry);
VALA_EXTERN gboolean dc_message_get_has_local_file (DcMessage* self);
static void dc_webxdc_manager_dialog_save_app_data_free (gpointer _data);
static gboolean dc_webxdc_manager_dialog_save_app_co (DcWebxdcManagerDialogSaveAppData* _data_);
VALA_EXTERN void dc_window_show_toast (DcWindow* self,
                           const gchar* message);
VALA_EXTERN void dc_window_save_attachment (DcWindow* self,
                                const gchar* src_path,
                                const gchar* name,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN void dc_window_save_attachment_finish (DcWindow* self,
                                       GAsyncResult* _res_);
VALA_EXTERN const gchar* dc_message_get_file_path (DcMessage* self);
VALA_EXTERN const gchar* dc_message_get_file_name (DcMessage* self);
static void dc_webxdc_manager_dialog_save_app_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static Block89Data* block89_data_ref (Block89Data* _data89_);
static void block89_data_unref (void * _userdata_);
VALA_EXTERN GType dc_contact_picker_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DcContactPickerDialog, g_object_unref)
VALA_EXTERN DcContactPickerDialog* dc_contact_picker_dialog_new (DcRpcClient* rpc,
                                                     GListStore* chat_store,
                                                     const gchar* title);
VALA_EXTERN DcContactPickerDialog* dc_contact_picker_dialog_construct (GType object_type,
                                                           DcRpcClient* rpc,
                                                           GListStore* chat_store,
                                                           const gchar* title);
static void __lambda401_ (Block89Data* _data89_,
                   gint contact_id,
                   const gchar* email);
static void dc_webxdc_manager_dialog_send_and_run (DcWebxdcManagerDialog* self,
                                            DcWebxdcManagerDialogAppInstance* inst,
                                            gint contact_id,
                                            const gchar* email,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void dc_webxdc_manager_dialog_send_and_run_finish (DcWebxdcManagerDialog* self,
                                                   GAsyncResult* _res_);
static void ___lambda401__dc_contact_picker_dialog_contact_picked (DcContactPickerDialog* _sender,
                                                            gint contact_id,
                                                            const gchar* email,
                                                            gpointer self);
static void dc_webxdc_manager_dialog_send_and_run_data_free (gpointer _data);
static gboolean dc_webxdc_manager_dialog_send_and_run_co (DcWebxdcManagerDialogSendAndRunData* _data_);
VALA_EXTERN void dc_rpc_client_get_or_create_contact (DcRpcClient* self,
                                          const gchar* email,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_or_create_contact_finish (DcRpcClient* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void dc_webxdc_manager_dialog_send_and_run_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
VALA_EXTERN void dc_rpc_client_get_or_create_chat_by_contact (DcRpcClient* self,
                                                  gint contact_id,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_get_or_create_chat_by_contact_finish (DcRpcClient* self,
                                                         GAsyncResult* _res_,
                                                         GError** error);
VALA_EXTERN void dc_rpc_client_send_msg (DcRpcClient* self,
                             gint chat_id,
                             const gchar* text,
                             const gchar* file_path,
                             const gchar* file_name,
                             gint quoted_msg_id,
                             const gchar* view_type,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_);
VALA_EXTERN gint dc_rpc_client_send_msg_finish (DcRpcClient* self,
                                    GAsyncResult* _res_,
                                    GError** error);
VALA_EXTERN void dc_rpc_client_fetch_message (DcRpcClient* self,
                                  gint msg_id,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN DcMessage* dc_rpc_client_fetch_message_finish (DcRpcClient* self,
                                               GAsyncResult* _res_,
                                               GError** error);
VALA_EXTERN void dc_show_error (GtkWidget* parent,
                    const gchar* message);
static Block90Data* block90_data_ref (Block90Data* _data90_);
static void block90_data_unref (void * _userdata_);
static void __lambda406_ (Block90Data* _data90_,
                   GObject* obj,
                   GAsyncResult* res);
static void ___lambda406__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void dc_webxdc_manager_dialog_app_instance_finalize (GObject * obj);
static GType dc_webxdc_manager_dialog_app_instance_get_type_once (void);
static void dc_webxdc_manager_dialog_app_user_finalize (GObject * obj);
static GType dc_webxdc_manager_dialog_app_user_get_type_once (void);
static void dc_webxdc_manager_dialog_app_entry_finalize (GObject * obj);
static GType dc_webxdc_manager_dialog_app_entry_get_type_once (void);
static void dc_webxdc_manager_dialog_finalize (GObject * obj);
static GType dc_webxdc_manager_dialog_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dc_webxdc_manager_dialog_get_instance_private (DcWebxdcManagerDialog* self)
{
	return G_STRUCT_MEMBER_P (self, DcWebxdcManagerDialog_private_offset);
}

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

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

static void
__lambda391_ (DcWebxdcManagerDialog* self)
{
	dc_webxdc_manager_dialog_rebuild_list (self);
}

static void
___lambda391__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                               gpointer self)
{
	__lambda391_ ((DcWebxdcManagerDialog*) self);
}

DcWebxdcManagerDialog*
dc_webxdc_manager_dialog_construct (GType object_type,
                                    DcWindow* window,
                                    DcRpcClient* rpc)
{
	DcWebxdcManagerDialog * self = NULL;
	DcRpcClient* _tmp0_;
	GHashTable* _tmp1_;
	GtkSearchEntry* _tmp2_;
	GtkSearchEntry* _tmp3_;
	GtkSearchEntry* _tmp4_;
	GtkSearchEntry* _tmp5_;
	GtkListBox* _tmp6_;
	GtkListBox* _tmp7_;
	GtkListBox* _tmp8_;
	GtkListBox* _tmp9_;
	GtkScrolledWindow* list_scroll = NULL;
	GtkScrolledWindow* _tmp10_;
	GtkListBox* _tmp11_;
	GtkSpinner* spinner = NULL;
	GtkSpinner* _tmp12_;
	AdwStatusPage* _tmp13_;
	AdwStatusPage* _tmp14_;
	AdwStatusPage* _tmp15_;
	AdwStatusPage* _tmp16_;
	GtkStack* _tmp17_;
	GtkStack* _tmp18_;
	GtkStack* _tmp19_;
	GtkStack* _tmp20_;
	AdwStatusPage* _tmp21_;
	GtkStack* _tmp22_;
	GtkStack* _tmp23_;
	GtkBox* content = NULL;
	GtkBox* _tmp24_;
	GtkSearchEntry* _tmp25_;
	GtkStack* _tmp26_;
	AdwToolbarView* toolbar = NULL;
	AdwToolbarView* _tmp27_;
	AdwHeaderBar* _tmp28_;
	AdwHeaderBar* _tmp29_;
	AdwNavigationView* _tmp30_;
	AdwNavigationView* _tmp31_;
	AdwNavigationPage* _tmp32_;
	AdwNavigationPage* _tmp33_;
	AdwNavigationView* _tmp34_;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (rpc != NULL, NULL);
	self = (DcWebxdcManagerDialog*) g_object_new (object_type, NULL);
	self->priv->app_window = window;
	_tmp0_ = _g_object_ref0 (rpc);
	_g_object_unref0 (self->priv->rpc);
	self->priv->rpc = _tmp0_;
	adw_dialog_set_title ((AdwDialog*) self, "Apps");
	adw_dialog_set_content_width ((AdwDialog*) self, 560);
	adw_dialog_set_content_height ((AdwDialog*) self, 620);
	_tmp1_ = dc_webxdc_manager_dialog_load_favorites ();
	_g_hash_table_unref0 (self->priv->favorites);
	self->priv->favorites = _tmp1_;
	_tmp2_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->search_entry);
	self->priv->search_entry = _tmp2_;
	_tmp3_ = self->priv->search_entry;
	g_object_set (_tmp3_, "placeholder-text", "Search apps…", NULL);
	_tmp4_ = self->priv->search_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp4_, TRUE);
	_tmp5_ = self->priv->search_entry;
	g_signal_connect_object (_tmp5_, "search-changed", (GCallback) ___lambda391__gtk_search_entry_search_changed, self, 0);
	_tmp6_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->app_list);
	self->priv->app_list = _tmp6_;
	_tmp7_ = self->priv->app_list;
	gtk_list_box_set_selection_mode (_tmp7_, GTK_SELECTION_NONE);
	_tmp8_ = self->priv->app_list;
	gtk_widget_add_css_class ((GtkWidget*) _tmp8_, "boxed-list");
	_tmp9_ = self->priv->app_list;
	gtk_widget_set_valign ((GtkWidget*) _tmp9_, GTK_ALIGN_START);
	_tmp10_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp10_);
	list_scroll = _tmp10_;
	gtk_widget_set_vexpand ((GtkWidget*) list_scroll, TRUE);
	g_object_set (list_scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp11_ = self->priv->app_list;
	gtk_scrolled_window_set_child (list_scroll, (GtkWidget*) _tmp11_);
	_tmp12_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_tmp12_);
	spinner = _tmp12_;
	gtk_spinner_set_spinning (spinner, TRUE);
	g_object_set ((GtkWidget*) spinner, "width-request", 32, NULL);
	g_object_set ((GtkWidget*) spinner, "height-request", 32, NULL);
	gtk_widget_set_halign ((GtkWidget*) spinner, GTK_ALIGN_CENTER);
	gtk_widget_set_valign ((GtkWidget*) spinner, GTK_ALIGN_CENTER);
	_tmp13_ = (AdwStatusPage*) adw_status_page_new ();
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->empty_page);
	self->priv->empty_page = _tmp13_;
	_tmp14_ = self->priv->empty_page;
	adw_status_page_set_icon_name (_tmp14_, "application-x-executable-symbolic");
	_tmp15_ = self->priv->empty_page;
	adw_status_page_set_title (_tmp15_, "No Apps Yet");
	_tmp16_ = self->priv->empty_page;
	adw_status_page_set_description (_tmp16_, "Webxdc apps shared in any chat of " "any profile will appear here");
	_tmp17_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->priv->stack);
	self->priv->stack = _tmp17_;
	_tmp18_ = self->priv->stack;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp18_, TRUE);
	_tmp19_ = self->priv->stack;
	gtk_stack_add_named (_tmp19_, (GtkWidget*) spinner, "loading");
	_tmp20_ = self->priv->stack;
	_tmp21_ = self->priv->empty_page;
	gtk_stack_add_named (_tmp20_, (GtkWidget*) _tmp21_, "empty");
	_tmp22_ = self->priv->stack;
	gtk_stack_add_named (_tmp22_, (GtkWidget*) list_scroll, "list");
	_tmp23_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp23_, "loading");
	_tmp24_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
	g_object_ref_sink (_tmp24_);
	content = _tmp24_;
	gtk_widget_set_margin_start ((GtkWidget*) content, 12);
	gtk_widget_set_margin_end ((GtkWidget*) content, 12);
	gtk_widget_set_margin_top ((GtkWidget*) content, 8);
	gtk_widget_set_margin_bottom ((GtkWidget*) content, 12);
	_tmp25_ = self->priv->search_entry;
	gtk_box_append (content, (GtkWidget*) _tmp25_);
	_tmp26_ = self->priv->stack;
	gtk_box_append (content, (GtkWidget*) _tmp26_);
	_tmp27_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp27_);
	toolbar = _tmp27_;
	_tmp28_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp28_);
	_tmp29_ = _tmp28_;
	adw_toolbar_view_add_top_bar (toolbar, (GtkWidget*) _tmp29_);
	_g_object_unref0 (_tmp29_);
	adw_toolbar_view_set_content (toolbar, (GtkWidget*) content);
	_tmp30_ = (AdwNavigationView*) adw_navigation_view_new ();
	g_object_ref_sink (_tmp30_);
	_g_object_unref0 (self->priv->nav);
	self->priv->nav = _tmp30_;
	_tmp31_ = self->priv->nav;
	_tmp32_ = adw_navigation_page_new ((GtkWidget*) toolbar, "Apps");
	g_object_ref_sink (_tmp32_);
	_tmp33_ = _tmp32_;
	adw_navigation_view_add (_tmp31_, _tmp33_);
	_g_object_unref0 (_tmp33_);
	_tmp34_ = self->priv->nav;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp34_);
	dc_install_escape_close ((AdwDialog*) self);
	dc_webxdc_manager_dialog_reload (self, NULL, NULL);
	_g_object_unref0 (toolbar);
	_g_object_unref0 (content);
	_g_object_unref0 (spinner);
	_g_object_unref0 (list_scroll);
	return self;
}

DcWebxdcManagerDialog*
dc_webxdc_manager_dialog_new (DcWindow* window,
                              DcRpcClient* rpc)
{
	return dc_webxdc_manager_dialog_construct (DC_TYPE_WEBXDC_MANAGER_DIALOG, window, rpc);
}

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

static void
dc_webxdc_manager_dialog_reload (DcWebxdcManagerDialog* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	DcWebxdcManagerDialogReloadData* _data_;
	DcWebxdcManagerDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWebxdcManagerDialogReloadData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_webxdc_manager_dialog_reload_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	dc_webxdc_manager_dialog_reload_co (_data_);
}

static void
dc_webxdc_manager_dialog_reload_finish (DcWebxdcManagerDialog* self,
                                        GAsyncResult* _res_)
{
	DcWebxdcManagerDialogReloadData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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

static void
dc_webxdc_manager_dialog_reload_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	DcWebxdcManagerDialogReloadData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_webxdc_manager_dialog_reload_co (_data_);
}

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

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

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

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

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		GPtrArray* self;
		self = _data21_->self;
		_g_ptr_array_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

static gint
__lambda0_ (Block21Data* _data21_,
            gconstpointer** a,
            gconstpointer** b)
{
	GPtrArray* self;
	gint result;
	self = _data21_->self;
	result = _data21_->compare_func ((gconstpointer**) (*a), (gconstpointer**) (*b));
	return result;
}

static gint
___lambda0__gcompare_data_func (gconstpointer a,
                                gconstpointer b,
                                gpointer self)
{
	gint result;
	result = __lambda0_ (self, a, b);
	return result;
}

static void
vala_g_ptr_array_sort (GPtrArray* self,
                       GCompareFunc compare_func)
{
	Block21Data* _data21_;
	g_return_if_fail (self != NULL);
	_data21_ = g_slice_new0 (Block21Data);
	_data21_->_ref_count_ = 1;
	_data21_->self = g_ptr_array_ref (self);
	_data21_->compare_func = compare_func;
	g_ptr_array_sort_with_data (self, ___lambda0__gcompare_data_func, _data21_);
	block21_data_unref (_data21_);
	_data21_ = NULL;
}

static gint
_____lambda402_ (DcWebxdcManagerDialogAppInstance* a,
                 DcWebxdcManagerDialogAppInstance* b)
{
	DcMessage* _tmp0_;
	gint64 _tmp1_;
	gint64 _tmp2_;
	DcMessage* _tmp3_;
	gint64 _tmp4_;
	gint64 _tmp5_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = b->msg;
	_tmp1_ = dc_message_get_timestamp (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = a->msg;
	_tmp4_ = dc_message_get_timestamp (_tmp3_);
	_tmp5_ = _tmp4_;
	result = (gint) CLAMP (_tmp2_ - _tmp5_, (gint64) -1, (gint64) 1);
	return result;
}

static gint
______lambda402__gcompare_func (gconstpointer a,
                                gconstpointer b)
{
	gint result;
	result = _____lambda402_ ((DcWebxdcManagerDialogAppInstance*) a, (DcWebxdcManagerDialogAppInstance*) b);
	return result;
}

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

static gboolean
dc_webxdc_manager_dialog_reload_co (DcWebxdcManagerDialogReloadData* _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_->self->priv->load_generation = _data_->self->priv->load_generation + 1;
	_data_->_tmp0_ = _data_->self->priv->load_generation;
	_data_->gen = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->stack;
	gtk_stack_set_visible_child_name (_data_->_tmp1_, "loading");
	_data_->_tmp2_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	_data_->found = _data_->_tmp2_;
	_data_->_tmp3_ = g_str_hash;
	_data_->_tmp4_ = g_str_equal;
	_data_->_tmp5_ = g_hash_table_new_full (_data_->_tmp3_, _data_->_tmp4_, _g_free0_, _g_object_unref0_);
	_data_->by_key = _data_->_tmp5_;
	{
		_data_->_tmp6_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_all_accounts (_data_->_tmp6_, dc_webxdc_manager_dialog_reload_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp7_ = dc_rpc_client_get_all_accounts_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
		_data_->accounts_node = _data_->_tmp7_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp8_ = _data_->accounts_node;
		if (_data_->_tmp8_ == NULL) {
			__vala_JsonNode_free0 (_data_->accounts_node);
			_g_hash_table_unref0 (_data_->by_key);
			_g_ptr_array_unref0 (_data_->found);
			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_->_tmp9_ = _data_->accounts_node;
		_data_->_tmp10_ = json_node_get_array (_data_->_tmp9_);
		_data_->_tmp11_ = _json_array_ref0 (_data_->_tmp10_);
		_data_->accounts = _data_->_tmp11_;
		{
			_data_->i = (guint) 0;
			{
				_data_->_tmp12_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp12_) {
						_data_->_tmp13_ = _data_->i;
						_data_->i = _data_->_tmp13_ + 1;
					}
					_data_->_tmp12_ = FALSE;
					_data_->_tmp14_ = _data_->accounts;
					if (!(_data_->i < json_array_get_length (_data_->_tmp14_))) {
						break;
					}
					_data_->_tmp15_ = _data_->accounts;
					_data_->_tmp16_ = json_array_get_object_element (_data_->_tmp15_, _data_->i);
					_data_->_tmp17_ = _json_object_ref0 (_data_->_tmp16_);
					_data_->acct = _data_->_tmp17_;
					_data_->_tmp18_ = _data_->acct;
					_data_->_tmp19_ = dc_json_str (_data_->_tmp18_, "kind");
					_data_->_tmp20_ = _data_->_tmp19_;
					_data_->_tmp21_ = g_strcmp0 (_data_->_tmp20_, "Configured") != 0;
					_g_free0 (_data_->_tmp20_);
					if (_data_->_tmp21_) {
						_json_object_unref0 (_data_->acct);
						continue;
					}
					_data_->_tmp22_ = _data_->acct;
					_data_->_tmp23_ = _data_->by_key;
					_data_->_tmp24_ = _data_->found;
					_data_->_state_ = 2;
					dc_webxdc_manager_dialog_collect_account_apps (_data_->self, _data_->_tmp22_, _data_->_tmp23_, _data_->_tmp24_, dc_webxdc_manager_dialog_reload_ready, _data_);
					return FALSE;
					_state_2:
					dc_webxdc_manager_dialog_collect_account_apps_finish (_data_->self, _data_->_res_);
					if (_data_->gen != _data_->self->priv->load_generation) {
						_json_object_unref0 (_data_->acct);
						_json_array_unref0 (_data_->accounts);
						__vala_JsonNode_free0 (_data_->accounts_node);
						_g_hash_table_unref0 (_data_->by_key);
						_g_ptr_array_unref0 (_data_->found);
						g_task_return_pointer (_data_->_async_result, _data_, NULL);
						if (_data_->_state_ != 0) {
							while (!g_task_get_completed (_data_->_async_result)) {
								g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
							}
						}
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					_json_object_unref0 (_data_->acct);
				}
			}
		}
		_json_array_unref0 (_data_->accounts);
		__vala_JsonNode_free0 (_data_->accounts_node);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp25_ = _data_->e;
		_data_->_tmp26_ = _data_->_tmp25_->message;
		g_warning ("webxdc_manager_dialog.vala:142: webxdc manager: %s", _data_->_tmp26_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_hash_table_unref0 (_data_->by_key);
		_g_ptr_array_unref0 (_data_->found);
		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;
	}
	if (_data_->gen != _data_->self->priv->load_generation) {
		_g_hash_table_unref0 (_data_->by_key);
		_g_ptr_array_unref0 (_data_->found);
		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_->_vala1_i = (guint) 0;
		{
			_data_->_tmp27_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp27_) {
					_data_->_tmp28_ = _data_->_vala1_i;
					_data_->_vala1_i = _data_->_tmp28_ + 1;
				}
				_data_->_tmp27_ = FALSE;
				_data_->_tmp29_ = _data_->found;
				_data_->_tmp30_ = vala_g_ptr_array_get_length (_data_->_tmp29_);
				_data_->_tmp31_ = _data_->_tmp30_;
				if (!(_data_->_vala1_i < ((guint) _data_->_tmp31_))) {
					break;
				}
				_data_->_tmp32_ = _data_->found;
				_data_->_tmp33_ = g_ptr_array_index (_data_->_tmp32_, _data_->_vala1_i);
				_data_->_tmp34_ = _g_object_ref0 ((DcWebxdcManagerDialogAppEntry*) _data_->_tmp33_);
				_data_->entry = _data_->_tmp34_;
				_data_->_tmp35_ = _data_->entry;
				_data_->_tmp36_ = _data_->self->priv->favorites;
				_data_->_tmp37_ = _data_->entry;
				_data_->_tmp38_ = _data_->_tmp37_->key;
				_data_->_tmp35_->favorite = g_hash_table_contains (_data_->_tmp36_, _data_->_tmp38_);
				_data_->_tmp39_ = _data_->entry;
				_data_->_tmp40_ = _data_->_tmp39_->instances;
				vala_g_ptr_array_sort (_data_->_tmp40_, ______lambda402__gcompare_func);
				_g_object_unref0 (_data_->entry);
			}
		}
	}
	_data_->_tmp41_ = _data_->found;
	_data_->_tmp42_ = _g_ptr_array_ref0 (_data_->_tmp41_);
	_g_ptr_array_unref0 (_data_->self->priv->apps);
	_data_->self->priv->apps = _data_->_tmp42_;
	dc_webxdc_manager_dialog_rebuild_list (_data_->self);
	_g_hash_table_unref0 (_data_->by_key);
	_g_ptr_array_unref0 (_data_->found);
	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_webxdc_manager_dialog_collect_account_apps_data_free (gpointer _data)
{
	DcWebxdcManagerDialogCollectAccountAppsData* _data_;
	_data_ = _data;
	_json_object_unref0 (_data_->acct);
	_g_hash_table_unref0 (_data_->by_key);
	_g_ptr_array_unref0 (_data_->found);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWebxdcManagerDialogCollectAccountAppsData, _data_);
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

static void
dc_webxdc_manager_dialog_collect_account_apps (DcWebxdcManagerDialog* self,
                                               JsonObject* acct,
                                               GHashTable* by_key,
                                               GPtrArray* found,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	DcWebxdcManagerDialogCollectAccountAppsData* _data_;
	DcWebxdcManagerDialog* _tmp0_;
	JsonObject* _tmp1_;
	GHashTable* _tmp2_;
	GPtrArray* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (acct != NULL);
	g_return_if_fail (by_key != NULL);
	g_return_if_fail (found != NULL);
	_data_ = g_slice_new0 (DcWebxdcManagerDialogCollectAccountAppsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_webxdc_manager_dialog_collect_account_apps_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _json_object_ref0 (acct);
	_json_object_unref0 (_data_->acct);
	_data_->acct = _tmp1_;
	_tmp2_ = _g_hash_table_ref0 (by_key);
	_g_hash_table_unref0 (_data_->by_key);
	_data_->by_key = _tmp2_;
	_tmp3_ = _g_ptr_array_ref0 (found);
	_g_ptr_array_unref0 (_data_->found);
	_data_->found = _tmp3_;
	dc_webxdc_manager_dialog_collect_account_apps_co (_data_);
}

static void
dc_webxdc_manager_dialog_collect_account_apps_finish (DcWebxdcManagerDialog* self,
                                                      GAsyncResult* _res_)
{
	DcWebxdcManagerDialogCollectAccountAppsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/** All Webxdc instances of one profile, merged into the app map.
            Failures stay local to the profile so one broken account does
            not empty the whole list. */
static void
dc_webxdc_manager_dialog_collect_account_apps_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	DcWebxdcManagerDialogCollectAccountAppsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_webxdc_manager_dialog_collect_account_apps_co (_data_);
}

static JsonNode*
_vala_JsonNode_copy (JsonNode* self)
{
	return g_boxed_copy (json_node_get_type (), self);
}

static gpointer
__vala_JsonNode_copy0 (gpointer self)
{
	return self ? _vala_JsonNode_copy (self) : NULL;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gboolean
dc_webxdc_manager_dialog_collect_account_apps_co (DcWebxdcManagerDialogCollectAccountAppsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->acct_id = (gint) dc_json_int (_data_->acct, "id", (gint64) 0);
	if (_data_->acct_id <= 0) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp0_ = dc_json_str (_data_->acct, "addr");
	_data_->self_addr = _data_->_tmp0_;
	_data_->_tmp2_ = dc_json_str (_data_->acct, "displayName");
	_data_->_tmp1_ = _data_->_tmp2_;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp4_ = _data_->self_addr;
		_data_->_tmp5_ = g_strdup (_data_->_tmp4_);
		_data_->_tmp3_ = _data_->_tmp5_;
		if (_data_->_tmp3_ == NULL) {
			_data_->_tmp6_ = g_strdup_printf ("Profile %d", _data_->acct_id);
			_g_free0 (_data_->_tmp3_);
			_data_->_tmp3_ = _data_->_tmp6_;
		}
		_data_->_tmp7_ = _data_->_tmp3_;
		_data_->_tmp3_ = NULL;
		_g_free0 (_data_->_tmp1_);
		_data_->_tmp1_ = _data_->_tmp7_;
		_g_free0 (_data_->_tmp3_);
	}
	_data_->_tmp8_ = _data_->_tmp1_;
	_data_->_tmp1_ = NULL;
	_data_->account_label = _data_->_tmp8_;
	_data_->msg_ids_length1 = 0;
	_data_->_msg_ids_size_ = 0;
	{
		_data_->_tmp10_ = 0;
		_data_->_state_ = 1;
		dc_webxdc_manager_dialog_account_chat_media (_data_->self, _data_->acct_id, dc_webxdc_manager_dialog_collect_account_apps_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = dc_webxdc_manager_dialog_account_chat_media_finish (_data_->self, _data_->_res_, &_data_->_tmp10_, &_data_->_inner_error0_);
		_data_->_tmp9_ = _data_->_tmp11_;
		_data_->_tmp9__length1 = _data_->_tmp10_;
		_data_->__tmp9__size_ = _data_->_tmp9__length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp12_ = _data_->_tmp9_;
		_data_->_tmp12__length1 = _data_->_tmp9__length1;
		_data_->_tmp9_ = NULL;
		_data_->_tmp9__length1 = 0;
		_data_->msg_ids = (g_free (_data_->msg_ids), NULL);
		_data_->msg_ids = _data_->_tmp12_;
		_data_->msg_ids_length1 = _data_->_tmp12__length1;
		_data_->_msg_ids_size_ = _data_->msg_ids_length1;
		_data_->_tmp13_ = _data_->msg_ids;
		_data_->_tmp13__length1 = _data_->msg_ids_length1;
		if (_data_->_tmp13__length1 == 0) {
			_data_->_tmp9_ = (g_free (_data_->_tmp9_), NULL);
			_json_object_unref0 (_data_->map);
			_data_->msg_ids = (g_free (_data_->msg_ids), NULL);
			_g_free0 (_data_->account_label);
			_g_free0 (_data_->_tmp1_);
			_g_free0 (_data_->self_addr);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp15_ = _data_->self->priv->rpc;
		_data_->_tmp16_ = _data_->msg_ids;
		_data_->_tmp16__length1 = _data_->msg_ids_length1;
		_data_->_state_ = 2;
		dc_rpc_client_get_messages_for (_data_->_tmp15_, _data_->acct_id, _data_->_tmp16_, (gint) _data_->_tmp16__length1, dc_webxdc_manager_dialog_collect_account_apps_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp17_ = dc_rpc_client_get_messages_for_finish (_data_->_tmp15_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp14_ = _data_->_tmp17_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_data_->_tmp9_ = (g_free (_data_->_tmp9_), NULL);
			goto __catch0_g_error;
		}
		_data_->_tmp18_ = _data_->_tmp14_;
		_data_->_tmp14_ = NULL;
		_json_object_unref0 (_data_->map);
		_data_->map = _data_->_tmp18_;
		_json_object_unref0 (_data_->_tmp14_);
		_data_->_tmp9_ = (g_free (_data_->_tmp9_), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp19_ = _data_->e;
		_data_->_tmp20_ = _data_->_tmp19_->message;
		g_warning ("webxdc_manager_dialog.vala:175: webxdc manager account %d: %s", _data_->acct_id, _data_->_tmp20_);
		_g_error_free0 (_data_->e);
		_json_object_unref0 (_data_->map);
		_data_->msg_ids = (g_free (_data_->msg_ids), NULL);
		_g_free0 (_data_->account_label);
		_g_free0 (_data_->_tmp1_);
		_g_free0 (_data_->self_addr);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_json_object_unref0 (_data_->map);
		_data_->msg_ids = (g_free (_data_->msg_ids), NULL);
		_g_free0 (_data_->account_label);
		_g_free0 (_data_->_tmp1_);
		_g_free0 (_data_->self_addr);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp21_ = _data_->map;
	if (_data_->_tmp21_ == NULL) {
		_json_object_unref0 (_data_->map);
		_data_->msg_ids = (g_free (_data_->msg_ids), NULL);
		_g_free0 (_data_->account_label);
		_g_free0 (_data_->_tmp1_);
		_g_free0 (_data_->self_addr);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp22_ = g_direct_hash;
	_data_->_tmp23_ = g_direct_equal;
	_data_->_tmp24_ = g_hash_table_new_full (_data_->_tmp22_, _data_->_tmp23_, NULL, _g_free0_);
	_data_->chat_names = _data_->_tmp24_;
	_data_->_tmp25_ = g_direct_hash;
	_data_->_tmp26_ = g_direct_equal;
	_data_->_tmp27_ = g_hash_table_new_full (_data_->_tmp25_, _data_->_tmp26_, NULL, _g_free0_);
	_data_->chat_avatars = _data_->_tmp27_;
	_data_->_tmp28_ = _data_->msg_ids;
	_data_->_tmp28__length1 = _data_->msg_ids_length1;
	{
		_data_->msg_id_collection_length1 = 0;
		_data_->_msg_id_collection_size_ = 0;
		_data_->msg_id_collection = _data_->_tmp28_;
		_data_->msg_id_collection_length1 = _data_->_tmp28__length1;
		for (_data_->msg_id_it = 0; _data_->msg_id_it < _data_->msg_id_collection_length1; _data_->msg_id_it = _data_->msg_id_it + 1) {
			_data_->msg_id = _data_->msg_id_collection[_data_->msg_id_it];
			{
				_data_->_tmp29_ = g_strdup_printf ("%i", _data_->msg_id);
				_data_->mkey = _data_->_tmp29_;
				_data_->_tmp30_ = _data_->map;
				_data_->_tmp31_ = _data_->mkey;
				if (!json_object_has_member (_data_->_tmp30_, _data_->_tmp31_)) {
					_g_free0 (_data_->mkey);
					continue;
				}
				_data_->_tmp32_ = _data_->map;
				_data_->_tmp33_ = _data_->mkey;
				_data_->_tmp34_ = json_object_get_member (_data_->_tmp32_, _data_->_tmp33_);
				_data_->_tmp35_ = __vala_JsonNode_copy0 (_data_->_tmp34_);
				_data_->node = _data_->_tmp35_;
				_data_->_tmp37_ = _data_->node;
				if (_data_->_tmp37_ == NULL) {
					_data_->_tmp36_ = TRUE;
				} else {
					_data_->_tmp38_ = _data_->node;
					_data_->_tmp36_ = json_node_get_node_type (_data_->_tmp38_) != JSON_NODE_OBJECT;
				}
				if (_data_->_tmp36_) {
					__vala_JsonNode_free0 (_data_->node);
					_g_free0 (_data_->mkey);
					continue;
				}
				_data_->_tmp39_ = _data_->node;
				_data_->_tmp40_ = json_node_get_object (_data_->_tmp39_);
				_data_->_tmp41_ = _json_object_ref0 (_data_->_tmp40_);
				_data_->obj = _data_->_tmp41_;
				_data_->_tmp42_ = _data_->obj;
				_data_->_tmp43_ = dc_json_str (_data_->_tmp42_, "kind");
				_data_->_tmp44_ = _data_->_tmp43_;
				_data_->_tmp45_ = g_strcmp0 (_data_->_tmp44_, "message") != 0;
				_g_free0 (_data_->_tmp44_);
				if (_data_->_tmp45_) {
					_json_object_unref0 (_data_->obj);
					__vala_JsonNode_free0 (_data_->node);
					_g_free0 (_data_->mkey);
					continue;
				}
				_data_->_tmp46_ = _data_->obj;
				_data_->_tmp47_ = _data_->self_addr;
				_data_->_tmp48_ = dc_rpc_parsers_parse_message (_data_->_tmp46_, _data_->_tmp47_);
				_data_->msg = _data_->_tmp48_;
				_data_->_tmp49_ = _data_->msg;
				if (!dc_message_is_webxdc (_data_->_tmp49_)) {
					_g_object_unref0 (_data_->msg);
					_json_object_unref0 (_data_->obj);
					__vala_JsonNode_free0 (_data_->node);
					_g_free0 (_data_->mkey);
					continue;
				}
				_data_->info = NULL;
				{
					_data_->_tmp50_ = _data_->self->priv->rpc;
					_data_->_tmp51_ = dc_params_begin ();
					_data_->_tmp52_ = _data_->_tmp51_;
					_data_->_tmp53_ = dc_params_add_int (_data_->_tmp52_, _data_->acct_id);
					_data_->_tmp54_ = _data_->_tmp53_;
					_data_->_tmp55_ = _data_->msg;
					_data_->_tmp56_ = dc_message_get_id (_data_->_tmp55_);
					_data_->_tmp57_ = _data_->_tmp56_;
					_data_->_tmp58_ = dc_params_add_int (_data_->_tmp54_, _data_->_tmp57_);
					_data_->_tmp59_ = _data_->_tmp58_;
					_data_->_tmp60_ = dc_params_build (_data_->_tmp59_);
					_data_->_tmp61_ = _data_->_tmp60_;
					_data_->_state_ = 3;
					dc_rpc_client_call (_data_->_tmp50_, "get_webxdc_info", _data_->_tmp61_, dc_webxdc_manager_dialog_collect_account_apps_ready, _data_);
					return FALSE;
					_state_3:
					_data_->_tmp62_ = dc_rpc_client_call_finish (_data_->_tmp50_, _data_->_res_, &_data_->_inner_error0_);
					_data_->_tmp63_ = _data_->_tmp62_;
					__vala_JsonNode_free0 (_data_->_tmp61_);
					_g_object_unref0 (_data_->_tmp59_);
					_g_object_unref0 (_data_->_tmp54_);
					_g_object_unref0 (_data_->_tmp52_);
					_data_->res = _data_->_tmp63_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch1_g_error;
					}
					_data_->_tmp64_ = _data_->res;
					_data_->_tmp65_ = json_node_get_object (_data_->_tmp64_);
					_data_->_tmp66_ = _json_object_ref0 (_data_->_tmp65_);
					_json_object_unref0 (_data_->info);
					_data_->info = _data_->_tmp66_;
					__vala_JsonNode_free0 (_data_->res);
				}
				goto __finally1;
				__catch1_g_error:
				{
					_data_->_vala1_e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp67_ = _data_->msg;
					_data_->_tmp68_ = dc_message_get_id (_data_->_tmp67_);
					_data_->_tmp69_ = _data_->_tmp68_;
					_data_->_tmp70_ = _data_->_vala1_e;
					_data_->_tmp71_ = _data_->_tmp70_->message;
					g_debug ("webxdc_manager_dialog.vala:202: webxdc info %d/%d: %s", _data_->acct_id, _data_->_tmp69_, _data_->_tmp71_);
					_g_error_free0 (_data_->_vala1_e);
				}
				__finally1:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_json_object_unref0 (_data_->info);
					_g_object_unref0 (_data_->msg);
					_json_object_unref0 (_data_->obj);
					__vala_JsonNode_free0 (_data_->node);
					_g_free0 (_data_->mkey);
					_g_hash_table_unref0 (_data_->chat_avatars);
					_g_hash_table_unref0 (_data_->chat_names);
					_json_object_unref0 (_data_->map);
					_data_->msg_ids = (g_free (_data_->msg_ids), NULL);
					_g_free0 (_data_->account_label);
					_g_free0 (_data_->_tmp1_);
					_g_free0 (_data_->self_addr);
					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_->_tmp73_ = _data_->info;
				if (_data_->_tmp73_ != NULL) {
					_data_->_tmp75_ = _data_->info;
					_data_->_tmp76_ = dc_json_str (_data_->_tmp75_, "name");
					_data_->_tmp74_ = _data_->_tmp76_;
					if (_data_->_tmp74_ == NULL) {
						_data_->_tmp77_ = g_strdup ("");
						_g_free0 (_data_->_tmp74_);
						_data_->_tmp74_ = _data_->_tmp77_;
					}
					_data_->_tmp78_ = _data_->_tmp74_;
					_data_->_tmp74_ = NULL;
					_g_free0 (_data_->_tmp72_);
					_data_->_tmp72_ = _data_->_tmp78_;
					_g_free0 (_data_->_tmp74_);
				} else {
					_data_->_tmp79_ = g_strdup ("");
					_g_free0 (_data_->_tmp72_);
					_data_->_tmp72_ = _data_->_tmp79_;
				}
				_data_->_tmp80_ = _data_->_tmp72_;
				_data_->_tmp72_ = NULL;
				_data_->name = _data_->_tmp80_;
				_data_->_tmp81_ = _data_->name;
				_data_->_tmp82_ = strlen (_data_->_tmp81_);
				_data_->_tmp83_ = _data_->_tmp82_;
				if (_data_->_tmp83_ == 0) {
					_data_->_tmp84_ = _data_->msg;
					_data_->_tmp85_ = dc_message_display_file_name (_data_->_tmp84_, "App");
					_g_free0 (_data_->name);
					_data_->name = _data_->_tmp85_;
					_data_->_tmp86_ = _data_->name;
					_data_->_tmp87_ = g_utf8_strdown (_data_->_tmp86_, (gssize) -1);
					_data_->_tmp88_ = _data_->_tmp87_;
					_data_->_tmp89_ = g_str_has_suffix (_data_->_tmp88_, ".xdc");
					_g_free0 (_data_->_tmp88_);
					if (_data_->_tmp89_) {
						_data_->_tmp90_ = _data_->name;
						_data_->_tmp91_ = _data_->name;
						_data_->_tmp92_ = strlen (_data_->_tmp91_);
						_data_->_tmp93_ = _data_->_tmp92_;
						_data_->_tmp94_ = string_substring (_data_->_tmp90_, (glong) 0, (glong) (_data_->_tmp93_ - 4));
						_g_free0 (_data_->name);
						_data_->name = _data_->_tmp94_;
					}
				}
				_data_->_tmp95_ = _data_->name;
				_data_->_tmp96_ = g_utf8_strdown (_data_->_tmp95_, (gssize) -1);
				_data_->key = _data_->_tmp96_;
				_data_->_tmp97_ = _data_->key;
				_data_->_tmp98_ = g_hash_table_lookup (_data_->by_key, _data_->_tmp97_);
				_data_->_tmp99_ = _g_object_ref0 ((DcWebxdcManagerDialogAppEntry*) _data_->_tmp98_);
				_data_->entry = _data_->_tmp99_;
				_data_->_tmp100_ = _data_->entry;
				if (_data_->_tmp100_ == NULL) {
					_data_->_tmp101_ = dc_webxdc_manager_dialog_app_entry_new ();
					_g_object_unref0 (_data_->entry);
					_data_->entry = _data_->_tmp101_;
					_data_->_tmp102_ = _data_->entry;
					_data_->_tmp103_ = _data_->key;
					_data_->_tmp104_ = g_strdup (_data_->_tmp103_);
					_g_free0 (_data_->_tmp102_->key);
					_data_->_tmp102_->key = _data_->_tmp104_;
					_data_->_tmp105_ = _data_->entry;
					_data_->_tmp106_ = _data_->name;
					_data_->_tmp107_ = g_strdup (_data_->_tmp106_);
					_g_free0 (_data_->_tmp105_->name);
					_data_->_tmp105_->name = _data_->_tmp107_;
					_data_->_tmp108_ = _data_->key;
					_data_->_tmp109_ = g_strdup (_data_->_tmp108_);
					_data_->_tmp110_ = _data_->entry;
					_data_->_tmp111_ = _g_object_ref0 (_data_->_tmp110_);
					g_hash_table_insert (_data_->by_key, _data_->_tmp109_, _data_->_tmp111_);
					_data_->_tmp112_ = _data_->entry;
					_data_->_tmp113_ = _g_object_ref0 (_data_->_tmp112_);
					g_ptr_array_add (_data_->found, _data_->_tmp113_);
				}
				_data_->_tmp114_ = _data_->info;
				if (_data_->_tmp114_ != NULL) {
					_data_->_tmp115_ = _data_->entry;
					_data_->_tmp116_ = _data_->msg;
					_data_->_tmp117_ = dc_message_get_id (_data_->_tmp116_);
					_data_->_tmp118_ = _data_->_tmp117_;
					_data_->_tmp119_ = _data_->info;
					_data_->_state_ = 4;
					dc_webxdc_manager_dialog_merge_info (_data_->self, _data_->_tmp115_, _data_->acct_id, _data_->_tmp118_, _data_->_tmp119_, dc_webxdc_manager_dialog_collect_account_apps_ready, _data_);
					return FALSE;
					_state_4:
					dc_webxdc_manager_dialog_merge_info_finish (_data_->self, _data_->_res_);
				}
				_data_->_tmp121_ = _data_->entry;
				if (_data_->_tmp121_->created == ((gint64) 0)) {
					_data_->_tmp120_ = TRUE;
				} else {
					_data_->_tmp123_ = _data_->msg;
					_data_->_tmp124_ = dc_message_get_timestamp (_data_->_tmp123_);
					_data_->_tmp125_ = _data_->_tmp124_;
					if (_data_->_tmp125_ > ((gint64) 0)) {
						_data_->_tmp126_ = _data_->msg;
						_data_->_tmp127_ = dc_message_get_timestamp (_data_->_tmp126_);
						_data_->_tmp128_ = _data_->_tmp127_;
						_data_->_tmp129_ = _data_->entry;
						_data_->_tmp122_ = _data_->_tmp128_ < _data_->_tmp129_->created;
					} else {
						_data_->_tmp122_ = FALSE;
					}
					_data_->_tmp120_ = _data_->_tmp122_;
				}
				if (_data_->_tmp120_) {
					_data_->_tmp130_ = _data_->entry;
					_data_->_tmp131_ = _data_->msg;
					_data_->_tmp132_ = dc_message_get_timestamp (_data_->_tmp131_);
					_data_->_tmp133_ = _data_->_tmp132_;
					_data_->_tmp130_->created = _data_->_tmp133_;
					_data_->_tmp134_ = _data_->entry;
					_data_->_tmp135_ = _data_->msg;
					_data_->_tmp136_ = dc_webxdc_manager_dialog_sender_label (_data_->_tmp135_);
					_g_free0 (_data_->_tmp134_->author);
					_data_->_tmp134_->author = _data_->_tmp136_;
				}
				_data_->_tmp137_ = dc_webxdc_manager_dialog_app_instance_new ();
				_data_->inst = _data_->_tmp137_;
				_data_->_tmp138_ = _data_->inst;
				_data_->_tmp138_->account_id = _data_->acct_id;
				_data_->_tmp139_ = _data_->inst;
				_data_->_tmp140_ = _data_->account_label;
				_data_->_tmp141_ = g_strdup (_data_->_tmp140_);
				_g_free0 (_data_->_tmp139_->account_label);
				_data_->_tmp139_->account_label = _data_->_tmp141_;
				_data_->_tmp142_ = _data_->inst;
				_data_->_tmp143_ = _data_->msg;
				_data_->_tmp144_ = _g_object_ref0 (_data_->_tmp143_);
				_g_object_unref0 (_data_->_tmp142_->msg);
				_data_->_tmp142_->msg = _data_->_tmp144_;
				_data_->_tmp145_ = _data_->msg;
				_data_->_tmp146_ = dc_message_get_chat_id (_data_->_tmp145_);
				_data_->_tmp147_ = _data_->_tmp146_;
				_data_->_tmp148_ = _data_->chat_names;
				_data_->_tmp149_ = _data_->chat_avatars;
				_data_->_state_ = 5;
				dc_webxdc_manager_dialog_lookup_chat (_data_->self, _data_->acct_id, _data_->_tmp147_, _data_->_tmp148_, _data_->_tmp149_, dc_webxdc_manager_dialog_collect_account_apps_ready, _data_);
				return FALSE;
				_state_5:
				dc_webxdc_manager_dialog_lookup_chat_finish (_data_->self, _data_->_res_);
				_data_->_tmp151_ = _data_->chat_names;
				_data_->_tmp152_ = _data_->msg;
				_data_->_tmp153_ = dc_message_get_chat_id (_data_->_tmp152_);
				_data_->_tmp154_ = _data_->_tmp153_;
				_data_->_tmp155_ = g_hash_table_lookup (_data_->_tmp151_, (gpointer) ((gintptr) _data_->_tmp154_));
				_data_->_tmp156_ = g_strdup ((const gchar*) _data_->_tmp155_);
				_data_->_tmp150_ = _data_->_tmp156_;
				if (_data_->_tmp150_ == NULL) {
					_data_->_tmp157_ = _data_->msg;
					_data_->_tmp158_ = dc_message_get_chat_id (_data_->_tmp157_);
					_data_->_tmp159_ = _data_->_tmp158_;
					_data_->_tmp160_ = g_strdup_printf ("Chat %d", _data_->_tmp159_);
					_g_free0 (_data_->_tmp150_);
					_data_->_tmp150_ = _data_->_tmp160_;
				}
				_data_->_tmp161_ = _data_->inst;
				_data_->_tmp162_ = _data_->_tmp150_;
				_data_->_tmp150_ = NULL;
				_g_free0 (_data_->_tmp161_->chat_name);
				_data_->_tmp161_->chat_name = _data_->_tmp162_;
				_data_->_tmp163_ = _data_->inst;
				_data_->_tmp164_ = _data_->chat_avatars;
				_data_->_tmp165_ = _data_->msg;
				_data_->_tmp166_ = dc_message_get_chat_id (_data_->_tmp165_);
				_data_->_tmp167_ = _data_->_tmp166_;
				_data_->_tmp168_ = g_hash_table_lookup (_data_->_tmp164_, (gpointer) ((gintptr) _data_->_tmp167_));
				_data_->_tmp169_ = g_strdup ((const gchar*) _data_->_tmp168_);
				_g_free0 (_data_->_tmp163_->chat_avatar);
				_data_->_tmp163_->chat_avatar = _data_->_tmp169_;
				_data_->_tmp170_ = _data_->entry;
				_data_->_tmp171_ = _data_->_tmp170_->instances;
				_data_->_tmp172_ = _data_->inst;
				_data_->_tmp173_ = _g_object_ref0 (_data_->_tmp172_);
				g_ptr_array_add (_data_->_tmp171_, _data_->_tmp173_);
				_data_->_tmp174_ = _data_->entry;
				_data_->_tmp175_ = _data_->msg;
				dc_webxdc_manager_dialog_add_user (_data_->self, _data_->_tmp174_, _data_->acct_id, _data_->_tmp175_);
				_g_free0 (_data_->_tmp150_);
				_g_object_unref0 (_data_->inst);
				_g_object_unref0 (_data_->entry);
				_g_free0 (_data_->key);
				_g_free0 (_data_->name);
				_g_free0 (_data_->_tmp72_);
				_json_object_unref0 (_data_->info);
				_g_object_unref0 (_data_->msg);
				_json_object_unref0 (_data_->obj);
				__vala_JsonNode_free0 (_data_->node);
				_g_free0 (_data_->mkey);
			}
		}
	}
	_g_hash_table_unref0 (_data_->chat_avatars);
	_g_hash_table_unref0 (_data_->chat_names);
	_json_object_unref0 (_data_->map);
	_data_->msg_ids = (g_free (_data_->msg_ids), NULL);
	_g_free0 (_data_->account_label);
	_g_free0 (_data_->_tmp1_);
	_g_free0 (_data_->self_addr);
	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_webxdc_manager_dialog_account_chat_media_data_free (gpointer _data)
{
	DcWebxdcManagerDialogAccountChatMediaData* _data_;
	_data_ = _data;
	_data_->result = (g_free (_data_->result), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWebxdcManagerDialogAccountChatMediaData, _data_);
}

static void
dc_webxdc_manager_dialog_account_chat_media (DcWebxdcManagerDialog* self,
                                             gint acct_id,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	DcWebxdcManagerDialogAccountChatMediaData* _data_;
	DcWebxdcManagerDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DcWebxdcManagerDialogAccountChatMediaData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_webxdc_manager_dialog_account_chat_media_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	dc_webxdc_manager_dialog_account_chat_media_co (_data_);
}

static gint*
dc_webxdc_manager_dialog_account_chat_media_finish (DcWebxdcManagerDialog* self,
                                                    GAsyncResult* _res_,
                                                    gint* result_length1,
                                                    GError** error)
{
	gint* result;
	DcWebxdcManagerDialogAccountChatMediaData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}

/** Webxdc message ids in any chat of the account, newest last. */
static void
dc_webxdc_manager_dialog_account_chat_media_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	DcWebxdcManagerDialogAccountChatMediaData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_webxdc_manager_dialog_account_chat_media_co (_data_);
}

static gboolean
dc_webxdc_manager_dialog_account_chat_media_co (DcWebxdcManagerDialogAccountChatMediaData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->rpc;
	_data_->_tmp1_ = dc_params_begin ();
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = dc_params_add_int (_data_->_tmp2_, _data_->acct_id);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = dc_params_add_null (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = dc_params_add_string (_data_->_tmp6_, "Webxdc");
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = dc_params_add_null (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = dc_params_add_null (_data_->_tmp10_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = dc_params_build (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_state_ = 1;
	dc_rpc_client_call (_data_->_tmp0_, "get_chat_media", _data_->_tmp14_, dc_webxdc_manager_dialog_account_chat_media_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp15_ = dc_rpc_client_call_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp16_ = _data_->_tmp15_;
	__vala_JsonNode_free0 (_data_->_tmp14_);
	_g_object_unref0 (_data_->_tmp12_);
	_g_object_unref0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->_tmp8_);
	_g_object_unref0 (_data_->_tmp6_);
	_g_object_unref0 (_data_->_tmp4_);
	_g_object_unref0 (_data_->_tmp2_);
	_data_->_result_ = _data_->_tmp16_;
	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;
	}
	if (_data_->_result_ == NULL) {
		_data_->_tmp17_ = TRUE;
	} else {
		_data_->_tmp17_ = json_node_get_node_type (_data_->_result_) != JSON_NODE_ARRAY;
	}
	if (_data_->_tmp17_) {
		_data_->_tmp18_ = g_new0 (gint, 0);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp19__length1 = 0;
		_data_->result_length1 = _data_->_tmp19__length1;
		_data_->result = _data_->_tmp19_;
		__vala_JsonNode_free0 (_data_->_result_);
		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_ = json_node_get_array (_data_->_result_);
	_data_->_tmp21_ = _json_array_ref0 (_data_->_tmp20_);
	_data_->arr = _data_->_tmp21_;
	_data_->_tmp22_ = _data_->arr;
	_data_->_tmp23_ = g_new0 (gint, json_array_get_length (_data_->_tmp22_));
	_data_->ids = _data_->_tmp23_;
	_data_->ids_length1 = json_array_get_length (_data_->_tmp22_);
	_data_->_ids_size_ = _data_->ids_length1;
	{
		_data_->i = (guint) 0;
		{
			_data_->_tmp24_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp24_) {
					_data_->_tmp25_ = _data_->i;
					_data_->i = _data_->_tmp25_ + 1;
				}
				_data_->_tmp24_ = FALSE;
				_data_->_tmp26_ = _data_->arr;
				if (!(_data_->i < json_array_get_length (_data_->_tmp26_))) {
					break;
				}
				_data_->_tmp27_ = _data_->ids;
				_data_->_tmp27__length1 = _data_->ids_length1;
				_data_->_tmp28_ = _data_->arr;
				_data_->_tmp27_[_data_->i] = (gint) json_array_get_int_element (_data_->_tmp28_, _data_->i);
			}
		}
	}
	_data_->_tmp29_ = _data_->ids;
	_data_->_tmp29__length1 = _data_->ids_length1;
	_data_->result_length1 = _data_->_tmp29__length1;
	_data_->result = _data_->_tmp29_;
	_json_array_unref0 (_data_->arr);
	__vala_JsonNode_free0 (_data_->_result_);
	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_webxdc_manager_dialog_merge_info_data_free (gpointer _data)
{
	DcWebxdcManagerDialogMergeInfoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->entry);
	_json_object_unref0 (_data_->info);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWebxdcManagerDialogMergeInfoData, _data_);
}

static void
dc_webxdc_manager_dialog_merge_info (DcWebxdcManagerDialog* self,
                                     DcWebxdcManagerDialogAppEntry* entry,
                                     gint acct_id,
                                     gint msg_id,
                                     JsonObject* info,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DcWebxdcManagerDialogMergeInfoData* _data_;
	DcWebxdcManagerDialog* _tmp0_;
	DcWebxdcManagerDialogAppEntry* _tmp1_;
	JsonObject* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (info != NULL);
	_data_ = g_slice_new0 (DcWebxdcManagerDialogMergeInfoData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_webxdc_manager_dialog_merge_info_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (entry);
	_g_object_unref0 (_data_->entry);
	_data_->entry = _tmp1_;
	_data_->acct_id = acct_id;
	_data_->msg_id = msg_id;
	_tmp2_ = _json_object_ref0 (info);
	_json_object_unref0 (_data_->info);
	_data_->info = _tmp2_;
	dc_webxdc_manager_dialog_merge_info_co (_data_);
}

static void
dc_webxdc_manager_dialog_merge_info_finish (DcWebxdcManagerDialog* self,
                                            GAsyncResult* _res_)
{
	DcWebxdcManagerDialogMergeInfoData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/** Manifest metadata and icon, filled from the first instance that
            provides each piece. */
static void
dc_webxdc_manager_dialog_merge_info_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DcWebxdcManagerDialogMergeInfoData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_webxdc_manager_dialog_merge_info_co (_data_);
}

static gboolean
dc_webxdc_manager_dialog_merge_info_co (DcWebxdcManagerDialogMergeInfoData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->entry->summary;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp1_ = dc_json_str (_data_->info, "summary");
		_data_->summary = _data_->_tmp1_;
		_data_->_tmp3_ = _data_->summary;
		if (_data_->_tmp3_ != NULL) {
			_data_->_tmp4_ = _data_->summary;
			_data_->_tmp5_ = strlen (_data_->_tmp4_);
			_data_->_tmp6_ = _data_->_tmp5_;
			_data_->_tmp2_ = _data_->_tmp6_ > 0;
		} else {
			_data_->_tmp2_ = FALSE;
		}
		if (_data_->_tmp2_) {
			_data_->_tmp7_ = _data_->summary;
			_data_->_tmp8_ = g_strdup (_data_->_tmp7_);
			_g_free0 (_data_->entry->summary);
			_data_->entry->summary = _data_->_tmp8_;
		}
		_g_free0 (_data_->summary);
	}
	_data_->_tmp9_ = _data_->entry->document;
	if (_data_->_tmp9_ == NULL) {
		_data_->_tmp10_ = dc_json_str (_data_->info, "document");
		_data_->document = _data_->_tmp10_;
		_data_->_tmp12_ = _data_->document;
		if (_data_->_tmp12_ != NULL) {
			_data_->_tmp13_ = _data_->document;
			_data_->_tmp14_ = strlen (_data_->_tmp13_);
			_data_->_tmp15_ = _data_->_tmp14_;
			_data_->_tmp11_ = _data_->_tmp15_ > 0;
		} else {
			_data_->_tmp11_ = FALSE;
		}
		if (_data_->_tmp11_) {
			_data_->_tmp16_ = _data_->document;
			_data_->_tmp17_ = g_strdup (_data_->_tmp16_);
			_g_free0 (_data_->entry->document);
			_data_->entry->document = _data_->_tmp17_;
		}
		_g_free0 (_data_->document);
	}
	_data_->_tmp18_ = _data_->entry->source_code_url;
	if (_data_->_tmp18_ == NULL) {
		_data_->_tmp19_ = dc_json_str (_data_->info, "sourceCodeUrl");
		_data_->url = _data_->_tmp19_;
		_data_->_tmp21_ = _data_->url;
		if (_data_->_tmp21_ != NULL) {
			_data_->_tmp22_ = _data_->url;
			_data_->_tmp23_ = strlen (_data_->_tmp22_);
			_data_->_tmp24_ = _data_->_tmp23_;
			_data_->_tmp20_ = _data_->_tmp24_ > 0;
		} else {
			_data_->_tmp20_ = FALSE;
		}
		if (_data_->_tmp20_) {
			_data_->_tmp25_ = _data_->url;
			_data_->_tmp26_ = g_strdup (_data_->_tmp25_);
			_g_free0 (_data_->entry->source_code_url);
			_data_->entry->source_code_url = _data_->_tmp26_;
		}
		_g_free0 (_data_->url);
	}
	if (dc_json_bool (_data_->info, "internetAccess")) {
		_data_->entry->internet_access = TRUE;
	}
	_data_->_tmp27_ = _data_->entry->icon;
	if (_data_->_tmp27_ != NULL) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp28_ = dc_json_str (_data_->info, "icon");
	_data_->icon_name = _data_->_tmp28_;
	_data_->_tmp30_ = _data_->icon_name;
	if (_data_->_tmp30_ == NULL) {
		_data_->_tmp29_ = TRUE;
	} else {
		_data_->_tmp31_ = _data_->icon_name;
		_data_->_tmp32_ = strlen (_data_->_tmp31_);
		_data_->_tmp33_ = _data_->_tmp32_;
		_data_->_tmp29_ = _data_->_tmp33_ == 0;
	}
	if (_data_->_tmp29_) {
		_g_free0 (_data_->icon_name);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp34_ = _data_->self->priv->rpc;
		_data_->_tmp35_ = dc_params_begin ();
		_data_->_tmp36_ = _data_->_tmp35_;
		_data_->_tmp37_ = dc_params_add_int (_data_->_tmp36_, _data_->acct_id);
		_data_->_tmp38_ = _data_->_tmp37_;
		_data_->_tmp39_ = dc_params_add_int (_data_->_tmp38_, _data_->msg_id);
		_data_->_tmp40_ = _data_->_tmp39_;
		_data_->_tmp41_ = _data_->icon_name;
		_data_->_tmp42_ = dc_params_add_string (_data_->_tmp40_, _data_->_tmp41_);
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_tmp44_ = dc_params_build (_data_->_tmp43_);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_state_ = 1;
		dc_rpc_client_call (_data_->_tmp34_, "get_webxdc_blob", _data_->_tmp45_, dc_webxdc_manager_dialog_merge_info_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp46_ = dc_rpc_client_call_finish (_data_->_tmp34_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp47_ = _data_->_tmp46_;
		__vala_JsonNode_free0 (_data_->_tmp45_);
		_g_object_unref0 (_data_->_tmp43_);
		_g_object_unref0 (_data_->_tmp40_);
		_g_object_unref0 (_data_->_tmp38_);
		_g_object_unref0 (_data_->_tmp36_);
		_data_->blob = _data_->_tmp47_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp49_ = _data_->blob;
		_data_->_tmp50_ = json_node_get_string (_data_->_tmp49_);
		_data_->_tmp51_ = 0;
		_data_->_tmp52_ = g_base64_decode (_data_->_tmp50_, &_data_->_tmp51_);
		_data_->_tmp53_ = _data_->_tmp52_;
		_data_->_tmp53__length1 = _data_->_tmp51_;
		_data_->_tmp54_ = g_bytes_new (_data_->_tmp53_, _data_->_tmp51_);
		_data_->_tmp55_ = _data_->_tmp54_;
		_data_->_tmp56_ = gdk_texture_new_from_bytes (_data_->_tmp55_, &_data_->_inner_error0_);
		_data_->_tmp57_ = _data_->_tmp56_;
		_g_bytes_unref0 (_data_->_tmp55_);
		_data_->_tmp53_ = (g_free (_data_->_tmp53_), NULL);
		_data_->_tmp48_ = _data_->_tmp57_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			__vala_JsonNode_free0 (_data_->blob);
			goto __catch0_g_error;
		}
		_data_->_tmp58_ = _data_->_tmp48_;
		_data_->_tmp48_ = NULL;
		_g_object_unref0 (_data_->entry->icon);
		_data_->entry->icon = _data_->_tmp58_;
		_g_object_unref0 (_data_->_tmp48_);
		__vala_JsonNode_free0 (_data_->blob);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp59_ = _data_->e;
		_data_->_tmp60_ = _data_->_tmp59_->message;
		g_debug ("webxdc_manager_dialog.vala:302: webxdc icon %d/%d: %s", _data_->acct_id, _data_->msg_id, _data_->_tmp60_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->icon_name);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_free0 (_data_->icon_name);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
dc_webxdc_manager_dialog_lookup_chat_data_free (gpointer _data)
{
	DcWebxdcManagerDialogLookupChatData* _data_;
	_data_ = _data;
	_g_hash_table_unref0 (_data_->names);
	_g_hash_table_unref0 (_data_->avatars);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWebxdcManagerDialogLookupChatData, _data_);
}

static void
dc_webxdc_manager_dialog_lookup_chat (DcWebxdcManagerDialog* self,
                                      gint acct_id,
                                      gint chat_id,
                                      GHashTable* names,
                                      GHashTable* avatars,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	DcWebxdcManagerDialogLookupChatData* _data_;
	DcWebxdcManagerDialog* _tmp0_;
	GHashTable* _tmp1_;
	GHashTable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (names != NULL);
	g_return_if_fail (avatars != NULL);
	_data_ = g_slice_new0 (DcWebxdcManagerDialogLookupChatData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_webxdc_manager_dialog_lookup_chat_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->acct_id = acct_id;
	_data_->chat_id = chat_id;
	_tmp1_ = _g_hash_table_ref0 (names);
	_g_hash_table_unref0 (_data_->names);
	_data_->names = _tmp1_;
	_tmp2_ = _g_hash_table_ref0 (avatars);
	_g_hash_table_unref0 (_data_->avatars);
	_data_->avatars = _tmp2_;
	dc_webxdc_manager_dialog_lookup_chat_co (_data_);
}

static void
dc_webxdc_manager_dialog_lookup_chat_finish (DcWebxdcManagerDialog* self,
                                             GAsyncResult* _res_)
{
	DcWebxdcManagerDialogLookupChatData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_webxdc_manager_dialog_lookup_chat_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	DcWebxdcManagerDialogLookupChatData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_webxdc_manager_dialog_lookup_chat_co (_data_);
}

static gboolean
dc_webxdc_manager_dialog_lookup_chat_co (DcWebxdcManagerDialogLookupChatData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_hash_table_lookup (_data_->names, (gpointer) ((gintptr) _data_->chat_id));
	if (((const gchar*) _data_->_tmp0_) != NULL) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp1_ = _data_->self->priv->rpc;
		_data_->_state_ = 1;
		dc_rpc_client_get_full_chat_by_id_for (_data_->_tmp1_, _data_->acct_id, _data_->chat_id, dc_webxdc_manager_dialog_lookup_chat_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = dc_rpc_client_get_full_chat_by_id_for_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->chat = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->chat;
		if (_data_->_tmp3_ == 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_, "name");
		_data_->name = _data_->_tmp5_;
		_data_->_tmp7_ = _data_->name;
		if (_data_->_tmp7_ != NULL) {
			_data_->_tmp8_ = _data_->name;
			_data_->_tmp9_ = strlen (_data_->_tmp8_);
			_data_->_tmp10_ = _data_->_tmp9_;
			_data_->_tmp6_ = _data_->_tmp10_ > 0;
		} else {
			_data_->_tmp6_ = FALSE;
		}
		if (_data_->_tmp6_) {
			_data_->_tmp11_ = _data_->name;
			_data_->_tmp12_ = g_strdup (_data_->_tmp11_);
			g_hash_table_insert (_data_->names, (gpointer) ((gintptr) _data_->chat_id), _data_->_tmp12_);
		}
		_data_->_tmp13_ = _data_->chat;
		_data_->_tmp14_ = dc_json_str (_data_->_tmp13_, "profileImage");
		_data_->avatar = _data_->_tmp14_;
		_data_->_tmp16_ = _data_->avatar;
		if (_data_->_tmp16_ != NULL) {
			_data_->_tmp17_ = _data_->avatar;
			_data_->_tmp18_ = strlen (_data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp15_ = _data_->_tmp19_ > 0;
		} else {
			_data_->_tmp15_ = FALSE;
		}
		if (_data_->_tmp15_) {
			_data_->_tmp20_ = _data_->avatar;
			_data_->_tmp21_ = g_strdup (_data_->_tmp20_);
			g_hash_table_insert (_data_->avatars, (gpointer) ((gintptr) _data_->chat_id), _data_->_tmp21_);
		}
		_g_free0 (_data_->avatar);
		_g_free0 (_data_->name);
		_json_object_unref0 (_data_->chat);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp22_ = _data_->e;
		_data_->_tmp23_ = _data_->_tmp22_->message;
		g_debug ("webxdc_manager_dialog.vala:323: webxdc chat %d/%d: %s", _data_->acct_id, _data_->chat_id, _data_->_tmp23_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gchar*
dc_webxdc_manager_dialog_sender_label (DcMessage* msg)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp9_;
	gchar* result;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp0_ = dc_message_get_is_outgoing (msg);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("Me");
		result = _tmp2_;
		return result;
	}
	_tmp4_ = dc_message_get_sender_name (msg);
	_tmp5_ = _tmp4_;
	_tmp3_ = _tmp5_;
	if (_tmp3_ == NULL) {
		const gchar* _tmp6_ = NULL;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp7_ = dc_message_get_sender_address (msg);
		_tmp8_ = _tmp7_;
		_tmp6_ = _tmp8_;
		if (_tmp6_ == NULL) {
			_tmp6_ = "Unknown";
		}
		_tmp3_ = _tmp6_;
	}
	_tmp9_ = g_strdup (_tmp3_);
	result = _tmp9_;
	return result;
}

static void
dc_webxdc_manager_dialog_add_user (DcWebxdcManagerDialog* self,
                                   DcWebxdcManagerDialogAppEntry* entry,
                                   gint acct_id,
                                   DcMessage* msg)
{
	gchar* key = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gchar* _tmp2_;
	DcWebxdcManagerDialogAppUser* user = NULL;
	DcWebxdcManagerDialogAppUser* _tmp12_;
	DcWebxdcManagerDialogAppUser* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	DcWebxdcManagerDialogAppUser* _tmp16_;
	gchar* _tmp17_;
	DcWebxdcManagerDialogAppUser* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	GPtrArray* _tmp22_;
	DcWebxdcManagerDialogAppUser* _tmp23_;
	DcWebxdcManagerDialogAppUser* _tmp24_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	g_return_if_fail (msg != NULL);
	_tmp0_ = dc_message_get_sender_contact_id (msg);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("%d:%d", acct_id, _tmp1_);
	key = _tmp2_;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				GPtrArray* _tmp5_;
				gint _tmp6_;
				gint _tmp7_;
				GPtrArray* _tmp8_;
				gconstpointer _tmp9_;
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				if (!_tmp3_) {
					guint _tmp4_;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				_tmp5_ = entry->users;
				_tmp6_ = vala_g_ptr_array_get_length (_tmp5_);
				_tmp7_ = _tmp6_;
				if (!(i < ((guint) _tmp7_))) {
					break;
				}
				_tmp8_ = entry->users;
				_tmp9_ = g_ptr_array_index (_tmp8_, i);
				_tmp10_ = ((DcWebxdcManagerDialogAppUser*) _tmp9_)->key;
				_tmp11_ = key;
				if (g_strcmp0 (_tmp10_, _tmp11_) == 0) {
					_g_free0 (key);
					return;
				}
			}
		}
	}
	_tmp12_ = dc_webxdc_manager_dialog_app_user_new ();
	user = _tmp12_;
	_tmp13_ = user;
	_tmp14_ = key;
	_tmp15_ = g_strdup (_tmp14_);
	_g_free0 (_tmp13_->key);
	_tmp13_->key = _tmp15_;
	_tmp16_ = user;
	_tmp17_ = dc_webxdc_manager_dialog_sender_label (msg);
	_g_free0 (_tmp16_->name);
	_tmp16_->name = _tmp17_;
	_tmp18_ = user;
	_tmp19_ = dc_message_get_sender_avatar_path (msg);
	_tmp20_ = _tmp19_;
	_tmp21_ = g_strdup (_tmp20_);
	_g_free0 (_tmp18_->avatar_path);
	_tmp18_->avatar_path = _tmp21_;
	_tmp22_ = entry->users;
	_tmp23_ = user;
	_tmp24_ = _g_object_ref0 (_tmp23_);
	g_ptr_array_add (_tmp22_, _tmp24_);
	_g_object_unref0 (user);
	_g_free0 (key);
}

static gchar*
dc_webxdc_manager_dialog_favorites_path (void)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	_tmp0_ = g_get_user_config_dir ();
	_tmp1_ = g_build_filename (_tmp0_, "parla", "webxdc-favorites.ini", NULL);
	result = _tmp1_;
	return result;
}

static GHashTable*
dc_webxdc_manager_dialog_load_favorites (void)
{
	GHashTable* set = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GKeyFile* kf = NULL;
	GKeyFile* _tmp3_;
	GError* _inner_error0_ = NULL;
	GHashTable* result;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _g_free0_);
	set = _tmp2_;
	_tmp3_ = g_key_file_new ();
	kf = _tmp3_;
	{
		GKeyFile* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar** _tmp7_ = NULL;
		GKeyFile* _tmp8_;
		gsize _tmp9_ = 0;
		gchar** _tmp10_;
		gint _tmp7__length1;
		gint __tmp7__size_;
		_tmp4_ = kf;
		_tmp5_ = dc_webxdc_manager_dialog_favorites_path ();
		_tmp6_ = _tmp5_;
		g_key_file_load_from_file (_tmp4_, _tmp6_, G_KEY_FILE_NONE, &_inner_error0_);
		_g_free0 (_tmp6_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp8_ = kf;
		_tmp10_ = g_key_file_get_string_list (_tmp8_, "Favorites", "apps", &_tmp9_, &_inner_error0_);
		_tmp7_ = _tmp10_;
		_tmp7__length1 = _tmp9_;
		__tmp7__size_ = _tmp7__length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		{
			gchar** key_collection = NULL;
			gint key_collection_length1 = 0;
			gint _key_collection_size_ = 0;
			gint key_it = 0;
			key_collection = _tmp7_;
			key_collection_length1 = _tmp7__length1;
			for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) {
				gchar* _tmp11_;
				gchar* key = NULL;
				_tmp11_ = g_strdup (key_collection[key_it]);
				key = _tmp11_;
				{
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = key;
					_tmp13_ = strlen (_tmp12_);
					_tmp14_ = _tmp13_;
					if (_tmp14_ > 0) {
						GHashTable* _tmp15_;
						const gchar* _tmp16_;
						gchar* _tmp17_;
						_tmp15_ = set;
						_tmp16_ = key;
						_tmp17_ = g_strdup (_tmp16_);
						g_hash_table_add (_tmp15_, _tmp17_);
					}
					_g_free0 (key);
				}
			}
		}
		_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		_g_hash_table_unref0 (set);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = set;
	_g_key_file_unref0 (kf);
	return result;
}

static Block82Data*
block82_data_ref (Block82Data* _data82_)
{
	g_atomic_int_inc (&_data82_->_ref_count_);
	return _data82_;
}

static void
block82_data_unref (void * _userdata_)
{
	Block82Data* _data82_;
	_data82_ = (Block82Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data82_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data82_->self;
		_data82_->keys = (_vala_array_free (_data82_->keys, _data82_->keys_length1, (GDestroyNotify) g_free), NULL);
		_g_object_unref0 (self);
		g_slice_free (Block82Data, _data82_);
	}
}

static Block83Data*
block83_data_ref (Block83Data* _data83_)
{
	g_atomic_int_inc (&_data83_->_ref_count_);
	return _data83_;
}

static void
block83_data_unref (void * _userdata_)
{
	Block83Data* _data83_;
	_data83_ = (Block83Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data83_->_ref_count_)) {
		GHashTable* self;
		self = _data83_->self;
		_g_hash_table_unref0 (self);
		g_slice_free (Block83Data, _data83_);
	}
}

static void
__lambda2_ (Block83Data* _data83_,
            gconstpointer k,
            gconstpointer v)
{
	GHashTable* self;
	self = _data83_->self;
	_data83_->func (v, _data83_->func_target);
}

static void
___lambda2__gh_func (gconstpointer key,
                     gconstpointer value,
                     gpointer self)
{
	__lambda2_ (self, key, value);
}

static void
_vala_g_hash_set_foreach (GHashTable* self,
                          GFunc func,
                          gpointer func_target)
{
	Block83Data* _data83_;
	g_return_if_fail (self != NULL);
	_data83_ = g_slice_new0 (Block83Data);
	_data83_->_ref_count_ = 1;
	_data83_->self = g_hash_table_ref (self);
	_data83_->func = func;
	_data83_->func_target = func_target;
	g_hash_table_foreach ((GHashTable*) self, ___lambda2__gh_func, _data83_);
	block83_data_unref (_data83_);
	_data83_ = NULL;
}

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

static void
__lambda394_ (Block82Data* _data82_,
              const gchar* key)
{
	DcWebxdcManagerDialog* self;
	gchar* _tmp0_;
	self = _data82_->self;
	g_return_if_fail (key != NULL);
	_tmp0_ = g_strdup (key);
	_vala_array_add53 (&_data82_->keys, &_data82_->keys_length1, &_data82_->_keys_size_, _tmp0_);
}

static void
___lambda394__gfunc (gconstpointer data,
                     gpointer self)
{
	__lambda394_ (self, (const gchar*) data);
}

static void
dc_webxdc_manager_dialog_save_favorites (DcWebxdcManagerDialog* self)
{
	Block82Data* _data82_;
	gchar** _tmp0_;
	GHashTable* _tmp1_;
	GKeyFile* kf = NULL;
	GKeyFile* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_data82_ = g_slice_new0 (Block82Data);
	_data82_->_ref_count_ = 1;
	_data82_->self = g_object_ref (self);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	_data82_->keys = _tmp0_;
	_data82_->keys_length1 = 0;
	_data82_->_keys_size_ = _data82_->keys_length1;
	_tmp1_ = self->priv->favorites;
	_vala_g_hash_set_foreach (_tmp1_, ___lambda394__gfunc, _data82_);
	_tmp2_ = g_key_file_new ();
	kf = _tmp2_;
	g_key_file_set_string_list (kf, "Favorites", "apps", (const gchar* const*) _data82_->keys, (gint) _data82_->keys_length1);
	{
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp3_ = dc_webxdc_manager_dialog_favorites_path ();
		_tmp4_ = _tmp3_;
		_tmp5_ = g_path_get_dirname (_tmp4_);
		_tmp6_ = _tmp5_;
		g_mkdir_with_parents (_tmp6_, 0700);
		_g_free0 (_tmp6_);
		_g_free0 (_tmp4_);
		_tmp7_ = dc_webxdc_manager_dialog_favorites_path ();
		_tmp8_ = _tmp7_;
		g_key_file_save_to_file (kf, _tmp8_, &_inner_error0_);
		_g_free0 (_tmp8_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp9_;
		const gchar* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp9_ = e;
		_tmp10_ = _tmp9_->message;
		g_warning ("webxdc_manager_dialog.vala:376: webxdc favorites: %s", _tmp10_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_key_file_unref0 (kf);
		block82_data_unref (_data82_);
		_data82_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_key_file_unref0 (kf);
	block82_data_unref (_data82_);
	_data82_ = NULL;
}

static gboolean
__lambda395_ (DcWebxdcManagerDialog* self)
{
	gboolean result;
	dc_webxdc_manager_dialog_rebuild_list (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda395__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda395_ ((DcWebxdcManagerDialog*) self);
	return result;
}

static void
dc_webxdc_manager_dialog_set_favorite (DcWebxdcManagerDialog* self,
                                       DcWebxdcManagerDialogAppEntry* entry,
                                       gboolean favorite)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	entry->favorite = favorite;
	if (favorite) {
		GHashTable* _tmp0_;
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp0_ = self->priv->favorites;
		_tmp1_ = entry->key;
		_tmp2_ = g_strdup (_tmp1_);
		g_hash_table_add (_tmp0_, _tmp2_);
	} else {
		GHashTable* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = self->priv->favorites;
		_tmp4_ = entry->key;
		g_hash_table_remove (_tmp3_, _tmp4_);
	}
	dc_webxdc_manager_dialog_save_favorites (self);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda395__gsource_func, g_object_ref (self), g_object_unref);
}

static GtkToggleButton*
dc_webxdc_manager_dialog_star_button (DcWebxdcManagerDialogAppEntry* entry)
{
	GtkToggleButton* star = NULL;
	GtkToggleButton* _tmp0_;
	GtkToggleButton* _tmp1_;
	GtkToggleButton* _tmp2_;
	GtkToggleButton* _tmp3_;
	const gchar* _tmp4_ = NULL;
	GtkToggleButton* _tmp5_;
	const gchar* _tmp6_ = NULL;
	GtkToggleButton* _tmp7_;
	GtkToggleButton* result;
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = (GtkToggleButton*) gtk_toggle_button_new ();
	g_object_ref_sink (_tmp0_);
	star = _tmp0_;
	_tmp1_ = star;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "flat");
	_tmp2_ = star;
	gtk_widget_set_valign ((GtkWidget*) _tmp2_, GTK_ALIGN_CENTER);
	_tmp3_ = star;
	gtk_toggle_button_set_active (_tmp3_, entry->favorite);
	if (entry->favorite) {
		_tmp4_ = "starred-symbolic";
	} else {
		_tmp4_ = "non-starred-symbolic";
	}
	_tmp5_ = star;
	gtk_button_set_icon_name ((GtkButton*) _tmp5_, _tmp4_);
	if (entry->favorite) {
		_tmp6_ = "Remove from favorites";
	} else {
		_tmp6_ = "Add to favorites";
	}
	_tmp7_ = star;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, _tmp6_);
	result = star;
	return result;
}

static gint
__lambda392_ (DcWebxdcManagerDialogAppEntry* a,
              DcWebxdcManagerDialogAppEntry* b)
{
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	if (a->favorite != b->favorite) {
		gint _tmp0_ = 0;
		if (a->favorite) {
			_tmp0_ = -1;
		} else {
			_tmp0_ = 1;
		}
		result = _tmp0_;
		return result;
	}
	_tmp1_ = a->name;
	_tmp2_ = b->name;
	result = g_utf8_collate (_tmp1_, _tmp2_);
	return result;
}

static gint
___lambda392__gcompare_func (gconstpointer a,
                             gconstpointer b)
{
	gint result;
	result = __lambda392_ ((DcWebxdcManagerDialogAppEntry*) a, (DcWebxdcManagerDialogAppEntry*) b);
	return result;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

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

static void
dc_webxdc_manager_dialog_rebuild_list (DcWebxdcManagerDialog* self)
{
	GtkListBox* _tmp0_;
	GPtrArray* _tmp1_;
	gchar* q = NULL;
	GtkSearchEntry* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	guint shown = 0U;
	GPtrArray* _tmp37_;
	gint _tmp38_;
	gint _tmp39_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->app_list;
	dc_clear_listbox (_tmp0_);
	_tmp1_ = self->priv->apps;
	vala_g_ptr_array_sort (_tmp1_, ___lambda392__gcompare_func);
	_tmp2_ = self->priv->search_entry;
	_tmp3_ = gtk_editable_get_text ((GtkEditable*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_strip (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_utf8_strdown (_tmp6_, (gssize) -1);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp6_);
	q = _tmp8_;
	shown = (guint) 0;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp9_ = FALSE;
			_tmp9_ = TRUE;
			while (TRUE) {
				GPtrArray* _tmp11_;
				gint _tmp12_;
				gint _tmp13_;
				DcWebxdcManagerDialogAppEntry* entry = NULL;
				GPtrArray* _tmp14_;
				gconstpointer _tmp15_;
				DcWebxdcManagerDialogAppEntry* _tmp16_;
				gboolean _tmp17_ = FALSE;
				gboolean _tmp18_ = FALSE;
				const gchar* _tmp19_;
				gint _tmp20_;
				gint _tmp21_;
				GtkListBox* _tmp32_;
				DcWebxdcManagerDialogAppEntry* _tmp33_;
				GtkWidget* _tmp34_;
				GtkWidget* _tmp35_;
				guint _tmp36_;
				if (!_tmp9_) {
					guint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp11_ = self->priv->apps;
				_tmp12_ = vala_g_ptr_array_get_length (_tmp11_);
				_tmp13_ = _tmp12_;
				if (!(i < ((guint) _tmp13_))) {
					break;
				}
				_tmp14_ = self->priv->apps;
				_tmp15_ = g_ptr_array_index (_tmp14_, i);
				_tmp16_ = _g_object_ref0 ((DcWebxdcManagerDialogAppEntry*) _tmp15_);
				entry = _tmp16_;
				_tmp19_ = q;
				_tmp20_ = strlen (_tmp19_);
				_tmp21_ = _tmp20_;
				if (_tmp21_ > 0) {
					DcWebxdcManagerDialogAppEntry* _tmp22_;
					const gchar* _tmp23_;
					gchar* _tmp24_;
					gchar* _tmp25_;
					const gchar* _tmp26_;
					_tmp22_ = entry;
					_tmp23_ = _tmp22_->name;
					_tmp24_ = g_utf8_strdown (_tmp23_, (gssize) -1);
					_tmp25_ = _tmp24_;
					_tmp26_ = q;
					_tmp18_ = !string_contains (_tmp25_, _tmp26_);
					_g_free0 (_tmp25_);
				} else {
					_tmp18_ = FALSE;
				}
				if (_tmp18_) {
					DcWebxdcManagerDialogAppEntry* _tmp27_;
					const gchar* _tmp28_;
					gchar* _tmp29_;
					gchar* _tmp30_;
					const gchar* _tmp31_;
					_tmp27_ = entry;
					_tmp28_ = _tmp27_->author;
					_tmp29_ = g_utf8_strdown (_tmp28_, (gssize) -1);
					_tmp30_ = _tmp29_;
					_tmp31_ = q;
					_tmp17_ = !string_contains (_tmp30_, _tmp31_);
					_g_free0 (_tmp30_);
				} else {
					_tmp17_ = FALSE;
				}
				if (_tmp17_) {
					_g_object_unref0 (entry);
					continue;
				}
				_tmp32_ = self->priv->app_list;
				_tmp33_ = entry;
				_tmp34_ = dc_webxdc_manager_dialog_build_app_row (self, _tmp33_);
				_tmp35_ = _tmp34_;
				gtk_list_box_append (_tmp32_, _tmp35_);
				_g_object_unref0 (_tmp35_);
				_tmp36_ = shown;
				shown = _tmp36_ + 1;
				_g_object_unref0 (entry);
			}
		}
	}
	_tmp37_ = self->priv->apps;
	_tmp38_ = vala_g_ptr_array_get_length (_tmp37_);
	_tmp39_ = _tmp38_;
	if (_tmp39_ == 0) {
		GtkStack* _tmp40_;
		_tmp40_ = self->priv->stack;
		gtk_stack_set_visible_child_name (_tmp40_, "empty");
	} else {
		GtkStack* _tmp41_;
		_tmp41_ = self->priv->stack;
		gtk_stack_set_visible_child_name (_tmp41_, "list");
		if (shown == ((guint) 0)) {
			GtkLabel* none = NULL;
			GtkLabel* _tmp42_;
			GtkLabel* _tmp43_;
			GtkLabel* _tmp44_;
			GtkLabel* _tmp45_;
			GtkListBox* _tmp46_;
			GtkLabel* _tmp47_;
			_tmp42_ = (GtkLabel*) gtk_label_new ("No apps match the search");
			g_object_ref_sink (_tmp42_);
			none = _tmp42_;
			_tmp43_ = none;
			gtk_widget_add_css_class ((GtkWidget*) _tmp43_, "dim-label");
			_tmp44_ = none;
			gtk_widget_set_margin_top ((GtkWidget*) _tmp44_, 12);
			_tmp45_ = none;
			gtk_widget_set_margin_bottom ((GtkWidget*) _tmp45_, 12);
			_tmp46_ = self->priv->app_list;
			_tmp47_ = none;
			gtk_list_box_append (_tmp46_, (GtkWidget*) _tmp47_);
			_g_object_unref0 (none);
		}
	}
	_g_free0 (q);
}

static Block84Data*
block84_data_ref (Block84Data* _data84_)
{
	g_atomic_int_inc (&_data84_->_ref_count_);
	return _data84_;
}

static void
block84_data_unref (void * _userdata_)
{
	Block84Data* _data84_;
	_data84_ = (Block84Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data84_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data84_->self;
		_g_object_unref0 (_data84_->star);
		_g_object_unref0 (_data84_->entry);
		_g_object_unref0 (self);
		g_slice_free (Block84Data, _data84_);
	}
}

static void
__lambda393_ (Block84Data* _data84_)
{
	DcWebxdcManagerDialog* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	self = _data84_->self;
	_tmp0_ = gtk_toggle_button_get_active (_data84_->star);
	_tmp1_ = _tmp0_;
	dc_webxdc_manager_dialog_set_favorite (self, _data84_->entry, _tmp1_);
}

static void
___lambda393__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                         gpointer self)
{
	__lambda393_ (self);
}

static void
__lambda396_ (Block84Data* _data84_)
{
	DcWebxdcManagerDialog* self;
	self = _data84_->self;
	dc_webxdc_manager_dialog_push_details (self, _data84_->entry);
}

static void
___lambda396__adw_action_row_activated (AdwActionRow* _sender,
                                        gpointer self)
{
	__lambda396_ (self);
}

static GtkWidget*
dc_webxdc_manager_dialog_build_app_row (DcWebxdcManagerDialog* self,
                                        DcWebxdcManagerDialogAppEntry* entry)
{
	Block84Data* _data84_;
	DcWebxdcManagerDialogAppEntry* _tmp0_;
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GPtrArray* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkWidget* _tmp11_;
	GtkWidget* _tmp12_;
	GtkWidget* _tmp13_;
	GtkWidget* _tmp14_;
	GtkToggleButton* _tmp15_;
	GtkImage* chevron = NULL;
	GtkImage* _tmp16_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_data84_ = g_slice_new0 (Block84Data);
	_data84_->_ref_count_ = 1;
	_data84_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (entry);
	_g_object_unref0 (_data84_->entry);
	_data84_->entry = _tmp0_;
	_tmp1_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp1_);
	row = _tmp1_;
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) row, FALSE);
	_tmp2_ = _data84_->entry->name;
	adw_preferences_row_set_title ((AdwPreferencesRow*) row, _tmp2_);
	_tmp3_ = _data84_->entry->author;
	_tmp4_ = _data84_->entry->instances;
	_tmp5_ = vala_g_ptr_array_get_length (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = dc_webxdc_manager_dialog_count_label ((guint) _tmp6_, "chat");
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strdup_printf ("%s · %s", _tmp3_, _tmp8_);
	_tmp10_ = _tmp9_;
	adw_action_row_set_subtitle (row, _tmp10_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) row, TRUE);
	_tmp11_ = dc_webxdc_manager_dialog_app_icon (self, _data84_->entry, 40);
	_tmp12_ = _tmp11_;
	adw_action_row_add_prefix (row, _tmp12_);
	_g_object_unref0 (_tmp12_);
	_tmp13_ = dc_webxdc_manager_dialog_users_cluster (self, _data84_->entry, 20, 3);
	_tmp14_ = _tmp13_;
	adw_action_row_add_suffix (row, _tmp14_);
	_g_object_unref0 (_tmp14_);
	_tmp15_ = dc_webxdc_manager_dialog_star_button (_data84_->entry);
	_data84_->star = _tmp15_;
	g_signal_connect_data (_data84_->star, "toggled", (GCallback) ___lambda393__gtk_toggle_button_toggled, block84_data_ref (_data84_), (GClosureNotify) block84_data_unref, 0);
	adw_action_row_add_suffix (row, (GtkWidget*) _data84_->star);
	_tmp16_ = (GtkImage*) gtk_image_new_from_icon_name ("go-next-symbolic");
	g_object_ref_sink (_tmp16_);
	chevron = _tmp16_;
	gtk_widget_add_css_class ((GtkWidget*) chevron, "dim-label");
	adw_action_row_add_suffix (row, (GtkWidget*) chevron);
	g_signal_connect_data (row, "activated", (GCallback) ___lambda396__adw_action_row_activated, block84_data_ref (_data84_), (GClosureNotify) block84_data_unref, 0);
	result = (GtkWidget*) row;
	_g_object_unref0 (chevron);
	block84_data_unref (_data84_);
	_data84_ = NULL;
	return result;
}

static GtkWidget*
dc_webxdc_manager_dialog_app_icon (DcWebxdcManagerDialog* self,
                                   DcWebxdcManagerDialogAppEntry* entry,
                                   gint size)
{
	GtkImage* icon = NULL;
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	GdkTexture* _tmp2_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	icon = _tmp0_;
	_tmp1_ = icon;
	gtk_image_set_pixel_size (_tmp1_, size);
	_tmp2_ = entry->icon;
	if (_tmp2_ != NULL) {
		GtkImage* _tmp3_;
		GdkTexture* _tmp4_;
		_tmp3_ = icon;
		_tmp4_ = entry->icon;
		g_object_set (_tmp3_, "paintable", (GdkPaintable*) _tmp4_, NULL);
	} else {
		GtkImage* _tmp5_;
		_tmp5_ = icon;
		g_object_set (_tmp5_, "icon-name", "application-x-executable-symbolic", NULL);
	}
	result = (GtkWidget*) icon;
	return result;
}

/** Small stacked preview of the people who used the app. */
static GtkWidget*
dc_webxdc_manager_dialog_users_cluster (DcWebxdcManagerDialog* self,
                                        DcWebxdcManagerDialogAppEntry* entry,
                                        gint size,
                                        gint max)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	guint shown = 0U;
	GPtrArray* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	GPtrArray* _tmp23_;
	gint _tmp24_;
	gint _tmp25_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = box;
	gtk_widget_set_valign ((GtkWidget*) _tmp1_, GTK_ALIGN_CENTER);
	_tmp2_ = entry->users;
	_tmp3_ = vala_g_ptr_array_get_length (_tmp2_);
	_tmp4_ = _tmp3_;
	shown = MIN ((guint) _tmp4_, (guint) max);
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				DcWebxdcManagerDialogAppUser* user = NULL;
				GPtrArray* _tmp7_;
				gconstpointer _tmp8_;
				DcWebxdcManagerDialogAppUser* _tmp9_;
				AdwAvatar* avatar = NULL;
				DcWebxdcManagerDialogAppUser* _tmp10_;
				const gchar* _tmp11_;
				AdwAvatar* _tmp12_;
				AdwAvatar* _tmp13_;
				DcWebxdcManagerDialogAppUser* _tmp14_;
				const gchar* _tmp15_;
				GdkTexture* _tmp16_;
				GdkTexture* _tmp17_;
				AdwAvatar* _tmp18_;
				DcWebxdcManagerDialogAppUser* _tmp19_;
				const gchar* _tmp20_;
				GtkBox* _tmp21_;
				AdwAvatar* _tmp22_;
				if (!_tmp5_) {
					guint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				if (!(i < shown)) {
					break;
				}
				_tmp7_ = entry->users;
				_tmp8_ = g_ptr_array_index (_tmp7_, i);
				_tmp9_ = _g_object_ref0 ((DcWebxdcManagerDialogAppUser*) _tmp8_);
				user = _tmp9_;
				_tmp10_ = user;
				_tmp11_ = _tmp10_->name;
				_tmp12_ = (AdwAvatar*) adw_avatar_new (size, _tmp11_, TRUE);
				g_object_ref_sink (_tmp12_);
				avatar = _tmp12_;
				_tmp13_ = avatar;
				_tmp14_ = user;
				_tmp15_ = _tmp14_->avatar_path;
				_tmp16_ = dc_load_avatar (_tmp15_);
				_tmp17_ = _tmp16_;
				adw_avatar_set_custom_image (_tmp13_, (GdkPaintable*) _tmp17_);
				_g_object_unref0 (_tmp17_);
				_tmp18_ = avatar;
				_tmp19_ = user;
				_tmp20_ = _tmp19_->name;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp18_, _tmp20_);
				_tmp21_ = box;
				_tmp22_ = avatar;
				gtk_box_append (_tmp21_, (GtkWidget*) _tmp22_);
				_g_object_unref0 (avatar);
				_g_object_unref0 (user);
			}
		}
	}
	_tmp23_ = entry->users;
	_tmp24_ = vala_g_ptr_array_get_length (_tmp23_);
	_tmp25_ = _tmp24_;
	if (_tmp25_ > max) {
		GtkLabel* more = NULL;
		GPtrArray* _tmp26_;
		gint _tmp27_;
		gint _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		GtkLabel* _tmp31_;
		GtkLabel* _tmp32_;
		GtkLabel* _tmp33_;
		GtkLabel* _tmp34_;
		GtkBox* _tmp35_;
		GtkLabel* _tmp36_;
		_tmp26_ = entry->users;
		_tmp27_ = vala_g_ptr_array_get_length (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = g_strdup_printf ("+%u", (guint) (_tmp28_ - max));
		_tmp30_ = _tmp29_;
		_tmp31_ = (GtkLabel*) gtk_label_new (_tmp30_);
		g_object_ref_sink (_tmp31_);
		_tmp32_ = _tmp31_;
		_g_free0 (_tmp30_);
		more = _tmp32_;
		_tmp33_ = more;
		gtk_widget_add_css_class ((GtkWidget*) _tmp33_, "dim-label");
		_tmp34_ = more;
		gtk_widget_add_css_class ((GtkWidget*) _tmp34_, "caption");
		_tmp35_ = box;
		_tmp36_ = more;
		gtk_box_append (_tmp35_, (GtkWidget*) _tmp36_);
		_g_object_unref0 (more);
	}
	result = (GtkWidget*) box;
	return result;
}

static gchar*
dc_webxdc_manager_dialog_count_label (guint n,
                                      const gchar* noun)
{
	gchar* _tmp0_ = NULL;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (noun != NULL, NULL);
	if (n == ((guint) 1)) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup_printf ("1 %s", noun);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		gchar* _tmp2_;
		_tmp2_ = g_strdup_printf ("%u %ss", n, noun);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp3_;
	_g_free0 (_tmp0_);
	return result;
}

static Block85Data*
block85_data_ref (Block85Data* _data85_)
{
	g_atomic_int_inc (&_data85_->_ref_count_);
	return _data85_;
}

static void
block85_data_unref (void * _userdata_)
{
	Block85Data* _data85_;
	_data85_ = (Block85Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data85_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data85_->self;
		_g_object_unref0 (_data85_->run_btn);
		_g_object_unref0 (_data85_->star);
		_g_object_unref0 (_data85_->entry);
		_g_object_unref0 (self);
		g_slice_free (Block85Data, _data85_);
	}
}

static void
__lambda397_ (Block85Data* _data85_)
{
	DcWebxdcManagerDialog* self;
	GtkToggleButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	const gchar* _tmp3_ = NULL;
	GtkToggleButton* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	GtkToggleButton* _tmp7_;
	self = _data85_->self;
	_tmp0_ = _data85_->star;
	_tmp1_ = gtk_toggle_button_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	dc_webxdc_manager_dialog_set_favorite (self, _data85_->entry, _tmp2_);
	_tmp4_ = _data85_->star;
	_tmp5_ = gtk_toggle_button_get_active (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		_tmp3_ = "starred-symbolic";
	} else {
		_tmp3_ = "non-starred-symbolic";
	}
	_tmp7_ = _data85_->star;
	gtk_button_set_icon_name ((GtkButton*) _tmp7_, _tmp3_);
}

static void
___lambda397__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                         gpointer self)
{
	__lambda397_ (self);
}

static void
__lambda398_ (Block85Data* _data85_)
{
	DcWebxdcManagerDialog* self;
	GtkButton* _tmp0_;
	self = _data85_->self;
	_tmp0_ = _data85_->run_btn;
	dc_webxdc_manager_dialog_show_run_menu (self, (GtkWidget*) _tmp0_, _data85_->entry);
}

static void
___lambda398__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda398_ (self);
}

static void
__lambda403_ (Block85Data* _data85_)
{
	DcWebxdcManagerDialog* self;
	self = _data85_->self;
	dc_webxdc_manager_dialog_pick_contact_and_send (self, _data85_->entry);
}

static void
___lambda403__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda403_ (self);
}

static void
__lambda404_ (Block85Data* _data85_)
{
	DcWebxdcManagerDialog* self;
	self = _data85_->self;
	dc_webxdc_manager_dialog_save_app (self, _data85_->entry, NULL, NULL);
}

static void
___lambda404__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda404_ (self);
}

static void
___lambda405_ (Block85Data* _data85_)
{
	DcWebxdcManagerDialog* self;
	const gchar* _tmp0_;
	self = _data85_->self;
	_tmp0_ = _data85_->entry->source_code_url;
	dc_webxdc_manager_dialog_open_url (self, _tmp0_);
}

static void
____lambda405__adw_action_row_activated (AdwActionRow* _sender,
                                         gpointer self)
{
	___lambda405_ (self);
}

static void
dc_webxdc_manager_dialog_push_details (DcWebxdcManagerDialog* self,
                                       DcWebxdcManagerDialogAppEntry* entry)
{
	Block85Data* _data85_;
	DcWebxdcManagerDialogAppEntry* _tmp0_;
	GtkBox* box = NULL;
	GtkBox* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* head = NULL;
	GtkBox* _tmp6_;
	GtkBox* _tmp7_;
	GtkWidget* _tmp8_;
	GtkWidget* _tmp9_;
	GtkBox* meta = NULL;
	GtkBox* _tmp10_;
	GtkBox* _tmp11_;
	GtkBox* _tmp12_;
	GtkLabel* name_lbl = NULL;
	const gchar* _tmp13_;
	GtkLabel* _tmp14_;
	GtkLabel* _tmp15_;
	GtkLabel* _tmp16_;
	GtkLabel* _tmp17_;
	GtkLabel* _tmp18_;
	GtkBox* _tmp19_;
	GtkLabel* _tmp20_;
	GtkBox* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	GtkWidget* _tmp25_;
	GtkWidget* _tmp26_;
	GtkBox* _tmp37_;
	GtkBox* _tmp38_;
	GtkToggleButton* _tmp39_;
	GtkToggleButton* _tmp40_;
	GtkToggleButton* _tmp41_;
	GtkBox* _tmp42_;
	GtkToggleButton* _tmp43_;
	GtkBox* _tmp44_;
	GtkBox* _tmp45_;
	GtkBox* actions = NULL;
	GtkBox* _tmp46_;
	GtkButton* _tmp47_;
	GtkButton* _tmp48_;
	GtkButton* _tmp49_;
	GtkButton* _tmp50_;
	GtkBox* _tmp51_;
	GtkButton* _tmp52_;
	GtkButton* chat_btn = NULL;
	GtkButton* _tmp53_;
	GtkButton* _tmp54_;
	GtkButton* _tmp55_;
	GtkButton* _tmp56_;
	GtkBox* _tmp57_;
	GtkButton* _tmp58_;
	GtkButton* save_btn = NULL;
	GtkButton* _tmp59_;
	GtkButton* _tmp60_;
	GtkButton* _tmp61_;
	GtkBox* _tmp62_;
	GtkButton* _tmp63_;
	GtkBox* _tmp64_;
	GtkBox* _tmp65_;
	GtkListBox* about = NULL;
	GtkListBox* _tmp66_;
	GtkListBox* _tmp67_;
	GtkListBox* _tmp68_;
	const gchar* _tmp69_;
	const gchar* _tmp74_;
	const gchar* _tmp79_;
	AdwActionRow* used_row = NULL;
	GPtrArray* _tmp90_;
	gint _tmp91_;
	gint _tmp92_;
	gchar* _tmp93_;
	gchar* _tmp94_;
	AdwActionRow* _tmp95_;
	AdwActionRow* _tmp96_;
	AdwActionRow* _tmp97_;
	GtkWidget* _tmp98_;
	GtkWidget* _tmp99_;
	GtkListBox* _tmp100_;
	AdwActionRow* _tmp101_;
	GtkBox* _tmp102_;
	GtkListBox* _tmp103_;
	GtkWidget* _tmp104_;
	GtkWidget* _tmp105_;
	GtkListBox* chats = NULL;
	GtkListBox* _tmp106_;
	GtkListBox* _tmp107_;
	GtkListBox* _tmp108_;
	GtkBox* _tmp119_;
	GtkListBox* _tmp120_;
	GtkWidget* _tmp121_;
	GtkWidget* _tmp122_;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp123_;
	GtkBox* _tmp124_;
	AdwToolbarView* toolbar = NULL;
	AdwToolbarView* _tmp125_;
	AdwHeaderBar* _tmp126_;
	AdwHeaderBar* _tmp127_;
	AdwNavigationView* _tmp128_;
	const gchar* _tmp129_;
	AdwNavigationPage* _tmp130_;
	AdwNavigationPage* _tmp131_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_data85_ = g_slice_new0 (Block85Data);
	_data85_->_ref_count_ = 1;
	_data85_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (entry);
	_g_object_unref0 (_data85_->entry);
	_data85_->entry = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 16);
	g_object_ref_sink (_tmp1_);
	box = _tmp1_;
	_tmp2_ = box;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp2_, 20);
	_tmp3_ = box;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp3_, 20);
	_tmp4_ = box;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp4_, 12);
	_tmp5_ = box;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 20);
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
	g_object_ref_sink (_tmp6_);
	head = _tmp6_;
	_tmp7_ = head;
	_tmp8_ = dc_webxdc_manager_dialog_app_icon (self, _data85_->entry, 96);
	_tmp9_ = _tmp8_;
	gtk_box_append (_tmp7_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	_tmp10_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
	g_object_ref_sink (_tmp10_);
	meta = _tmp10_;
	_tmp11_ = meta;
	gtk_widget_set_valign ((GtkWidget*) _tmp11_, GTK_ALIGN_CENTER);
	_tmp12_ = meta;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp12_, TRUE);
	_tmp13_ = _data85_->entry->name;
	_tmp14_ = (GtkLabel*) gtk_label_new (_tmp13_);
	g_object_ref_sink (_tmp14_);
	name_lbl = _tmp14_;
	_tmp15_ = name_lbl;
	gtk_widget_add_css_class ((GtkWidget*) _tmp15_, "title-1");
	_tmp16_ = name_lbl;
	gtk_widget_set_halign ((GtkWidget*) _tmp16_, GTK_ALIGN_START);
	_tmp17_ = name_lbl;
	gtk_label_set_wrap (_tmp17_, TRUE);
	_tmp18_ = name_lbl;
	gtk_label_set_xalign (_tmp18_, (gfloat) 0);
	_tmp19_ = meta;
	_tmp20_ = name_lbl;
	gtk_box_append (_tmp19_, (GtkWidget*) _tmp20_);
	_tmp21_ = meta;
	_tmp22_ = _data85_->entry->author;
	_tmp23_ = g_strdup_printf ("Shared by %s", _tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = dc_webxdc_manager_dialog_detail_line (_tmp24_);
	_tmp26_ = _tmp25_;
	gtk_box_append (_tmp21_, _tmp26_);
	_g_object_unref0 (_tmp26_);
	_g_free0 (_tmp24_);
	if (_data85_->entry->created > ((gint64) 0)) {
		GtkBox* _tmp27_;
		gchar* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		GtkWidget* _tmp32_;
		GtkWidget* _tmp33_;
		_tmp27_ = meta;
		_tmp28_ = dc_format_date_time (_data85_->entry->created);
		_tmp29_ = _tmp28_;
		_tmp30_ = g_strdup_printf ("First seen %s", _tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = dc_webxdc_manager_dialog_detail_line (_tmp31_);
		_tmp33_ = _tmp32_;
		gtk_box_append (_tmp27_, _tmp33_);
		_g_object_unref0 (_tmp33_);
		_g_free0 (_tmp31_);
		_g_free0 (_tmp29_);
	}
	if (_data85_->entry->internet_access) {
		GtkBox* _tmp34_;
		GtkWidget* _tmp35_;
		GtkWidget* _tmp36_;
		_tmp34_ = meta;
		_tmp35_ = dc_webxdc_manager_dialog_detail_line ("Requests internet access");
		_tmp36_ = _tmp35_;
		gtk_box_append (_tmp34_, _tmp36_);
		_g_object_unref0 (_tmp36_);
	}
	_tmp37_ = head;
	_tmp38_ = meta;
	gtk_box_append (_tmp37_, (GtkWidget*) _tmp38_);
	_tmp39_ = dc_webxdc_manager_dialog_star_button (_data85_->entry);
	_data85_->star = _tmp39_;
	_tmp40_ = _data85_->star;
	gtk_widget_set_valign ((GtkWidget*) _tmp40_, GTK_ALIGN_START);
	_tmp41_ = _data85_->star;
	g_signal_connect_data (_tmp41_, "toggled", (GCallback) ___lambda397__gtk_toggle_button_toggled, block85_data_ref (_data85_), (GClosureNotify) block85_data_unref, 0);
	_tmp42_ = head;
	_tmp43_ = _data85_->star;
	gtk_box_append (_tmp42_, (GtkWidget*) _tmp43_);
	_tmp44_ = box;
	_tmp45_ = head;
	gtk_box_append (_tmp44_, (GtkWidget*) _tmp45_);
	_tmp46_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp46_);
	actions = _tmp46_;
	_tmp47_ = (GtkButton*) gtk_button_new_with_label ("Run");
	g_object_ref_sink (_tmp47_);
	_data85_->run_btn = _tmp47_;
	_tmp48_ = _data85_->run_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp48_, "suggested-action");
	_tmp49_ = _data85_->run_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp49_, "pill");
	_tmp50_ = _data85_->run_btn;
	g_signal_connect_data (_tmp50_, "clicked", (GCallback) ___lambda398__gtk_button_clicked, block85_data_ref (_data85_), (GClosureNotify) block85_data_unref, 0);
	_tmp51_ = actions;
	_tmp52_ = _data85_->run_btn;
	gtk_box_append (_tmp51_, (GtkWidget*) _tmp52_);
	_tmp53_ = (GtkButton*) gtk_button_new_with_label ("New Chat…");
	g_object_ref_sink (_tmp53_);
	chat_btn = _tmp53_;
	_tmp54_ = chat_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp54_, "pill");
	_tmp55_ = chat_btn;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp55_, "Share and start this app in a chat with a contact");
	_tmp56_ = chat_btn;
	g_signal_connect_data (_tmp56_, "clicked", (GCallback) ___lambda403__gtk_button_clicked, block85_data_ref (_data85_), (GClosureNotify) block85_data_unref, 0);
	_tmp57_ = actions;
	_tmp58_ = chat_btn;
	gtk_box_append (_tmp57_, (GtkWidget*) _tmp58_);
	_tmp59_ = (GtkButton*) gtk_button_new_with_label ("Save to Disk…");
	g_object_ref_sink (_tmp59_);
	save_btn = _tmp59_;
	_tmp60_ = save_btn;
	gtk_widget_add_css_class ((GtkWidget*) _tmp60_, "pill");
	_tmp61_ = save_btn;
	g_signal_connect_data (_tmp61_, "clicked", (GCallback) ___lambda404__gtk_button_clicked, block85_data_ref (_data85_), (GClosureNotify) block85_data_unref, 0);
	_tmp62_ = actions;
	_tmp63_ = save_btn;
	gtk_box_append (_tmp62_, (GtkWidget*) _tmp63_);
	_tmp64_ = box;
	_tmp65_ = actions;
	gtk_box_append (_tmp64_, (GtkWidget*) _tmp65_);
	_tmp66_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp66_);
	about = _tmp66_;
	_tmp67_ = about;
	gtk_list_box_set_selection_mode (_tmp67_, GTK_SELECTION_NONE);
	_tmp68_ = about;
	gtk_widget_add_css_class ((GtkWidget*) _tmp68_, "boxed-list");
	_tmp69_ = _data85_->entry->summary;
	if (_tmp69_ != NULL) {
		GtkListBox* _tmp70_;
		const gchar* _tmp71_;
		AdwActionRow* _tmp72_;
		AdwActionRow* _tmp73_;
		_tmp70_ = about;
		_tmp71_ = _data85_->entry->summary;
		_tmp72_ = dc_webxdc_manager_dialog_info_row ("Description", _tmp71_);
		_tmp73_ = _tmp72_;
		gtk_list_box_append (_tmp70_, (GtkWidget*) _tmp73_);
		_g_object_unref0 (_tmp73_);
	}
	_tmp74_ = _data85_->entry->document;
	if (_tmp74_ != NULL) {
		GtkListBox* _tmp75_;
		const gchar* _tmp76_;
		AdwActionRow* _tmp77_;
		AdwActionRow* _tmp78_;
		_tmp75_ = about;
		_tmp76_ = _data85_->entry->document;
		_tmp77_ = dc_webxdc_manager_dialog_info_row ("Document", _tmp76_);
		_tmp78_ = _tmp77_;
		gtk_list_box_append (_tmp75_, (GtkWidget*) _tmp78_);
		_g_object_unref0 (_tmp78_);
	}
	_tmp79_ = _data85_->entry->source_code_url;
	if (_tmp79_ != NULL) {
		AdwActionRow* url_row = NULL;
		const gchar* _tmp80_;
		AdwActionRow* _tmp81_;
		AdwActionRow* _tmp82_;
		AdwActionRow* _tmp83_;
		GtkImage* open_img = NULL;
		GtkImage* _tmp84_;
		GtkImage* _tmp85_;
		AdwActionRow* _tmp86_;
		GtkImage* _tmp87_;
		GtkListBox* _tmp88_;
		AdwActionRow* _tmp89_;
		_tmp80_ = _data85_->entry->source_code_url;
		_tmp81_ = dc_webxdc_manager_dialog_info_row ("Source Code", _tmp80_);
		url_row = _tmp81_;
		_tmp82_ = url_row;
		gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp82_, TRUE);
		_tmp83_ = url_row;
		g_signal_connect_data (_tmp83_, "activated", (GCallback) ____lambda405__adw_action_row_activated, block85_data_ref (_data85_), (GClosureNotify) block85_data_unref, 0);
		_tmp84_ = (GtkImage*) gtk_image_new_from_icon_name ("adw-external-link-symbolic");
		g_object_ref_sink (_tmp84_);
		open_img = _tmp84_;
		_tmp85_ = open_img;
		gtk_widget_add_css_class ((GtkWidget*) _tmp85_, "dim-label");
		_tmp86_ = url_row;
		_tmp87_ = open_img;
		adw_action_row_add_suffix (_tmp86_, (GtkWidget*) _tmp87_);
		_tmp88_ = about;
		_tmp89_ = url_row;
		gtk_list_box_append (_tmp88_, (GtkWidget*) _tmp89_);
		_g_object_unref0 (open_img);
		_g_object_unref0 (url_row);
	}
	_tmp90_ = _data85_->entry->users;
	_tmp91_ = vala_g_ptr_array_get_length (_tmp90_);
	_tmp92_ = _tmp91_;
	_tmp93_ = dc_webxdc_manager_dialog_count_label ((guint) _tmp92_, "person");
	_tmp94_ = _tmp93_;
	_tmp95_ = dc_webxdc_manager_dialog_info_row ("Used by", _tmp94_);
	_tmp96_ = _tmp95_;
	_g_free0 (_tmp94_);
	used_row = _tmp96_;
	_tmp97_ = used_row;
	_tmp98_ = dc_webxdc_manager_dialog_users_cluster (self, _data85_->entry, 24, 6);
	_tmp99_ = _tmp98_;
	adw_action_row_add_suffix (_tmp97_, _tmp99_);
	_g_object_unref0 (_tmp99_);
	_tmp100_ = about;
	_tmp101_ = used_row;
	gtk_list_box_append (_tmp100_, (GtkWidget*) _tmp101_);
	_tmp102_ = box;
	_tmp103_ = about;
	_tmp104_ = dc_webxdc_manager_dialog_section ("About", (GtkWidget*) _tmp103_);
	_tmp105_ = _tmp104_;
	gtk_box_append (_tmp102_, _tmp105_);
	_g_object_unref0 (_tmp105_);
	_tmp106_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp106_);
	chats = _tmp106_;
	_tmp107_ = chats;
	gtk_list_box_set_selection_mode (_tmp107_, GTK_SELECTION_NONE);
	_tmp108_ = chats;
	gtk_widget_add_css_class ((GtkWidget*) _tmp108_, "boxed-list");
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp109_ = FALSE;
			_tmp109_ = TRUE;
			while (TRUE) {
				GPtrArray* _tmp111_;
				gint _tmp112_;
				gint _tmp113_;
				GtkListBox* _tmp114_;
				GPtrArray* _tmp115_;
				gconstpointer _tmp116_;
				GtkWidget* _tmp117_;
				GtkWidget* _tmp118_;
				if (!_tmp109_) {
					guint _tmp110_;
					_tmp110_ = i;
					i = _tmp110_ + 1;
				}
				_tmp109_ = FALSE;
				_tmp111_ = _data85_->entry->instances;
				_tmp112_ = vala_g_ptr_array_get_length (_tmp111_);
				_tmp113_ = _tmp112_;
				if (!(i < ((guint) _tmp113_))) {
					break;
				}
				_tmp114_ = chats;
				_tmp115_ = _data85_->entry->instances;
				_tmp116_ = g_ptr_array_index (_tmp115_, i);
				_tmp117_ = dc_webxdc_manager_dialog_build_instance_row (self, (DcWebxdcManagerDialogAppInstance*) _tmp116_);
				_tmp118_ = _tmp117_;
				gtk_list_box_append (_tmp114_, _tmp118_);
				_g_object_unref0 (_tmp118_);
			}
		}
	}
	_tmp119_ = box;
	_tmp120_ = chats;
	_tmp121_ = dc_webxdc_manager_dialog_section ("Chats", (GtkWidget*) _tmp120_);
	_tmp122_ = _tmp121_;
	gtk_box_append (_tmp119_, _tmp122_);
	_g_object_unref0 (_tmp122_);
	_tmp123_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_ref_sink (_tmp123_);
	scroll = _tmp123_;
	gtk_widget_set_vexpand ((GtkWidget*) scroll, TRUE);
	g_object_set (scroll, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp124_ = box;
	gtk_scrolled_window_set_child (scroll, (GtkWidget*) _tmp124_);
	_tmp125_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp125_);
	toolbar = _tmp125_;
	_tmp126_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp126_);
	_tmp127_ = _tmp126_;
	adw_toolbar_view_add_top_bar (toolbar, (GtkWidget*) _tmp127_);
	_g_object_unref0 (_tmp127_);
	adw_toolbar_view_set_content (toolbar, (GtkWidget*) scroll);
	_tmp128_ = self->priv->nav;
	_tmp129_ = _data85_->entry->name;
	_tmp130_ = adw_navigation_page_new ((GtkWidget*) toolbar, _tmp129_);
	g_object_ref_sink (_tmp130_);
	_tmp131_ = _tmp130_;
	adw_navigation_view_push (_tmp128_, _tmp131_);
	_g_object_unref0 (_tmp131_);
	_g_object_unref0 (toolbar);
	_g_object_unref0 (scroll);
	_g_object_unref0 (chats);
	_g_object_unref0 (used_row);
	_g_object_unref0 (about);
	_g_object_unref0 (save_btn);
	_g_object_unref0 (chat_btn);
	_g_object_unref0 (actions);
	_g_object_unref0 (name_lbl);
	_g_object_unref0 (meta);
	_g_object_unref0 (head);
	_g_object_unref0 (box);
	block85_data_unref (_data85_);
	_data85_ = NULL;
}

static GtkWidget*
dc_webxdc_manager_dialog_detail_line (const gchar* text)
{
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp0_;
	GtkWidget* result;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (text);
	g_object_ref_sink (_tmp0_);
	lbl = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) lbl, "dim-label");
	gtk_widget_set_halign ((GtkWidget*) lbl, GTK_ALIGN_START);
	gtk_label_set_wrap (lbl, TRUE);
	gtk_label_set_xalign (lbl, (gfloat) 0);
	result = (GtkWidget*) lbl;
	return result;
}

static AdwActionRow*
dc_webxdc_manager_dialog_info_row (const gchar* title,
                                   const gchar* subtitle)
{
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp0_;
	AdwActionRow* result;
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (subtitle != NULL, NULL);
	_tmp0_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) row, FALSE);
	adw_preferences_row_set_title ((AdwPreferencesRow*) row, title);
	adw_action_row_set_subtitle (row, subtitle);
	result = row;
	return result;
}

static GtkWidget*
dc_webxdc_manager_dialog_section (const gchar* heading,
                                  GtkWidget* child)
{
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp1_;
	GtkWidget* result;
	g_return_val_if_fail (heading != NULL, NULL);
	g_return_val_if_fail (child != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = (GtkLabel*) gtk_label_new (heading);
	g_object_ref_sink (_tmp1_);
	lbl = _tmp1_;
	gtk_widget_add_css_class ((GtkWidget*) lbl, "heading");
	gtk_widget_add_css_class ((GtkWidget*) lbl, "dim-label");
	gtk_widget_set_halign ((GtkWidget*) lbl, GTK_ALIGN_START);
	gtk_box_append (box, (GtkWidget*) lbl);
	gtk_box_append (box, child);
	result = (GtkWidget*) box;
	_g_object_unref0 (lbl);
	return result;
}

static Block86Data*
block86_data_ref (Block86Data* _data86_)
{
	g_atomic_int_inc (&_data86_->_ref_count_);
	return _data86_;
}

static void
block86_data_unref (void * _userdata_)
{
	Block86Data* _data86_;
	_data86_ = (Block86Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data86_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data86_->self;
		_g_object_unref0 (_data86_->inst);
		_g_object_unref0 (self);
		g_slice_free (Block86Data, _data86_);
	}
}

static void
__lambda407_ (Block86Data* _data86_)
{
	DcWebxdcManagerDialog* self;
	self = _data86_->self;
	dc_webxdc_manager_dialog_launch (self, _data86_->inst);
}

static void
___lambda407__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda407_ (self);
}

static void
__lambda408_ (Block86Data* _data86_)
{
	DcWebxdcManagerDialog* self;
	self = _data86_->self;
	dc_webxdc_manager_dialog_launch (self, _data86_->inst);
}

static void
___lambda408__adw_action_row_activated (AdwActionRow* _sender,
                                        gpointer self)
{
	__lambda408_ (self);
}

static GtkWidget*
dc_webxdc_manager_dialog_build_instance_row (DcWebxdcManagerDialog* self,
                                             DcWebxdcManagerDialogAppInstance* inst)
{
	Block86Data* _data86_;
	DcWebxdcManagerDialogAppInstance* _tmp0_;
	AdwActionRow* row = NULL;
	AdwActionRow* _tmp1_;
	AdwActionRow* _tmp2_;
	AdwActionRow* _tmp3_;
	const gchar* _tmp4_;
	AdwActionRow* _tmp5_;
	const gchar* _tmp6_;
	DcMessage* _tmp7_;
	gint64 _tmp8_;
	gint64 _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	AdwActionRow* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	GtkWidget* _tmp17_;
	GtkWidget* _tmp18_;
	gboolean _tmp19_ = FALSE;
	DcMessage* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	GtkButton* run = NULL;
	GtkButton* _tmp32_;
	AdwActionRow* _tmp33_;
	AdwActionRow* _tmp34_;
	AdwActionRow* _tmp35_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (inst != NULL, NULL);
	_data86_ = g_slice_new0 (Block86Data);
	_data86_->_ref_count_ = 1;
	_data86_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (inst);
	_g_object_unref0 (_data86_->inst);
	_data86_->inst = _tmp0_;
	_tmp1_ = (AdwActionRow*) adw_action_row_new ();
	g_object_ref_sink (_tmp1_);
	row = _tmp1_;
	_tmp2_ = row;
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp2_, FALSE);
	_tmp3_ = row;
	_tmp4_ = _data86_->inst->chat_name;
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp3_, _tmp4_);
	_tmp5_ = row;
	_tmp6_ = _data86_->inst->account_label;
	_tmp7_ = _data86_->inst->msg;
	_tmp8_ = dc_message_get_timestamp (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = dc_format_date_time (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strdup_printf ("%s · %s", _tmp6_, _tmp11_);
	_tmp13_ = _tmp12_;
	adw_action_row_set_subtitle (_tmp5_, _tmp13_);
	_g_free0 (_tmp13_);
	_g_free0 (_tmp11_);
	_tmp14_ = row;
	_tmp15_ = _data86_->inst->chat_name;
	_tmp16_ = _data86_->inst->chat_avatar;
	_tmp17_ = dc_presence_avatar (32, _tmp15_, _tmp16_, FALSE, NULL, NULL);
	_tmp18_ = _tmp17_;
	adw_action_row_add_prefix (_tmp14_, _tmp18_);
	_g_object_unref0 (_tmp18_);
	_tmp20_ = _data86_->inst->msg;
	_tmp21_ = dc_message_get_id (_tmp20_);
	_tmp22_ = _tmp21_;
	if (dc_webxdc_is_running (_tmp22_)) {
		DcRpcClient* _tmp23_;
		gint _tmp24_;
		gint _tmp25_;
		_tmp23_ = self->priv->rpc;
		_tmp24_ = dc_rpc_client_get_account_id (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp19_ = _data86_->inst->account_id == _tmp25_;
	} else {
		_tmp19_ = FALSE;
	}
	if (_tmp19_) {
		GtkLabel* running = NULL;
		GtkLabel* _tmp26_;
		GtkLabel* _tmp27_;
		GtkLabel* _tmp28_;
		GtkLabel* _tmp29_;
		AdwActionRow* _tmp30_;
		GtkLabel* _tmp31_;
		_tmp26_ = (GtkLabel*) gtk_label_new ("Running");
		g_object_ref_sink (_tmp26_);
		running = _tmp26_;
		_tmp27_ = running;
		gtk_widget_add_css_class ((GtkWidget*) _tmp27_, "caption");
		_tmp28_ = running;
		gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "accent");
		_tmp29_ = running;
		gtk_widget_set_valign ((GtkWidget*) _tmp29_, GTK_ALIGN_CENTER);
		_tmp30_ = row;
		_tmp31_ = running;
		adw_action_row_add_suffix (_tmp30_, (GtkWidget*) _tmp31_);
		_g_object_unref0 (running);
	}
	_tmp32_ = (GtkButton*) gtk_button_new_from_icon_name ("media-playback-start-symbolic");
	g_object_ref_sink (_tmp32_);
	run = _tmp32_;
	gtk_widget_add_css_class ((GtkWidget*) run, "flat");
	gtk_widget_set_valign ((GtkWidget*) run, GTK_ALIGN_CENTER);
	gtk_widget_set_tooltip_text ((GtkWidget*) run, "Run in this chat");
	g_signal_connect_data (run, "clicked", (GCallback) ___lambda407__gtk_button_clicked, block86_data_ref (_data86_), (GClosureNotify) block86_data_unref, 0);
	_tmp33_ = row;
	adw_action_row_add_suffix (_tmp33_, (GtkWidget*) run);
	_tmp34_ = row;
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp34_, TRUE);
	_tmp35_ = row;
	g_signal_connect_data (_tmp35_, "activated", (GCallback) ___lambda408__adw_action_row_activated, block86_data_ref (_data86_), (GClosureNotify) block86_data_unref, 0);
	result = (GtkWidget*) row;
	_g_object_unref0 (run);
	block86_data_unref (_data86_);
	_data86_ = NULL;
	return result;
}

/** Run: continue the app where it already ran, or start it in a
            fresh chat with a contact. A single known chat starts directly;
            several offer the choice. */
static Block87Data*
block87_data_ref (Block87Data* _data87_)
{
	g_atomic_int_inc (&_data87_->_ref_count_);
	return _data87_;
}

static void
block87_data_unref (void * _userdata_)
{
	Block87Data* _data87_;
	_data87_ = (Block87Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data87_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data87_->self;
		_g_object_unref0 (_data87_->entry);
		_g_object_unref0 (self);
		g_slice_free (Block87Data, _data87_);
	}
}

static Block88Data*
block88_data_ref (Block88Data* _data88_)
{
	g_atomic_int_inc (&_data88_->_ref_count_);
	return _data88_;
}

static void
block88_data_unref (void * _userdata_)
{
	Block88Data* _data88_;
	_data88_ = (Block88Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data88_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data88_->_data87_->self;
		_g_object_unref0 (_data88_->inst);
		block87_data_unref (_data88_->_data87_);
		_data88_->_data87_ = NULL;
		g_slice_free (Block88Data, _data88_);
	}
}

static void
_____lambda399_ (Block88Data* _data88_)
{
	Block87Data* _data87_;
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppInstance* _tmp0_;
	_data87_ = _data88_->_data87_;
	self = _data87_->self;
	_tmp0_ = _data88_->inst;
	dc_webxdc_manager_dialog_launch (self, _tmp0_);
}

static void
______lambda399__dc_popover_button_selected (DcPopoverButton* _sender,
                                             gpointer self)
{
	_____lambda399_ (self);
}

static void
__lambda400_ (Block87Data* _data87_)
{
	DcWebxdcManagerDialog* self;
	self = _data87_->self;
	dc_webxdc_manager_dialog_pick_contact_and_send (self, _data87_->entry);
}

static void
___lambda400__dc_popover_button_selected (DcPopoverButton* _sender,
                                          gpointer self)
{
	__lambda400_ (self);
}

static void
dc_webxdc_manager_dialog_show_run_menu (DcWebxdcManagerDialog* self,
                                        GtkWidget* anchor,
                                        DcWebxdcManagerDialogAppEntry* entry)
{
	Block87Data* _data87_;
	DcWebxdcManagerDialogAppEntry* _tmp0_;
	GPtrArray* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GtkBox* vbox = NULL;
	GtkPopover* popover = NULL;
	GtkBox* _tmp6_ = NULL;
	GtkPopover* _tmp7_;
	GtkBox* _tmp28_;
	GtkSeparator* _tmp29_;
	GtkSeparator* _tmp30_;
	DcPopoverButton* fresh = NULL;
	GtkPopover* _tmp31_;
	DcPopoverButton* _tmp32_;
	DcPopoverButton* _tmp33_;
	GtkBox* _tmp34_;
	DcPopoverButton* _tmp35_;
	GtkPopover* _tmp36_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (anchor != NULL);
	g_return_if_fail (entry != NULL);
	_data87_ = g_slice_new0 (Block87Data);
	_data87_->_ref_count_ = 1;
	_data87_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (entry);
	_g_object_unref0 (_data87_->entry);
	_data87_->entry = _tmp0_;
	_tmp1_ = _data87_->entry->instances;
	_tmp2_ = vala_g_ptr_array_get_length (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == 1) {
		GPtrArray* _tmp4_;
		gconstpointer _tmp5_;
		_tmp4_ = _data87_->entry->instances;
		_tmp5_ = g_ptr_array_index (_tmp4_, (guint) 0);
		dc_webxdc_manager_dialog_launch (self, (DcWebxdcManagerDialogAppInstance*) _tmp5_);
		block87_data_unref (_data87_);
		_data87_ = NULL;
		return;
	}
	_tmp7_ = dc_popover_menu (anchor, (gdouble) (gtk_widget_get_width (anchor) / 2), (gdouble) gtk_widget_get_height (anchor), &_tmp6_);
	_g_object_unref0 (vbox);
	vbox = _tmp6_;
	popover = _tmp7_;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				Block88Data* _data88_;
				GPtrArray* _tmp10_;
				gint _tmp11_;
				gint _tmp12_;
				GPtrArray* _tmp13_;
				gconstpointer _tmp14_;
				DcWebxdcManagerDialogAppInstance* _tmp15_;
				DcPopoverButton* btn = NULL;
				GtkPopover* _tmp16_;
				DcWebxdcManagerDialogAppInstance* _tmp17_;
				const gchar* _tmp18_;
				DcWebxdcManagerDialogAppInstance* _tmp19_;
				const gchar* _tmp20_;
				gchar* _tmp21_;
				gchar* _tmp22_;
				DcPopoverButton* _tmp23_;
				DcPopoverButton* _tmp24_;
				DcPopoverButton* _tmp25_;
				GtkBox* _tmp26_;
				DcPopoverButton* _tmp27_;
				_data88_ = g_slice_new0 (Block88Data);
				_data88_->_ref_count_ = 1;
				_data88_->_data87_ = block87_data_ref (_data87_);
				if (!_tmp8_) {
					guint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				_tmp10_ = _data87_->entry->instances;
				_tmp11_ = vala_g_ptr_array_get_length (_tmp10_);
				_tmp12_ = _tmp11_;
				if (!(i < ((guint) _tmp12_))) {
					block88_data_unref (_data88_);
					_data88_ = NULL;
					break;
				}
				_tmp13_ = _data87_->entry->instances;
				_tmp14_ = g_ptr_array_index (_tmp13_, i);
				_tmp15_ = _g_object_ref0 ((DcWebxdcManagerDialogAppInstance*) _tmp14_);
				_data88_->inst = _tmp15_;
				_tmp16_ = popover;
				_tmp17_ = _data88_->inst;
				_tmp18_ = _tmp17_->chat_name;
				_tmp19_ = _data88_->inst;
				_tmp20_ = _tmp19_->account_label;
				_tmp21_ = g_strdup_printf ("%s — %s", _tmp18_, _tmp20_);
				_tmp22_ = _tmp21_;
				_tmp23_ = dc_popover_button_new (_tmp16_, _tmp22_, FALSE, FALSE);
				g_object_ref_sink (_tmp23_);
				_tmp24_ = _tmp23_;
				_g_free0 (_tmp22_);
				btn = _tmp24_;
				_tmp25_ = btn;
				g_signal_connect_data (_tmp25_, "selected", (GCallback) ______lambda399__dc_popover_button_selected, block88_data_ref (_data88_), (GClosureNotify) block88_data_unref, 0);
				_tmp26_ = vbox;
				_tmp27_ = btn;
				gtk_box_append (_tmp26_, (GtkWidget*) _tmp27_);
				_g_object_unref0 (btn);
				block88_data_unref (_data88_);
				_data88_ = NULL;
			}
		}
	}
	_tmp28_ = vbox;
	_tmp29_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp29_);
	_tmp30_ = _tmp29_;
	gtk_box_append (_tmp28_, (GtkWidget*) _tmp30_);
	_g_object_unref0 (_tmp30_);
	_tmp31_ = popover;
	_tmp32_ = dc_popover_button_new (_tmp31_, "Start in a new chat…", FALSE, FALSE);
	g_object_ref_sink (_tmp32_);
	fresh = _tmp32_;
	_tmp33_ = fresh;
	g_signal_connect_data (_tmp33_, "selected", (GCallback) ___lambda400__dc_popover_button_selected, block87_data_ref (_data87_), (GClosureNotify) block87_data_unref, 0);
	_tmp34_ = vbox;
	_tmp35_ = fresh;
	gtk_box_append (_tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = popover;
	gtk_popover_popup (_tmp36_);
	_g_object_unref0 (fresh);
	_g_object_unref0 (popover);
	_g_object_unref0 (vbox);
	block87_data_unref (_data87_);
	_data87_ = NULL;
}

/** The app window lives outside this dialog; close before starting
            so a possible profile switch is not blocked by the open modal. */
static void
dc_webxdc_manager_dialog_launch (DcWebxdcManagerDialog* self,
                                 DcWebxdcManagerDialogAppInstance* inst)
{
	DcWindow* _tmp0_;
	DcMessage* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (inst != NULL);
	adw_dialog_close ((AdwDialog*) self);
	_tmp0_ = self->priv->app_window;
	_tmp1_ = inst->msg;
	dc_window_run_webxdc_instance (_tmp0_, inst->account_id, _tmp1_, NULL, NULL);
}

static DcWebxdcManagerDialogAppInstance*
dc_webxdc_manager_dialog_local_instance (DcWebxdcManagerDialog* self,
                                         DcWebxdcManagerDialogAppEntry* entry)
{
	DcWebxdcManagerDialogAppInstance* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (entry != NULL, NULL);
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GPtrArray* _tmp2_;
				gint _tmp3_;
				gint _tmp4_;
				DcWebxdcManagerDialogAppInstance* inst = NULL;
				GPtrArray* _tmp5_;
				gconstpointer _tmp6_;
				DcWebxdcManagerDialogAppInstance* _tmp7_;
				gboolean _tmp8_ = FALSE;
				DcWebxdcManagerDialogAppInstance* _tmp9_;
				DcRpcClient* _tmp10_;
				gint _tmp11_;
				gint _tmp12_;
				if (!_tmp0_) {
					guint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = entry->instances;
				_tmp3_ = vala_g_ptr_array_get_length (_tmp2_);
				_tmp4_ = _tmp3_;
				if (!(i < ((guint) _tmp4_))) {
					break;
				}
				_tmp5_ = entry->instances;
				_tmp6_ = g_ptr_array_index (_tmp5_, i);
				_tmp7_ = _g_object_ref0 ((DcWebxdcManagerDialogAppInstance*) _tmp6_);
				inst = _tmp7_;
				_tmp9_ = inst;
				_tmp10_ = self->priv->rpc;
				_tmp11_ = dc_rpc_client_get_account_id (_tmp10_);
				_tmp12_ = _tmp11_;
				if (_tmp9_->account_id == _tmp12_) {
					DcWebxdcManagerDialogAppInstance* _tmp13_;
					DcMessage* _tmp14_;
					gboolean _tmp15_;
					gboolean _tmp16_;
					_tmp13_ = inst;
					_tmp14_ = _tmp13_->msg;
					_tmp15_ = dc_message_get_has_local_file (_tmp14_);
					_tmp16_ = _tmp15_;
					_tmp8_ = _tmp16_;
				} else {
					_tmp8_ = FALSE;
				}
				if (_tmp8_) {
					result = inst;
					return result;
				}
				_g_object_unref0 (inst);
			}
		}
	}
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp17_ = FALSE;
			_tmp17_ = TRUE;
			while (TRUE) {
				GPtrArray* _tmp19_;
				gint _tmp20_;
				gint _tmp21_;
				GPtrArray* _tmp22_;
				gconstpointer _tmp23_;
				DcMessage* _tmp24_;
				gboolean _tmp25_;
				gboolean _tmp26_;
				if (!_tmp17_) {
					guint _tmp18_;
					_tmp18_ = i;
					i = _tmp18_ + 1;
				}
				_tmp17_ = FALSE;
				_tmp19_ = entry->instances;
				_tmp20_ = vala_g_ptr_array_get_length (_tmp19_);
				_tmp21_ = _tmp20_;
				if (!(i < ((guint) _tmp21_))) {
					break;
				}
				_tmp22_ = entry->instances;
				_tmp23_ = g_ptr_array_index (_tmp22_, i);
				_tmp24_ = ((DcWebxdcManagerDialogAppInstance*) _tmp23_)->msg;
				_tmp25_ = dc_message_get_has_local_file (_tmp24_);
				_tmp26_ = _tmp25_;
				if (_tmp26_) {
					GPtrArray* _tmp27_;
					gconstpointer _tmp28_;
					DcWebxdcManagerDialogAppInstance* _tmp29_;
					_tmp27_ = entry->instances;
					_tmp28_ = g_ptr_array_index (_tmp27_, i);
					_tmp29_ = _g_object_ref0 ((DcWebxdcManagerDialogAppInstance*) _tmp28_);
					result = _tmp29_;
					return result;
				}
			}
		}
	}
	result = NULL;
	return result;
}

static void
dc_webxdc_manager_dialog_save_app_data_free (gpointer _data)
{
	DcWebxdcManagerDialogSaveAppData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->entry);
	_g_object_unref0 (_data_->self);
	g_slice_free (DcWebxdcManagerDialogSaveAppData, _data_);
}

static void
dc_webxdc_manager_dialog_save_app (DcWebxdcManagerDialog* self,
                                   DcWebxdcManagerDialogAppEntry* entry,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	DcWebxdcManagerDialogSaveAppData* _data_;
	DcWebxdcManagerDialog* _tmp0_;
	DcWebxdcManagerDialogAppEntry* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_data_ = g_slice_new0 (DcWebxdcManagerDialogSaveAppData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_webxdc_manager_dialog_save_app_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (entry);
	_g_object_unref0 (_data_->entry);
	_data_->entry = _tmp1_;
	dc_webxdc_manager_dialog_save_app_co (_data_);
}

static void
dc_webxdc_manager_dialog_save_app_finish (DcWebxdcManagerDialog* self,
                                          GAsyncResult* _res_)
{
	DcWebxdcManagerDialogSaveAppData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dc_webxdc_manager_dialog_save_app_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	DcWebxdcManagerDialogSaveAppData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_webxdc_manager_dialog_save_app_co (_data_);
}

static gboolean
dc_webxdc_manager_dialog_save_app_co (DcWebxdcManagerDialogSaveAppData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = dc_webxdc_manager_dialog_local_instance (_data_->self, _data_->entry);
	_data_->inst = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->inst;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp2_ = _data_->self->priv->app_window;
		dc_window_show_toast (_data_->_tmp2_, "The app file has not been downloaded yet");
		_g_object_unref0 (_data_->inst);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->self->priv->app_window;
	_data_->_tmp4_ = _data_->inst;
	_data_->_tmp5_ = _data_->_tmp4_->msg;
	_data_->_tmp6_ = dc_message_get_file_path (_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->inst;
	_data_->_tmp9_ = _data_->_tmp8_->msg;
	_data_->_tmp10_ = dc_message_get_file_name (_data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_state_ = 1;
	dc_window_save_attachment (_data_->_tmp3_, _data_->_tmp7_, _data_->_tmp11_, dc_webxdc_manager_dialog_save_app_ready, _data_);
	return FALSE;
	_state_1:
	dc_window_save_attachment_finish (_data_->_tmp3_, _data_->_res_);
	_g_object_unref0 (_data_->inst);
	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 Block89Data*
block89_data_ref (Block89Data* _data89_)
{
	g_atomic_int_inc (&_data89_->_ref_count_);
	return _data89_;
}

static void
block89_data_unref (void * _userdata_)
{
	Block89Data* _data89_;
	_data89_ = (Block89Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data89_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data89_->self;
		_g_object_unref0 (_data89_->inst);
		_g_object_unref0 (self);
		g_slice_free (Block89Data, _data89_);
	}
}

static void
__lambda401_ (Block89Data* _data89_,
              gint contact_id,
              const gchar* email)
{
	DcWebxdcManagerDialog* self;
	DcWebxdcManagerDialogAppInstance* _tmp0_;
	self = _data89_->self;
	g_return_if_fail (email != NULL);
	_tmp0_ = _data89_->inst;
	dc_webxdc_manager_dialog_send_and_run (self, _tmp0_, contact_id, email, NULL, NULL);
}

static void
___lambda401__dc_contact_picker_dialog_contact_picked (DcContactPickerDialog* _sender,
                                                       gint contact_id,
                                                       const gchar* email,
                                                       gpointer self)
{
	__lambda401_ (self, contact_id, email);
}

static void
dc_webxdc_manager_dialog_pick_contact_and_send (DcWebxdcManagerDialog* self,
                                                DcWebxdcManagerDialogAppEntry* entry)
{
	Block89Data* _data89_;
	DcWebxdcManagerDialogAppInstance* _tmp0_;
	DcWebxdcManagerDialogAppInstance* _tmp1_;
	DcContactPickerDialog* picker = NULL;
	DcRpcClient* _tmp3_;
	DcContactPickerDialog* _tmp4_;
	DcContactPickerDialog* _tmp5_;
	DcContactPickerDialog* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_data89_ = g_slice_new0 (Block89Data);
	_data89_->_ref_count_ = 1;
	_data89_->self = g_object_ref (self);
	_tmp0_ = dc_webxdc_manager_dialog_local_instance (self, entry);
	_data89_->inst = _tmp0_;
	_tmp1_ = _data89_->inst;
	if (_tmp1_ == NULL) {
		DcWindow* _tmp2_;
		_tmp2_ = self->priv->app_window;
		dc_window_show_toast (_tmp2_, "The app file has not been downloaded yet");
		block89_data_unref (_data89_);
		_data89_ = NULL;
		return;
	}
	_tmp3_ = self->priv->rpc;
	_tmp4_ = dc_contact_picker_dialog_new (_tmp3_, NULL, "Start App With…");
	g_object_ref_sink (_tmp4_);
	picker = _tmp4_;
	_tmp5_ = picker;
	g_signal_connect_data (_tmp5_, "contact-picked", (GCallback) ___lambda401__dc_contact_picker_dialog_contact_picked, block89_data_ref (_data89_), (GClosureNotify) block89_data_unref, 0);
	_tmp6_ = picker;
	adw_dialog_present ((AdwDialog*) _tmp6_, (GtkWidget*) self);
	_g_object_unref0 (picker);
	block89_data_unref (_data89_);
	_data89_ = NULL;
}

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

static void
dc_webxdc_manager_dialog_send_and_run (DcWebxdcManagerDialog* self,
                                       DcWebxdcManagerDialogAppInstance* inst,
                                       gint contact_id,
                                       const gchar* email,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	DcWebxdcManagerDialogSendAndRunData* _data_;
	DcWebxdcManagerDialog* _tmp0_;
	DcWebxdcManagerDialogAppInstance* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (inst != NULL);
	g_return_if_fail (email != NULL);
	_data_ = g_slice_new0 (DcWebxdcManagerDialogSendAndRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dc_webxdc_manager_dialog_send_and_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (inst);
	_g_object_unref0 (_data_->inst);
	_data_->inst = _tmp1_;
	_data_->contact_id = contact_id;
	_tmp2_ = g_strdup (email);
	_g_free0 (_data_->email);
	_data_->email = _tmp2_;
	dc_webxdc_manager_dialog_send_and_run_co (_data_);
}

static void
dc_webxdc_manager_dialog_send_and_run_finish (DcWebxdcManagerDialog* self,
                                              GAsyncResult* _res_)
{
	DcWebxdcManagerDialogSendAndRunData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

/** Share the .xdc into a (possibly new) 1:1 chat of the active
            profile and start it there. */
static void
dc_webxdc_manager_dialog_send_and_run_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	DcWebxdcManagerDialogSendAndRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dc_webxdc_manager_dialog_send_and_run_co (_data_);
}

static gboolean
dc_webxdc_manager_dialog_send_and_run_co (DcWebxdcManagerDialogSendAndRunData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		if (_data_->contact_id == 0) {
			_data_->_tmp1_ = _data_->self->priv->rpc;
			_data_->_state_ = 1;
			dc_rpc_client_get_or_create_contact (_data_->_tmp1_, _data_->email, dc_webxdc_manager_dialog_send_and_run_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp0_ = dc_rpc_client_get_or_create_contact_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->contact_id = _data_->_tmp0_;
		}
		_data_->_tmp2_ = _data_->self->priv->rpc;
		_data_->_state_ = 2;
		dc_rpc_client_get_or_create_chat_by_contact (_data_->_tmp2_, _data_->contact_id, dc_webxdc_manager_dialog_send_and_run_ready, _data_);
		return FALSE;
		_state_2:
		_data_->chat_id = dc_rpc_client_get_or_create_chat_by_contact_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->self->priv->rpc;
		_data_->_tmp4_ = _data_->inst->msg;
		_data_->_tmp5_ = dc_message_get_file_path (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = _data_->inst->msg;
		_data_->_tmp8_ = dc_message_get_file_name (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_state_ = 3;
		dc_rpc_client_send_msg (_data_->_tmp3_, _data_->chat_id, NULL, _data_->_tmp6_, _data_->_tmp9_, 0, "Webxdc", dc_webxdc_manager_dialog_send_and_run_ready, _data_);
		return FALSE;
		_state_3:
		_data_->msg_id = dc_rpc_client_send_msg_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (_data_->msg_id <= 0) {
			_data_->_tmp10_ = _data_->self->priv->app_window;
			dc_window_show_toast (_data_->_tmp10_, "Could not share the app");
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp11_ = _data_->self->priv->app_window;
		dc_window_show_toast (_data_->_tmp11_, "App shared into the chat");
		_data_->_tmp12_ = _data_->self->priv->rpc;
		_data_->_state_ = 4;
		dc_rpc_client_fetch_message (_data_->_tmp12_, _data_->msg_id, dc_webxdc_manager_dialog_send_and_run_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp13_ = dc_rpc_client_fetch_message_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error0_);
		_data_->sent = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = _data_->sent;
		if (_data_->_tmp14_ != NULL) {
			adw_dialog_close ((AdwDialog*) _data_->self);
			_data_->_tmp15_ = _data_->self->priv->app_window;
			_data_->_tmp16_ = _data_->self->priv->rpc;
			_data_->_tmp17_ = dc_rpc_client_get_account_id (_data_->_tmp16_);
			_data_->_tmp18_ = _data_->_tmp17_;
			_data_->_tmp19_ = _data_->sent;
			_data_->_state_ = 5;
			dc_window_run_webxdc_instance (_data_->_tmp15_, _data_->_tmp18_, _data_->_tmp19_, dc_webxdc_manager_dialog_send_and_run_ready, _data_);
			return FALSE;
			_state_5:
			dc_window_run_webxdc_instance_finish (_data_->_tmp15_, _data_->_res_);
			_g_object_unref0 (_data_->sent);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_state_ = 6;
		dc_webxdc_manager_dialog_reload (_data_->self, dc_webxdc_manager_dialog_send_and_run_ready, _data_);
		return FALSE;
		_state_6:
		dc_webxdc_manager_dialog_reload_finish (_data_->self, _data_->_res_);
		_g_object_unref0 (_data_->sent);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp20_ = _data_->e;
		_data_->_tmp21_ = _data_->_tmp20_->message;
		_data_->_tmp22_ = g_strconcat ("Could not share the app: ", _data_->_tmp21_, NULL);
		_data_->_tmp23_ = _data_->_tmp22_;
		dc_show_error ((GtkWidget*) _data_->self, _data_->_tmp23_);
		_g_free0 (_data_->_tmp23_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static Block90Data*
block90_data_ref (Block90Data* _data90_)
{
	g_atomic_int_inc (&_data90_->_ref_count_);
	return _data90_;
}

static void
block90_data_unref (void * _userdata_)
{
	Block90Data* _data90_;
	_data90_ = (Block90Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data90_->_ref_count_)) {
		DcWebxdcManagerDialog* self;
		self = _data90_->self;
		_g_object_unref0 (_data90_->launcher);
		_g_object_unref0 (self);
		g_slice_free (Block90Data, _data90_);
	}
}

static void
__lambda406_ (Block90Data* _data90_,
              GObject* obj,
              GAsyncResult* res)
{
	DcWebxdcManagerDialog* self;
	GError* _inner_error0_ = NULL;
	self = _data90_->self;
	g_return_if_fail (res != NULL);
	{
		gtk_uri_launcher_launch_finish (_data90_->launcher, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		DcWindow* _tmp0_;
		GError* _tmp1_;
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = self->priv->app_window;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		_tmp3_ = g_strconcat ("Could not open link: ", _tmp2_, NULL);
		_tmp4_ = _tmp3_;
		dc_window_show_toast (_tmp0_, _tmp4_);
		_g_free0 (_tmp4_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda406__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	__lambda406_ (self, source_object, res);
	block90_data_unref (self);
}

static void
dc_webxdc_manager_dialog_open_url (DcWebxdcManagerDialog* self,
                                   const gchar* url)
{
	Block90Data* _data90_;
	GtkUriLauncher* _tmp0_;
	DcWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
	_data90_ = g_slice_new0 (Block90Data);
	_data90_->_ref_count_ = 1;
	_data90_->self = g_object_ref (self);
	_tmp0_ = gtk_uri_launcher_new (url);
	_data90_->launcher = _tmp0_;
	_tmp1_ = self->priv->app_window;
	gtk_uri_launcher_launch (_data90_->launcher, (GtkWindow*) _tmp1_, NULL, ___lambda406__gasync_ready_callback, block90_data_ref (_data90_));
	block90_data_unref (_data90_);
	_data90_ = NULL;
}

static DcWebxdcManagerDialogAppInstance*
dc_webxdc_manager_dialog_app_instance_construct (GType object_type)
{
	DcWebxdcManagerDialogAppInstance * self = NULL;
	self = (DcWebxdcManagerDialogAppInstance*) g_object_new (object_type, NULL);
	return self;
}

static DcWebxdcManagerDialogAppInstance*
dc_webxdc_manager_dialog_app_instance_new (void)
{
	return dc_webxdc_manager_dialog_app_instance_construct (DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE);
}

static void
dc_webxdc_manager_dialog_app_instance_class_init (DcWebxdcManagerDialogAppInstanceClass * klass,
                                                  gpointer klass_data)
{
	dc_webxdc_manager_dialog_app_instance_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = dc_webxdc_manager_dialog_app_instance_finalize;
}

static void
dc_webxdc_manager_dialog_app_instance_instance_init (DcWebxdcManagerDialogAppInstance * self,
                                                     gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	self->account_id = 0;
	_tmp0_ = g_strdup ("");
	self->account_label = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->chat_name = _tmp1_;
	self->chat_avatar = NULL;
}

static void
dc_webxdc_manager_dialog_app_instance_finalize (GObject * obj)
{
	DcWebxdcManagerDialogAppInstance * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_INSTANCE, DcWebxdcManagerDialogAppInstance);
	_g_free0 (self->account_label);
	_g_object_unref0 (self->msg);
	_g_free0 (self->chat_name);
	_g_free0 (self->chat_avatar);
	G_OBJECT_CLASS (dc_webxdc_manager_dialog_app_instance_parent_class)->finalize (obj);
}

static GType
dc_webxdc_manager_dialog_app_instance_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcWebxdcManagerDialogAppInstanceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_webxdc_manager_dialog_app_instance_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcWebxdcManagerDialogAppInstance), 0, (GInstanceInitFunc) dc_webxdc_manager_dialog_app_instance_instance_init, NULL };
	GType dc_webxdc_manager_dialog_app_instance_type_id;
	dc_webxdc_manager_dialog_app_instance_type_id = g_type_register_static (G_TYPE_OBJECT, "DcWebxdcManagerDialogAppInstance", &g_define_type_info, 0);
	return dc_webxdc_manager_dialog_app_instance_type_id;
}

static GType
dc_webxdc_manager_dialog_app_instance_get_type (void)
{
	static volatile gsize dc_webxdc_manager_dialog_app_instance_type_id__once = 0;
	if (g_once_init_enter (&dc_webxdc_manager_dialog_app_instance_type_id__once)) {
		GType dc_webxdc_manager_dialog_app_instance_type_id;
		dc_webxdc_manager_dialog_app_instance_type_id = dc_webxdc_manager_dialog_app_instance_get_type_once ();
		g_once_init_leave (&dc_webxdc_manager_dialog_app_instance_type_id__once, dc_webxdc_manager_dialog_app_instance_type_id);
	}
	return dc_webxdc_manager_dialog_app_instance_type_id__once;
}

static DcWebxdcManagerDialogAppUser*
dc_webxdc_manager_dialog_app_user_construct (GType object_type)
{
	DcWebxdcManagerDialogAppUser * self = NULL;
	self = (DcWebxdcManagerDialogAppUser*) g_object_new (object_type, NULL);
	return self;
}

static DcWebxdcManagerDialogAppUser*
dc_webxdc_manager_dialog_app_user_new (void)
{
	return dc_webxdc_manager_dialog_app_user_construct (DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER);
}

static void
dc_webxdc_manager_dialog_app_user_class_init (DcWebxdcManagerDialogAppUserClass * klass,
                                              gpointer klass_data)
{
	dc_webxdc_manager_dialog_app_user_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = dc_webxdc_manager_dialog_app_user_finalize;
}

static void
dc_webxdc_manager_dialog_app_user_instance_init (DcWebxdcManagerDialogAppUser * self,
                                                 gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	_tmp0_ = g_strdup ("");
	self->key = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->name = _tmp1_;
	self->avatar_path = NULL;
}

static void
dc_webxdc_manager_dialog_app_user_finalize (GObject * obj)
{
	DcWebxdcManagerDialogAppUser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_USER, DcWebxdcManagerDialogAppUser);
	_g_free0 (self->key);
	_g_free0 (self->name);
	_g_free0 (self->avatar_path);
	G_OBJECT_CLASS (dc_webxdc_manager_dialog_app_user_parent_class)->finalize (obj);
}

static GType
dc_webxdc_manager_dialog_app_user_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcWebxdcManagerDialogAppUserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_webxdc_manager_dialog_app_user_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcWebxdcManagerDialogAppUser), 0, (GInstanceInitFunc) dc_webxdc_manager_dialog_app_user_instance_init, NULL };
	GType dc_webxdc_manager_dialog_app_user_type_id;
	dc_webxdc_manager_dialog_app_user_type_id = g_type_register_static (G_TYPE_OBJECT, "DcWebxdcManagerDialogAppUser", &g_define_type_info, 0);
	return dc_webxdc_manager_dialog_app_user_type_id;
}

static GType
dc_webxdc_manager_dialog_app_user_get_type (void)
{
	static volatile gsize dc_webxdc_manager_dialog_app_user_type_id__once = 0;
	if (g_once_init_enter (&dc_webxdc_manager_dialog_app_user_type_id__once)) {
		GType dc_webxdc_manager_dialog_app_user_type_id;
		dc_webxdc_manager_dialog_app_user_type_id = dc_webxdc_manager_dialog_app_user_get_type_once ();
		g_once_init_leave (&dc_webxdc_manager_dialog_app_user_type_id__once, dc_webxdc_manager_dialog_app_user_type_id);
	}
	return dc_webxdc_manager_dialog_app_user_type_id__once;
}

static DcWebxdcManagerDialogAppEntry*
dc_webxdc_manager_dialog_app_entry_construct (GType object_type)
{
	DcWebxdcManagerDialogAppEntry * self = NULL;
	self = (DcWebxdcManagerDialogAppEntry*) g_object_new (object_type, NULL);
	return self;
}

static DcWebxdcManagerDialogAppEntry*
dc_webxdc_manager_dialog_app_entry_new (void)
{
	return dc_webxdc_manager_dialog_app_entry_construct (DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY);
}

static void
dc_webxdc_manager_dialog_app_entry_class_init (DcWebxdcManagerDialogAppEntryClass * klass,
                                               gpointer klass_data)
{
	dc_webxdc_manager_dialog_app_entry_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = dc_webxdc_manager_dialog_app_entry_finalize;
}

static void
dc_webxdc_manager_dialog_app_entry_instance_init (DcWebxdcManagerDialogAppEntry * self,
                                                  gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GPtrArray* _tmp3_;
	GPtrArray* _tmp4_;
	_tmp0_ = g_strdup ("");
	self->key = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->name = _tmp1_;
	self->icon = NULL;
	self->summary = NULL;
	self->document = NULL;
	self->source_code_url = NULL;
	self->internet_access = FALSE;
	_tmp2_ = g_strdup ("");
	self->author = _tmp2_;
	self->created = (gint64) 0;
	self->favorite = FALSE;
	_tmp3_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	self->instances = _tmp3_;
	_tmp4_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	self->users = _tmp4_;
}

static void
dc_webxdc_manager_dialog_app_entry_finalize (GObject * obj)
{
	DcWebxdcManagerDialogAppEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_WEBXDC_MANAGER_DIALOG_TYPE_APP_ENTRY, DcWebxdcManagerDialogAppEntry);
	_g_free0 (self->key);
	_g_free0 (self->name);
	_g_object_unref0 (self->icon);
	_g_free0 (self->summary);
	_g_free0 (self->document);
	_g_free0 (self->source_code_url);
	_g_free0 (self->author);
	_g_ptr_array_unref0 (self->instances);
	_g_ptr_array_unref0 (self->users);
	G_OBJECT_CLASS (dc_webxdc_manager_dialog_app_entry_parent_class)->finalize (obj);
}

static GType
dc_webxdc_manager_dialog_app_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcWebxdcManagerDialogAppEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_webxdc_manager_dialog_app_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcWebxdcManagerDialogAppEntry), 0, (GInstanceInitFunc) dc_webxdc_manager_dialog_app_entry_instance_init, NULL };
	GType dc_webxdc_manager_dialog_app_entry_type_id;
	dc_webxdc_manager_dialog_app_entry_type_id = g_type_register_static (G_TYPE_OBJECT, "DcWebxdcManagerDialogAppEntry", &g_define_type_info, 0);
	return dc_webxdc_manager_dialog_app_entry_type_id;
}

static GType
dc_webxdc_manager_dialog_app_entry_get_type (void)
{
	static volatile gsize dc_webxdc_manager_dialog_app_entry_type_id__once = 0;
	if (g_once_init_enter (&dc_webxdc_manager_dialog_app_entry_type_id__once)) {
		GType dc_webxdc_manager_dialog_app_entry_type_id;
		dc_webxdc_manager_dialog_app_entry_type_id = dc_webxdc_manager_dialog_app_entry_get_type_once ();
		g_once_init_leave (&dc_webxdc_manager_dialog_app_entry_type_id__once, dc_webxdc_manager_dialog_app_entry_type_id);
	}
	return dc_webxdc_manager_dialog_app_entry_type_id__once;
}

static void
dc_webxdc_manager_dialog_class_init (DcWebxdcManagerDialogClass * klass,
                                     gpointer klass_data)
{
	dc_webxdc_manager_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DcWebxdcManagerDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dc_webxdc_manager_dialog_finalize;
}

static void
dc_webxdc_manager_dialog_instance_init (DcWebxdcManagerDialog * self,
                                        gpointer klass)
{
	GPtrArray* _tmp0_;
	self->priv = dc_webxdc_manager_dialog_get_instance_private (self);
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_object_unref0_);
	self->priv->apps = _tmp0_;
	self->priv->load_generation = (guint) 0;
}

static void
dc_webxdc_manager_dialog_finalize (GObject * obj)
{
	DcWebxdcManagerDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DC_TYPE_WEBXDC_MANAGER_DIALOG, DcWebxdcManagerDialog);
	_g_object_unref0 (self->priv->rpc);
	_g_object_unref0 (self->priv->nav);
	_g_object_unref0 (self->priv->search_entry);
	_g_object_unref0 (self->priv->app_list);
	_g_object_unref0 (self->priv->stack);
	_g_object_unref0 (self->priv->empty_page);
	_g_ptr_array_unref0 (self->priv->apps);
	_g_hash_table_unref0 (self->priv->favorites);
	G_OBJECT_CLASS (dc_webxdc_manager_dialog_parent_class)->finalize (obj);
}

/**
     * "Apps" manager: every Webxdc app found in any chat of any profile,
     * collected in one place. The list page shows each app with its icon,
     * the people who used it and a favorite star; activating an app pushes
     * an appstore-like detail page with the icon, description, author,
     * first-seen date, the users' avatars and the chats it ran in. From
     * there the app can be started ("Run" continues an existing chat or
     * shares it into a fresh one via the contact list) or saved to disk.
     * Favorites persist in a keyfile next to settings.ini and sort first.
     */
static GType
dc_webxdc_manager_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DcWebxdcManagerDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dc_webxdc_manager_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DcWebxdcManagerDialog), 0, (GInstanceInitFunc) dc_webxdc_manager_dialog_instance_init, NULL };
	GType dc_webxdc_manager_dialog_type_id;
	dc_webxdc_manager_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "DcWebxdcManagerDialog", &g_define_type_info, 0);
	DcWebxdcManagerDialog_private_offset = g_type_add_instance_private (dc_webxdc_manager_dialog_type_id, sizeof (DcWebxdcManagerDialogPrivate));
	return dc_webxdc_manager_dialog_type_id;
}

GType
dc_webxdc_manager_dialog_get_type (void)
{
	static volatile gsize dc_webxdc_manager_dialog_type_id__once = 0;
	if (g_once_init_enter (&dc_webxdc_manager_dialog_type_id__once)) {
		GType dc_webxdc_manager_dialog_type_id;
		dc_webxdc_manager_dialog_type_id = dc_webxdc_manager_dialog_get_type_once ();
		g_once_init_leave (&dc_webxdc_manager_dialog_type_id__once, dc_webxdc_manager_dialog_type_id);
	}
	return dc_webxdc_manager_dialog_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

