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

#include <gtk/gtk.h>
#include <glib-object.h>
#include "libdino.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "xmpp-vala.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_ADD_CONTACT_DIALOG (dino_ui_add_contact_dialog_get_type ())
#define DINO_UI_ADD_CONTACT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_ADD_CONTACT_DIALOG, DinoUiAddContactDialog))
#define DINO_UI_ADD_CONTACT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_ADD_CONTACT_DIALOG, DinoUiAddContactDialogClass))
#define DINO_UI_IS_ADD_CONTACT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_ADD_CONTACT_DIALOG))
#define DINO_UI_IS_ADD_CONTACT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_ADD_CONTACT_DIALOG))
#define DINO_UI_ADD_CONTACT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_ADD_CONTACT_DIALOG, DinoUiAddContactDialogClass))

typedef struct _DinoUiAddContactDialog DinoUiAddContactDialog;
typedef struct _DinoUiAddContactDialogClass DinoUiAddContactDialogClass;
typedef struct _DinoUiAddContactDialogPrivate DinoUiAddContactDialogPrivate;

#define DINO_UI_TYPE_ACCOUNT_COMBO_BOX (dino_ui_account_combo_box_get_type ())
#define DINO_UI_ACCOUNT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_ACCOUNT_COMBO_BOX, DinoUiAccountComboBox))
#define DINO_UI_ACCOUNT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_ACCOUNT_COMBO_BOX, DinoUiAccountComboBoxClass))
#define DINO_UI_IS_ACCOUNT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_ACCOUNT_COMBO_BOX))
#define DINO_UI_IS_ACCOUNT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_ACCOUNT_COMBO_BOX))
#define DINO_UI_ACCOUNT_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_ACCOUNT_COMBO_BOX, DinoUiAccountComboBoxClass))

typedef struct _DinoUiAccountComboBox DinoUiAccountComboBox;
typedef struct _DinoUiAccountComboBoxClass DinoUiAccountComboBoxClass;
enum  {
	DINO_UI_ADD_CONTACT_DIALOG_0_PROPERTY,
	DINO_UI_ADD_CONTACT_DIALOG_ACCOUNT_PROPERTY,
	DINO_UI_ADD_CONTACT_DIALOG_JID_PROPERTY,
	DINO_UI_ADD_CONTACT_DIALOG_NUM_PROPERTIES
};
static GParamSpec* dino_ui_add_contact_dialog_properties[DINO_UI_ADD_CONTACT_DIALOG_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 _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _xmpp_roster_item_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_roster_item_unref (var), NULL)))

struct _DinoUiAddContactDialog {
	GtkDialog parent_instance;
	DinoUiAddContactDialogPrivate * priv;
};

struct _DinoUiAddContactDialogClass {
	GtkDialogClass parent_class;
};

struct _DinoUiAddContactDialogPrivate {
	DinoUiAccountComboBox* account_combobox;
	GtkButton* ok_button;
	GtkButton* cancel_button;
	GtkEntry* jid_entry;
	GtkEntry* alias_entry;
	DinoStreamInteractor* stream_interactor;
};

static gint DinoUiAddContactDialog_private_offset;
static gpointer dino_ui_add_contact_dialog_parent_class = NULL;

VALA_EXTERN GType dino_ui_add_contact_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiAddContactDialog, g_object_unref)
VALA_EXTERN GType dino_ui_account_combo_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiAccountComboBox, g_object_unref)
VALA_EXTERN DinoUiAddContactDialog* dino_ui_add_contact_dialog_new (DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiAddContactDialog* dino_ui_add_contact_dialog_construct (GType object_type,
                                                              DinoStreamInteractor* stream_interactor);
VALA_EXTERN void dino_ui_account_combo_box_initialize (DinoUiAccountComboBox* self,
                                           DinoStreamInteractor* stream_interactor);
static void __lambda94_ (DinoUiAddContactDialog* self);
static void ___lambda94__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void dino_ui_add_contact_dialog_on_ok_button_clicked (DinoUiAddContactDialog* self);
static void _dino_ui_add_contact_dialog_on_ok_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void dino_ui_add_contact_dialog_on_jid_entry_changed (DinoUiAddContactDialog* self);
static void _dino_ui_add_contact_dialog_on_jid_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                                            gpointer self);
VALA_EXTERN DinoEntitiesAccount* dino_ui_add_contact_dialog_get_account (DinoUiAddContactDialog* self);
VALA_EXTERN DinoEntitiesAccount* dino_ui_account_combo_box_get_selected (DinoUiAccountComboBox* self);
VALA_EXTERN void dino_ui_add_contact_dialog_set_account (DinoUiAddContactDialog* self,
                                             DinoEntitiesAccount* value);
VALA_EXTERN void dino_ui_account_combo_box_set_selected (DinoUiAccountComboBox* self,
                                             DinoEntitiesAccount* value);
VALA_EXTERN const gchar* dino_ui_add_contact_dialog_get_jid (DinoUiAddContactDialog* self);
VALA_EXTERN void dino_ui_add_contact_dialog_set_jid (DinoUiAddContactDialog* self,
                                         const gchar* value);
static void dino_ui_add_contact_dialog_finalize (GObject * obj);
static GType dino_ui_add_contact_dialog_get_type_once (void);
static void _vala_dino_ui_add_contact_dialog_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_dino_ui_add_contact_dialog_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);

static inline gpointer
dino_ui_add_contact_dialog_get_instance_private (DinoUiAddContactDialog* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiAddContactDialog_private_offset);
}

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

static void
__lambda94_ (DinoUiAddContactDialog* self)
{
	g_signal_emit_by_name ((GtkDialog*) self, "close");
}

static void
___lambda94__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda94_ ((DinoUiAddContactDialog*) self);
}

static void
_dino_ui_add_contact_dialog_on_ok_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	dino_ui_add_contact_dialog_on_ok_button_clicked ((DinoUiAddContactDialog*) self);
}

static void
_dino_ui_add_contact_dialog_on_jid_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                                       gpointer self)
{
	dino_ui_add_contact_dialog_on_jid_entry_changed ((DinoUiAddContactDialog*) self);
}

DinoUiAddContactDialog*
dino_ui_add_contact_dialog_construct (GType object_type,
                                      DinoStreamInteractor* stream_interactor)
{
	DinoUiAddContactDialog * self = NULL;
	DinoStreamInteractor* _tmp0_;
	DinoUiAccountComboBox* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkEntry* _tmp4_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	self = (DinoUiAddContactDialog*) g_object_new (object_type, "use-header-bar", 1, NULL);
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp0_;
	_tmp1_ = self->priv->account_combobox;
	dino_ui_account_combo_box_initialize (_tmp1_, stream_interactor);
	_tmp2_ = self->priv->cancel_button;
	g_signal_connect_object (_tmp2_, "clicked", (GCallback) ___lambda94__gtk_button_clicked, self, 0);
	_tmp3_ = self->priv->ok_button;
	g_signal_connect_object (_tmp3_, "clicked", (GCallback) _dino_ui_add_contact_dialog_on_ok_button_clicked_gtk_button_clicked, self, 0);
	_tmp4_ = self->priv->jid_entry;
	g_signal_connect_object ((GtkEditable*) _tmp4_, "changed", (GCallback) _dino_ui_add_contact_dialog_on_jid_entry_changed_gtk_editable_changed, self, 0);
	return self;
}

DinoUiAddContactDialog*
dino_ui_add_contact_dialog_new (DinoStreamInteractor* stream_interactor)
{
	return dino_ui_add_contact_dialog_construct (DINO_UI_TYPE_ADD_CONTACT_DIALOG, stream_interactor);
}

static void
dino_ui_add_contact_dialog_on_ok_button_clicked (DinoUiAddContactDialog* self)
{
	const gchar* _tmp0_ = NULL;
	GtkEntry* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* alias = NULL;
	gchar* _tmp7_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->alias_entry;
	_tmp2_ = gtk_editable_get_text ((GtkEditable*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (g_strcmp0 (_tmp3_, "") == 0) {
		_tmp0_ = NULL;
	} else {
		GtkEntry* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp4_ = self->priv->alias_entry;
		_tmp5_ = gtk_editable_get_text ((GtkEditable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_;
	}
	_tmp7_ = g_strdup (_tmp0_);
	alias = _tmp7_;
	{
		XmppJid* jid = NULL;
		GtkEntry* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		XmppJid* _tmp11_;
		DinoStreamInteractor* _tmp12_;
		DinoModuleIdentity* _tmp13_;
		gpointer _tmp14_;
		DinoRosterManager* _tmp15_;
		DinoEntitiesAccount* _tmp16_;
		DinoEntitiesAccount* _tmp17_;
		DinoStreamInteractor* _tmp18_;
		DinoModuleIdentity* _tmp19_;
		gpointer _tmp20_;
		DinoPresenceManager* _tmp21_;
		DinoEntitiesAccount* _tmp22_;
		DinoEntitiesAccount* _tmp23_;
		_tmp8_ = self->priv->jid_entry;
		_tmp9_ = gtk_editable_get_text ((GtkEditable*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = xmpp_jid_new (_tmp10_, &_inner_error0_);
		jid = _tmp11_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
				goto __catch0_xmpp_invalid_jid_error;
			}
			_g_free0 (alias);
			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;
		}
		_tmp12_ = self->priv->stream_interactor;
		_tmp13_ = dino_roster_manager_IDENTITY;
		_tmp14_ = dino_stream_interactor_get_module (_tmp12_, DINO_TYPE_ROSTER_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp13_);
		_tmp15_ = (DinoRosterManager*) _tmp14_;
		_tmp16_ = dino_ui_add_contact_dialog_get_account (self);
		_tmp17_ = _tmp16_;
		dino_roster_manager_add_jid (_tmp15_, _tmp17_, jid, alias);
		_g_object_unref0 (_tmp15_);
		_tmp18_ = self->priv->stream_interactor;
		_tmp19_ = dino_presence_manager_IDENTITY;
		_tmp20_ = dino_stream_interactor_get_module (_tmp18_, DINO_TYPE_PRESENCE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp19_);
		_tmp21_ = (DinoPresenceManager*) _tmp20_;
		_tmp22_ = dino_ui_add_contact_dialog_get_account (self);
		_tmp23_ = _tmp22_;
		dino_presence_manager_request_subscription (_tmp21_, _tmp23_, jid);
		_g_object_unref0 (_tmp21_);
		g_signal_emit_by_name ((GtkDialog*) self, "close");
		_xmpp_jid_unref0 (jid);
	}
	goto __finally0;
	__catch0_xmpp_invalid_jid_error:
	{
		GError* e = NULL;
		GError* _tmp24_;
		const gchar* _tmp25_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp24_ = e;
		_tmp25_ = _tmp24_->message;
		g_warning ("add_contact_dialog.vala:48: Tried to add contact with invalid Jid: %s", _tmp25_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (alias);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_free0 (alias);
}

static void
dino_ui_add_contact_dialog_on_jid_entry_changed (DinoUiAddContactDialog* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		XmppJid* parsed_jid = NULL;
		GtkEntry* _tmp0_;
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		XmppJid* _tmp3_;
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		GtkButton* _tmp15_;
		_tmp0_ = self->priv->jid_entry;
		_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = xmpp_jid_new (_tmp2_, &_inner_error0_);
		parsed_jid = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
				goto __catch0_xmpp_invalid_jid_error;
			}
			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;
		}
		if (parsed_jid != NULL) {
			const gchar* _tmp6_;
			_tmp6_ = parsed_jid->resourcepart;
			_tmp5_ = _tmp6_ == NULL;
		} else {
			_tmp5_ = FALSE;
		}
		if (_tmp5_) {
			DinoStreamInteractor* _tmp7_;
			DinoModuleIdentity* _tmp8_;
			gpointer _tmp9_;
			DinoRosterManager* _tmp10_;
			DinoEntitiesAccount* _tmp11_;
			DinoEntitiesAccount* _tmp12_;
			XmppRosterItem* _tmp13_;
			XmppRosterItem* _tmp14_;
			_tmp7_ = self->priv->stream_interactor;
			_tmp8_ = dino_roster_manager_IDENTITY;
			_tmp9_ = dino_stream_interactor_get_module (_tmp7_, DINO_TYPE_ROSTER_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp8_);
			_tmp10_ = (DinoRosterManager*) _tmp9_;
			_tmp11_ = dino_ui_add_contact_dialog_get_account (self);
			_tmp12_ = _tmp11_;
			_tmp13_ = dino_roster_manager_get_roster_item (_tmp10_, _tmp12_, parsed_jid);
			_tmp14_ = _tmp13_;
			_tmp4_ = _tmp14_ == NULL;
			_xmpp_roster_item_unref0 (_tmp14_);
			_g_object_unref0 (_tmp10_);
		} else {
			_tmp4_ = FALSE;
		}
		_tmp15_ = self->priv->ok_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, _tmp4_);
		_xmpp_jid_unref0 (parsed_jid);
	}
	goto __finally0;
	__catch0_xmpp_invalid_jid_error:
	{
		GtkButton* _tmp16_;
		g_clear_error (&_inner_error0_);
		_tmp16_ = self->priv->ok_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp16_, FALSE);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

DinoEntitiesAccount*
dino_ui_add_contact_dialog_get_account (DinoUiAddContactDialog* self)
{
	DinoEntitiesAccount* result;
	DinoUiAccountComboBox* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->account_combobox;
	_tmp1_ = dino_ui_account_combo_box_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
dino_ui_add_contact_dialog_set_account (DinoUiAddContactDialog* self,
                                        DinoEntitiesAccount* value)
{
	DinoUiAccountComboBox* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->account_combobox;
	dino_ui_account_combo_box_set_selected (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, dino_ui_add_contact_dialog_properties[DINO_UI_ADD_CONTACT_DIALOG_ACCOUNT_PROPERTY]);
}

const gchar*
dino_ui_add_contact_dialog_get_jid (DinoUiAddContactDialog* self)
{
	const gchar* result;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->jid_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
dino_ui_add_contact_dialog_set_jid (DinoUiAddContactDialog* self,
                                    const gchar* value)
{
	GtkEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->jid_entry;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, dino_ui_add_contact_dialog_properties[DINO_UI_ADD_CONTACT_DIALOG_JID_PROPERTY]);
}

static void
dino_ui_add_contact_dialog_class_init (DinoUiAddContactDialogClass * klass,
                                       gpointer klass_data)
{
	dino_ui_add_contact_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiAddContactDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_add_contact_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_add_contact_dialog_set_property;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_add_contact_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_ADD_CONTACT_DIALOG_ACCOUNT_PROPERTY, dino_ui_add_contact_dialog_properties[DINO_UI_ADD_CONTACT_DIALOG_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", DINO_ENTITIES_TYPE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_ADD_CONTACT_DIALOG_JID_PROPERTY, dino_ui_add_contact_dialog_properties[DINO_UI_ADD_CONTACT_DIALOG_JID_PROPERTY] = g_param_spec_string ("jid", "jid", "jid", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/im/dino/Dino/add_conversation/add_contact_dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "account_combobox", FALSE, DinoUiAddContactDialog_private_offset + G_STRUCT_OFFSET (DinoUiAddContactDialogPrivate, account_combobox));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "ok_button", FALSE, DinoUiAddContactDialog_private_offset + G_STRUCT_OFFSET (DinoUiAddContactDialogPrivate, ok_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "cancel_button", FALSE, DinoUiAddContactDialog_private_offset + G_STRUCT_OFFSET (DinoUiAddContactDialogPrivate, cancel_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "jid_entry", FALSE, DinoUiAddContactDialog_private_offset + G_STRUCT_OFFSET (DinoUiAddContactDialogPrivate, jid_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "alias_entry", FALSE, DinoUiAddContactDialog_private_offset + G_STRUCT_OFFSET (DinoUiAddContactDialogPrivate, alias_entry));
}

static void
dino_ui_add_contact_dialog_instance_init (DinoUiAddContactDialog * self,
                                          gpointer klass)
{
	self->priv = dino_ui_add_contact_dialog_get_instance_private (self);
	g_type_ensure (DINO_UI_TYPE_ACCOUNT_COMBO_BOX);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
dino_ui_add_contact_dialog_finalize (GObject * obj)
{
	DinoUiAddContactDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_ADD_CONTACT_DIALOG, DinoUiAddContactDialog);
	_g_object_unref0 (self->priv->stream_interactor);
	G_OBJECT_CLASS (dino_ui_add_contact_dialog_parent_class)->finalize (obj);
}

static GType
dino_ui_add_contact_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiAddContactDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_add_contact_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiAddContactDialog), 0, (GInstanceInitFunc) dino_ui_add_contact_dialog_instance_init, NULL };
	GType dino_ui_add_contact_dialog_type_id;
	dino_ui_add_contact_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "DinoUiAddContactDialog", &g_define_type_info, 0);
	DinoUiAddContactDialog_private_offset = g_type_add_instance_private (dino_ui_add_contact_dialog_type_id, sizeof (DinoUiAddContactDialogPrivate));
	return dino_ui_add_contact_dialog_type_id;
}

GType
dino_ui_add_contact_dialog_get_type (void)
{
	static volatile gsize dino_ui_add_contact_dialog_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_add_contact_dialog_type_id__once)) {
		GType dino_ui_add_contact_dialog_type_id;
		dino_ui_add_contact_dialog_type_id = dino_ui_add_contact_dialog_get_type_once ();
		g_once_init_leave (&dino_ui_add_contact_dialog_type_id__once, dino_ui_add_contact_dialog_type_id);
	}
	return dino_ui_add_contact_dialog_type_id__once;
}

static void
_vala_dino_ui_add_contact_dialog_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	DinoUiAddContactDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_ADD_CONTACT_DIALOG, DinoUiAddContactDialog);
	switch (property_id) {
		case DINO_UI_ADD_CONTACT_DIALOG_ACCOUNT_PROPERTY:
		g_value_set_object (value, dino_ui_add_contact_dialog_get_account (self));
		break;
		case DINO_UI_ADD_CONTACT_DIALOG_JID_PROPERTY:
		g_value_set_string (value, dino_ui_add_contact_dialog_get_jid (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_add_contact_dialog_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	DinoUiAddContactDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_ADD_CONTACT_DIALOG, DinoUiAddContactDialog);
	switch (property_id) {
		case DINO_UI_ADD_CONTACT_DIALOG_ACCOUNT_PROPERTY:
		dino_ui_add_contact_dialog_set_account (self, g_value_get_object (value));
		break;
		case DINO_UI_ADD_CONTACT_DIALOG_JID_PROPERTY:
		dino_ui_add_contact_dialog_set_jid (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

