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

#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "xmpp-vala.h"
#include <pango/pango.h>

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

#define DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER (dino_ui_call_encryption_button_controller_get_type ())
#define DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER, DinoUiCallEncryptionButtonController))
#define DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER, DinoUiCallEncryptionButtonControllerClass))
#define DINO_UI_IS_CALL_ENCRYPTION_BUTTON_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER))
#define DINO_UI_IS_CALL_ENCRYPTION_BUTTON_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER))
#define DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER, DinoUiCallEncryptionButtonControllerClass))

typedef struct _DinoUiCallEncryptionButtonController DinoUiCallEncryptionButtonController;
typedef struct _DinoUiCallEncryptionButtonControllerClass DinoUiCallEncryptionButtonControllerClass;
typedef struct _DinoUiCallEncryptionButtonControllerPrivate DinoUiCallEncryptionButtonControllerPrivate;
enum  {
	DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_0_PROPERTY,
	DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_CONTROLS_ACTIVE_PROPERTY,
	DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_NUM_PROPERTIES
};
static GParamSpec* dino_ui_call_encryption_button_controller_properties[DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

struct _DinoUiCallEncryptionButtonController {
	GObject parent_instance;
	DinoUiCallEncryptionButtonControllerPrivate * priv;
	GtkMenuButton* button;
};

struct _DinoUiCallEncryptionButtonControllerClass {
	GObjectClass parent_class;
};

struct _DinoUiCallEncryptionButtonControllerPrivate {
	gboolean has_been_set;
	gboolean _controls_active;
};

static gint DinoUiCallEncryptionButtonController_private_offset;
static gpointer dino_ui_call_encryption_button_controller_parent_class = NULL;

VALA_EXTERN GType dino_ui_call_encryption_button_controller_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiCallEncryptionButtonController, g_object_unref)
VALA_EXTERN DinoUiCallEncryptionButtonController* dino_ui_call_encryption_button_controller_new (GtkMenuButton* button);
VALA_EXTERN DinoUiCallEncryptionButtonController* dino_ui_call_encryption_button_controller_construct (GType object_type,
                                                                                           GtkMenuButton* button);
VALA_EXTERN void dino_ui_call_encryption_button_controller_update_opacity (DinoUiCallEncryptionButtonController* self);
static void _dino_ui_call_encryption_button_controller_update_opacity_g_object_notify (GObject* _sender,
                                                                                GParamSpec* pspec,
                                                                                gpointer self);
VALA_EXTERN void dino_ui_call_encryption_button_controller_set_icon (DinoUiCallEncryptionButtonController* self,
                                                         gboolean encrypted,
                                                         const gchar* icon_name);
static gboolean dino_ui_call_encryption_button_controller_bytes_equal (guint8* a1,
                                                                gint a1_length1,
                                                                guint8* a2,
                                                                gint a2_length1);
static gboolean dino_ui_call_encryption_button_controller_encryption_equals (XmppXepJingleContentEncryption* audio_encryption,
                                                                      XmppXepJingleContentEncryption* video_encryption);
VALA_EXTERN void dino_ui_call_encryption_button_controller_set_info (DinoUiCallEncryptionButtonController* self,
                                                         const gchar* title,
                                                         gboolean show_keys,
                                                         gboolean has_audio,
                                                         XmppXepJingleContentEncryption* audio_encryption,
                                                         gboolean has_video,
                                                         XmppXepJingleContentEncryption* video_encryption);
static GtkWidget* dino_ui_call_encryption_button_controller_create_media_encryption_grid (DinoUiCallEncryptionButtonController* self,
                                                                                   XmppXepJingleContentEncryption* encryption);
VALA_EXTERN gboolean dino_ui_call_encryption_button_controller_get_controls_active (DinoUiCallEncryptionButtonController* self);
static gchar* dino_ui_call_encryption_button_controller_format_fingerprint (DinoUiCallEncryptionButtonController* self,
                                                                     guint8* fingerprint,
                                                                     gint fingerprint_length1);
VALA_EXTERN void dino_ui_call_encryption_button_controller_set_controls_active (DinoUiCallEncryptionButtonController* self,
                                                                    gboolean value);
static void dino_ui_call_encryption_button_controller_finalize (GObject * obj);
static GType dino_ui_call_encryption_button_controller_get_type_once (void);
static void _vala_dino_ui_call_encryption_button_controller_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static void _vala_dino_ui_call_encryption_button_controller_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec);

static inline gpointer
dino_ui_call_encryption_button_controller_get_instance_private (DinoUiCallEncryptionButtonController* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiCallEncryptionButtonController_private_offset);
}

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

static void
_dino_ui_call_encryption_button_controller_update_opacity_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self)
{
	dino_ui_call_encryption_button_controller_update_opacity ((DinoUiCallEncryptionButtonController*) self);
}

DinoUiCallEncryptionButtonController*
dino_ui_call_encryption_button_controller_construct (GType object_type,
                                                     GtkMenuButton* button)
{
	DinoUiCallEncryptionButtonController * self = NULL;
	GtkMenuButton* _tmp0_;
	g_return_val_if_fail (button != NULL, NULL);
	self = (DinoUiCallEncryptionButtonController*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (button);
	_g_object_unref0 (self->button);
	self->button = _tmp0_;
	gtk_widget_set_opacity ((GtkWidget*) button, (gdouble) 0);
	g_signal_connect_object ((GObject*) button, "notify::controls-active", (GCallback) _dino_ui_call_encryption_button_controller_update_opacity_g_object_notify, self, 0);
	return self;
}

DinoUiCallEncryptionButtonController*
dino_ui_call_encryption_button_controller_new (GtkMenuButton* button)
{
	return dino_ui_call_encryption_button_controller_construct (DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER, button);
}

void
dino_ui_call_encryption_button_controller_set_icon (DinoUiCallEncryptionButtonController* self,
                                                    gboolean encrypted,
                                                    const gchar* icon_name)
{
	g_return_if_fail (self != NULL);
	if (encrypted) {
		const gchar* _tmp0_ = NULL;
		GtkMenuButton* _tmp1_;
		GtkMenuButton* _tmp2_;
		_tmp0_ = icon_name;
		if (_tmp0_ == NULL) {
			_tmp0_ = "changes-prevent-symbolic";
		}
		_tmp1_ = self->button;
		gtk_menu_button_set_icon_name (_tmp1_, _tmp0_);
		_tmp2_ = self->button;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp2_, "unencrypted");
	} else {
		const gchar* _tmp3_ = NULL;
		GtkMenuButton* _tmp4_;
		GtkMenuButton* _tmp5_;
		_tmp3_ = icon_name;
		if (_tmp3_ == NULL) {
			_tmp3_ = "changes-allow-symbolic";
		}
		_tmp4_ = self->button;
		gtk_menu_button_set_icon_name (_tmp4_, _tmp3_);
		_tmp5_ = self->button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "unencrypted");
	}
	self->priv->has_been_set = TRUE;
	dino_ui_call_encryption_button_controller_update_opacity (self);
}

static gboolean
dino_ui_call_encryption_button_controller_bytes_equal (guint8* a1,
                                                       gint a1_length1,
                                                       guint8* a2,
                                                       gint a2_length1)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	if (a1_length1 == a2_length1) {
		_tmp0_ = memcmp (a1, a2, (gsize) a1_length1) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
dino_ui_call_encryption_button_controller_encryption_equals (XmppXepJingleContentEncryption* audio_encryption,
                                                             XmppXepJingleContentEncryption* video_encryption)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	guint8* _tmp6_;
	gint _tmp6__length1;
	guint8* _tmp7_;
	gint _tmp7__length1;
	guint8* _tmp8_;
	gint _tmp8__length1;
	guint8* _tmp9_;
	gint _tmp9__length1;
	gboolean result;
	if (audio_encryption == NULL) {
		_tmp0_ = video_encryption == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	if (audio_encryption == NULL) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = video_encryption == NULL;
	}
	if (_tmp1_) {
		result = FALSE;
		return result;
	}
	_tmp2_ = audio_encryption->encryption_ns;
	_tmp3_ = video_encryption->encryption_ns;
	if (g_strcmp0 (_tmp2_, _tmp3_) != 0) {
		result = FALSE;
		return result;
	}
	_tmp4_ = audio_encryption->encryption_name;
	_tmp5_ = video_encryption->encryption_name;
	if (g_strcmp0 (_tmp4_, _tmp5_) != 0) {
		result = FALSE;
		return result;
	}
	_tmp6_ = audio_encryption->our_key;
	_tmp6__length1 = audio_encryption->our_key_length1;
	_tmp7_ = video_encryption->our_key;
	_tmp7__length1 = video_encryption->our_key_length1;
	if (!dino_ui_call_encryption_button_controller_bytes_equal (_tmp6_, (gint) _tmp6__length1, _tmp7_, (gint) _tmp7__length1)) {
		result = FALSE;
		return result;
	}
	_tmp8_ = audio_encryption->peer_key;
	_tmp8__length1 = audio_encryption->peer_key_length1;
	_tmp9_ = video_encryption->peer_key;
	_tmp9__length1 = video_encryption->peer_key_length1;
	if (!dino_ui_call_encryption_button_controller_bytes_equal (_tmp8_, (gint) _tmp8__length1, _tmp9_, (gint) _tmp9__length1)) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}

void
dino_ui_call_encryption_button_controller_set_info (DinoUiCallEncryptionButtonController* self,
                                                    const gchar* title,
                                                    gboolean show_keys,
                                                    gboolean has_audio,
                                                    XmppXepJingleContentEncryption* audio_encryption,
                                                    gboolean has_video,
                                                    XmppXepJingleContentEncryption* video_encryption)
{
	GtkPopover* popover = NULL;
	GtkPopover* _tmp0_;
	GtkMenuButton* _tmp1_;
	GtkPopover* _tmp2_;
	XmppXepJingleContentEncryption* single_encryption = NULL;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp11_ = FALSE;
	GtkBox* box = NULL;
	GtkBox* _tmp15_;
	XmppXepJingleContentEncryption* _tmp16_;
	GtkPopover* _tmp45_;
	GtkBox* _tmp46_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp0_);
	popover = _tmp0_;
	_tmp1_ = self->button;
	_tmp2_ = popover;
	gtk_menu_button_set_popover (_tmp1_, _tmp2_);
	single_encryption = NULL;
	if (!has_audio) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = !has_video;
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = dino_ui_call_encryption_button_controller_encryption_equals (audio_encryption, video_encryption);
	}
	if (_tmp3_) {
		XmppXepJingleContentEncryption* _tmp5_ = NULL;
		XmppXepJingleContentEncryption* _tmp6_;
		XmppXepJingleContentEncryption* _tmp7_;
		_tmp5_ = audio_encryption;
		if (_tmp5_ == NULL) {
			_tmp5_ = video_encryption;
		}
		_tmp6_ = _g_object_ref0 (_tmp5_);
		_g_object_unref0 (single_encryption);
		single_encryption = _tmp6_;
		_tmp7_ = single_encryption;
		if (_tmp7_ == NULL) {
			GtkPopover* _tmp8_;
			GtkLabel* _tmp9_;
			GtkLabel* _tmp10_;
			_tmp8_ = popover;
			_tmp9_ = (GtkLabel*) gtk_label_new ("This call is unencrypted.");
			g_object_ref_sink (_tmp9_);
			_tmp10_ = _tmp9_;
			gtk_popover_set_child (_tmp8_, (GtkWidget*) _tmp10_);
			_g_object_unref0 (_tmp10_);
			_g_object_unref0 (single_encryption);
			_g_object_unref0 (popover);
			return;
		}
	}
	if (title != NULL) {
		_tmp11_ = !show_keys;
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		GtkPopover* _tmp12_;
		GtkLabel* _tmp13_ = NULL;
		GtkLabel* _tmp14_;
		_tmp12_ = popover;
		_tmp13_ = (GtkLabel*) gtk_label_new (title);
		gtk_label_set_use_markup (_tmp13_, TRUE);
		g_object_ref_sink (_tmp13_);
		_tmp14_ = _tmp13_;
		gtk_popover_set_child (_tmp12_, (GtkWidget*) _tmp14_);
		_g_object_unref0 (_tmp14_);
		_g_object_unref0 (single_encryption);
		_g_object_unref0 (popover);
		return;
	}
	_tmp15_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
	g_object_ref_sink (_tmp15_);
	box = _tmp15_;
	_tmp16_ = single_encryption;
	if (_tmp16_ != NULL) {
		const gchar* _tmp17_ = NULL;
		GtkBox* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		GtkLabel* _tmp21_ = NULL;
		GtkLabel* _tmp22_;
		GtkBox* _tmp23_;
		XmppXepJingleContentEncryption* _tmp24_;
		GtkWidget* _tmp25_;
		GtkWidget* _tmp26_;
		_tmp17_ = title;
		if (_tmp17_ == NULL) {
			_tmp17_ = "This call is end-to-end encrypted.";
		}
		_tmp18_ = box;
		_tmp19_ = g_strdup_printf ("<b>%s</b>", _tmp17_);
		_tmp20_ = _tmp19_;
		_tmp21_ = (GtkLabel*) gtk_label_new (_tmp20_);
		gtk_label_set_use_markup (_tmp21_, TRUE);
		gtk_label_set_xalign (_tmp21_, (gfloat) 0);
		g_object_ref_sink (_tmp21_);
		_tmp22_ = _tmp21_;
		gtk_box_append (_tmp18_, (GtkWidget*) _tmp22_);
		_g_object_unref0 (_tmp22_);
		_g_free0 (_tmp20_);
		_tmp23_ = box;
		_tmp24_ = single_encryption;
		_tmp25_ = dino_ui_call_encryption_button_controller_create_media_encryption_grid (self, _tmp24_);
		_tmp26_ = _tmp25_;
		gtk_box_append (_tmp23_, _tmp26_);
		_g_object_unref0 (_tmp26_);
	} else {
		const gchar* _tmp27_ = NULL;
		GtkBox* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		GtkLabel* _tmp31_ = NULL;
		GtkLabel* _tmp32_;
		_tmp27_ = title;
		if (_tmp27_ == NULL) {
			_tmp27_ = "This call is partially end-to-end encrypted.";
		}
		_tmp28_ = box;
		_tmp29_ = g_strdup_printf ("<b>%s</b>", _tmp27_);
		_tmp30_ = _tmp29_;
		_tmp31_ = (GtkLabel*) gtk_label_new (_tmp30_);
		gtk_label_set_use_markup (_tmp31_, TRUE);
		gtk_label_set_xalign (_tmp31_, (gfloat) 0);
		g_object_ref_sink (_tmp31_);
		_tmp32_ = _tmp31_;
		gtk_box_append (_tmp28_, (GtkWidget*) _tmp32_);
		_g_object_unref0 (_tmp32_);
		_g_free0 (_tmp30_);
		if (has_audio) {
			GtkBox* _tmp33_;
			GtkLabel* _tmp34_ = NULL;
			GtkLabel* _tmp35_;
			GtkBox* _tmp36_;
			GtkWidget* _tmp37_;
			GtkWidget* _tmp38_;
			_tmp33_ = box;
			_tmp34_ = (GtkLabel*) gtk_label_new ("<b>Audio</b>");
			gtk_label_set_use_markup (_tmp34_, TRUE);
			gtk_label_set_xalign (_tmp34_, (gfloat) 0);
			g_object_ref_sink (_tmp34_);
			_tmp35_ = _tmp34_;
			gtk_box_append (_tmp33_, (GtkWidget*) _tmp35_);
			_g_object_unref0 (_tmp35_);
			_tmp36_ = box;
			_tmp37_ = dino_ui_call_encryption_button_controller_create_media_encryption_grid (self, audio_encryption);
			_tmp38_ = _tmp37_;
			gtk_box_append (_tmp36_, _tmp38_);
			_g_object_unref0 (_tmp38_);
		}
		if (has_video) {
			GtkBox* _tmp39_;
			GtkLabel* _tmp40_ = NULL;
			GtkLabel* _tmp41_;
			GtkBox* _tmp42_;
			GtkWidget* _tmp43_;
			GtkWidget* _tmp44_;
			_tmp39_ = box;
			_tmp40_ = (GtkLabel*) gtk_label_new ("<b>Video</b>");
			gtk_label_set_use_markup (_tmp40_, TRUE);
			gtk_label_set_xalign (_tmp40_, (gfloat) 0);
			g_object_ref_sink (_tmp40_);
			_tmp41_ = _tmp40_;
			gtk_box_append (_tmp39_, (GtkWidget*) _tmp41_);
			_g_object_unref0 (_tmp41_);
			_tmp42_ = box;
			_tmp43_ = dino_ui_call_encryption_button_controller_create_media_encryption_grid (self, video_encryption);
			_tmp44_ = _tmp43_;
			gtk_box_append (_tmp42_, _tmp44_);
			_g_object_unref0 (_tmp44_);
		}
	}
	_tmp45_ = popover;
	_tmp46_ = box;
	gtk_popover_set_child (_tmp45_, (GtkWidget*) _tmp46_);
	_g_object_unref0 (box);
	_g_object_unref0 (single_encryption);
	_g_object_unref0 (popover);
}

void
dino_ui_call_encryption_button_controller_update_opacity (DinoUiCallEncryptionButtonController* self)
{
	gint _tmp0_ = 0;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	GtkMenuButton* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp2_ = self->priv->_controls_active;
	if (_tmp2_) {
		_tmp1_ = self->priv->has_been_set;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = 1;
	} else {
		_tmp0_ = 0;
	}
	_tmp3_ = self->button;
	gtk_widget_set_opacity ((GtkWidget*) _tmp3_, (gdouble) _tmp0_);
}

static GtkWidget*
dino_ui_call_encryption_button_controller_create_media_encryption_grid (DinoUiCallEncryptionButtonController* self,
                                                                        XmppXepJingleContentEncryption* encryption)
{
	GtkGrid* ret = NULL;
	GtkGrid* _tmp1_ = NULL;
	guint8* _tmp2_;
	gint _tmp2__length1;
	guint8* _tmp16_;
	gint _tmp16__length1;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (encryption == NULL) {
		GtkLabel* _tmp0_ = NULL;
		_tmp0_ = (GtkLabel*) gtk_label_new ("This content is unencrypted.");
		gtk_label_set_xalign (_tmp0_, (gfloat) 0);
		g_object_ref_sink (_tmp0_);
		result = (GtkWidget*) _tmp0_;
		return result;
	}
	_tmp1_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_row_spacing (_tmp1_, 3);
	gtk_grid_set_column_spacing (_tmp1_, 5);
	g_object_ref_sink (_tmp1_);
	ret = _tmp1_;
	_tmp2_ = encryption->peer_key;
	_tmp2__length1 = encryption->peer_key_length1;
	if (_tmp2__length1 > 0) {
		GtkGrid* _tmp3_;
		GtkLabel* _tmp4_ = NULL;
		GtkLabel* _tmp5_;
		GtkGrid* _tmp6_;
		guint8* _tmp7_;
		gint _tmp7__length1;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		GtkLabel* _tmp14_ = NULL;
		GtkLabel* _tmp15_;
		_tmp3_ = ret;
		_tmp4_ = (GtkLabel*) gtk_label_new ("Peer call key");
		gtk_label_set_xalign (_tmp4_, (gfloat) 0);
		g_object_ref_sink (_tmp4_);
		_tmp5_ = _tmp4_;
		gtk_grid_attach (_tmp3_, (GtkWidget*) _tmp5_, 1, 2, 1, 1);
		_g_object_unref0 (_tmp5_);
		_tmp6_ = ret;
		_tmp7_ = encryption->peer_key;
		_tmp7__length1 = encryption->peer_key_length1;
		_tmp8_ = dino_ui_call_encryption_button_controller_format_fingerprint (self, _tmp7_, (gint) _tmp7__length1);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_strconcat ("<span font_family='monospace'>", _tmp9_, NULL);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strconcat (_tmp11_, "</span>", NULL);
		_tmp13_ = _tmp12_;
		_tmp14_ = (GtkLabel*) gtk_label_new (_tmp13_);
		gtk_label_set_use_markup (_tmp14_, TRUE);
		gtk_label_set_max_width_chars (_tmp14_, 25);
		gtk_label_set_ellipsize (_tmp14_, PANGO_ELLIPSIZE_MIDDLE);
		gtk_label_set_xalign (_tmp14_, (gfloat) 0);
		gtk_widget_set_hexpand ((GtkWidget*) _tmp14_, TRUE);
		g_object_ref_sink (_tmp14_);
		_tmp15_ = _tmp14_;
		gtk_grid_attach (_tmp6_, (GtkWidget*) _tmp15_, 2, 2, 1, 1);
		_g_object_unref0 (_tmp15_);
		_g_free0 (_tmp13_);
		_g_free0 (_tmp11_);
		_g_free0 (_tmp9_);
	}
	_tmp16_ = encryption->our_key;
	_tmp16__length1 = encryption->our_key_length1;
	if (_tmp16__length1 > 0) {
		GtkGrid* _tmp17_;
		GtkLabel* _tmp18_ = NULL;
		GtkLabel* _tmp19_;
		GtkGrid* _tmp20_;
		guint8* _tmp21_;
		gint _tmp21__length1;
		gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		GtkLabel* _tmp28_ = NULL;
		GtkLabel* _tmp29_;
		_tmp17_ = ret;
		_tmp18_ = (GtkLabel*) gtk_label_new ("Your call key");
		gtk_label_set_xalign (_tmp18_, (gfloat) 0);
		g_object_ref_sink (_tmp18_);
		_tmp19_ = _tmp18_;
		gtk_grid_attach (_tmp17_, (GtkWidget*) _tmp19_, 1, 3, 1, 1);
		_g_object_unref0 (_tmp19_);
		_tmp20_ = ret;
		_tmp21_ = encryption->our_key;
		_tmp21__length1 = encryption->our_key_length1;
		_tmp22_ = dino_ui_call_encryption_button_controller_format_fingerprint (self, _tmp21_, (gint) _tmp21__length1);
		_tmp23_ = _tmp22_;
		_tmp24_ = g_strconcat ("<span font_family='monospace'>", _tmp23_, NULL);
		_tmp25_ = _tmp24_;
		_tmp26_ = g_strconcat (_tmp25_, "</span>", NULL);
		_tmp27_ = _tmp26_;
		_tmp28_ = (GtkLabel*) gtk_label_new (_tmp27_);
		gtk_label_set_use_markup (_tmp28_, TRUE);
		gtk_label_set_max_width_chars (_tmp28_, 25);
		gtk_label_set_ellipsize (_tmp28_, PANGO_ELLIPSIZE_MIDDLE);
		gtk_label_set_xalign (_tmp28_, (gfloat) 0);
		gtk_widget_set_hexpand ((GtkWidget*) _tmp28_, TRUE);
		g_object_ref_sink (_tmp28_);
		_tmp29_ = _tmp28_;
		gtk_grid_attach (_tmp20_, (GtkWidget*) _tmp29_, 2, 3, 1, 1);
		_g_object_unref0 (_tmp29_);
		_g_free0 (_tmp27_);
		_g_free0 (_tmp25_);
		_g_free0 (_tmp23_);
	}
	result = (GtkWidget*) ret;
	return result;
}

static gchar*
dino_ui_call_encryption_button_controller_format_fingerprint (DinoUiCallEncryptionButtonController* self,
                                                              guint8* fingerprint,
                                                              gint fingerprint_length1)
{
	GString* sb = NULL;
	GString* _tmp0_;
	GString* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_string_new ("");
	sb = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GString* _tmp3_;
				guint8 _tmp4_;
				gchar* _tmp5_;
				gchar* _tmp6_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < fingerprint_length1)) {
					break;
				}
				_tmp3_ = sb;
				_tmp4_ = fingerprint[i];
				_tmp5_ = g_strdup_printf ("%02x", (guint) _tmp4_);
				_tmp6_ = _tmp5_;
				g_string_append (_tmp3_, _tmp6_);
				_g_free0 (_tmp6_);
				if (i < (fingerprint_length1 - 1)) {
					GString* _tmp7_;
					_tmp7_ = sb;
					g_string_append (_tmp7_, ":");
				}
			}
		}
	}
	_tmp8_ = sb;
	_tmp9_ = _tmp8_->str;
	_tmp10_ = g_strdup (_tmp9_);
	result = _tmp10_;
	_g_string_free0 (sb);
	return result;
}

gboolean
dino_ui_call_encryption_button_controller_get_controls_active (DinoUiCallEncryptionButtonController* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_controls_active;
	return result;
}

void
dino_ui_call_encryption_button_controller_set_controls_active (DinoUiCallEncryptionButtonController* self,
                                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_call_encryption_button_controller_get_controls_active (self);
	if (old_value != value) {
		self->priv->_controls_active = value;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_call_encryption_button_controller_properties[DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_CONTROLS_ACTIVE_PROPERTY]);
	}
}

static void
dino_ui_call_encryption_button_controller_class_init (DinoUiCallEncryptionButtonControllerClass * klass,
                                                      gpointer klass_data)
{
	dino_ui_call_encryption_button_controller_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiCallEncryptionButtonController_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_call_encryption_button_controller_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_call_encryption_button_controller_set_property;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_call_encryption_button_controller_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_CONTROLS_ACTIVE_PROPERTY, dino_ui_call_encryption_button_controller_properties[DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_CONTROLS_ACTIVE_PROPERTY] = g_param_spec_boolean ("controls-active", "controls-active", "controls-active", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
dino_ui_call_encryption_button_controller_instance_init (DinoUiCallEncryptionButtonController * self,
                                                         gpointer klass)
{
	self->priv = dino_ui_call_encryption_button_controller_get_instance_private (self);
	self->priv->has_been_set = FALSE;
	self->priv->_controls_active = FALSE;
}

static void
dino_ui_call_encryption_button_controller_finalize (GObject * obj)
{
	DinoUiCallEncryptionButtonController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER, DinoUiCallEncryptionButtonController);
	_g_object_unref0 (self->button);
	G_OBJECT_CLASS (dino_ui_call_encryption_button_controller_parent_class)->finalize (obj);
}

static GType
dino_ui_call_encryption_button_controller_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiCallEncryptionButtonControllerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_call_encryption_button_controller_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiCallEncryptionButtonController), 0, (GInstanceInitFunc) dino_ui_call_encryption_button_controller_instance_init, NULL };
	GType dino_ui_call_encryption_button_controller_type_id;
	dino_ui_call_encryption_button_controller_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoUiCallEncryptionButtonController", &g_define_type_info, 0);
	DinoUiCallEncryptionButtonController_private_offset = g_type_add_instance_private (dino_ui_call_encryption_button_controller_type_id, sizeof (DinoUiCallEncryptionButtonControllerPrivate));
	return dino_ui_call_encryption_button_controller_type_id;
}

GType
dino_ui_call_encryption_button_controller_get_type (void)
{
	static volatile gsize dino_ui_call_encryption_button_controller_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_call_encryption_button_controller_type_id__once)) {
		GType dino_ui_call_encryption_button_controller_type_id;
		dino_ui_call_encryption_button_controller_type_id = dino_ui_call_encryption_button_controller_get_type_once ();
		g_once_init_leave (&dino_ui_call_encryption_button_controller_type_id__once, dino_ui_call_encryption_button_controller_type_id);
	}
	return dino_ui_call_encryption_button_controller_type_id__once;
}

static void
_vala_dino_ui_call_encryption_button_controller_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	DinoUiCallEncryptionButtonController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER, DinoUiCallEncryptionButtonController);
	switch (property_id) {
		case DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_CONTROLS_ACTIVE_PROPERTY:
		g_value_set_boolean (value, dino_ui_call_encryption_button_controller_get_controls_active (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_call_encryption_button_controller_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec)
{
	DinoUiCallEncryptionButtonController * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_CALL_ENCRYPTION_BUTTON_CONTROLLER, DinoUiCallEncryptionButtonController);
	switch (property_id) {
		case DINO_UI_CALL_ENCRYPTION_BUTTON_CONTROLLER_CONTROLS_ACTIVE_PROPERTY:
		dino_ui_call_encryption_button_controller_set_controls_active (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

