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

#include "omemo.h"
#include "libdino.h"
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "xmpp-vala.h"
#include <gee.h>
#include <adwaita.h>
#include <gtk/gtk.h>
#include "dino_i18n.h"
#include "qlite.h"
#include <gdk/gdk.h>
#include <qrencode.h>
#include <omemo/signal_protocol.h>
#include <native/helper.h>
#include <omemo/signal_protocol_types.h>
#include <omemo/session_state.h>
#include <omemo/curve.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

enum  {
	DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_ENTRY_0_PROPERTY,
	DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_ENTRY_ID_PROPERTY,
	DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_ENTRY_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_omemo_omemo_preferences_entry_properties[DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_ENTRY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
enum  {
	DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_WIDGET_0_PROPERTY,
	DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_WIDGET_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_omemo_omemo_preferences_widget_properties[DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_WIDGET_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _qlite_row_option_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_option_unref (var), NULL)))
#define _qlite_statement_builder_unref0(var) ((var == NULL) ? NULL : (var = (qlite_statement_builder_unref (var), NULL)))
#define _qlite_row_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_unref (var), NULL)))
#define _qlite_row_iterator_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_iterator_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block23Data Block23Data;
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
#define _QRcode_free0(var) ((var == NULL) ? NULL : (var = (QRcode_free (var), NULL)))
typedef struct _Block24Data Block24Data;
#define _signal_type_unref_vapi0(var) ((var == NULL) ? NULL : (var = (signal_type_unref_vapi (var), NULL)))
#define _signal_protocol_address_free0(var) ((var == NULL) ? NULL : (var = (signal_protocol_address_free (var), NULL)))
#define _signal_buffer_free0(var) ((var == NULL) ? NULL : (var = (signal_buffer_free (var), NULL)))
typedef struct _Block25Data Block25Data;
typedef struct _Block26Data Block26Data;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _DinoPluginsOmemoOmemoPreferencesEntryPrivate {
	DinoPluginsOmemoOmemoPreferencesWidget* widget;
	DinoPluginsOmemoPlugin* plugin;
};

struct _DinoPluginsOmemoOmemoPreferencesWidgetPrivate {
	DinoPluginsOmemoPlugin* plugin;
	DinoEntitiesAccount* account;
	XmppJid* jid;
	gint identity_id;
	OmemoStore* store;
	GeeSet* displayed_ids;
	AdwActionRow* automatically_accept_new_row;
	GtkSwitch* automatically_accept_new_switch;
	AdwActionRow* encrypt_by_default_row;
	GtkSwitch* encrypt_by_default_switch;
	GtkLabel* new_keys_label;
	AdwPreferencesGroup* keys_preferences_group;
	GtkListBox* new_keys_listbox;
	GtkPicture* qrcode_picture;
	GtkPopover* qrcode_popover;
	GeeArrayList* keys_preferences_group_children;
};

struct _Block23Data {
	int _ref_count_;
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	gchar* fingerprint;
	GtkButton* copy_button;
};

struct _Block24Data {
	int _ref_count_;
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	QliteRow* device;
};

struct _Block25Data {
	int _ref_count_;
	Block24Data * _data24_;
	QliteRow* updated_device;
};

struct _Block26Data {
	int _ref_count_;
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	AdwActionRow* action_row;
	QliteRow* device;
};

static gint DinoPluginsOmemoOmemoPreferencesEntry_private_offset;
static gpointer dino_plugins_omemo_omemo_preferences_entry_parent_class = NULL;
static gint DinoPluginsOmemoOmemoPreferencesWidget_private_offset;
static gpointer dino_plugins_omemo_omemo_preferences_widget_parent_class = NULL;

static GObject* dino_plugins_omemo_omemo_preferences_entry_real_get_widget (DinoPluginsEncryptionPreferencesEntry* base,
                                                                     DinoEntitiesAccount* account,
                                                                     DinoPluginsWidgetType type);
static void dino_plugins_omemo_omemo_preferences_entry_finalize (GObject * obj);
static GType dino_plugins_omemo_omemo_preferences_entry_get_type_once (void);
static void _vala_dino_plugins_omemo_omemo_preferences_entry_get_property (GObject * object,
                                                                    guint property_id,
                                                                    GValue * value,
                                                                    GParamSpec * pspec);
static gboolean dino_plugins_omemo_omemo_preferences_widget_on_auto_accept_toggled (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                             gboolean active);
static gboolean _dino_plugins_omemo_omemo_preferences_widget_on_auto_accept_toggled_gtk_switch_state_set (GtkSwitch* _sender,
                                                                                                   gboolean state,
                                                                                                   gpointer self);
static gboolean dino_plugins_omemo_omemo_preferences_widget_on_omemo_by_default_toggled (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                                  gboolean active);
static gboolean _dino_plugins_omemo_omemo_preferences_widget_on_omemo_by_default_toggled_gtk_switch_state_set (GtkSwitch* _sender,
                                                                                                        gboolean state,
                                                                                                        gpointer self);
static void dino_plugins_omemo_omemo_preferences_widget_redraw_key_list (DinoPluginsOmemoOmemoPreferencesWidget* self);
static void dino_plugins_omemo_omemo_preferences_widget_fetch_unknown_bundles (DinoPluginsOmemoOmemoPreferencesWidget* self);
static void dino_plugins_omemo_omemo_preferences_widget_add_own_fingerprint (DinoPluginsOmemoOmemoPreferencesWidget* self);
static void dino_plugins_omemo_omemo_preferences_widget_add_fingerprint (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                  QliteRow* device,
                                                                  DinoPluginsOmemoTrustLevel trust);
static void dino_plugins_omemo_omemo_preferences_widget_add_new_fingerprint (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                      QliteRow* device);
static gchar* dino_plugins_omemo_omemo_preferences_widget_escape_for_iri_path_segment (const gchar* s);
static void __lambda36_ (DinoPluginsOmemoOmemoPreferencesWidget* self,
                  XmppJid* bundle_jid,
                  gint device_id,
                  DinoPluginsOmemoBundle* bundle);
static void ___lambda36__dino_plugins_omemo_stream_module_bundle_fetched (DinoPluginsOmemoStreamModule* _sender,
                                                                   XmppJid* jid,
                                                                   gint device_id,
                                                                   DinoPluginsOmemoBundle* bundle,
                                                                   gpointer self);
static Block23Data* block23_data_ref (Block23Data* _data23_);
static void block23_data_unref (void * _userdata_);
static void __lambda33_ (Block23Data* _data23_);
static void ___lambda33__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void dino_plugins_omemo_omemo_preferences_widget_add_key_row (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                              AdwPreferencesRow* widget);
static Block24Data* block24_data_ref (Block24Data* _data24_);
static void block24_data_unref (void * _userdata_);
static guint8* _vala_array_dup37 (guint8* self,
                           gssize length);
static void ___lambda26_ (Block24Data* _data24_);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
static void __lambda32_ (Block25Data* _data25_,
                  gint response);
static void dino_plugins_omemo_omemo_preferences_widget_update_stored_trust (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                      gint response,
                                                                      QliteRow* device);
static void ___lambda32__gtk_dialog_response (GtkDialog* _sender,
                                       gint response_id,
                                       gpointer self);
static void ____lambda26__adw_action_row_activated (AdwActionRow* _sender,
                                             gpointer self);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
static void __lambda34_ (Block26Data* _data26_);
static void dino_plugins_omemo_omemo_preferences_widget_remove_key_row (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                 AdwPreferencesRow* widget);
static void ___lambda34__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void __lambda35_ (Block26Data* _data26_);
static void ___lambda35__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static GObject * dino_plugins_omemo_omemo_preferences_widget_constructor (GType type,
                                                                   guint n_construct_properties,
                                                                   GObjectConstructParam * construct_properties);
static void dino_plugins_omemo_omemo_preferences_widget_finalize (GObject * obj);
static GType dino_plugins_omemo_omemo_preferences_widget_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_plugins_omemo_omemo_preferences_entry_get_instance_private (DinoPluginsOmemoOmemoPreferencesEntry* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsOmemoOmemoPreferencesEntry_private_offset);
}

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

DinoPluginsOmemoOmemoPreferencesEntry*
dino_plugins_omemo_omemo_preferences_entry_construct (GType object_type,
                                                      DinoPluginsOmemoPlugin* plugin)
{
	DinoPluginsOmemoOmemoPreferencesEntry * self = NULL;
	DinoPluginsOmemoPlugin* _tmp0_;
	g_return_val_if_fail (plugin != NULL, NULL);
	self = (DinoPluginsOmemoOmemoPreferencesEntry*) dino_plugins_encryption_preferences_entry_construct (object_type);
	_tmp0_ = _g_object_ref0 (plugin);
	_g_object_unref0 (self->priv->plugin);
	self->priv->plugin = _tmp0_;
	return self;
}

DinoPluginsOmemoOmemoPreferencesEntry*
dino_plugins_omemo_omemo_preferences_entry_new (DinoPluginsOmemoPlugin* plugin)
{
	return dino_plugins_omemo_omemo_preferences_entry_construct (DINO_PLUGINS_OMEMO_TYPE_OMEMO_PREFERENCES_ENTRY, plugin);
}

static GObject*
dino_plugins_omemo_omemo_preferences_entry_real_get_widget (DinoPluginsEncryptionPreferencesEntry* base,
                                                            DinoEntitiesAccount* account,
                                                            DinoPluginsWidgetType type)
{
	DinoPluginsOmemoOmemoPreferencesEntry * self;
	DinoPluginsOmemoOmemoPreferencesWidget* widget = NULL;
	DinoPluginsOmemoPlugin* _tmp0_;
	DinoPluginsOmemoOmemoPreferencesWidget* _tmp1_;
	DinoPluginsOmemoOmemoPreferencesWidget* _tmp2_;
	XmppJid* _tmp3_;
	XmppJid* _tmp4_;
	XmppJid* _tmp5_;
	GObject* result;
	self = (DinoPluginsOmemoOmemoPreferencesEntry*) base;
	g_return_val_if_fail (account != NULL, NULL);
	if (type != DINO_PLUGINS_WIDGET_TYPE_GTK4) {
		result = NULL;
		return result;
	}
	_tmp0_ = self->priv->plugin;
	_tmp1_ = dino_plugins_omemo_omemo_preferences_widget_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	widget = _tmp1_;
	_tmp2_ = widget;
	_tmp3_ = dino_entities_account_get_bare_jid (account);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	dino_plugins_omemo_omemo_preferences_widget_set_jid (_tmp2_, account, _tmp5_);
	_xmpp_jid_unref0 (_tmp5_);
	result = (GObject*) widget;
	return result;
}

static const gchar*
dino_plugins_omemo_omemo_preferences_entry_real_get_id (DinoPluginsEncryptionPreferencesEntry* base)
{
	const gchar* result;
	DinoPluginsOmemoOmemoPreferencesEntry* self;
	self = (DinoPluginsOmemoOmemoPreferencesEntry*) base;
	result = "omemo_preferences_entryption";
	return result;
}

static void
dino_plugins_omemo_omemo_preferences_entry_class_init (DinoPluginsOmemoOmemoPreferencesEntryClass * klass,
                                                       gpointer klass_data)
{
	dino_plugins_omemo_omemo_preferences_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsOmemoOmemoPreferencesEntry_private_offset);
	((DinoPluginsEncryptionPreferencesEntryClass *) klass)->get_widget = (GObject* (*) (DinoPluginsEncryptionPreferencesEntry*, DinoEntitiesAccount*, DinoPluginsWidgetType)) dino_plugins_omemo_omemo_preferences_entry_real_get_widget;
	DINO_PLUGINS_ENCRYPTION_PREFERENCES_ENTRY_CLASS (klass)->get_id = (const gchar* (*) (DinoPluginsEncryptionPreferencesEntry*)) dino_plugins_omemo_omemo_preferences_entry_real_get_id;
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_plugins_omemo_omemo_preferences_entry_get_property;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_omemo_omemo_preferences_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_ENTRY_ID_PROPERTY, dino_plugins_omemo_omemo_preferences_entry_properties[DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_ENTRY_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dino_plugins_omemo_omemo_preferences_entry_instance_init (DinoPluginsOmemoOmemoPreferencesEntry * self,
                                                          gpointer klass)
{
	self->priv = dino_plugins_omemo_omemo_preferences_entry_get_instance_private (self);
}

static void
dino_plugins_omemo_omemo_preferences_entry_finalize (GObject * obj)
{
	DinoPluginsOmemoOmemoPreferencesEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_OMEMO_TYPE_OMEMO_PREFERENCES_ENTRY, DinoPluginsOmemoOmemoPreferencesEntry);
	_g_object_unref0 (self->priv->widget);
	_g_object_unref0 (self->priv->plugin);
	G_OBJECT_CLASS (dino_plugins_omemo_omemo_preferences_entry_parent_class)->finalize (obj);
}

static GType
dino_plugins_omemo_omemo_preferences_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsOmemoOmemoPreferencesEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_omemo_omemo_preferences_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsOmemoOmemoPreferencesEntry), 0, (GInstanceInitFunc) dino_plugins_omemo_omemo_preferences_entry_instance_init, NULL };
	GType dino_plugins_omemo_omemo_preferences_entry_type_id;
	dino_plugins_omemo_omemo_preferences_entry_type_id = g_type_register_static (DINO_PLUGINS_TYPE_ENCRYPTION_PREFERENCES_ENTRY, "DinoPluginsOmemoOmemoPreferencesEntry", &g_define_type_info, 0);
	DinoPluginsOmemoOmemoPreferencesEntry_private_offset = g_type_add_instance_private (dino_plugins_omemo_omemo_preferences_entry_type_id, sizeof (DinoPluginsOmemoOmemoPreferencesEntryPrivate));
	return dino_plugins_omemo_omemo_preferences_entry_type_id;
}

GType
dino_plugins_omemo_omemo_preferences_entry_get_type (void)
{
	static volatile gsize dino_plugins_omemo_omemo_preferences_entry_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_omemo_omemo_preferences_entry_type_id__once)) {
		GType dino_plugins_omemo_omemo_preferences_entry_type_id;
		dino_plugins_omemo_omemo_preferences_entry_type_id = dino_plugins_omemo_omemo_preferences_entry_get_type_once ();
		g_once_init_leave (&dino_plugins_omemo_omemo_preferences_entry_type_id__once, dino_plugins_omemo_omemo_preferences_entry_type_id);
	}
	return dino_plugins_omemo_omemo_preferences_entry_type_id__once;
}

static void
_vala_dino_plugins_omemo_omemo_preferences_entry_get_property (GObject * object,
                                                               guint property_id,
                                                               GValue * value,
                                                               GParamSpec * pspec)
{
	DinoPluginsOmemoOmemoPreferencesEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_PLUGINS_OMEMO_TYPE_OMEMO_PREFERENCES_ENTRY, DinoPluginsOmemoOmemoPreferencesEntry);
	switch (property_id) {
		case DINO_PLUGINS_OMEMO_OMEMO_PREFERENCES_ENTRY_ID_PROPERTY:
		g_value_set_string (value, dino_plugins_encryption_preferences_entry_get_id ((DinoPluginsEncryptionPreferencesEntry*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
dino_plugins_omemo_omemo_preferences_widget_get_instance_private (DinoPluginsOmemoOmemoPreferencesWidget* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsOmemoOmemoPreferencesWidget_private_offset);
}

DinoPluginsOmemoOmemoPreferencesWidget*
dino_plugins_omemo_omemo_preferences_widget_construct (GType object_type,
                                                       DinoPluginsOmemoPlugin* plugin)
{
	DinoPluginsOmemoOmemoPreferencesWidget * self = NULL;
	DinoPluginsOmemoPlugin* _tmp0_;
	g_return_val_if_fail (plugin != NULL, NULL);
	self = (DinoPluginsOmemoOmemoPreferencesWidget*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (plugin);
	_g_object_unref0 (self->priv->plugin);
	self->priv->plugin = _tmp0_;
	return self;
}

DinoPluginsOmemoOmemoPreferencesWidget*
dino_plugins_omemo_omemo_preferences_widget_new (DinoPluginsOmemoPlugin* plugin)
{
	return dino_plugins_omemo_omemo_preferences_widget_construct (DINO_PLUGINS_OMEMO_TYPE_OMEMO_PREFERENCES_WIDGET, plugin);
}

static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

static gboolean
_dino_plugins_omemo_omemo_preferences_widget_on_auto_accept_toggled_gtk_switch_state_set (GtkSwitch* _sender,
                                                                                          gboolean state,
                                                                                          gpointer self)
{
	gboolean result;
	result = dino_plugins_omemo_omemo_preferences_widget_on_auto_accept_toggled ((DinoPluginsOmemoOmemoPreferencesWidget*) self, state);
	return result;
}

static gboolean
_dino_plugins_omemo_omemo_preferences_widget_on_omemo_by_default_toggled_gtk_switch_state_set (GtkSwitch* _sender,
                                                                                               gboolean state,
                                                                                               gpointer self)
{
	gboolean result;
	result = dino_plugins_omemo_omemo_preferences_widget_on_omemo_by_default_toggled ((DinoPluginsOmemoOmemoPreferencesWidget*) self, state);
	return result;
}

void
dino_plugins_omemo_omemo_preferences_widget_set_jid (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                     DinoEntitiesAccount* account,
                                                     XmppJid* jid)
{
	DinoEntitiesAccount* _tmp0_;
	XmppJid* _tmp1_;
	DinoPluginsOmemoPlugin* _tmp2_;
	DinoPluginsOmemoDatabase* _tmp3_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp4_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GtkSwitch* _tmp8_;
	DinoPluginsOmemoPlugin* _tmp9_;
	DinoPluginsOmemoDatabase* _tmp10_;
	DinoPluginsOmemoDatabaseTrustTable* _tmp11_;
	DinoPluginsOmemoDatabaseTrustTable* _tmp12_;
	XmppJid* _tmp13_;
	XmppJid* _tmp14_;
	XmppJid* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GtkSwitch* _tmp18_;
	AdwActionRow* _tmp19_;
	XmppJid* _tmp20_;
	XmppJid* _tmp21_;
	XmppJid* _tmp22_;
	GtkSwitch* _tmp23_;
	DinoPluginsOmemoPlugin* _tmp24_;
	DinoApplication* _tmp25_;
	DinoEntitiesSettings* _tmp26_;
	DinoEntitiesSettings* _tmp27_;
	GtkSwitch* _tmp28_;
	DinoApplication* app = NULL;
	DinoApplication* _tmp29_;
	DinoApplication* _tmp30_;
	DinoApplication* _tmp31_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	g_return_if_fail (jid != NULL);
	_tmp0_ = _g_object_ref0 (account);
	_g_object_unref0 (self->priv->account);
	self->priv->account = _tmp0_;
	_tmp1_ = _xmpp_jid_ref0 (jid);
	_xmpp_jid_unref0 (self->priv->jid);
	self->priv->jid = _tmp1_;
	_tmp2_ = self->priv->plugin;
	_tmp3_ = _tmp2_->db;
	_tmp4_ = dino_plugins_omemo_database_get_identity (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = dino_entities_account_get_id (account);
	_tmp7_ = _tmp6_;
	self->priv->identity_id = dino_plugins_omemo_database_identity_table_get_id (_tmp5_, _tmp7_);
	if (self->priv->identity_id <= 0) {
		g_warning ("encryption_preferences_entry.vala:70: OmemoPreferencesWidget missing i" \
"dentity_id");
		return;
	}
	_tmp8_ = self->priv->automatically_accept_new_switch;
	_tmp9_ = self->priv->plugin;
	_tmp10_ = _tmp9_->db;
	_tmp11_ = dino_plugins_omemo_database_get_trust (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = xmpp_jid_get_bare_jid (jid);
	_tmp14_ = _tmp13_;
	_tmp15_ = _tmp14_;
	_tmp16_ = xmpp_jid_to_string (_tmp15_);
	_tmp17_ = _tmp16_;
	gtk_switch_set_active (_tmp8_, dino_plugins_omemo_database_trust_table_get_blind_trust (_tmp12_, (gint32) self->priv->identity_id, _tmp17_, TRUE));
	_g_free0 (_tmp17_);
	_xmpp_jid_unref0 (_tmp15_);
	_tmp18_ = self->priv->automatically_accept_new_switch;
	g_signal_connect_object (_tmp18_, "state-set", (GCallback) _dino_plugins_omemo_omemo_preferences_widget_on_auto_accept_toggled_gtk_switch_state_set, self, 0);
	_tmp19_ = self->priv->encrypt_by_default_row;
	_tmp20_ = dino_entities_account_get_bare_jid (account);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_;
	gtk_widget_set_visible ((GtkWidget*) _tmp19_, xmpp_jid_equals_bare (_tmp22_, jid));
	_xmpp_jid_unref0 (_tmp22_);
	_tmp23_ = self->priv->encrypt_by_default_switch;
	_tmp24_ = self->priv->plugin;
	_tmp25_ = _tmp24_->app;
	_tmp26_ = dino_application_get_settings (_tmp25_);
	_tmp27_ = _tmp26_;
	gtk_switch_set_active (_tmp23_, dino_entities_settings_get_default_encryption (_tmp27_, account) != DINO_ENTITIES_ENCRYPTION_NONE);
	_tmp28_ = self->priv->encrypt_by_default_switch;
	g_signal_connect_object (_tmp28_, "state-set", (GCallback) _dino_plugins_omemo_omemo_preferences_widget_on_omemo_by_default_toggled_gtk_switch_state_set, self, 0);
	_tmp29_ = dino_application_get_default ();
	_tmp30_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp29_, DINO_TYPE_APPLICATION) ? ((DinoApplication*) _tmp29_) : NULL);
	app = _tmp30_;
	_tmp31_ = app;
	if (_tmp31_ != NULL) {
		DinoApplication* _tmp32_;
		DinoStreamInteractor* _tmp33_;
		DinoStreamInteractor* _tmp34_;
		DinoModuleManager* _tmp35_;
		XmppModuleIdentity* _tmp36_;
		gpointer _tmp37_;
		DinoPluginsOmemoStreamModule* _tmp38_;
		OmemoStore* _tmp39_;
		OmemoStore* _tmp40_;
		OmemoStore* _tmp41_;
		_tmp32_ = app;
		_tmp33_ = dino_application_get_stream_interactor (_tmp32_);
		_tmp34_ = _tmp33_;
		_tmp35_ = _tmp34_->module_manager;
		_tmp36_ = dino_plugins_omemo_stream_module_IDENTITY;
		_tmp37_ = dino_module_manager_get_module (_tmp35_, DINO_PLUGINS_OMEMO_TYPE_STREAM_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, account, _tmp36_);
		_tmp38_ = (DinoPluginsOmemoStreamModule*) _tmp37_;
		_tmp39_ = dino_plugins_omemo_stream_module_get_store (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp41_ = _g_object_ref0 (_tmp40_);
		_g_object_unref0 (self->priv->store);
		self->priv->store = _tmp41_;
		_g_object_unref0 (_tmp38_);
	}
	dino_plugins_omemo_omemo_preferences_widget_redraw_key_list (self);
	dino_plugins_omemo_omemo_preferences_widget_fetch_unknown_bundles (self);
	_g_object_unref0 (app);
}

static void
dino_plugins_omemo_omemo_preferences_widget_redraw_key_list (DinoPluginsOmemoOmemoPreferencesWidget* self)
{
	GeeArrayList* _tmp10_;
	XmppJid* _tmp11_;
	DinoEntitiesAccount* _tmp12_;
	XmppJid* _tmp13_;
	XmppJid* _tmp14_;
	XmppJid* _tmp15_;
	gboolean _tmp16_;
	gint own_id = 0;
	DinoPluginsOmemoPlugin* _tmp19_;
	DinoPluginsOmemoDatabase* _tmp20_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp21_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp22_;
	DinoPluginsOmemoPlugin* _tmp23_;
	DinoPluginsOmemoDatabase* _tmp24_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp25_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp26_;
	QliteColumn* _tmp27_;
	DinoEntitiesAccount* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	QliteRowOption* _tmp31_;
	QliteRowOption* _tmp32_;
	DinoPluginsOmemoPlugin* _tmp33_;
	DinoPluginsOmemoDatabase* _tmp34_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp35_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp36_;
	QliteColumn* _tmp37_;
	gpointer _tmp38_;
	gint _tmp39_;
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _widget_list = NULL;
		GeeArrayList* _tmp0_;
		gint _widget_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _widget_index = 0;
		_tmp0_ = self->priv->keys_preferences_group_children;
		_widget_list = _tmp0_;
		_tmp1_ = _widget_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_widget_size = _tmp3_;
		_widget_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			GtkWidget* widget = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			AdwPreferencesGroup* _tmp8_;
			GtkWidget* _tmp9_;
			_widget_index = _widget_index + 1;
			_tmp4_ = _widget_index;
			_tmp5_ = _widget_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _widget_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _widget_index);
			widget = (GtkWidget*) _tmp7_;
			_tmp8_ = self->priv->keys_preferences_group;
			_tmp9_ = widget;
			adw_preferences_group_remove (_tmp8_, _tmp9_);
			_g_object_unref0 (widget);
		}
	}
	_tmp10_ = self->priv->keys_preferences_group_children;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp10_);
	_tmp11_ = self->priv->jid;
	_tmp12_ = self->priv->account;
	_tmp13_ = dino_entities_account_get_bare_jid (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = _tmp14_;
	_tmp16_ = xmpp_jid_equals (_tmp11_, _tmp15_);
	_xmpp_jid_unref0 (_tmp15_);
	if (_tmp16_) {
		AdwActionRow* _tmp17_;
		const gchar* _tmp18_;
		_tmp17_ = self->priv->automatically_accept_new_row;
		_tmp18_ = dino_gettext ("New encryption keys from your other devices will be accepted automatic" \
"ally.");
		adw_action_row_set_subtitle (_tmp17_, _tmp18_);
		dino_plugins_omemo_omemo_preferences_widget_add_own_fingerprint (self);
	}
	_tmp19_ = self->priv->plugin;
	_tmp20_ = _tmp19_->db;
	_tmp21_ = dino_plugins_omemo_database_get_identity (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = self->priv->plugin;
	_tmp24_ = _tmp23_->db;
	_tmp25_ = dino_plugins_omemo_database_get_identity (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = _tmp26_->account_id;
	_tmp28_ = self->priv->account;
	_tmp29_ = dino_entities_account_get_id (_tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = qlite_table_row_with ((QliteTable*) _tmp22_, G_TYPE_INT, NULL, NULL, _tmp27_, (gpointer) ((gintptr) _tmp30_));
	_tmp32_ = _tmp31_;
	_tmp33_ = self->priv->plugin;
	_tmp34_ = _tmp33_->db;
	_tmp35_ = dino_plugins_omemo_database_get_identity (_tmp34_);
	_tmp36_ = _tmp35_;
	_tmp37_ = _tmp36_->device_id;
	_tmp38_ = qlite_row_option_get (_tmp32_, G_TYPE_INT, NULL, NULL, _tmp37_, NULL);
	_tmp39_ = (gint) ((gintptr) _tmp38_);
	_qlite_row_option_unref0 (_tmp32_);
	own_id = _tmp39_;
	{
		QliteRowIterator* _device_it = NULL;
		DinoPluginsOmemoPlugin* _tmp40_;
		DinoPluginsOmemoDatabase* _tmp41_;
		DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp42_;
		DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp43_;
		XmppJid* _tmp44_;
		gchar* _tmp45_;
		gchar* _tmp46_;
		QliteQueryBuilder* _tmp47_;
		QliteQueryBuilder* _tmp48_;
		QliteRowIterator* _tmp49_;
		QliteRowIterator* _tmp50_;
		_tmp40_ = self->priv->plugin;
		_tmp41_ = _tmp40_->db;
		_tmp42_ = dino_plugins_omemo_database_get_identity_meta (_tmp41_);
		_tmp43_ = _tmp42_;
		_tmp44_ = self->priv->jid;
		_tmp45_ = xmpp_jid_to_string (_tmp44_);
		_tmp46_ = _tmp45_;
		_tmp47_ = dino_plugins_omemo_database_identity_meta_table_get_known_devices (_tmp43_, self->priv->identity_id, _tmp46_);
		_tmp48_ = _tmp47_;
		_tmp49_ = qlite_query_builder_iterator (_tmp48_);
		_tmp50_ = _tmp49_;
		_qlite_statement_builder_unref0 (_tmp48_);
		_g_free0 (_tmp46_);
		_device_it = _tmp50_;
		while (TRUE) {
			QliteRowIterator* _tmp51_;
			QliteRow* device = NULL;
			QliteRowIterator* _tmp52_;
			QliteRow* _tmp53_;
			gboolean _tmp54_ = FALSE;
			XmppJid* _tmp55_;
			DinoEntitiesAccount* _tmp56_;
			XmppJid* _tmp57_;
			XmppJid* _tmp58_;
			XmppJid* _tmp59_;
			gboolean _tmp60_;
			QliteRow* _tmp68_;
			QliteRow* _tmp69_;
			DinoPluginsOmemoPlugin* _tmp70_;
			DinoPluginsOmemoDatabase* _tmp71_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp72_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp73_;
			QliteColumn* _tmp74_;
			gpointer _tmp75_;
			_tmp51_ = _device_it;
			if (!qlite_row_iterator_next (_tmp51_)) {
				break;
			}
			_tmp52_ = _device_it;
			_tmp53_ = qlite_row_iterator_get (_tmp52_);
			device = _tmp53_;
			_tmp55_ = self->priv->jid;
			_tmp56_ = self->priv->account;
			_tmp57_ = dino_entities_account_get_bare_jid (_tmp56_);
			_tmp58_ = _tmp57_;
			_tmp59_ = _tmp58_;
			_tmp60_ = xmpp_jid_equals (_tmp55_, _tmp59_);
			_xmpp_jid_unref0 (_tmp59_);
			if (_tmp60_) {
				QliteRow* _tmp61_;
				DinoPluginsOmemoPlugin* _tmp62_;
				DinoPluginsOmemoDatabase* _tmp63_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp64_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp65_;
				QliteColumn* _tmp66_;
				gpointer _tmp67_;
				_tmp61_ = device;
				_tmp62_ = self->priv->plugin;
				_tmp63_ = _tmp62_->db;
				_tmp64_ = dino_plugins_omemo_database_get_identity_meta (_tmp63_);
				_tmp65_ = _tmp64_;
				_tmp66_ = _tmp65_->device_id;
				_tmp67_ = qlite_row_get (_tmp61_, G_TYPE_INT, NULL, NULL, _tmp66_);
				_tmp54_ = ((gint) ((gintptr) _tmp67_)) == own_id;
			} else {
				_tmp54_ = FALSE;
			}
			if (_tmp54_) {
				_qlite_row_unref0 (device);
				continue;
			}
			_tmp68_ = device;
			_tmp69_ = device;
			_tmp70_ = self->priv->plugin;
			_tmp71_ = _tmp70_->db;
			_tmp72_ = dino_plugins_omemo_database_get_identity_meta (_tmp71_);
			_tmp73_ = _tmp72_;
			_tmp74_ = _tmp73_->trust_level;
			_tmp75_ = qlite_row_get (_tmp69_, G_TYPE_INT, NULL, NULL, _tmp74_);
			dino_plugins_omemo_omemo_preferences_widget_add_fingerprint (self, _tmp68_, (DinoPluginsOmemoTrustLevel) ((gint) ((gintptr) _tmp75_)));
			_qlite_row_unref0 (device);
		}
		_qlite_row_iterator_unref0 (_device_it);
	}
	{
		QliteRowIterator* _device_it = NULL;
		DinoPluginsOmemoPlugin* _tmp76_;
		DinoPluginsOmemoDatabase* _tmp77_;
		DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp78_;
		DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp79_;
		XmppJid* _tmp80_;
		gchar* _tmp81_;
		gchar* _tmp82_;
		QliteQueryBuilder* _tmp83_;
		QliteQueryBuilder* _tmp84_;
		QliteRowIterator* _tmp85_;
		QliteRowIterator* _tmp86_;
		_tmp76_ = self->priv->plugin;
		_tmp77_ = _tmp76_->db;
		_tmp78_ = dino_plugins_omemo_database_get_identity_meta (_tmp77_);
		_tmp79_ = _tmp78_;
		_tmp80_ = self->priv->jid;
		_tmp81_ = xmpp_jid_to_string (_tmp80_);
		_tmp82_ = _tmp81_;
		_tmp83_ = dino_plugins_omemo_database_identity_meta_table_get_new_devices (_tmp79_, self->priv->identity_id, _tmp82_);
		_tmp84_ = _tmp83_;
		_tmp85_ = qlite_query_builder_iterator (_tmp84_);
		_tmp86_ = _tmp85_;
		_qlite_statement_builder_unref0 (_tmp84_);
		_g_free0 (_tmp82_);
		_device_it = _tmp86_;
		while (TRUE) {
			QliteRowIterator* _tmp87_;
			QliteRow* device = NULL;
			QliteRowIterator* _tmp88_;
			QliteRow* _tmp89_;
			QliteRow* _tmp90_;
			_tmp87_ = _device_it;
			if (!qlite_row_iterator_next (_tmp87_)) {
				break;
			}
			_tmp88_ = _device_it;
			_tmp89_ = qlite_row_iterator_get (_tmp88_);
			device = _tmp89_;
			_tmp90_ = device;
			dino_plugins_omemo_omemo_preferences_widget_add_new_fingerprint (self, _tmp90_);
			_qlite_row_unref0 (device);
		}
		_qlite_row_iterator_unref0 (_device_it);
	}
}

static gchar*
dino_plugins_omemo_omemo_preferences_widget_escape_for_iri_path_segment (const gchar* s)
{
	gchar* SUB_DELIMS = NULL;
	gchar* _tmp0_;
	gchar* ALLOWED_RESERVED_CHARS = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (s != NULL, NULL);
	_tmp0_ = g_strdup ("!$&'()*+,;=");
	SUB_DELIMS = _tmp0_;
	_tmp1_ = g_strconcat (SUB_DELIMS, ":@", NULL);
	ALLOWED_RESERVED_CHARS = _tmp1_;
	_tmp2_ = g_uri_escape_string (s, ALLOWED_RESERVED_CHARS, TRUE);
	result = _tmp2_;
	_g_free0 (ALLOWED_RESERVED_CHARS);
	_g_free0 (SUB_DELIMS);
	return result;
}

static void
__lambda36_ (DinoPluginsOmemoOmemoPreferencesWidget* self,
             XmppJid* bundle_jid,
             gint device_id,
             DinoPluginsOmemoBundle* bundle)
{
	gboolean _tmp0_ = FALSE;
	XmppJid* _tmp1_;
	g_return_if_fail (bundle_jid != NULL);
	g_return_if_fail (bundle != NULL);
	_tmp1_ = self->priv->jid;
	if (xmpp_jid_equals (bundle_jid, _tmp1_)) {
		GeeSet* _tmp2_;
		_tmp2_ = self->priv->displayed_ids;
		_tmp0_ = !gee_collection_contains ((GeeCollection*) _tmp2_, (gpointer) ((guintptr) device_id));
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		dino_plugins_omemo_omemo_preferences_widget_redraw_key_list (self);
	}
}

static void
___lambda36__dino_plugins_omemo_stream_module_bundle_fetched (DinoPluginsOmemoStreamModule* _sender,
                                                              XmppJid* jid,
                                                              gint device_id,
                                                              DinoPluginsOmemoBundle* bundle,
                                                              gpointer self)
{
	__lambda36_ ((DinoPluginsOmemoOmemoPreferencesWidget*) self, jid, device_id, bundle);
}

static void
dino_plugins_omemo_omemo_preferences_widget_fetch_unknown_bundles (DinoPluginsOmemoOmemoPreferencesWidget* self)
{
	DinoApplication* app = NULL;
	DinoApplication* _tmp0_;
	DinoApplication* _tmp1_;
	XmppXmppStream* stream = NULL;
	DinoApplication* _tmp2_;
	DinoStreamInteractor* _tmp3_;
	DinoStreamInteractor* _tmp4_;
	DinoEntitiesAccount* _tmp5_;
	XmppXmppStream* _tmp6_;
	XmppXmppStream* _tmp7_;
	DinoPluginsOmemoStreamModule* module = NULL;
	XmppXmppStream* _tmp8_;
	XmppModuleIdentity* _tmp9_;
	gpointer _tmp10_;
	DinoPluginsOmemoStreamModule* _tmp11_;
	DinoPluginsOmemoStreamModule* _tmp12_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = dino_application_get_default ();
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, DINO_TYPE_APPLICATION) ? ((DinoApplication*) _tmp0_) : NULL);
	app = _tmp1_;
	_tmp2_ = app;
	_tmp3_ = dino_application_get_stream_interactor (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->account;
	_tmp6_ = dino_stream_interactor_get_stream (_tmp4_, _tmp5_);
	stream = _tmp6_;
	_tmp7_ = stream;
	if (_tmp7_ == NULL) {
		_g_object_unref0 (stream);
		_g_object_unref0 (app);
		return;
	}
	_tmp8_ = stream;
	_tmp9_ = dino_plugins_omemo_stream_module_IDENTITY;
	_tmp10_ = xmpp_xmpp_stream_get_module (_tmp8_, DINO_PLUGINS_OMEMO_TYPE_STREAM_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp9_);
	module = (DinoPluginsOmemoStreamModule*) _tmp10_;
	_tmp11_ = module;
	if (_tmp11_ == NULL) {
		_g_object_unref0 (module);
		_g_object_unref0 (stream);
		_g_object_unref0 (app);
		return;
	}
	_tmp12_ = module;
	g_signal_connect_object (_tmp12_, "bundle-fetched", (GCallback) ___lambda36__dino_plugins_omemo_stream_module_bundle_fetched, self, G_CONNECT_AFTER);
	{
		QliteRowIterator* _device_it = NULL;
		DinoPluginsOmemoPlugin* _tmp13_;
		DinoPluginsOmemoDatabase* _tmp14_;
		DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp15_;
		DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp16_;
		XmppJid* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		QliteQueryBuilder* _tmp20_;
		QliteQueryBuilder* _tmp21_;
		QliteRowIterator* _tmp22_;
		QliteRowIterator* _tmp23_;
		_tmp13_ = self->priv->plugin;
		_tmp14_ = _tmp13_->db;
		_tmp15_ = dino_plugins_omemo_database_get_identity_meta (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = self->priv->jid;
		_tmp18_ = xmpp_jid_to_string (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = dino_plugins_omemo_database_identity_meta_table_get_unknown_devices (_tmp16_, self->priv->identity_id, _tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = qlite_query_builder_iterator (_tmp21_);
		_tmp23_ = _tmp22_;
		_qlite_statement_builder_unref0 (_tmp21_);
		_g_free0 (_tmp19_);
		_device_it = _tmp23_;
		while (TRUE) {
			QliteRowIterator* _tmp24_;
			QliteRow* device = NULL;
			QliteRowIterator* _tmp25_;
			QliteRow* _tmp26_;
			_tmp24_ = _device_it;
			if (!qlite_row_iterator_next (_tmp24_)) {
				break;
			}
			_tmp25_ = _device_it;
			_tmp26_ = qlite_row_iterator_get (_tmp25_);
			device = _tmp26_;
			{
				XmppJid* _tmp27_ = NULL;
				QliteRow* _tmp28_;
				DinoPluginsOmemoPlugin* _tmp29_;
				DinoPluginsOmemoDatabase* _tmp30_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp31_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp32_;
				QliteColumn* _tmp33_;
				gpointer _tmp34_;
				gchar* _tmp35_;
				XmppJid* _tmp36_;
				XmppJid* _tmp37_;
				DinoPluginsOmemoStreamModule* _tmp38_;
				XmppXmppStream* _tmp39_;
				QliteRow* _tmp40_;
				DinoPluginsOmemoPlugin* _tmp41_;
				DinoPluginsOmemoDatabase* _tmp42_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp43_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp44_;
				QliteColumn* _tmp45_;
				gpointer _tmp46_;
				_tmp28_ = device;
				_tmp29_ = self->priv->plugin;
				_tmp30_ = _tmp29_->db;
				_tmp31_ = dino_plugins_omemo_database_get_identity_meta (_tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = _tmp32_->address_name;
				_tmp34_ = qlite_row_get (_tmp28_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp33_);
				_tmp35_ = (gchar*) _tmp34_;
				_tmp36_ = xmpp_jid_new (_tmp35_, &_inner_error0_);
				_tmp37_ = _tmp36_;
				_g_free0 (_tmp35_);
				_tmp27_ = _tmp37_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
						goto __catch0_xmpp_invalid_jid_error;
					}
					_qlite_row_unref0 (device);
					_qlite_row_iterator_unref0 (_device_it);
					_g_object_unref0 (module);
					_g_object_unref0 (stream);
					_g_object_unref0 (app);
					g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return;
				}
				_tmp38_ = module;
				_tmp39_ = stream;
				_tmp40_ = device;
				_tmp41_ = self->priv->plugin;
				_tmp42_ = _tmp41_->db;
				_tmp43_ = dino_plugins_omemo_database_get_identity_meta (_tmp42_);
				_tmp44_ = _tmp43_;
				_tmp45_ = _tmp44_->device_id;
				_tmp46_ = qlite_row_get (_tmp40_, G_TYPE_INT, NULL, NULL, _tmp45_);
				dino_plugins_omemo_stream_module_fetch_bundle (_tmp38_, _tmp39_, _tmp27_, (gint) ((gintptr) _tmp46_), FALSE);
				_xmpp_jid_unref0 (_tmp27_);
			}
			goto __finally0;
			__catch0_xmpp_invalid_jid_error:
			{
				GError* e = NULL;
				GError* _tmp47_;
				const gchar* _tmp48_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp47_ = e;
				_tmp48_ = _tmp47_->message;
				g_warning ("encryption_preferences_entry.vala:145: Ignoring device with invalid Ji" \
"d: %s", _tmp48_);
				_g_error_free0 (e);
			}
			__finally0:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_qlite_row_unref0 (device);
				_qlite_row_iterator_unref0 (_device_it);
				_g_object_unref0 (module);
				_g_object_unref0 (stream);
				_g_object_unref0 (app);
				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;
			}
			_qlite_row_unref0 (device);
		}
		_qlite_row_iterator_unref0 (_device_it);
	}
	_g_object_unref0 (module);
	_g_object_unref0 (stream);
	_g_object_unref0 (app);
}

static Block23Data*
block23_data_ref (Block23Data* _data23_)
{
	g_atomic_int_inc (&_data23_->_ref_count_);
	return _data23_;
}

static void
block23_data_unref (void * _userdata_)
{
	Block23Data* _data23_;
	_data23_ = (Block23Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data23_->_ref_count_)) {
		DinoPluginsOmemoOmemoPreferencesWidget* self;
		self = _data23_->self;
		_g_object_unref0 (_data23_->copy_button);
		_g_free0 (_data23_->fingerprint);
		_g_object_unref0 (self);
		g_slice_free (Block23Data, _data23_);
	}
}

static void
__lambda33_ (Block23Data* _data23_)
{
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	GdkClipboard* _tmp0_;
	self = _data23_->self;
	_tmp0_ = gtk_widget_get_clipboard ((GtkWidget*) _data23_->copy_button);
	gdk_clipboard_set_text (_tmp0_, _data23_->fingerprint);
}

static void
___lambda33__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda33_ (self);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

/**  Does 2D nearest-neighbor upsampling of an array of single-byte
         * samples, while expanding the least significant bit of each sample
         * to three 0-or-255 bytes.
         */
static void
qrencode_qrcode_expand_and_upsample (QRcode* self,
                                     guint8* src,
                                     gint src_length1,
                                     guint src_w,
                                     guint src_h,
                                     guint8* dst,
                                     gint dst_length1,
                                     guint dst_w,
                                     guint dst_h)
{
	guint scale_x = 0U;
	guint scale_y = 0U;
	g_return_if_fail (self != NULL);
	_vala_assert ((dst_w % src_w) == ((guint) 0), "dst_w % src_w == 0");
	_vala_assert ((dst_h % src_h) == ((guint) 0), "dst_h % src_h == 0");
	scale_x = dst_w / src_w;
	scale_y = dst_h / src_h;
	{
		guint src_y = 0U;
		src_y = (guint) 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				if (!_tmp0_) {
					guint _tmp1_;
					src_y = src_y + 1;
					_tmp1_ = src_y;
				}
				_tmp0_ = FALSE;
				if (!(src_y < src_h)) {
					break;
				}
				{
					guint repeat_y = 0U;
					repeat_y = (guint) 0;
					{
						gboolean _tmp2_ = FALSE;
						_tmp2_ = TRUE;
						while (TRUE) {
							guint dst_y = 0U;
							if (!_tmp2_) {
								guint _tmp3_;
								repeat_y = repeat_y + 1;
								_tmp3_ = repeat_y;
							}
							_tmp2_ = FALSE;
							if (!(repeat_y < scale_y)) {
								break;
							}
							dst_y = (src_y * scale_y) + repeat_y;
							{
								guint src_x = 0U;
								src_x = (guint) 0;
								{
									gboolean _tmp4_ = FALSE;
									_tmp4_ = TRUE;
									while (TRUE) {
										gint _tmp6_ = 0;
										guint8 _tmp7_;
										guint8 value = 0U;
										if (!_tmp4_) {
											guint _tmp5_;
											src_x = src_x + 1;
											_tmp5_ = src_x;
										}
										_tmp4_ = FALSE;
										if (!(src_x < src_w)) {
											break;
										}
										_tmp7_ = src[(src_y * src_w) + src_x];
										if (((gint) (_tmp7_ & 1)) == 1) {
											_tmp6_ = 0;
										} else {
											_tmp6_ = 255;
										}
										value = (guint8) _tmp6_;
										{
											guint repeat_x = 0U;
											repeat_x = (guint) 0;
											{
												gboolean _tmp8_ = FALSE;
												_tmp8_ = TRUE;
												while (TRUE) {
													guint dst_x = 0U;
													guint dst_idx = 0U;
													if (!_tmp8_) {
														guint _tmp9_;
														repeat_x = repeat_x + 1;
														_tmp9_ = repeat_x;
													}
													_tmp8_ = FALSE;
													if (!(repeat_x < scale_x)) {
														break;
													}
													dst_x = (src_x * scale_x) + repeat_x;
													dst_idx = (dst_y * dst_w) + dst_x;
													dst[(dst_idx * 3) + 0] = value;
													dst[(dst_idx * 3) + 1] = value;
													dst[(dst_idx * 3) + 2] = value;
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

static GdkPaintable*
qrencode_qrcode_to_paintable (QRcode* self,
                              gint module_size)
{
	gint dst_width = 0;
	guint8* dst_data = NULL;
	guint8* _tmp0_;
	gint dst_data_length1;
	gint _dst_data_size_;
	guint8* _tmp1_;
	gint _tmp1__length1;
	guint8* _tmp2_;
	gint _tmp2__length1;
	guint8* _tmp3_;
	gint _tmp3__length1;
	GBytes* _tmp4_;
	GBytes* _tmp5_;
	GdkMemoryTexture* _tmp6_;
	GdkPaintable* _tmp7_;
	GdkPaintable* result;
	g_return_val_if_fail (self != NULL, NULL);
	_vala_assert (module_size > 0, "module_size > 0");
	dst_width = self->width * module_size;
	_tmp0_ = g_new0 (guint8, (dst_width * dst_width) * 3);
	dst_data = _tmp0_;
	dst_data_length1 = (dst_width * dst_width) * 3;
	_dst_data_size_ = dst_data_length1;
	_tmp1_ = self->data;
	_tmp1__length1 = -1;
	_tmp2_ = dst_data;
	_tmp2__length1 = dst_data_length1;
	qrencode_qrcode_expand_and_upsample (self, _tmp1_, (gint) _tmp1__length1, (guint) self->width, (guint) self->width, _tmp2_, (gint) _tmp2__length1, (guint) dst_width, (guint) dst_width);
	_tmp3_ = dst_data;
	_tmp3__length1 = dst_data_length1;
	dst_data = NULL;
	dst_data_length1 = 0;
	_tmp4_ = g_bytes_new_take (_tmp3_, _tmp3__length1);
	_tmp5_ = _tmp4_;
	_tmp6_ = (GdkMemoryTexture*) gdk_memory_texture_new (dst_width, dst_width, GDK_MEMORY_R8G8B8, _tmp5_, (gsize) (dst_width * 3));
	_tmp7_ = (GdkPaintable*) _tmp6_;
	_g_bytes_unref0 (_tmp5_);
	result = _tmp7_;
	dst_data = (g_free (dst_data), NULL);
	return result;
}

static void
dino_plugins_omemo_omemo_preferences_widget_add_own_fingerprint (DinoPluginsOmemoOmemoPreferencesWidget* self)
{
	Block23Data* _data23_;
	gchar* own_b64 = NULL;
	DinoPluginsOmemoPlugin* _tmp0_;
	DinoPluginsOmemoDatabase* _tmp1_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp2_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp3_;
	DinoPluginsOmemoPlugin* _tmp4_;
	DinoPluginsOmemoDatabase* _tmp5_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp6_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp7_;
	QliteColumn* _tmp8_;
	DinoEntitiesAccount* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	QliteRowOption* _tmp12_;
	QliteRowOption* _tmp13_;
	DinoPluginsOmemoPlugin* _tmp14_;
	DinoPluginsOmemoDatabase* _tmp15_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp16_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp17_;
	QliteColumn* _tmp18_;
	gpointer _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GtkBox* own_action_box = NULL;
	GtkBox* _tmp22_;
	GtkMenuButton* show_qrcode_button = NULL;
	gchar* _tmp23_;
	GtkMenuButton* _tmp24_ = NULL;
	gchar* _tmp25_;
	GtkButton* _tmp26_ = NULL;
	AdwActionRow* action_row = NULL;
	AdwActionRow* _tmp27_ = NULL;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gint sid = 0;
	DinoPluginsOmemoPlugin* _tmp33_;
	DinoPluginsOmemoDatabase* _tmp34_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp35_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp36_;
	DinoPluginsOmemoPlugin* _tmp37_;
	DinoPluginsOmemoDatabase* _tmp38_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp39_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp40_;
	QliteColumn* _tmp41_;
	DinoEntitiesAccount* _tmp42_;
	gint _tmp43_;
	gint _tmp44_;
	QliteRowOption* _tmp45_;
	QliteRowOption* _tmp46_;
	DinoPluginsOmemoPlugin* _tmp47_;
	DinoPluginsOmemoDatabase* _tmp48_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp49_;
	DinoPluginsOmemoDatabaseIdentityTable* _tmp50_;
	QliteColumn* _tmp51_;
	gpointer _tmp52_;
	gint _tmp53_;
	gchar* iri_query = NULL;
	gchar* _tmp54_;
	gchar* _tmp55_;
	const gchar* _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	gchar* iri_path_seg = NULL;
	XmppJid* _tmp59_;
	gchar* _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* iri = NULL;
	const gchar* _tmp64_;
	const gchar* _tmp65_;
	gchar* _tmp66_;
	static const gint QUIET_ZONE_MODULES = 4;
	static const gint MODULE_SIZE_PX = 4;
	GdkPaintable* qr_paintable = NULL;
	QRcode* _tmp67_;
	QRcode* _tmp68_;
	GtkPicture* _tmp69_;
	gint _tmp70_;
	gint _tmp71_;
	GdkPaintable* _tmp72_;
	GdkPaintable* _tmp73_;
	GtkPicture* _tmp74_;
	GtkPicture* _tmp75_;
	GtkPicture* _tmp76_;
	GtkPicture* _tmp77_;
	GtkPicture* _tmp78_;
	GtkPopover* _tmp79_;
	GtkPopover* _tmp80_;
	g_return_if_fail (self != NULL);
	_data23_ = g_slice_new0 (Block23Data);
	_data23_->_ref_count_ = 1;
	_data23_->self = g_object_ref (self);
	_tmp0_ = self->priv->plugin;
	_tmp1_ = _tmp0_->db;
	_tmp2_ = dino_plugins_omemo_database_get_identity (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->plugin;
	_tmp5_ = _tmp4_->db;
	_tmp6_ = dino_plugins_omemo_database_get_identity (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->account_id;
	_tmp9_ = self->priv->account;
	_tmp10_ = dino_entities_account_get_id (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = qlite_table_row_with ((QliteTable*) _tmp3_, G_TYPE_INT, NULL, NULL, _tmp8_, (gpointer) ((gintptr) _tmp11_));
	_tmp13_ = _tmp12_;
	_tmp14_ = self->priv->plugin;
	_tmp15_ = _tmp14_->db;
	_tmp16_ = dino_plugins_omemo_database_get_identity (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = _tmp17_->identity_key_public_base64;
	_tmp19_ = qlite_row_option_get (_tmp13_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp18_, NULL);
	_tmp20_ = (gchar*) _tmp19_;
	_qlite_row_option_unref0 (_tmp13_);
	own_b64 = _tmp20_;
	_tmp21_ = dino_plugins_omemo_fingerprint_from_base64 (own_b64);
	_data23_->fingerprint = _tmp21_;
	_tmp22_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp22_);
	own_action_box = _tmp22_;
	_tmp23_ = g_strdup ("dino-qr-code-symbolic");
	_tmp24_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_menu_button_set_icon_name (_tmp24_, _tmp23_);
	_g_free0 (_tmp23_);
	gtk_widget_set_valign ((GtkWidget*) _tmp24_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp24_);
	show_qrcode_button = _tmp24_;
	gtk_box_append (own_action_box, (GtkWidget*) show_qrcode_button);
	_tmp25_ = g_strdup ("edit-copy-symbolic");
	_tmp26_ = (GtkButton*) gtk_button_new ();
	gtk_button_set_icon_name (_tmp26_, _tmp25_);
	_g_free0 (_tmp25_);
	gtk_widget_set_valign ((GtkWidget*) _tmp26_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp26_);
	_data23_->copy_button = _tmp26_;
	g_signal_connect_data (_data23_->copy_button, "clicked", (GCallback) ___lambda33__gtk_button_clicked, block23_data_ref (_data23_), (GClosureNotify) block23_data_unref, 0);
	gtk_box_append (own_action_box, (GtkWidget*) _data23_->copy_button);
	_tmp27_ = (AdwActionRow*) adw_action_row_new ();
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp27_, TRUE);
	g_object_ref_sink (_tmp27_);
	action_row = _tmp27_;
	_tmp28_ = dino_gettext ("This device");
	adw_preferences_row_set_title ((AdwPreferencesRow*) action_row, _tmp28_);
	_tmp29_ = dino_plugins_omemo_fingerprint_from_base64 (own_b64);
	_tmp30_ = _tmp29_;
	_tmp31_ = dino_plugins_omemo_fingerprint_markup (_tmp30_);
	_tmp32_ = _tmp31_;
	adw_action_row_set_subtitle (action_row, _tmp32_);
	_g_free0 (_tmp32_);
	_g_free0 (_tmp30_);
	adw_action_row_add_suffix (action_row, (GtkWidget*) own_action_box);
	dino_plugins_omemo_omemo_preferences_widget_add_key_row (self, (AdwPreferencesRow*) action_row);
	_tmp33_ = self->priv->plugin;
	_tmp34_ = _tmp33_->db;
	_tmp35_ = dino_plugins_omemo_database_get_identity (_tmp34_);
	_tmp36_ = _tmp35_;
	_tmp37_ = self->priv->plugin;
	_tmp38_ = _tmp37_->db;
	_tmp39_ = dino_plugins_omemo_database_get_identity (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = _tmp40_->account_id;
	_tmp42_ = self->priv->account;
	_tmp43_ = dino_entities_account_get_id (_tmp42_);
	_tmp44_ = _tmp43_;
	_tmp45_ = qlite_table_row_with ((QliteTable*) _tmp36_, G_TYPE_INT, NULL, NULL, _tmp41_, (gpointer) ((gintptr) _tmp44_));
	_tmp46_ = _tmp45_;
	_tmp47_ = self->priv->plugin;
	_tmp48_ = _tmp47_->db;
	_tmp49_ = dino_plugins_omemo_database_get_identity (_tmp48_);
	_tmp50_ = _tmp49_;
	_tmp51_ = _tmp50_->device_id;
	_tmp52_ = qlite_row_option_get (_tmp46_, G_TYPE_INT, NULL, NULL, _tmp51_, NULL);
	_tmp53_ = (gint) ((gintptr) _tmp52_);
	_qlite_row_option_unref0 (_tmp46_);
	sid = _tmp53_;
	_tmp54_ = g_strdup_printf ("%i", sid);
	_tmp55_ = _tmp54_;
	_tmp56_ = string_to_string (_data23_->fingerprint);
	_tmp57_ = g_strconcat ("omemo-sid-", _tmp55_, "=", _tmp56_, NULL);
	_tmp58_ = _tmp57_;
	_g_free0 (_tmp55_);
	iri_query = _tmp58_;
	_tmp59_ = self->priv->jid;
	_tmp60_ = xmpp_jid_to_string (_tmp59_);
	_tmp61_ = _tmp60_;
	_tmp62_ = dino_plugins_omemo_omemo_preferences_widget_escape_for_iri_path_segment (_tmp61_);
	_tmp63_ = _tmp62_;
	_g_free0 (_tmp61_);
	iri_path_seg = _tmp63_;
	_tmp64_ = string_to_string (iri_path_seg);
	_tmp65_ = string_to_string (iri_query);
	_tmp66_ = g_strconcat ("xmpp:", _tmp64_, "?", _tmp65_, NULL);
	iri = _tmp66_;
	_tmp67_ = QRcode_encodeString (iri, 2, QR_ECLEVEL_L, QR_MODE_8, TRUE);
	_tmp68_ = _tmp67_;
	_tmp69_ = self->priv->qrcode_picture;
	_tmp70_ = gtk_widget_get_scale_factor ((GtkWidget*) _tmp69_);
	_tmp71_ = _tmp70_;
	_tmp72_ = qrencode_qrcode_to_paintable (_tmp68_, MODULE_SIZE_PX * _tmp71_);
	_tmp73_ = _tmp72_;
	_QRcode_free0 (_tmp68_);
	qr_paintable = _tmp73_;
	_tmp74_ = self->priv->qrcode_picture;
	gtk_picture_set_paintable (_tmp74_, qr_paintable);
	_tmp75_ = self->priv->qrcode_picture;
	_tmp76_ = self->priv->qrcode_picture;
	_tmp77_ = self->priv->qrcode_picture;
	_tmp78_ = self->priv->qrcode_picture;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp78_, QUIET_ZONE_MODULES * MODULE_SIZE_PX);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp77_, QUIET_ZONE_MODULES * MODULE_SIZE_PX);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp76_, QUIET_ZONE_MODULES * MODULE_SIZE_PX);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp75_, QUIET_ZONE_MODULES * MODULE_SIZE_PX);
	_tmp79_ = self->priv->qrcode_popover;
	gtk_widget_add_css_class ((GtkWidget*) _tmp79_, "qrcode-container");
	_tmp80_ = self->priv->qrcode_popover;
	gtk_menu_button_set_popover (show_qrcode_button, _tmp80_);
	_g_object_unref0 (qr_paintable);
	_g_free0 (iri);
	_g_free0 (iri_path_seg);
	_g_free0 (iri_query);
	_g_object_unref0 (action_row);
	_g_object_unref0 (show_qrcode_button);
	_g_object_unref0 (own_action_box);
	_g_free0 (own_b64);
	block23_data_unref (_data23_);
	_data23_ = NULL;
}

static gpointer
_qlite_row_ref0 (gpointer self)
{
	return self ? qlite_row_ref (self) : NULL;
}

static Block24Data*
block24_data_ref (Block24Data* _data24_)
{
	g_atomic_int_inc (&_data24_->_ref_count_);
	return _data24_;
}

static void
block24_data_unref (void * _userdata_)
{
	Block24Data* _data24_;
	_data24_ = (Block24Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
		DinoPluginsOmemoOmemoPreferencesWidget* self;
		self = _data24_->self;
		_qlite_row_unref0 (_data24_->device);
		_g_object_unref0 (self);
		g_slice_free (Block24Data, _data24_);
	}
}

static guint8*
signal_buffer_get_data (signal_buffer* self,
                        gint* result_length1)
{
	guint8* result;
	gint x = 0;
	guint8* res = NULL;
	guint8* _tmp0_;
	gint res_length1;
	gint _res_size_;
	guint8* _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	x = (gint) signal_buffer_len (self);
	_tmp0_ = signal_buffer_data (self);
	res = _tmp0_;
	res_length1 = -1;
	_res_size_ = res_length1;
	res_length1 = x;
	_tmp1_ = res;
	_tmp1__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

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

static guint8*
ec_public_key_serialize_ (ec_public_key* self,
                          gint* result_length1)
{
	signal_buffer* buffer = NULL;
	gint code = 0;
	signal_buffer* _tmp0_ = NULL;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	signal_buffer* _tmp3_;
	guint8* _tmp4_;
	gint _tmp4__length1;
	gint _tmp5_ = 0;
	guint8* _tmp6_;
	gint _tmp6__length1;
	guint8* _tmp7_;
	gint _tmp7__length1;
	guint8* _tmp8_;
	gint _tmp8__length1;
	guint8* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = ec_public_key_serialize (&_tmp0_, self);
	_signal_buffer_free0 (buffer);
	buffer = _tmp0_;
	code = _tmp1_;
	if (code < 0) {
		_tmp2_ = code > SG_ERR_MINIMUM;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		g_assert_not_reached ();
	}
	_tmp3_ = buffer;
	_tmp4_ = signal_buffer_get_data (_tmp3_, &_tmp5_);
	_tmp4__length1 = _tmp5_;
	_tmp6_ = _tmp4_;
	_tmp6__length1 = _tmp4__length1;
	_tmp7_ = (_tmp6_ != NULL) ? _vala_array_dup37 (_tmp6_, _tmp6__length1) : _tmp6_;
	_tmp7__length1 = _tmp6__length1;
	_tmp8_ = _tmp7_;
	_tmp8__length1 = _tmp7__length1;
	if (result_length1) {
		*result_length1 = _tmp8__length1;
	}
	result = _tmp8_;
	_signal_buffer_free0 (buffer);
	return result;
}

static Block25Data*
block25_data_ref (Block25Data* _data25_)
{
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}

static void
block25_data_unref (void * _userdata_)
{
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		DinoPluginsOmemoOmemoPreferencesWidget* self;
		self = _data25_->_data24_->self;
		_qlite_row_unref0 (_data25_->updated_device);
		block24_data_unref (_data25_->_data24_);
		_data25_->_data24_ = NULL;
		g_slice_free (Block25Data, _data25_);
	}
}

static void
__lambda32_ (Block25Data* _data25_,
             gint response)
{
	Block24Data* _data24_;
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	_data24_ = _data25_->_data24_;
	self = _data24_->self;
	dino_plugins_omemo_omemo_preferences_widget_update_stored_trust (self, response, _data25_->updated_device);
	dino_plugins_omemo_omemo_preferences_widget_redraw_key_list (self);
}

static void
___lambda32__gtk_dialog_response (GtkDialog* _sender,
                                  gint response_id,
                                  gpointer self)
{
	__lambda32_ (self, response_id);
}

static void
___lambda26_ (Block24Data* _data24_)
{
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	Block25Data* _data25_;
	DinoPluginsOmemoPlugin* _tmp0_;
	DinoPluginsOmemoDatabase* _tmp1_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp2_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp3_;
	DinoPluginsOmemoPlugin* _tmp4_;
	DinoPluginsOmemoDatabase* _tmp5_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp6_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp7_;
	QliteColumn* _tmp8_;
	gpointer _tmp9_;
	DinoPluginsOmemoPlugin* _tmp10_;
	DinoPluginsOmemoDatabase* _tmp11_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp12_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp13_;
	QliteColumn* _tmp14_;
	gpointer _tmp15_;
	gchar* _tmp16_;
	DinoPluginsOmemoPlugin* _tmp17_;
	DinoPluginsOmemoDatabase* _tmp18_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp19_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp20_;
	QliteColumn* _tmp21_;
	gpointer _tmp22_;
	QliteRow* _tmp23_;
	QliteRow* _tmp24_;
	DinoPluginsOmemoManageKeyDialog* manage_dialog = NULL;
	DinoPluginsOmemoPlugin* _tmp25_;
	DinoPluginsOmemoDatabase* _tmp26_;
	DinoPluginsOmemoManageKeyDialog* _tmp27_;
	GtkRoot* _tmp28_;
	self = _data24_->self;
	_data25_ = g_slice_new0 (Block25Data);
	_data25_->_ref_count_ = 1;
	_data25_->_data24_ = block24_data_ref (_data24_);
	_tmp0_ = self->priv->plugin;
	_tmp1_ = _tmp0_->db;
	_tmp2_ = dino_plugins_omemo_database_get_identity_meta (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->plugin;
	_tmp5_ = _tmp4_->db;
	_tmp6_ = dino_plugins_omemo_database_get_identity_meta (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->identity_id;
	_tmp9_ = qlite_row_get (_data24_->device, G_TYPE_INT, NULL, NULL, _tmp8_);
	_tmp10_ = self->priv->plugin;
	_tmp11_ = _tmp10_->db;
	_tmp12_ = dino_plugins_omemo_database_get_identity_meta (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_->address_name;
	_tmp15_ = qlite_row_get (_data24_->device, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp14_);
	_tmp16_ = (gchar*) _tmp15_;
	_tmp17_ = self->priv->plugin;
	_tmp18_ = _tmp17_->db;
	_tmp19_ = dino_plugins_omemo_database_get_identity_meta (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = _tmp20_->device_id;
	_tmp22_ = qlite_row_get (_data24_->device, G_TYPE_INT, NULL, NULL, _tmp21_);
	_tmp23_ = dino_plugins_omemo_database_identity_meta_table_get_device (_tmp3_, (gint) ((gintptr) _tmp9_), _tmp16_, (gint) ((gintptr) _tmp22_));
	_tmp24_ = _tmp23_;
	_g_free0 (_tmp16_);
	_data25_->updated_device = _tmp24_;
	_tmp25_ = self->priv->plugin;
	_tmp26_ = _tmp25_->db;
	_tmp27_ = dino_plugins_omemo_manage_key_dialog_new (_data25_->updated_device, _tmp26_);
	g_object_ref_sink (_tmp27_);
	manage_dialog = _tmp27_;
	_tmp28_ = gtk_widget_get_root ((GtkWidget*) self);
	gtk_window_set_transient_for ((GtkWindow*) manage_dialog, G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, gtk_window_get_type (), GtkWindow));
	gtk_window_present ((GtkWindow*) manage_dialog);
	g_signal_connect_data ((GtkDialog*) manage_dialog, "response", (GCallback) ___lambda32__gtk_dialog_response, block25_data_ref (_data25_), (GClosureNotify) block25_data_unref, 0);
	_g_object_unref0 (manage_dialog);
	block25_data_unref (_data25_);
	_data25_ = NULL;
}

static void
____lambda26__adw_action_row_activated (AdwActionRow* _sender,
                                        gpointer self)
{
	___lambda26_ (self);
}

static void
dino_plugins_omemo_omemo_preferences_widget_add_fingerprint (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                             QliteRow* device,
                                                             DinoPluginsOmemoTrustLevel trust)
{
	Block24Data* _data24_;
	QliteRow* _tmp0_;
	gchar* key_base64 = NULL;
	DinoPluginsOmemoPlugin* _tmp1_;
	DinoPluginsOmemoDatabase* _tmp2_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp3_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp4_;
	QliteColumn* _tmp5_;
	gpointer _tmp6_;
	gboolean key_active = FALSE;
	DinoPluginsOmemoPlugin* _tmp7_;
	DinoPluginsOmemoDatabase* _tmp8_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp9_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp10_;
	QliteColumn* _tmp11_;
	gpointer _tmp12_;
	OmemoStore* _tmp13_;
	DinoPluginsOmemoPlugin* _tmp49_;
	DinoPluginsOmemoDatabase* _tmp50_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp51_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp52_;
	QliteColumn* _tmp53_;
	gpointer _tmp54_;
	GeeSet* _tmp85_;
	DinoPluginsOmemoPlugin* _tmp86_;
	DinoPluginsOmemoDatabase* _tmp87_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp88_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp89_;
	QliteColumn* _tmp90_;
	gpointer _tmp91_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (device != NULL);
	_data24_ = g_slice_new0 (Block24Data);
	_data24_->_ref_count_ = 1;
	_data24_->self = g_object_ref (self);
	_tmp0_ = _qlite_row_ref0 (device);
	_qlite_row_unref0 (_data24_->device);
	_data24_->device = _tmp0_;
	_tmp1_ = self->priv->plugin;
	_tmp2_ = _tmp1_->db;
	_tmp3_ = dino_plugins_omemo_database_get_identity_meta (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_->identity_key_public_base64;
	_tmp6_ = qlite_row_get (_data24_->device, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp5_);
	key_base64 = (gchar*) _tmp6_;
	_tmp7_ = self->priv->plugin;
	_tmp8_ = _tmp7_->db;
	_tmp9_ = dino_plugins_omemo_database_get_identity_meta (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_->now_active;
	_tmp12_ = qlite_row_get (_data24_->device, G_TYPE_BOOLEAN, NULL, NULL, _tmp11_);
	key_active = (gboolean) ((gintptr) _tmp12_);
	_tmp13_ = self->priv->store;
	if (_tmp13_ != NULL) {
		{
			signal_protocol_address* address = NULL;
			XmppJid* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			DinoPluginsOmemoPlugin* _tmp17_;
			DinoPluginsOmemoDatabase* _tmp18_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp19_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp20_;
			QliteColumn* _tmp21_;
			gpointer _tmp22_;
			signal_protocol_address* _tmp23_;
			signal_protocol_address* _tmp24_;
			session_record* session = NULL;
			gboolean _tmp25_ = FALSE;
			OmemoStore* _tmp26_;
			signal_protocol_address* _tmp27_;
			_tmp14_ = self->priv->jid;
			_tmp15_ = xmpp_jid_to_string (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = self->priv->plugin;
			_tmp18_ = _tmp17_->db;
			_tmp19_ = dino_plugins_omemo_database_get_identity_meta (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = _tmp20_->device_id;
			_tmp22_ = qlite_row_get (_data24_->device, G_TYPE_INT, NULL, NULL, _tmp21_);
			_tmp23_ = signal_protocol_address_new (_tmp16_, (gint32) ((gint) ((gintptr) _tmp22_)));
			_tmp24_ = _tmp23_;
			_g_free0 (_tmp16_);
			address = _tmp24_;
			session = NULL;
			_tmp26_ = self->priv->store;
			_tmp27_ = address;
			_tmp25_ = omemo_store_contains_session (_tmp26_, _tmp27_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_signal_type_unref_vapi0 (session);
				_signal_protocol_address_free0 (address);
				goto __catch0_g_error;
			}
			if (_tmp25_) {
				session_record* _tmp28_ = NULL;
				OmemoStore* _tmp29_;
				signal_protocol_address* _tmp30_;
				session_record* _tmp31_;
				session_record* _tmp32_;
				gchar* session_key_base64 = NULL;
				session_record* _tmp33_;
				session_state* _tmp34_;
				session_state* _tmp35_;
				ec_public_key* _tmp36_;
				ec_public_key* _tmp37_;
				gint _tmp38_ = 0;
				guint8* _tmp39_;
				guint8* _tmp40_;
				gint _tmp40__length1;
				gchar* _tmp41_;
				gchar* _tmp42_;
				const gchar* _tmp43_;
				const gchar* _tmp44_;
				_tmp29_ = self->priv->store;
				_tmp30_ = address;
				_tmp31_ = omemo_store_load_session (_tmp29_, _tmp30_, &_inner_error0_);
				_tmp28_ = _tmp31_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_signal_type_unref_vapi0 (session);
					_signal_protocol_address_free0 (address);
					goto __catch0_g_error;
				}
				_tmp32_ = _tmp28_;
				_tmp28_ = NULL;
				_signal_type_unref_vapi0 (session);
				session = _tmp32_;
				_tmp33_ = session;
				_tmp34_ = session_record_get_state (_tmp33_);
				_tmp35_ = _tmp34_;
				_tmp36_ = session_state_get_remote_identity_key (_tmp35_);
				_tmp37_ = _tmp36_;
				_tmp39_ = ec_public_key_serialize_ (_tmp37_, &_tmp38_);
				_tmp40_ = _tmp39_;
				_tmp40__length1 = _tmp38_;
				_tmp41_ = g_base64_encode (_tmp40_, (gint) _tmp38_);
				_tmp42_ = _tmp41_;
				_tmp40_ = (g_free (_tmp40_), NULL);
				session_key_base64 = _tmp42_;
				_tmp43_ = key_base64;
				_tmp44_ = session_key_base64;
				if (g_strcmp0 (_tmp43_, _tmp44_) != 0) {
					const gchar* _tmp45_;
					gchar* _tmp46_;
					g_critical ("encryption_preferences_entry.vala:200: Session and database identity k" \
"ey mismatch!");
					_tmp45_ = session_key_base64;
					_tmp46_ = g_strdup (_tmp45_);
					_g_free0 (key_base64);
					key_base64 = _tmp46_;
				}
				_g_free0 (session_key_base64);
				_signal_type_unref_vapi0 (_tmp28_);
			}
			_signal_type_unref_vapi0 (session);
			_signal_protocol_address_free0 (address);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp47_;
			const gchar* _tmp48_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp47_ = e;
			_tmp48_ = _tmp47_->message;
			g_print ("Error while reading session store: %s", _tmp48_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (key_base64);
			block24_data_unref (_data24_);
			_data24_ = 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;
		}
	}
	_tmp49_ = self->priv->plugin;
	_tmp50_ = _tmp49_->db;
	_tmp51_ = dino_plugins_omemo_database_get_identity_meta (_tmp50_);
	_tmp52_ = _tmp51_;
	_tmp53_ = _tmp52_->now_active;
	_tmp54_ = qlite_row_get (_data24_->device, G_TYPE_BOOLEAN, NULL, NULL, _tmp53_);
	if ((gboolean) ((gintptr) _tmp54_)) {
		AdwActionRow* action_row = NULL;
		AdwActionRow* _tmp55_ = NULL;
		AdwActionRow* _tmp56_;
		AdwActionRow* _tmp57_;
		const gchar* _tmp58_ = NULL;
		DinoEntitiesAccount* _tmp59_;
		XmppJid* _tmp60_;
		XmppJid* _tmp61_;
		XmppJid* _tmp62_;
		XmppJid* _tmp63_;
		gboolean _tmp64_;
		AdwActionRow* _tmp67_;
		AdwActionRow* _tmp68_;
		const gchar* _tmp69_;
		gchar* _tmp70_;
		gchar* _tmp71_;
		gchar* _tmp72_;
		gchar* _tmp73_;
		gchar* trust_str = NULL;
		const gchar* _tmp74_;
		gchar* _tmp75_;
		AdwActionRow* _tmp80_;
		const gchar* _tmp81_;
		GtkLabel* _tmp82_;
		GtkLabel* _tmp83_;
		AdwActionRow* _tmp84_;
		_tmp55_ = (AdwActionRow*) adw_action_row_new ();
		adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp55_, TRUE);
		g_object_ref_sink (_tmp55_);
		action_row = _tmp55_;
		_tmp56_ = action_row;
		g_signal_connect_data (_tmp56_, "activated", (GCallback) ____lambda26__adw_action_row_activated, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
		_tmp57_ = action_row;
		gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp57_, TRUE);
		_tmp59_ = self->priv->account;
		_tmp60_ = dino_entities_account_get_bare_jid (_tmp59_);
		_tmp61_ = _tmp60_;
		_tmp62_ = _tmp61_;
		_tmp63_ = self->priv->jid;
		_tmp64_ = xmpp_jid_equals_bare (_tmp62_, _tmp63_);
		_xmpp_jid_unref0 (_tmp62_);
		if (_tmp64_) {
			const gchar* _tmp65_;
			_tmp65_ = dino_gettext ("Other device");
			_tmp58_ = _tmp65_;
		} else {
			const gchar* _tmp66_;
			_tmp66_ = dino_gettext ("Device");
			_tmp58_ = _tmp66_;
		}
		_tmp67_ = action_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp67_, _tmp58_);
		_tmp68_ = action_row;
		_tmp69_ = key_base64;
		_tmp70_ = dino_plugins_omemo_fingerprint_from_base64 (_tmp69_);
		_tmp71_ = _tmp70_;
		_tmp72_ = dino_plugins_omemo_fingerprint_markup (_tmp71_);
		_tmp73_ = _tmp72_;
		adw_action_row_set_subtitle (_tmp68_, _tmp73_);
		_g_free0 (_tmp73_);
		_g_free0 (_tmp71_);
		_tmp74_ = dino_gettext ("Accepted");
		_tmp75_ = g_strdup (_tmp74_);
		trust_str = _tmp75_;
		switch (trust) {
			case DINO_PLUGINS_OMEMO_TRUST_LEVEL_UNTRUSTED:
			{
				const gchar* _tmp76_;
				gchar* _tmp77_;
				_tmp76_ = dino_gettext ("Rejected");
				_tmp77_ = g_strdup (_tmp76_);
				_g_free0 (trust_str);
				trust_str = _tmp77_;
				break;
			}
			case DINO_PLUGINS_OMEMO_TRUST_LEVEL_VERIFIED:
			{
				const gchar* _tmp78_;
				gchar* _tmp79_;
				_tmp78_ = dino_gettext ("Verified");
				_tmp79_ = g_strdup (_tmp78_);
				_g_free0 (trust_str);
				trust_str = _tmp79_;
				break;
			}
			default:
			break;
		}
		_tmp80_ = action_row;
		_tmp81_ = trust_str;
		_tmp82_ = (GtkLabel*) gtk_label_new (_tmp81_);
		g_object_ref_sink (_tmp82_);
		_tmp83_ = _tmp82_;
		adw_action_row_add_suffix (_tmp80_, (GtkWidget*) _tmp83_);
		_g_object_unref0 (_tmp83_);
		_tmp84_ = action_row;
		dino_plugins_omemo_omemo_preferences_widget_add_key_row (self, (AdwPreferencesRow*) _tmp84_);
		_g_free0 (trust_str);
		_g_object_unref0 (action_row);
	}
	_tmp85_ = self->priv->displayed_ids;
	_tmp86_ = self->priv->plugin;
	_tmp87_ = _tmp86_->db;
	_tmp88_ = dino_plugins_omemo_database_get_identity_meta (_tmp87_);
	_tmp89_ = _tmp88_;
	_tmp90_ = _tmp89_->device_id;
	_tmp91_ = qlite_row_get (_data24_->device, G_TYPE_INT, NULL, NULL, _tmp90_);
	gee_collection_add ((GeeCollection*) _tmp85_, (gpointer) ((guintptr) _tmp91_));
	_g_free0 (key_base64);
	block24_data_unref (_data24_);
	_data24_ = NULL;
}

static gboolean
dino_plugins_omemo_omemo_preferences_widget_on_auto_accept_toggled (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                    gboolean active)
{
	DinoPluginsOmemoPlugin* _tmp0_;
	DinoPluginsOmemoTrustManager* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	XmppJid* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->plugin;
	_tmp1_ = _tmp0_->trust_manager;
	_tmp2_ = self->priv->account;
	_tmp3_ = self->priv->jid;
	dino_plugins_omemo_trust_manager_set_blind_trust (_tmp1_, _tmp2_, _tmp3_, active);
	if (active) {
		gint identity_id = 0;
		DinoPluginsOmemoPlugin* _tmp4_;
		DinoPluginsOmemoDatabase* _tmp5_;
		DinoPluginsOmemoDatabaseIdentityTable* _tmp6_;
		DinoPluginsOmemoDatabaseIdentityTable* _tmp7_;
		DinoEntitiesAccount* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		_tmp4_ = self->priv->plugin;
		_tmp5_ = _tmp4_->db;
		_tmp6_ = dino_plugins_omemo_database_get_identity (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = self->priv->account;
		_tmp9_ = dino_entities_account_get_id (_tmp8_);
		_tmp10_ = _tmp9_;
		identity_id = dino_plugins_omemo_database_identity_table_get_id (_tmp7_, _tmp10_);
		if (identity_id < 0) {
			result = FALSE;
			return result;
		}
		{
			QliteRowIterator* _device_it = NULL;
			DinoPluginsOmemoPlugin* _tmp11_;
			DinoPluginsOmemoDatabase* _tmp12_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp13_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp14_;
			XmppJid* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			QliteQueryBuilder* _tmp18_;
			QliteQueryBuilder* _tmp19_;
			QliteRowIterator* _tmp20_;
			QliteRowIterator* _tmp21_;
			_tmp11_ = self->priv->plugin;
			_tmp12_ = _tmp11_->db;
			_tmp13_ = dino_plugins_omemo_database_get_identity_meta (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = self->priv->jid;
			_tmp16_ = xmpp_jid_to_string (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = dino_plugins_omemo_database_identity_meta_table_get_new_devices (_tmp14_, identity_id, _tmp17_);
			_tmp19_ = _tmp18_;
			_tmp20_ = qlite_query_builder_iterator (_tmp19_);
			_tmp21_ = _tmp20_;
			_qlite_statement_builder_unref0 (_tmp19_);
			_g_free0 (_tmp17_);
			_device_it = _tmp21_;
			while (TRUE) {
				QliteRowIterator* _tmp22_;
				QliteRow* device = NULL;
				QliteRowIterator* _tmp23_;
				QliteRow* _tmp24_;
				DinoPluginsOmemoPlugin* _tmp25_;
				DinoPluginsOmemoTrustManager* _tmp26_;
				DinoEntitiesAccount* _tmp27_;
				XmppJid* _tmp28_;
				QliteRow* _tmp29_;
				DinoPluginsOmemoPlugin* _tmp30_;
				DinoPluginsOmemoDatabase* _tmp31_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp32_;
				DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp33_;
				QliteColumn* _tmp34_;
				gpointer _tmp35_;
				QliteRow* _tmp36_;
				_tmp22_ = _device_it;
				if (!qlite_row_iterator_next (_tmp22_)) {
					break;
				}
				_tmp23_ = _device_it;
				_tmp24_ = qlite_row_iterator_get (_tmp23_);
				device = _tmp24_;
				_tmp25_ = self->priv->plugin;
				_tmp26_ = _tmp25_->trust_manager;
				_tmp27_ = self->priv->account;
				_tmp28_ = self->priv->jid;
				_tmp29_ = device;
				_tmp30_ = self->priv->plugin;
				_tmp31_ = _tmp30_->db;
				_tmp32_ = dino_plugins_omemo_database_get_identity_meta (_tmp31_);
				_tmp33_ = _tmp32_;
				_tmp34_ = _tmp33_->device_id;
				_tmp35_ = qlite_row_get (_tmp29_, G_TYPE_INT, NULL, NULL, _tmp34_);
				dino_plugins_omemo_trust_manager_set_device_trust (_tmp26_, _tmp27_, _tmp28_, (gint) ((gintptr) _tmp35_), DINO_PLUGINS_OMEMO_TRUST_LEVEL_TRUSTED);
				_tmp36_ = device;
				dino_plugins_omemo_omemo_preferences_widget_add_fingerprint (self, _tmp36_, DINO_PLUGINS_OMEMO_TRUST_LEVEL_TRUSTED);
				_qlite_row_unref0 (device);
			}
			_qlite_row_iterator_unref0 (_device_it);
		}
	}
	result = FALSE;
	return result;
}

static gboolean
dino_plugins_omemo_omemo_preferences_widget_on_omemo_by_default_toggled (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                         gboolean active)
{
	DinoEntitiesEncryption _tmp0_ = 0;
	DinoEntitiesEncryption encryption_value = 0;
	DinoPluginsOmemoPlugin* _tmp1_;
	DinoApplication* _tmp2_;
	DinoEntitiesSettings* _tmp3_;
	DinoEntitiesSettings* _tmp4_;
	DinoEntitiesAccount* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (active) {
		_tmp0_ = DINO_ENTITIES_ENCRYPTION_OMEMO;
	} else {
		_tmp0_ = DINO_ENTITIES_ENCRYPTION_NONE;
	}
	encryption_value = _tmp0_;
	_tmp1_ = self->priv->plugin;
	_tmp2_ = _tmp1_->app;
	_tmp3_ = dino_application_get_settings (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->account;
	dino_entities_settings_set_default_encryption (_tmp4_, _tmp5_, encryption_value);
	result = FALSE;
	return result;
}

static void
dino_plugins_omemo_omemo_preferences_widget_update_stored_trust (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                 gint response,
                                                                 QliteRow* device)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (device != NULL);
	switch (response) {
		case DINO_PLUGINS_OMEMO_TRUST_LEVEL_TRUSTED:
		{
			DinoPluginsOmemoPlugin* _tmp0_;
			DinoPluginsOmemoTrustManager* _tmp1_;
			DinoEntitiesAccount* _tmp2_;
			XmppJid* _tmp3_;
			DinoPluginsOmemoPlugin* _tmp4_;
			DinoPluginsOmemoDatabase* _tmp5_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp6_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp7_;
			QliteColumn* _tmp8_;
			gpointer _tmp9_;
			_tmp0_ = self->priv->plugin;
			_tmp1_ = _tmp0_->trust_manager;
			_tmp2_ = self->priv->account;
			_tmp3_ = self->priv->jid;
			_tmp4_ = self->priv->plugin;
			_tmp5_ = _tmp4_->db;
			_tmp6_ = dino_plugins_omemo_database_get_identity_meta (_tmp5_);
			_tmp7_ = _tmp6_;
			_tmp8_ = _tmp7_->device_id;
			_tmp9_ = qlite_row_get (device, G_TYPE_INT, NULL, NULL, _tmp8_);
			dino_plugins_omemo_trust_manager_set_device_trust (_tmp1_, _tmp2_, _tmp3_, (gint) ((gintptr) _tmp9_), DINO_PLUGINS_OMEMO_TRUST_LEVEL_TRUSTED);
			break;
		}
		case DINO_PLUGINS_OMEMO_TRUST_LEVEL_UNTRUSTED:
		{
			DinoPluginsOmemoPlugin* _tmp10_;
			DinoPluginsOmemoTrustManager* _tmp11_;
			DinoEntitiesAccount* _tmp12_;
			XmppJid* _tmp13_;
			DinoPluginsOmemoPlugin* _tmp14_;
			DinoPluginsOmemoDatabase* _tmp15_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp16_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp17_;
			QliteColumn* _tmp18_;
			gpointer _tmp19_;
			_tmp10_ = self->priv->plugin;
			_tmp11_ = _tmp10_->trust_manager;
			_tmp12_ = self->priv->account;
			_tmp13_ = self->priv->jid;
			_tmp14_ = self->priv->plugin;
			_tmp15_ = _tmp14_->db;
			_tmp16_ = dino_plugins_omemo_database_get_identity_meta (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = _tmp17_->device_id;
			_tmp19_ = qlite_row_get (device, G_TYPE_INT, NULL, NULL, _tmp18_);
			dino_plugins_omemo_trust_manager_set_device_trust (_tmp11_, _tmp12_, _tmp13_, (gint) ((gintptr) _tmp19_), DINO_PLUGINS_OMEMO_TRUST_LEVEL_UNTRUSTED);
			break;
		}
		case DINO_PLUGINS_OMEMO_TRUST_LEVEL_VERIFIED:
		{
			DinoPluginsOmemoPlugin* _tmp20_;
			DinoPluginsOmemoTrustManager* _tmp21_;
			DinoEntitiesAccount* _tmp22_;
			XmppJid* _tmp23_;
			DinoPluginsOmemoPlugin* _tmp24_;
			DinoPluginsOmemoDatabase* _tmp25_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp26_;
			DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp27_;
			QliteColumn* _tmp28_;
			gpointer _tmp29_;
			DinoPluginsOmemoPlugin* _tmp30_;
			DinoPluginsOmemoTrustManager* _tmp31_;
			DinoEntitiesAccount* _tmp32_;
			XmppJid* _tmp33_;
			GtkSwitch* _tmp34_;
			_tmp20_ = self->priv->plugin;
			_tmp21_ = _tmp20_->trust_manager;
			_tmp22_ = self->priv->account;
			_tmp23_ = self->priv->jid;
			_tmp24_ = self->priv->plugin;
			_tmp25_ = _tmp24_->db;
			_tmp26_ = dino_plugins_omemo_database_get_identity_meta (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp28_ = _tmp27_->device_id;
			_tmp29_ = qlite_row_get (device, G_TYPE_INT, NULL, NULL, _tmp28_);
			dino_plugins_omemo_trust_manager_set_device_trust (_tmp21_, _tmp22_, _tmp23_, (gint) ((gintptr) _tmp29_), DINO_PLUGINS_OMEMO_TRUST_LEVEL_VERIFIED);
			_tmp30_ = self->priv->plugin;
			_tmp31_ = _tmp30_->trust_manager;
			_tmp32_ = self->priv->account;
			_tmp33_ = self->priv->jid;
			dino_plugins_omemo_trust_manager_set_blind_trust (_tmp31_, _tmp32_, _tmp33_, FALSE);
			_tmp34_ = self->priv->automatically_accept_new_switch;
			gtk_switch_set_active (_tmp34_, FALSE);
			break;
		}
		default:
		break;
	}
}

static Block26Data*
block26_data_ref (Block26Data* _data26_)
{
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}

static void
block26_data_unref (void * _userdata_)
{
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		DinoPluginsOmemoOmemoPreferencesWidget* self;
		self = _data26_->self;
		_g_object_unref0 (_data26_->action_row);
		_qlite_row_unref0 (_data26_->device);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}

static void
__lambda34_ (Block26Data* _data26_)
{
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	DinoPluginsOmemoPlugin* _tmp0_;
	DinoPluginsOmemoTrustManager* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	XmppJid* _tmp3_;
	DinoPluginsOmemoPlugin* _tmp4_;
	DinoPluginsOmemoDatabase* _tmp5_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp6_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp7_;
	QliteColumn* _tmp8_;
	gpointer _tmp9_;
	self = _data26_->self;
	_tmp0_ = self->priv->plugin;
	_tmp1_ = _tmp0_->trust_manager;
	_tmp2_ = self->priv->account;
	_tmp3_ = self->priv->jid;
	_tmp4_ = self->priv->plugin;
	_tmp5_ = _tmp4_->db;
	_tmp6_ = dino_plugins_omemo_database_get_identity_meta (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->device_id;
	_tmp9_ = qlite_row_get (_data26_->device, G_TYPE_INT, NULL, NULL, _tmp8_);
	dino_plugins_omemo_trust_manager_set_device_trust (_tmp1_, _tmp2_, _tmp3_, (gint) ((gintptr) _tmp9_), DINO_PLUGINS_OMEMO_TRUST_LEVEL_TRUSTED);
	dino_plugins_omemo_omemo_preferences_widget_add_fingerprint (self, _data26_->device, DINO_PLUGINS_OMEMO_TRUST_LEVEL_TRUSTED);
	dino_plugins_omemo_omemo_preferences_widget_remove_key_row (self, (AdwPreferencesRow*) _data26_->action_row);
}

static void
___lambda34__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda34_ (self);
}

static void
__lambda35_ (Block26Data* _data26_)
{
	DinoPluginsOmemoOmemoPreferencesWidget* self;
	DinoPluginsOmemoPlugin* _tmp0_;
	DinoPluginsOmemoTrustManager* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	XmppJid* _tmp3_;
	DinoPluginsOmemoPlugin* _tmp4_;
	DinoPluginsOmemoDatabase* _tmp5_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp6_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp7_;
	QliteColumn* _tmp8_;
	gpointer _tmp9_;
	self = _data26_->self;
	_tmp0_ = self->priv->plugin;
	_tmp1_ = _tmp0_->trust_manager;
	_tmp2_ = self->priv->account;
	_tmp3_ = self->priv->jid;
	_tmp4_ = self->priv->plugin;
	_tmp5_ = _tmp4_->db;
	_tmp6_ = dino_plugins_omemo_database_get_identity_meta (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->device_id;
	_tmp9_ = qlite_row_get (_data26_->device, G_TYPE_INT, NULL, NULL, _tmp8_);
	dino_plugins_omemo_trust_manager_set_device_trust (_tmp1_, _tmp2_, _tmp3_, (gint) ((gintptr) _tmp9_), DINO_PLUGINS_OMEMO_TRUST_LEVEL_UNTRUSTED);
	dino_plugins_omemo_omemo_preferences_widget_add_fingerprint (self, _data26_->device, DINO_PLUGINS_OMEMO_TRUST_LEVEL_UNTRUSTED);
	dino_plugins_omemo_omemo_preferences_widget_remove_key_row (self, (AdwPreferencesRow*) _data26_->action_row);
}

static void
___lambda35__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda35_ (self);
}

static void
dino_plugins_omemo_omemo_preferences_widget_add_new_fingerprint (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                                 QliteRow* device)
{
	Block26Data* _data26_;
	QliteRow* _tmp0_;
	AdwActionRow* _tmp1_ = NULL;
	const gchar* _tmp2_;
	DinoPluginsOmemoPlugin* _tmp3_;
	DinoPluginsOmemoDatabase* _tmp4_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp5_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp6_;
	QliteColumn* _tmp7_;
	gpointer _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GtkButton* accept_button = NULL;
	GtkButton* _tmp14_ = NULL;
	const gchar* _tmp15_;
	GtkButton* reject_button = NULL;
	GtkButton* _tmp16_ = NULL;
	const gchar* _tmp17_;
	GtkBox* control_box = NULL;
	GtkBox* _tmp18_ = NULL;
	GeeSet* _tmp19_;
	DinoPluginsOmemoPlugin* _tmp20_;
	DinoPluginsOmemoDatabase* _tmp21_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp22_;
	DinoPluginsOmemoDatabaseIdentityMetaTable* _tmp23_;
	QliteColumn* _tmp24_;
	gpointer _tmp25_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (device != NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = g_object_ref (self);
	_tmp0_ = _qlite_row_ref0 (device);
	_qlite_row_unref0 (_data26_->device);
	_data26_->device = _tmp0_;
	_tmp1_ = (AdwActionRow*) adw_action_row_new ();
	adw_preferences_row_set_use_markup ((AdwPreferencesRow*) _tmp1_, TRUE);
	g_object_ref_sink (_tmp1_);
	_data26_->action_row = _tmp1_;
	_tmp2_ = dino_gettext ("New device");
	adw_preferences_row_set_title ((AdwPreferencesRow*) _data26_->action_row, _tmp2_);
	_tmp3_ = self->priv->plugin;
	_tmp4_ = _tmp3_->db;
	_tmp5_ = dino_plugins_omemo_database_get_identity_meta (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_->identity_key_public_base64;
	_tmp8_ = qlite_row_get (_data26_->device, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp7_);
	_tmp9_ = (gchar*) _tmp8_;
	_tmp10_ = dino_plugins_omemo_fingerprint_from_base64 (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = dino_plugins_omemo_fingerprint_markup (_tmp11_);
	_tmp13_ = _tmp12_;
	adw_action_row_set_subtitle (_data26_->action_row, _tmp13_);
	_g_free0 (_tmp13_);
	_g_free0 (_tmp11_);
	_g_free0 (_tmp9_);
	_tmp14_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_visible ((GtkWidget*) _tmp14_, TRUE);
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp14_, TRUE);
	g_object_ref_sink (_tmp14_);
	accept_button = _tmp14_;
	gtk_button_set_icon_name (accept_button, "check-plain-symbolic");
	gtk_widget_add_css_class ((GtkWidget*) accept_button, "suggested-action");
	_tmp15_ = dino_gettext ("Accept key");
	gtk_widget_set_tooltip_text ((GtkWidget*) accept_button, _tmp15_);
	_tmp16_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_visible ((GtkWidget*) _tmp16_, TRUE);
	gtk_widget_set_valign ((GtkWidget*) _tmp16_, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp16_, TRUE);
	g_object_ref_sink (_tmp16_);
	reject_button = _tmp16_;
	gtk_button_set_icon_name (reject_button, "action-unavailable-symbolic");
	gtk_widget_add_css_class ((GtkWidget*) reject_button, "destructive-action");
	_tmp17_ = dino_gettext ("Reject key");
	gtk_widget_set_tooltip_text ((GtkWidget*) reject_button, _tmp17_);
	g_signal_connect_data (accept_button, "clicked", (GCallback) ___lambda34__gtk_button_clicked, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	g_signal_connect_data (reject_button, "clicked", (GCallback) ___lambda35__gtk_button_clicked, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	_tmp18_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_visible ((GtkWidget*) _tmp18_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp18_, TRUE);
	g_object_ref_sink (_tmp18_);
	control_box = _tmp18_;
	gtk_box_append (control_box, (GtkWidget*) accept_button);
	gtk_box_append (control_box, (GtkWidget*) reject_button);
	gtk_widget_add_css_class ((GtkWidget*) control_box, "linked");
	adw_action_row_add_suffix (_data26_->action_row, (GtkWidget*) control_box);
	dino_plugins_omemo_omemo_preferences_widget_add_key_row (self, (AdwPreferencesRow*) _data26_->action_row);
	_tmp19_ = self->priv->displayed_ids;
	_tmp20_ = self->priv->plugin;
	_tmp21_ = _tmp20_->db;
	_tmp22_ = dino_plugins_omemo_database_get_identity_meta (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = _tmp23_->device_id;
	_tmp25_ = qlite_row_get (_data26_->device, G_TYPE_INT, NULL, NULL, _tmp24_);
	gee_collection_add ((GeeCollection*) _tmp19_, (gpointer) ((guintptr) _tmp25_));
	_g_object_unref0 (control_box);
	_g_object_unref0 (reject_button);
	_g_object_unref0 (accept_button);
	block26_data_unref (_data26_);
	_data26_ = NULL;
}

static void
dino_plugins_omemo_omemo_preferences_widget_add_key_row (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                         AdwPreferencesRow* widget)
{
	AdwPreferencesGroup* _tmp0_;
	GeeArrayList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->keys_preferences_group;
	adw_preferences_group_add (_tmp0_, (GtkWidget*) widget);
	_tmp1_ = self->priv->keys_preferences_group_children;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp1_, (GtkWidget*) widget);
}

static void
dino_plugins_omemo_omemo_preferences_widget_remove_key_row (DinoPluginsOmemoOmemoPreferencesWidget* self,
                                                            AdwPreferencesRow* widget)
{
	AdwPreferencesGroup* _tmp0_;
	GeeArrayList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->keys_preferences_group;
	adw_preferences_group_remove (_tmp0_, (GtkWidget*) widget);
	_tmp1_ = self->priv->keys_preferences_group_children;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp1_, (GtkWidget*) widget);
}

static GObject *
dino_plugins_omemo_omemo_preferences_widget_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DinoPluginsOmemoOmemoPreferencesWidget * self;
	AdwActionRow* _tmp0_;
	const gchar* _tmp1_;
	AdwActionRow* _tmp2_;
	const gchar* _tmp3_;
	AdwActionRow* _tmp4_;
	const gchar* _tmp5_;
	AdwActionRow* _tmp6_;
	const gchar* _tmp7_;
	GtkLabel* _tmp8_;
	const gchar* _tmp9_;
	parent_class = G_OBJECT_CLASS (dino_plugins_omemo_omemo_preferences_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_OMEMO_TYPE_OMEMO_PREFERENCES_WIDGET, DinoPluginsOmemoOmemoPreferencesWidget);
	_tmp0_ = self->priv->encrypt_by_default_row;
	_tmp1_ = dino_gettext ("OMEMO by default");
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp0_, _tmp1_);
	_tmp2_ = self->priv->encrypt_by_default_row;
	_tmp3_ = dino_gettext ("Enable OMEMO encryption for new conversations");
	adw_action_row_set_subtitle (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->automatically_accept_new_row;
	_tmp5_ = dino_gettext ("Encrypt to new devices");
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp4_, _tmp5_);
	_tmp6_ = self->priv->automatically_accept_new_row;
	_tmp7_ = dino_gettext ("Automatically encrypt to new devices from this contact.");
	adw_action_row_set_subtitle (_tmp6_, _tmp7_);
	_tmp8_ = self->priv->new_keys_label;
	_tmp9_ = dino_gettext ("New keys");
	gtk_label_set_label (_tmp8_, _tmp9_);
	return obj;
}

static void
dino_plugins_omemo_omemo_preferences_widget_class_init (DinoPluginsOmemoOmemoPreferencesWidgetClass * klass,
                                                        gpointer klass_data)
{
	dino_plugins_omemo_omemo_preferences_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsOmemoOmemoPreferencesWidget_private_offset);
	G_OBJECT_CLASS (klass)->constructor = dino_plugins_omemo_omemo_preferences_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_omemo_omemo_preferences_widget_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/im/dino/Dino/omemo/encryption_preferences_entry.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "automatically_accept_new_row", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, automatically_accept_new_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "automatically_accept_new_switch", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, automatically_accept_new_switch));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "encrypt_by_default_row", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, encrypt_by_default_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "encrypt_by_default_switch", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, encrypt_by_default_switch));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "new_keys_label", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, new_keys_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "keys_preferences_group", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, keys_preferences_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "new_keys_listbox", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, new_keys_listbox));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "qrcode_picture", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, qrcode_picture));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "qrcode_popover", FALSE, DinoPluginsOmemoOmemoPreferencesWidget_private_offset + G_STRUCT_OFFSET (DinoPluginsOmemoOmemoPreferencesWidgetPrivate, qrcode_popover));
}

static void
dino_plugins_omemo_omemo_preferences_widget_instance_init (DinoPluginsOmemoOmemoPreferencesWidget * self,
                                                           gpointer klass)
{
	GeeHashSet* _tmp0_;
	GeeArrayList* _tmp1_;
	self->priv = dino_plugins_omemo_omemo_preferences_widget_get_instance_private (self);
	self->priv->identity_id = 0;
	_tmp0_ = gee_hash_set_new (G_TYPE_UINT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->displayed_ids = (GeeSet*) _tmp0_;
	_tmp1_ = gee_array_list_new (gtk_widget_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->keys_preferences_group_children = _tmp1_;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
dino_plugins_omemo_omemo_preferences_widget_finalize (GObject * obj)
{
	DinoPluginsOmemoOmemoPreferencesWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_OMEMO_TYPE_OMEMO_PREFERENCES_WIDGET, DinoPluginsOmemoOmemoPreferencesWidget);
	_g_object_unref0 (self->priv->plugin);
	_g_object_unref0 (self->priv->account);
	_xmpp_jid_unref0 (self->priv->jid);
	_g_object_unref0 (self->priv->store);
	_g_object_unref0 (self->priv->displayed_ids);
	_g_object_unref0 (self->priv->keys_preferences_group_children);
	G_OBJECT_CLASS (dino_plugins_omemo_omemo_preferences_widget_parent_class)->finalize (obj);
}

static GType
dino_plugins_omemo_omemo_preferences_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsOmemoOmemoPreferencesWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_omemo_omemo_preferences_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsOmemoOmemoPreferencesWidget), 0, (GInstanceInitFunc) dino_plugins_omemo_omemo_preferences_widget_instance_init, NULL };
	GType dino_plugins_omemo_omemo_preferences_widget_type_id;
	dino_plugins_omemo_omemo_preferences_widget_type_id = g_type_register_static (adw_preferences_group_get_type (), "DinoPluginsOmemoOmemoPreferencesWidget", &g_define_type_info, 0);
	DinoPluginsOmemoOmemoPreferencesWidget_private_offset = g_type_add_instance_private (dino_plugins_omemo_omemo_preferences_widget_type_id, sizeof (DinoPluginsOmemoOmemoPreferencesWidgetPrivate));
	return dino_plugins_omemo_omemo_preferences_widget_type_id;
}

GType
dino_plugins_omemo_omemo_preferences_widget_get_type (void)
{
	static volatile gsize dino_plugins_omemo_omemo_preferences_widget_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_omemo_omemo_preferences_widget_type_id__once)) {
		GType dino_plugins_omemo_omemo_preferences_widget_type_id;
		dino_plugins_omemo_omemo_preferences_widget_type_id = dino_plugins_omemo_omemo_preferences_widget_get_type_once ();
		g_once_init_leave (&dino_plugins_omemo_omemo_preferences_widget_type_id__once, dino_plugins_omemo_omemo_preferences_widget_type_id);
	}
	return dino_plugins_omemo_omemo_preferences_widget_type_id__once;
}

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

