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

#include "omemo.h"
#include "libdino.h"
#include <glib-object.h>
#include <glib.h>
#include "xmpp-vala.h"
#include <gtk/gtk.h>
#include "dino_i18n.h"
#include <stdlib.h>
#include <string.h>
#include <gio/gio.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

#define DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION (dino_plugins_omemo_conversation_notification_get_type ())
#define DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION, DinoPluginsOmemoConversationNotification))
#define DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION, DinoPluginsOmemoConversationNotificationClass))
#define DINO_PLUGINS_OMEMO_IS_CONVERSATION_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION))
#define DINO_PLUGINS_OMEMO_IS_CONVERSATION_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION))
#define DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION, DinoPluginsOmemoConversationNotificationClass))

typedef struct _DinoPluginsOmemoConversationNotification DinoPluginsOmemoConversationNotification;
typedef struct _DinoPluginsOmemoConversationNotificationClass DinoPluginsOmemoConversationNotificationClass;
enum  {
	DINO_PLUGINS_OMEMO_DEVICE_NOTIFICATION_POPULATOR_0_PROPERTY,
	DINO_PLUGINS_OMEMO_DEVICE_NOTIFICATION_POPULATOR_ID_PROPERTY,
	DINO_PLUGINS_OMEMO_DEVICE_NOTIFICATION_POPULATOR_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_omemo_device_notification_populator_properties[DINO_PLUGINS_OMEMO_DEVICE_NOTIFICATION_POPULATOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _DinoPluginsOmemoConversationNotificationPrivate DinoPluginsOmemoConversationNotificationPrivate;
enum  {
	DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_0_PROPERTY,
	DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_omemo_conversation_notification_properties[DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_NUM_PROPERTIES];
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
typedef struct _Block22Data Block22Data;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
enum  {
	DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_SHOULD_HIDE_SIGNAL,
	DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_NUM_SIGNALS
};
static guint dino_plugins_omemo_conversation_notification_signals[DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_NUM_SIGNALS] = {0};

struct _DinoPluginsOmemoDeviceNotificationPopulatorPrivate {
	DinoStreamInteractor* stream_interactor;
	DinoPluginsOmemoPlugin* plugin;
	DinoEntitiesConversation* current_conversation;
	DinoPluginsNotificationCollection* notification_collection;
	DinoPluginsOmemoConversationNotification* notification;
};

struct _DinoPluginsOmemoConversationNotification {
	DinoPluginsMetaConversationNotification parent_instance;
	DinoPluginsOmemoConversationNotificationPrivate * priv;
};

struct _DinoPluginsOmemoConversationNotificationClass {
	DinoPluginsMetaConversationNotificationClass parent_class;
};

struct _DinoPluginsOmemoConversationNotificationPrivate {
	GtkWidget* widget;
	DinoPluginsOmemoPlugin* plugin;
	XmppJid* jid;
	DinoEntitiesAccount* account;
};

struct _Block22Data {
	int _ref_count_;
	DinoPluginsOmemoConversationNotification* self;
	GtkButton* manage_button;
	DinoEntitiesConversation* conversation;
};

static gint DinoPluginsOmemoDeviceNotificationPopulator_private_offset;
static gpointer dino_plugins_omemo_device_notification_populator_parent_class = NULL;
static DinoPluginsNotificationPopulatorIface * dino_plugins_omemo_device_notification_populator_dino_plugins_notification_populator_parent_iface = NULL;
static gint DinoPluginsOmemoConversationNotification_private_offset;
static gpointer dino_plugins_omemo_conversation_notification_parent_class = NULL;

VALA_EXTERN GType dino_plugins_omemo_conversation_notification_get_type (void) G_GNUC_CONST ;
static void dino_plugins_omemo_device_notification_populator_on_account_added (DinoPluginsOmemoDeviceNotificationPopulator* self,
                                                                        DinoEntitiesAccount* account);
static void _dino_plugins_omemo_device_notification_populator_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                                                              DinoEntitiesAccount* account,
                                                                                                              gpointer self);
static void dino_plugins_omemo_device_notification_populator_real_init (DinoPluginsNotificationPopulator* base,
                                                                 DinoEntitiesConversation* conversation,
                                                                 DinoPluginsNotificationCollection* notification_collection,
                                                                 DinoPluginsWidgetType type);
static void dino_plugins_omemo_device_notification_populator_display_notification (DinoPluginsOmemoDeviceNotificationPopulator* self);
static void dino_plugins_omemo_device_notification_populator_real_close (DinoPluginsNotificationPopulator* base,
                                                                  DinoEntitiesConversation* conversation);
VALA_EXTERN DinoPluginsOmemoConversationNotification* dino_plugins_omemo_conversation_notification_new (DinoPluginsOmemoPlugin* plugin,
                                                                                            DinoEntitiesConversation* conversation);
VALA_EXTERN DinoPluginsOmemoConversationNotification* dino_plugins_omemo_conversation_notification_construct (GType object_type,
                                                                                                  DinoPluginsOmemoPlugin* plugin,
                                                                                                  DinoEntitiesConversation* conversation);
static void _dino_plugins_omemo_device_notification_populator_should_hide_dino_plugins_omemo_conversation_notification_should_hide (DinoPluginsOmemoConversationNotification* _sender,
                                                                                                                             gpointer self);
static void __lambda38_ (DinoPluginsOmemoDeviceNotificationPopulator* self,
                  XmppJid* jid,
                  gint device_id,
                  DinoPluginsOmemoBundle* bundle);
static void ___lambda38__dino_plugins_omemo_stream_module_bundle_fetched (DinoPluginsOmemoStreamModule* _sender,
                                                                   XmppJid* jid,
                                                                   gint device_id,
                                                                   DinoPluginsOmemoBundle* bundle,
                                                                   gpointer self);
static void dino_plugins_omemo_device_notification_populator_finalize (GObject * obj);
static GType dino_plugins_omemo_device_notification_populator_get_type_once (void);
static void _vala_dino_plugins_omemo_device_notification_populator_get_property (GObject * object,
                                                                          guint property_id,
                                                                          GValue * value,
                                                                          GParamSpec * pspec);
static Block22Data* block22_data_ref (Block22Data* _data22_);
static void block22_data_unref (void * _userdata_);
static void __lambda37_ (Block22Data* _data22_);
static void ___lambda37__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static GObject* dino_plugins_omemo_conversation_notification_real_get_widget (DinoPluginsMetaConversationNotification* base,
                                                                       DinoPluginsWidgetType type);
static void dino_plugins_omemo_conversation_notification_finalize (GObject * obj);
static GType dino_plugins_omemo_conversation_notification_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_plugins_omemo_device_notification_populator_get_instance_private (DinoPluginsOmemoDeviceNotificationPopulator* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsOmemoDeviceNotificationPopulator_private_offset);
}

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

static void
_dino_plugins_omemo_device_notification_populator_on_account_added_dino_stream_interactor_account_added (DinoStreamInteractor* _sender,
                                                                                                         DinoEntitiesAccount* account,
                                                                                                         gpointer self)
{
	dino_plugins_omemo_device_notification_populator_on_account_added ((DinoPluginsOmemoDeviceNotificationPopulator*) self, account);
}

DinoPluginsOmemoDeviceNotificationPopulator*
dino_plugins_omemo_device_notification_populator_construct (GType object_type,
                                                            DinoPluginsOmemoPlugin* plugin,
                                                            DinoStreamInteractor* stream_interactor)
{
	DinoPluginsOmemoDeviceNotificationPopulator * self = NULL;
	DinoStreamInteractor* _tmp0_;
	DinoPluginsOmemoPlugin* _tmp1_;
	g_return_val_if_fail (plugin != NULL, NULL);
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	self = (DinoPluginsOmemoDeviceNotificationPopulator*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp0_;
	_tmp1_ = _g_object_ref0 (plugin);
	_g_object_unref0 (self->priv->plugin);
	self->priv->plugin = _tmp1_;
	g_signal_connect_object (stream_interactor, "account-added", (GCallback) _dino_plugins_omemo_device_notification_populator_on_account_added_dino_stream_interactor_account_added, self, 0);
	return self;
}

DinoPluginsOmemoDeviceNotificationPopulator*
dino_plugins_omemo_device_notification_populator_new (DinoPluginsOmemoPlugin* plugin,
                                                      DinoStreamInteractor* stream_interactor)
{
	return dino_plugins_omemo_device_notification_populator_construct (DINO_PLUGINS_OMEMO_TYPE_DEVICE_NOTIFICATION_POPULATOR, plugin, stream_interactor);
}

static void
dino_plugins_omemo_device_notification_populator_real_init (DinoPluginsNotificationPopulator* base,
                                                            DinoEntitiesConversation* conversation,
                                                            DinoPluginsNotificationCollection* notification_collection,
                                                            DinoPluginsWidgetType type)
{
	DinoPluginsOmemoDeviceNotificationPopulator * self;
	DinoEntitiesConversation* _tmp0_;
	DinoPluginsNotificationCollection* _tmp1_;
	gboolean _tmp2_ = FALSE;
	DinoPluginsOmemoPlugin* _tmp3_;
	DinoEntitiesAccount* _tmp4_;
	DinoEntitiesAccount* _tmp5_;
	XmppJid* _tmp6_;
	XmppJid* _tmp7_;
	self = (DinoPluginsOmemoDeviceNotificationPopulator*) base;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (notification_collection != NULL);
	_tmp0_ = _g_object_ref0 (conversation);
	_g_object_unref0 (self->priv->current_conversation);
	self->priv->current_conversation = _tmp0_;
	_tmp1_ = _g_object_ref0 (notification_collection);
	_g_object_unref0 (self->priv->notification_collection);
	self->priv->notification_collection = _tmp1_;
	_tmp3_ = self->priv->plugin;
	_tmp4_ = dino_entities_conversation_get_account (conversation);
	_tmp5_ = _tmp4_;
	_tmp6_ = dino_entities_conversation_get_counterpart (conversation);
	_tmp7_ = _tmp6_;
	if (dino_plugins_omemo_plugin_has_new_devices (_tmp3_, _tmp5_, _tmp7_)) {
		DinoEntitiesConversationType _tmp8_;
		DinoEntitiesConversationType _tmp9_;
		_tmp8_ = dino_entities_conversation_get_type_ (conversation);
		_tmp9_ = _tmp8_;
		_tmp2_ = _tmp9_ == DINO_ENTITIES_CONVERSATION_TYPE_CHAT;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		dino_plugins_omemo_device_notification_populator_display_notification (self);
	}
}

static void
dino_plugins_omemo_device_notification_populator_real_close (DinoPluginsNotificationPopulator* base,
                                                             DinoEntitiesConversation* conversation)
{
	DinoPluginsOmemoDeviceNotificationPopulator * self;
	self = (DinoPluginsOmemoDeviceNotificationPopulator*) base;
	g_return_if_fail (conversation != NULL);
	_g_object_unref0 (self->priv->notification);
	self->priv->notification = NULL;
}

static void
_dino_plugins_omemo_device_notification_populator_should_hide_dino_plugins_omemo_conversation_notification_should_hide (DinoPluginsOmemoConversationNotification* _sender,
                                                                                                                        gpointer self)
{
	dino_plugins_omemo_device_notification_populator_should_hide ((DinoPluginsOmemoDeviceNotificationPopulator*) self);
}

static void
dino_plugins_omemo_device_notification_populator_display_notification (DinoPluginsOmemoDeviceNotificationPopulator* self)
{
	DinoPluginsOmemoConversationNotification* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->notification;
	if (_tmp0_ == NULL) {
		DinoPluginsOmemoPlugin* _tmp1_;
		DinoEntitiesConversation* _tmp2_;
		DinoPluginsOmemoConversationNotification* _tmp3_;
		DinoPluginsOmemoConversationNotification* _tmp4_;
		DinoPluginsNotificationCollection* _tmp5_;
		DinoPluginsOmemoConversationNotification* _tmp6_;
		_tmp1_ = self->priv->plugin;
		_tmp2_ = self->priv->current_conversation;
		_tmp3_ = dino_plugins_omemo_conversation_notification_new (_tmp1_, _tmp2_);
		_g_object_unref0 (self->priv->notification);
		self->priv->notification = _tmp3_;
		_tmp4_ = self->priv->notification;
		g_signal_connect_object (_tmp4_, "should-hide", (GCallback) _dino_plugins_omemo_device_notification_populator_should_hide_dino_plugins_omemo_conversation_notification_should_hide, self, 0);
		_tmp5_ = self->priv->notification_collection;
		_tmp6_ = self->priv->notification;
		g_signal_emit_by_name (_tmp5_, "add-meta-notification", (DinoPluginsMetaConversationNotification*) _tmp6_);
	}
}

void
dino_plugins_omemo_device_notification_populator_should_hide (DinoPluginsOmemoDeviceNotificationPopulator* self)
{
	gboolean _tmp0_ = FALSE;
	DinoPluginsOmemoPlugin* _tmp1_;
	DinoEntitiesConversation* _tmp2_;
	DinoEntitiesAccount* _tmp3_;
	DinoEntitiesAccount* _tmp4_;
	DinoEntitiesConversation* _tmp5_;
	XmppJid* _tmp6_;
	XmppJid* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->plugin;
	_tmp2_ = self->priv->current_conversation;
	_tmp3_ = dino_entities_conversation_get_account (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->current_conversation;
	_tmp6_ = dino_entities_conversation_get_counterpart (_tmp5_);
	_tmp7_ = _tmp6_;
	if (!dino_plugins_omemo_plugin_has_new_devices (_tmp1_, _tmp4_, _tmp7_)) {
		DinoPluginsOmemoConversationNotification* _tmp8_;
		_tmp8_ = self->priv->notification;
		_tmp0_ = _tmp8_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		DinoPluginsNotificationCollection* _tmp9_;
		DinoPluginsOmemoConversationNotification* _tmp10_;
		_tmp9_ = self->priv->notification_collection;
		_tmp10_ = self->priv->notification;
		g_signal_emit_by_name (_tmp9_, "remove-meta-notification", (DinoPluginsMetaConversationNotification*) _tmp10_);
		_g_object_unref0 (self->priv->notification);
		self->priv->notification = NULL;
	}
}

static void
__lambda38_ (DinoPluginsOmemoDeviceNotificationPopulator* self,
             XmppJid* jid,
             gint device_id,
             DinoPluginsOmemoBundle* bundle)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	DinoEntitiesConversation* _tmp2_;
	g_return_if_fail (jid != NULL);
	g_return_if_fail (bundle != NULL);
	_tmp2_ = self->priv->current_conversation;
	if (_tmp2_ != NULL) {
		DinoEntitiesConversation* _tmp3_;
		XmppJid* _tmp4_;
		XmppJid* _tmp5_;
		_tmp3_ = self->priv->current_conversation;
		_tmp4_ = dino_entities_conversation_get_counterpart (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp1_ = xmpp_jid_equals (jid, _tmp5_);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		DinoPluginsOmemoPlugin* _tmp6_;
		DinoEntitiesConversation* _tmp7_;
		DinoEntitiesAccount* _tmp8_;
		DinoEntitiesAccount* _tmp9_;
		DinoEntitiesConversation* _tmp10_;
		XmppJid* _tmp11_;
		XmppJid* _tmp12_;
		_tmp6_ = self->priv->plugin;
		_tmp7_ = self->priv->current_conversation;
		_tmp8_ = dino_entities_conversation_get_account (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = self->priv->current_conversation;
		_tmp11_ = dino_entities_conversation_get_counterpart (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp0_ = dino_plugins_omemo_plugin_has_new_devices (_tmp6_, _tmp9_, _tmp12_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		dino_plugins_omemo_device_notification_populator_display_notification (self);
	}
}

static void
___lambda38__dino_plugins_omemo_stream_module_bundle_fetched (DinoPluginsOmemoStreamModule* _sender,
                                                              XmppJid* jid,
                                                              gint device_id,
                                                              DinoPluginsOmemoBundle* bundle,
                                                              gpointer self)
{
	__lambda38_ ((DinoPluginsOmemoDeviceNotificationPopulator*) self, jid, device_id, bundle);
}

static void
dino_plugins_omemo_device_notification_populator_on_account_added (DinoPluginsOmemoDeviceNotificationPopulator* self,
                                                                   DinoEntitiesAccount* account)
{
	DinoStreamInteractor* _tmp0_;
	DinoModuleManager* _tmp1_;
	XmppModuleIdentity* _tmp2_;
	gpointer _tmp3_;
	DinoPluginsOmemoStreamModule* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	_tmp0_ = self->priv->stream_interactor;
	_tmp1_ = _tmp0_->module_manager;
	_tmp2_ = dino_plugins_omemo_stream_module_IDENTITY;
	_tmp3_ = dino_module_manager_get_module (_tmp1_, DINO_PLUGINS_OMEMO_TYPE_STREAM_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, account, _tmp2_);
	_tmp4_ = (DinoPluginsOmemoStreamModule*) _tmp3_;
	g_signal_connect_object (_tmp4_, "bundle-fetched", (GCallback) ___lambda38__dino_plugins_omemo_stream_module_bundle_fetched, self, G_CONNECT_AFTER);
	_g_object_unref0 (_tmp4_);
}

static const gchar*
dino_plugins_omemo_device_notification_populator_real_get_id (DinoPluginsNotificationPopulator* base)
{
	const gchar* result;
	DinoPluginsOmemoDeviceNotificationPopulator* self;
	self = (DinoPluginsOmemoDeviceNotificationPopulator*) base;
	result = "device_notification";
	return result;
}

static void
dino_plugins_omemo_device_notification_populator_class_init (DinoPluginsOmemoDeviceNotificationPopulatorClass * klass,
                                                             gpointer klass_data)
{
	dino_plugins_omemo_device_notification_populator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsOmemoDeviceNotificationPopulator_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_plugins_omemo_device_notification_populator_get_property;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_omemo_device_notification_populator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_OMEMO_DEVICE_NOTIFICATION_POPULATOR_ID_PROPERTY, dino_plugins_omemo_device_notification_populator_properties[DINO_PLUGINS_OMEMO_DEVICE_NOTIFICATION_POPULATOR_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dino_plugins_omemo_device_notification_populator_dino_plugins_notification_populator_interface_init (DinoPluginsNotificationPopulatorIface * iface,
                                                                                                     gpointer iface_data)
{
	dino_plugins_omemo_device_notification_populator_dino_plugins_notification_populator_parent_iface = g_type_interface_peek_parent (iface);
	iface->init = (void (*) (DinoPluginsNotificationPopulator*, DinoEntitiesConversation*, DinoPluginsNotificationCollection*, DinoPluginsWidgetType)) dino_plugins_omemo_device_notification_populator_real_init;
	iface->close = (void (*) (DinoPluginsNotificationPopulator*, DinoEntitiesConversation*)) dino_plugins_omemo_device_notification_populator_real_close;
	iface->get_id = dino_plugins_omemo_device_notification_populator_real_get_id;
}

static void
dino_plugins_omemo_device_notification_populator_instance_init (DinoPluginsOmemoDeviceNotificationPopulator * self,
                                                                gpointer klass)
{
	self->priv = dino_plugins_omemo_device_notification_populator_get_instance_private (self);
}

static void
dino_plugins_omemo_device_notification_populator_finalize (GObject * obj)
{
	DinoPluginsOmemoDeviceNotificationPopulator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_OMEMO_TYPE_DEVICE_NOTIFICATION_POPULATOR, DinoPluginsOmemoDeviceNotificationPopulator);
	_g_object_unref0 (self->priv->stream_interactor);
	_g_object_unref0 (self->priv->plugin);
	_g_object_unref0 (self->priv->current_conversation);
	_g_object_unref0 (self->priv->notification_collection);
	_g_object_unref0 (self->priv->notification);
	G_OBJECT_CLASS (dino_plugins_omemo_device_notification_populator_parent_class)->finalize (obj);
}

static GType
dino_plugins_omemo_device_notification_populator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsOmemoDeviceNotificationPopulatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_omemo_device_notification_populator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsOmemoDeviceNotificationPopulator), 0, (GInstanceInitFunc) dino_plugins_omemo_device_notification_populator_instance_init, NULL };
	static const GInterfaceInfo dino_plugins_notification_populator_info = { (GInterfaceInitFunc) dino_plugins_omemo_device_notification_populator_dino_plugins_notification_populator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_plugins_omemo_device_notification_populator_type_id;
	dino_plugins_omemo_device_notification_populator_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoPluginsOmemoDeviceNotificationPopulator", &g_define_type_info, 0);
	g_type_add_interface_static (dino_plugins_omemo_device_notification_populator_type_id, DINO_PLUGINS_TYPE_NOTIFICATION_POPULATOR, &dino_plugins_notification_populator_info);
	DinoPluginsOmemoDeviceNotificationPopulator_private_offset = g_type_add_instance_private (dino_plugins_omemo_device_notification_populator_type_id, sizeof (DinoPluginsOmemoDeviceNotificationPopulatorPrivate));
	return dino_plugins_omemo_device_notification_populator_type_id;
}

GType
dino_plugins_omemo_device_notification_populator_get_type (void)
{
	static volatile gsize dino_plugins_omemo_device_notification_populator_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_omemo_device_notification_populator_type_id__once)) {
		GType dino_plugins_omemo_device_notification_populator_type_id;
		dino_plugins_omemo_device_notification_populator_type_id = dino_plugins_omemo_device_notification_populator_get_type_once ();
		g_once_init_leave (&dino_plugins_omemo_device_notification_populator_type_id__once, dino_plugins_omemo_device_notification_populator_type_id);
	}
	return dino_plugins_omemo_device_notification_populator_type_id__once;
}

static void
_vala_dino_plugins_omemo_device_notification_populator_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec)
{
	DinoPluginsOmemoDeviceNotificationPopulator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_PLUGINS_OMEMO_TYPE_DEVICE_NOTIFICATION_POPULATOR, DinoPluginsOmemoDeviceNotificationPopulator);
	switch (property_id) {
		case DINO_PLUGINS_OMEMO_DEVICE_NOTIFICATION_POPULATOR_ID_PROPERTY:
		g_value_set_string (value, dino_plugins_notification_populator_get_id ((DinoPluginsNotificationPopulator*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
dino_plugins_omemo_conversation_notification_get_instance_private (DinoPluginsOmemoConversationNotification* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsOmemoConversationNotification_private_offset);
}

static Block22Data*
block22_data_ref (Block22Data* _data22_)
{
	g_atomic_int_inc (&_data22_->_ref_count_);
	return _data22_;
}

static void
block22_data_unref (void * _userdata_)
{
	Block22Data* _data22_;
	_data22_ = (Block22Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data22_->_ref_count_)) {
		DinoPluginsOmemoConversationNotification* self;
		self = _data22_->self;
		_g_object_unref0 (_data22_->manage_button);
		_g_object_unref0 (_data22_->conversation);
		_g_object_unref0 (self);
		g_slice_free (Block22Data, _data22_);
	}
}

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

static void
__lambda37_ (Block22Data* _data22_)
{
	DinoPluginsOmemoConversationNotification* self;
	GVariant* variant = NULL;
	gint _tmp0_;
	gint _tmp1_;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	GVariant** _tmp4_;
	GVariant** _tmp5_;
	gint _tmp5__length1;
	GVariant* _tmp6_;
	GVariant* _tmp7_;
	GApplication* _tmp8_;
	self = _data22_->self;
	g_signal_emit_by_name (_data22_->manage_button, "activate");
	_tmp0_ = dino_entities_conversation_get_id (_data22_->conversation);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_new_int32 ((gint32) _tmp1_);
	g_variant_ref_sink (_tmp2_);
	_tmp3_ = g_variant_new_string ("encryption");
	g_variant_ref_sink (_tmp3_);
	_tmp4_ = g_new0 (GVariant*, 2 + 1);
	_tmp4_[0] = _tmp2_;
	_tmp4_[1] = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp5__length1 = 2;
	_tmp6_ = g_variant_new_tuple (_tmp5_, 2);
	g_variant_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_variant_unref), NULL);
	variant = _tmp7_;
	_tmp8_ = g_application_get_default ();
	g_action_group_activate_action ((GActionGroup*) _tmp8_, "open-conversation-details", variant);
	_g_variant_unref0 (variant);
}

static void
___lambda37__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda37_ (self);
}

DinoPluginsOmemoConversationNotification*
dino_plugins_omemo_conversation_notification_construct (GType object_type,
                                                        DinoPluginsOmemoPlugin* plugin,
                                                        DinoEntitiesConversation* conversation)
{
	DinoPluginsOmemoConversationNotification * self = NULL;
	Block22Data* _data22_;
	DinoEntitiesConversation* _tmp0_;
	DinoPluginsOmemoPlugin* _tmp1_;
	XmppJid* _tmp2_;
	XmppJid* _tmp3_;
	DinoEntitiesAccount* _tmp4_;
	DinoEntitiesAccount* _tmp5_;
	GtkBox* box = NULL;
	GtkBox* _tmp6_;
	const gchar* _tmp7_;
	GtkButton* _tmp8_;
	const gchar* _tmp9_;
	GtkLabel* _tmp10_ = NULL;
	GtkLabel* _tmp11_;
	GtkWidget* _tmp12_;
	g_return_val_if_fail (plugin != NULL, NULL);
	g_return_val_if_fail (conversation != NULL, NULL);
	_data22_ = g_slice_new0 (Block22Data);
	_data22_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (conversation);
	_g_object_unref0 (_data22_->conversation);
	_data22_->conversation = _tmp0_;
	self = (DinoPluginsOmemoConversationNotification*) dino_plugins_meta_conversation_notification_construct (object_type);
	_data22_->self = g_object_ref (self);
	_tmp1_ = _g_object_ref0 (plugin);
	_g_object_unref0 (self->priv->plugin);
	self->priv->plugin = _tmp1_;
	_tmp2_ = self->priv->jid;
	_tmp3_ = _xmpp_jid_ref0 (_tmp2_);
	_xmpp_jid_unref0 (self->priv->jid);
	self->priv->jid = _tmp3_;
	_tmp4_ = self->priv->account;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->priv->account);
	self->priv->account = _tmp5_;
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
	g_object_ref_sink (_tmp6_);
	box = _tmp6_;
	_tmp7_ = dino_gettext ("Manage");
	_tmp8_ = (GtkButton*) gtk_button_new_with_label (_tmp7_);
	g_object_ref_sink (_tmp8_);
	_data22_->manage_button = _tmp8_;
	g_signal_connect_data (_data22_->manage_button, "clicked", (GCallback) ___lambda37__gtk_button_clicked, block22_data_ref (_data22_), (GClosureNotify) block22_data_unref, 0);
	_tmp9_ = dino_gettext ("This contact has new devices");
	_tmp10_ = (GtkLabel*) gtk_label_new (_tmp9_);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp10_, 10);
	g_object_ref_sink (_tmp10_);
	_tmp11_ = _tmp10_;
	gtk_box_append (box, (GtkWidget*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	gtk_box_append (box, (GtkWidget*) _data22_->manage_button);
	_tmp12_ = _g_object_ref0 ((GtkWidget*) box);
	_g_object_unref0 (self->priv->widget);
	self->priv->widget = _tmp12_;
	_g_object_unref0 (box);
	block22_data_unref (_data22_);
	_data22_ = NULL;
	return self;
}

DinoPluginsOmemoConversationNotification*
dino_plugins_omemo_conversation_notification_new (DinoPluginsOmemoPlugin* plugin,
                                                  DinoEntitiesConversation* conversation)
{
	return dino_plugins_omemo_conversation_notification_construct (DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION, plugin, conversation);
}

static GObject*
dino_plugins_omemo_conversation_notification_real_get_widget (DinoPluginsMetaConversationNotification* base,
                                                              DinoPluginsWidgetType type)
{
	DinoPluginsOmemoConversationNotification * self;
	GtkWidget* _tmp0_;
	GObject* _tmp1_;
	GObject* result;
	self = (DinoPluginsOmemoConversationNotification*) base;
	_tmp0_ = self->priv->widget;
	_tmp1_ = _g_object_ref0 ((GObject*) _tmp0_);
	result = _tmp1_;
	return result;
}

static void
dino_plugins_omemo_conversation_notification_class_init (DinoPluginsOmemoConversationNotificationClass * klass,
                                                         gpointer klass_data)
{
	dino_plugins_omemo_conversation_notification_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsOmemoConversationNotification_private_offset);
	((DinoPluginsMetaConversationNotificationClass *) klass)->get_widget = (GObject* (*) (DinoPluginsMetaConversationNotification*, DinoPluginsWidgetType)) dino_plugins_omemo_conversation_notification_real_get_widget;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_omemo_conversation_notification_finalize;
	dino_plugins_omemo_conversation_notification_signals[DINO_PLUGINS_OMEMO_CONVERSATION_NOTIFICATION_SHOULD_HIDE_SIGNAL] = g_signal_new ("should-hide", DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dino_plugins_omemo_conversation_notification_instance_init (DinoPluginsOmemoConversationNotification * self,
                                                            gpointer klass)
{
	self->priv = dino_plugins_omemo_conversation_notification_get_instance_private (self);
}

static void
dino_plugins_omemo_conversation_notification_finalize (GObject * obj)
{
	DinoPluginsOmemoConversationNotification * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_OMEMO_TYPE_CONVERSATION_NOTIFICATION, DinoPluginsOmemoConversationNotification);
	_g_object_unref0 (self->priv->widget);
	_g_object_unref0 (self->priv->plugin);
	_xmpp_jid_unref0 (self->priv->jid);
	_g_object_unref0 (self->priv->account);
	G_OBJECT_CLASS (dino_plugins_omemo_conversation_notification_parent_class)->finalize (obj);
}

static GType
dino_plugins_omemo_conversation_notification_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsOmemoConversationNotificationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_omemo_conversation_notification_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsOmemoConversationNotification), 0, (GInstanceInitFunc) dino_plugins_omemo_conversation_notification_instance_init, NULL };
	GType dino_plugins_omemo_conversation_notification_type_id;
	dino_plugins_omemo_conversation_notification_type_id = g_type_register_static (DINO_PLUGINS_TYPE_META_CONVERSATION_NOTIFICATION, "DinoPluginsOmemoConversationNotification", &g_define_type_info, 0);
	DinoPluginsOmemoConversationNotification_private_offset = g_type_add_instance_private (dino_plugins_omemo_conversation_notification_type_id, sizeof (DinoPluginsOmemoConversationNotificationPrivate));
	return dino_plugins_omemo_conversation_notification_type_id;
}

GType
dino_plugins_omemo_conversation_notification_get_type (void)
{
	static volatile gsize dino_plugins_omemo_conversation_notification_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_omemo_conversation_notification_type_id__once)) {
		GType dino_plugins_omemo_conversation_notification_type_id;
		dino_plugins_omemo_conversation_notification_type_id = dino_plugins_omemo_conversation_notification_get_type_once ();
		g_once_init_leave (&dino_plugins_omemo_conversation_notification_type_id__once, dino_plugins_omemo_conversation_notification_type_id);
	}
	return dino_plugins_omemo_conversation_notification_type_id__once;
}

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

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

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

