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

#include <gtk/gtk.h>
#include <glib-object.h>
#include "libdino.h"
#include "xmpp-vala.h"
#include <glib.h>
#include <gee.h>
#include <stdlib.h>
#include <string.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_LIST_ROW (dino_ui_list_row_get_type ())
#define DINO_UI_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_LIST_ROW, DinoUiListRow))
#define DINO_UI_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_LIST_ROW, DinoUiListRowClass))
#define DINO_UI_IS_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_LIST_ROW))
#define DINO_UI_IS_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_LIST_ROW))
#define DINO_UI_LIST_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_LIST_ROW, DinoUiListRowClass))

typedef struct _DinoUiListRow DinoUiListRow;
typedef struct _DinoUiListRowClass DinoUiListRowClass;
typedef struct _DinoUiListRowPrivate DinoUiListRowPrivate;

#define DINO_UI_TYPE_AVATAR_PICTURE (dino_ui_avatar_picture_get_type ())
#define DINO_UI_AVATAR_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_AVATAR_PICTURE, DinoUiAvatarPicture))
#define DINO_UI_AVATAR_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_AVATAR_PICTURE, DinoUiAvatarPictureClass))
#define DINO_UI_IS_AVATAR_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_AVATAR_PICTURE))
#define DINO_UI_IS_AVATAR_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_AVATAR_PICTURE))
#define DINO_UI_AVATAR_PICTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_AVATAR_PICTURE, DinoUiAvatarPictureClass))

typedef struct _DinoUiAvatarPicture DinoUiAvatarPicture;
typedef struct _DinoUiAvatarPictureClass DinoUiAvatarPictureClass;
enum  {
	DINO_UI_LIST_ROW_0_PROPERTY,
	DINO_UI_LIST_ROW_NUM_PROPERTIES
};
static GParamSpec* dino_ui_list_row_properties[DINO_UI_LIST_ROW_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)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block4Data Block4Data;

#define DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL (dino_ui_view_model_avatar_picture_model_get_type ())
#define DINO_UI_VIEW_MODEL_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL, DinoUiViewModelAvatarPictureModel))
#define DINO_UI_VIEW_MODEL_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL, DinoUiViewModelAvatarPictureModelClass))
#define DINO_UI_VIEW_MODEL_IS_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_IS_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_AVATAR_PICTURE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL, DinoUiViewModelAvatarPictureModelClass))

typedef struct _DinoUiViewModelAvatarPictureModel DinoUiViewModelAvatarPictureModel;
typedef struct _DinoUiViewModelAvatarPictureModelClass DinoUiViewModelAvatarPictureModelClass;

#define DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL (dino_ui_view_model_compat_avatar_picture_model_get_type ())
#define DINO_UI_VIEW_MODEL_COMPAT_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL, DinoUiViewModelCompatAvatarPictureModel))
#define DINO_UI_VIEW_MODEL_COMPAT_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL, DinoUiViewModelCompatAvatarPictureModelClass))
#define DINO_UI_VIEW_MODEL_IS_COMPAT_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_IS_COMPAT_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_COMPAT_AVATAR_PICTURE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL, DinoUiViewModelCompatAvatarPictureModelClass))

typedef struct _DinoUiViewModelCompatAvatarPictureModel DinoUiViewModelCompatAvatarPictureModel;
typedef struct _DinoUiViewModelCompatAvatarPictureModelClass DinoUiViewModelCompatAvatarPictureModelClass;

struct _DinoUiListRow {
	GtkWidget parent_instance;
	DinoUiListRowPrivate * priv;
	GtkBox* outer_box;
	DinoUiAvatarPicture* picture;
	GtkLabel* name_label;
	GtkImage* status_dot;
	GtkLabel* via_label;
	DinoStreamInteractor* stream_interactor;
	XmppJid* jid;
	DinoEntitiesAccount* account;
};

struct _DinoUiListRowClass {
	GtkWidgetClass parent_class;
};

struct _DinoUiListRowPrivate {
	gulong* handler_ids;
	gint handler_ids_length1;
	gint _handler_ids_size_;
};

struct _Block4Data {
	int _ref_count_;
	DinoUiListRow* self;
	DinoStreamInteractor* stream_interactor;
};

static gint DinoUiListRow_private_offset;
static gpointer dino_ui_list_row_parent_class = NULL;

VALA_EXTERN GType dino_ui_list_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiListRow, g_object_unref)
VALA_EXTERN GType dino_ui_avatar_picture_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiAvatarPicture, g_object_unref)
static void dino_ui_list_row_set_status_dot (DinoUiListRow* self,
                                      DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiListRow* dino_ui_list_row_new_from_jid (DinoStreamInteractor* stream_interactor,
                                              XmppJid* jid,
                                              DinoEntitiesAccount* account,
                                              gboolean show_account);
VALA_EXTERN DinoUiListRow* dino_ui_list_row_construct_from_jid (GType object_type,
                                                    DinoStreamInteractor* stream_interactor,
                                                    XmppJid* jid,
                                                    DinoEntitiesAccount* account,
                                                    gboolean show_account);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
VALA_EXTERN gchar* dino_ui_util_get_conversation_display_name (DinoStreamInteractor* stream_interactor,
                                                   DinoEntitiesConversation* conversation);
VALA_EXTERN gboolean dino_ui_util_use_tooltips (void);
VALA_EXTERN gchar* dino_ui_util_string_if_tooltips_active (const gchar* s);
VALA_EXTERN DinoUiViewModelCompatAvatarPictureModel* dino_ui_view_model_compat_avatar_picture_model_new (DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiViewModelCompatAvatarPictureModel* dino_ui_view_model_compat_avatar_picture_model_construct (GType object_type,
                                                                                                   DinoStreamInteractor* stream_interactor);
VALA_EXTERN GType dino_ui_view_model_avatar_picture_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiViewModelAvatarPictureModel, g_object_unref)
VALA_EXTERN GType dino_ui_view_model_compat_avatar_picture_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiViewModelCompatAvatarPictureModel, g_object_unref)
VALA_EXTERN DinoUiViewModelCompatAvatarPictureModel* dino_ui_view_model_compat_avatar_picture_model_set_conversation (DinoUiViewModelCompatAvatarPictureModel* self,
                                                                                                          DinoEntitiesConversation* conversation);
VALA_EXTERN void dino_ui_avatar_picture_set_model (DinoUiAvatarPicture* self,
                                       DinoUiViewModelAvatarPictureModel* value);
static void __lambda85_ (Block4Data* _data4_,
                  XmppJid* jid,
                  DinoEntitiesAccount* account);
static void ___lambda85__dino_presence_manager_show_received (DinoPresenceManager* _sender,
                                                       XmppJid* jid,
                                                       DinoEntitiesAccount* account,
                                                       gpointer self);
static void _vala_array_add1 (gulong* * array,
                       gint* length,
                       gint* size,
                       gulong value);
static void __lambda86_ (Block4Data* _data4_,
                  XmppJid* jid,
                  DinoEntitiesAccount* account);
static void ___lambda86__dino_presence_manager_received_offline_presence (DinoPresenceManager* _sender,
                                                                   XmppJid* jid,
                                                                   DinoEntitiesAccount* account,
                                                                   gpointer self);
static void _vala_array_add2 (gulong* * array,
                       gint* length,
                       gint* size,
                       gulong value);
static void dino_ui_list_row_real_dispose (GObject* base);
VALA_EXTERN DinoUiListRow* dino_ui_list_row_new (void);
VALA_EXTERN DinoUiListRow* dino_ui_list_row_construct (GType object_type);
static GObject * dino_ui_list_row_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties);
static void dino_ui_list_row_finalize (GObject * obj);
static GType dino_ui_list_row_get_type_once (void);

static inline gpointer
dino_ui_list_row_get_instance_private (DinoUiListRow* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiListRow_private_offset);
}

static void
dino_ui_list_row_set_status_dot (DinoUiListRow* self,
                                 DinoStreamInteractor* stream_interactor)
{
	GtkImage* _tmp0_;
	DinoConnectionManager* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	GeeList* full_jids = NULL;
	DinoModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	DinoPresenceManager* _tmp5_;
	XmppJid* _tmp6_;
	DinoEntitiesAccount* _tmp7_;
	GeeList* _tmp8_;
	GeeList* _tmp9_;
	GeeList* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream_interactor != NULL);
	_tmp0_ = self->status_dot;
	_tmp1_ = stream_interactor->connection_manager;
	_tmp2_ = self->account;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, dino_connection_manager_get_state (_tmp1_, _tmp2_) == DINO_CONNECTION_MANAGER_CONNECTION_STATE_CONNECTED);
	_tmp3_ = dino_presence_manager_IDENTITY;
	_tmp4_ = dino_stream_interactor_get_module (stream_interactor, DINO_TYPE_PRESENCE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (DinoPresenceManager*) _tmp4_;
	_tmp6_ = self->jid;
	_tmp7_ = self->account;
	_tmp8_ = dino_presence_manager_get_full_jids (_tmp5_, _tmp6_, _tmp7_);
	_tmp9_ = _tmp8_;
	_g_object_unref0 (_tmp5_);
	full_jids = _tmp9_;
	_tmp10_ = full_jids;
	if (_tmp10_ != NULL) {
		GeeArrayList* statuses = NULL;
		GeeArrayList* _tmp11_;
		GeeArrayList* _tmp28_;
		_tmp11_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
		statuses = _tmp11_;
		{
			GeeList* _full_jid_list = NULL;
			GeeList* _tmp12_;
			gint _full_jid_size = 0;
			GeeList* _tmp13_;
			gint _tmp14_;
			gint _tmp15_;
			gint _full_jid_index = 0;
			_tmp12_ = full_jids;
			_full_jid_list = _tmp12_;
			_tmp13_ = _full_jid_list;
			_tmp14_ = gee_collection_get_size ((GeeCollection*) _tmp13_);
			_tmp15_ = _tmp14_;
			_full_jid_size = _tmp15_;
			_full_jid_index = -1;
			while (TRUE) {
				gint _tmp16_;
				gint _tmp17_;
				XmppJid* full_jid = NULL;
				GeeList* _tmp18_;
				gpointer _tmp19_;
				GeeArrayList* _tmp20_;
				DinoModuleIdentity* _tmp21_;
				gpointer _tmp22_;
				DinoPresenceManager* _tmp23_;
				XmppJid* _tmp24_;
				DinoEntitiesAccount* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				_full_jid_index = _full_jid_index + 1;
				_tmp16_ = _full_jid_index;
				_tmp17_ = _full_jid_size;
				if (!(_tmp16_ < _tmp17_)) {
					break;
				}
				_tmp18_ = _full_jid_list;
				_tmp19_ = gee_list_get (_tmp18_, _full_jid_index);
				full_jid = (XmppJid*) _tmp19_;
				_tmp20_ = statuses;
				_tmp21_ = dino_presence_manager_IDENTITY;
				_tmp22_ = dino_stream_interactor_get_module (stream_interactor, DINO_TYPE_PRESENCE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp21_);
				_tmp23_ = (DinoPresenceManager*) _tmp22_;
				_tmp24_ = full_jid;
				_tmp25_ = self->account;
				_tmp26_ = dino_presence_manager_get_last_show (_tmp23_, _tmp24_, _tmp25_);
				_tmp27_ = _tmp26_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, _tmp27_);
				_g_free0 (_tmp27_);
				_g_object_unref0 (_tmp23_);
				_xmpp_jid_unref0 (full_jid);
			}
		}
		_tmp28_ = statuses;
		if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp28_, XMPP_PRESENCE_STANZA_SHOW_DND)) {
			GtkImage* _tmp29_;
			_tmp29_ = self->status_dot;
			gtk_image_set_from_icon_name (_tmp29_, "dino-status-dnd");
		} else {
			GeeArrayList* _tmp30_;
			_tmp30_ = statuses;
			if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp30_, XMPP_PRESENCE_STANZA_SHOW_CHAT)) {
				GtkImage* _tmp31_;
				_tmp31_ = self->status_dot;
				gtk_image_set_from_icon_name (_tmp31_, "dino-status-chat");
			} else {
				GeeArrayList* _tmp32_;
				_tmp32_ = statuses;
				if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp32_, XMPP_PRESENCE_STANZA_SHOW_ONLINE)) {
					GtkImage* _tmp33_;
					_tmp33_ = self->status_dot;
					gtk_image_set_from_icon_name (_tmp33_, "dino-status-online");
				} else {
					GeeArrayList* _tmp34_;
					_tmp34_ = statuses;
					if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp34_, XMPP_PRESENCE_STANZA_SHOW_AWAY)) {
						GtkImage* _tmp35_;
						_tmp35_ = self->status_dot;
						gtk_image_set_from_icon_name (_tmp35_, "dino-status-away");
					} else {
						GeeArrayList* _tmp36_;
						_tmp36_ = statuses;
						if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp36_, XMPP_PRESENCE_STANZA_SHOW_XA)) {
							GtkImage* _tmp37_;
							_tmp37_ = self->status_dot;
							gtk_image_set_from_icon_name (_tmp37_, "dino-status-away");
						} else {
							GtkImage* _tmp38_;
							_tmp38_ = self->status_dot;
							gtk_image_set_from_icon_name (_tmp38_, "dino-status-offline");
						}
					}
				}
			}
		}
		_g_object_unref0 (statuses);
	} else {
		GtkImage* _tmp39_;
		_tmp39_ = self->status_dot;
		gtk_image_set_from_icon_name (_tmp39_, "dino-status-offline");
	}
	_g_object_unref0 (full_jids);
}

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

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		DinoUiListRow* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->stream_interactor);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

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

static void
__lambda85_ (Block4Data* _data4_,
             XmppJid* jid,
             DinoEntitiesAccount* account)
{
	DinoUiListRow* self;
	gboolean _tmp0_ = FALSE;
	DinoEntitiesAccount* _tmp1_;
	self = _data4_->self;
	g_return_if_fail (jid != NULL);
	g_return_if_fail (account != NULL);
	_tmp1_ = self->account;
	if (dino_entities_account_equals (account, _tmp1_)) {
		XmppJid* _tmp2_;
		_tmp2_ = self->jid;
		_tmp0_ = xmpp_jid_equals_bare (jid, _tmp2_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		dino_ui_list_row_set_status_dot (self, _data4_->stream_interactor);
	}
}

static void
___lambda85__dino_presence_manager_show_received (DinoPresenceManager* _sender,
                                                  XmppJid* jid,
                                                  DinoEntitiesAccount* account,
                                                  gpointer self)
{
	__lambda85_ (self, jid, account);
}

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

static void
__lambda86_ (Block4Data* _data4_,
             XmppJid* jid,
             DinoEntitiesAccount* account)
{
	DinoUiListRow* self;
	gboolean _tmp0_ = FALSE;
	DinoEntitiesAccount* _tmp1_;
	self = _data4_->self;
	g_return_if_fail (jid != NULL);
	g_return_if_fail (account != NULL);
	_tmp1_ = self->account;
	if (dino_entities_account_equals (account, _tmp1_)) {
		XmppJid* _tmp2_;
		_tmp2_ = self->jid;
		_tmp0_ = xmpp_jid_equals_bare (jid, _tmp2_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		dino_ui_list_row_set_status_dot (self, _data4_->stream_interactor);
	}
}

static void
___lambda86__dino_presence_manager_received_offline_presence (DinoPresenceManager* _sender,
                                                              XmppJid* jid,
                                                              DinoEntitiesAccount* account,
                                                              gpointer self)
{
	__lambda86_ (self, jid, account);
}

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

DinoUiListRow*
dino_ui_list_row_construct_from_jid (GType object_type,
                                     DinoStreamInteractor* stream_interactor,
                                     XmppJid* jid,
                                     DinoEntitiesAccount* account,
                                     gboolean show_account)
{
	DinoUiListRow * self = NULL;
	Block4Data* _data4_;
	DinoStreamInteractor* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	XmppJid* _tmp2_;
	DinoEntitiesAccount* _tmp3_;
	DinoEntitiesConversation* conv = NULL;
	DinoEntitiesConversation* _tmp4_;
	gchar* display_name = NULL;
	DinoEntitiesConversation* _tmp5_;
	gchar* _tmp6_;
	gboolean _tmp7_ = FALSE;
	GtkLabel* _tmp38_;
	const gchar* _tmp39_;
	DinoUiAvatarPicture* _tmp40_;
	DinoUiViewModelCompatAvatarPictureModel* _tmp41_;
	DinoUiViewModelCompatAvatarPictureModel* _tmp42_;
	DinoEntitiesConversation* _tmp43_;
	DinoUiViewModelCompatAvatarPictureModel* _tmp44_;
	DinoUiViewModelCompatAvatarPictureModel* _tmp45_;
	DinoModuleIdentity* _tmp46_;
	gpointer _tmp47_;
	DinoPresenceManager* _tmp48_;
	gulong _tmp49_;
	DinoModuleIdentity* _tmp50_;
	gpointer _tmp51_;
	DinoPresenceManager* _tmp52_;
	gulong _tmp53_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	g_return_val_if_fail (jid != NULL, NULL);
	g_return_val_if_fail (account != NULL, NULL);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (_data4_->stream_interactor);
	_data4_->stream_interactor = _tmp0_;
	self = (DinoUiListRow*) g_object_new (object_type, NULL);
	_data4_->self = g_object_ref (self);
	_tmp1_ = _g_object_ref0 (_data4_->stream_interactor);
	_g_object_unref0 (self->stream_interactor);
	self->stream_interactor = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (jid);
	_xmpp_jid_unref0 (self->jid);
	self->jid = _tmp2_;
	_tmp3_ = _g_object_ref0 (account);
	_g_object_unref0 (self->account);
	self->account = _tmp3_;
	_tmp4_ = dino_entities_conversation_new (jid, account, DINO_ENTITIES_CONVERSATION_TYPE_CHAT);
	conv = _tmp4_;
	_tmp5_ = conv;
	_tmp6_ = dino_ui_util_get_conversation_display_name (_data4_->stream_interactor, _tmp5_);
	display_name = _tmp6_;
	if (show_account) {
		GeeArrayList* _tmp8_;
		GeeArrayList* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		_tmp8_ = dino_stream_interactor_get_accounts (_data4_->stream_interactor);
		_tmp9_ = _tmp8_;
		_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp7_ = _tmp11_ > 1;
		_g_object_unref0 (_tmp9_);
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		GtkLabel* _tmp12_;
		XmppJid* _tmp13_;
		XmppJid* _tmp14_;
		XmppJid* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		_tmp12_ = self->via_label;
		_tmp13_ = dino_entities_account_get_bare_jid (account);
		_tmp14_ = _tmp13_;
		_tmp15_ = _tmp14_;
		_tmp16_ = xmpp_jid_to_string (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = g_strconcat ("via ", _tmp17_, NULL);
		_tmp19_ = _tmp18_;
		gtk_label_set_label (_tmp12_, _tmp19_);
		_g_free0 (_tmp19_);
		_g_free0 (_tmp17_);
		_xmpp_jid_unref0 (_tmp15_);
		gtk_widget_set_has_tooltip ((GtkWidget*) self, dino_ui_util_use_tooltips ());
		_tmp20_ = xmpp_jid_to_string (jid);
		_tmp21_ = _tmp20_;
		_tmp22_ = dino_ui_util_string_if_tooltips_active (_tmp21_);
		_tmp23_ = _tmp22_;
		gtk_widget_set_tooltip_text ((GtkWidget*) self, _tmp23_);
		_g_free0 (_tmp23_);
		_g_free0 (_tmp21_);
	} else {
		const gchar* _tmp24_;
		XmppJid* _tmp25_;
		XmppJid* _tmp26_;
		XmppJid* _tmp27_;
		gchar* _tmp28_;
		gchar* _tmp29_;
		gboolean _tmp30_;
		_tmp24_ = display_name;
		_tmp25_ = xmpp_jid_get_bare_jid (jid);
		_tmp26_ = _tmp25_;
		_tmp27_ = _tmp26_;
		_tmp28_ = xmpp_jid_to_string (_tmp27_);
		_tmp29_ = _tmp28_;
		_tmp30_ = g_strcmp0 (_tmp24_, _tmp29_) != 0;
		_g_free0 (_tmp29_);
		_xmpp_jid_unref0 (_tmp27_);
		if (_tmp30_) {
			GtkLabel* _tmp31_;
			XmppJid* _tmp32_;
			XmppJid* _tmp33_;
			XmppJid* _tmp34_;
			gchar* _tmp35_;
			gchar* _tmp36_;
			_tmp31_ = self->via_label;
			_tmp32_ = xmpp_jid_get_bare_jid (jid);
			_tmp33_ = _tmp32_;
			_tmp34_ = _tmp33_;
			_tmp35_ = xmpp_jid_to_string (_tmp34_);
			_tmp36_ = _tmp35_;
			gtk_label_set_label (_tmp31_, _tmp36_);
			_g_free0 (_tmp36_);
			_xmpp_jid_unref0 (_tmp34_);
		} else {
			GtkLabel* _tmp37_;
			_tmp37_ = self->via_label;
			gtk_widget_set_visible ((GtkWidget*) _tmp37_, FALSE);
		}
	}
	_tmp38_ = self->name_label;
	_tmp39_ = display_name;
	gtk_label_set_label (_tmp38_, _tmp39_);
	_tmp40_ = self->picture;
	_tmp41_ = dino_ui_view_model_compat_avatar_picture_model_new (_data4_->stream_interactor);
	_tmp42_ = _tmp41_;
	_tmp43_ = conv;
	_tmp44_ = dino_ui_view_model_compat_avatar_picture_model_set_conversation (_tmp42_, _tmp43_);
	_tmp45_ = _tmp44_;
	dino_ui_avatar_picture_set_model (_tmp40_, (DinoUiViewModelAvatarPictureModel*) _tmp45_);
	_g_object_unref0 (_tmp45_);
	_g_object_unref0 (_tmp42_);
	_tmp46_ = dino_presence_manager_IDENTITY;
	_tmp47_ = dino_stream_interactor_get_module (_data4_->stream_interactor, DINO_TYPE_PRESENCE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp46_);
	_tmp48_ = (DinoPresenceManager*) _tmp47_;
	_tmp49_ = g_signal_connect_data (_tmp48_, "show-received", (GCallback) ___lambda85__dino_presence_manager_show_received, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_vala_array_add1 (&self->priv->handler_ids, &self->priv->handler_ids_length1, &self->priv->_handler_ids_size_, _tmp49_);
	_g_object_unref0 (_tmp48_);
	_tmp50_ = dino_presence_manager_IDENTITY;
	_tmp51_ = dino_stream_interactor_get_module (_data4_->stream_interactor, DINO_TYPE_PRESENCE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp50_);
	_tmp52_ = (DinoPresenceManager*) _tmp51_;
	_tmp53_ = g_signal_connect_data (_tmp52_, "received-offline-presence", (GCallback) ___lambda86__dino_presence_manager_received_offline_presence, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_vala_array_add2 (&self->priv->handler_ids, &self->priv->handler_ids_length1, &self->priv->_handler_ids_size_, _tmp53_);
	_g_object_unref0 (_tmp52_);
	dino_ui_list_row_set_status_dot (self, _data4_->stream_interactor);
	_g_free0 (display_name);
	_g_object_unref0 (conv);
	block4_data_unref (_data4_);
	_data4_ = NULL;
	return self;
}

DinoUiListRow*
dino_ui_list_row_new_from_jid (DinoStreamInteractor* stream_interactor,
                               XmppJid* jid,
                               DinoEntitiesAccount* account,
                               gboolean show_account)
{
	return dino_ui_list_row_construct_from_jid (DINO_UI_TYPE_LIST_ROW, stream_interactor, jid, account, show_account);
}

static void
dino_ui_list_row_real_dispose (GObject* base)
{
	DinoUiListRow * self;
	GtkBox* _tmp0_;
	gulong* _tmp1_;
	gint _tmp1__length1;
	self = (DinoUiListRow*) base;
	_tmp0_ = self->outer_box;
	gtk_widget_unparent ((GtkWidget*) _tmp0_);
	_tmp1_ = self->priv->handler_ids;
	_tmp1__length1 = self->priv->handler_ids_length1;
	{
		gulong* handler_id_collection = NULL;
		gint handler_id_collection_length1 = 0;
		gint _handler_id_collection_size_ = 0;
		gint handler_id_it = 0;
		handler_id_collection = _tmp1_;
		handler_id_collection_length1 = _tmp1__length1;
		for (handler_id_it = 0; handler_id_it < handler_id_collection_length1; handler_id_it = handler_id_it + 1) {
			gulong handler_id = 0UL;
			handler_id = handler_id_collection[handler_id_it];
			{
				DinoStreamInteractor* _tmp2_;
				DinoModuleIdentity* _tmp3_;
				gpointer _tmp4_;
				DinoPresenceManager* _tmp5_;
				_tmp2_ = self->stream_interactor;
				_tmp3_ = dino_presence_manager_IDENTITY;
				_tmp4_ = dino_stream_interactor_get_module (_tmp2_, DINO_TYPE_PRESENCE_MANAGER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
				_tmp5_ = (DinoPresenceManager*) _tmp4_;
				g_signal_handler_disconnect ((GObject*) _tmp5_, handler_id);
				_g_object_unref0 (_tmp5_);
			}
		}
	}
}

DinoUiListRow*
dino_ui_list_row_construct (GType object_type)
{
	DinoUiListRow * self = NULL;
	self = (DinoUiListRow*) g_object_new (object_type, NULL);
	return self;
}

DinoUiListRow*
dino_ui_list_row_new (void)
{
	return dino_ui_list_row_construct (DINO_UI_TYPE_LIST_ROW);
}

static GObject *
dino_ui_list_row_constructor (GType type,
                              guint n_construct_properties,
                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DinoUiListRow * self;
	GtkBuilder* builder = NULL;
	GtkBuilder* _tmp0_;
	GtkBuilder* _tmp1_;
	GObject* _tmp2_;
	GtkBox* _tmp3_;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_;
	DinoUiAvatarPicture* _tmp6_;
	GtkBuilder* _tmp7_;
	GObject* _tmp8_;
	GtkLabel* _tmp9_;
	GtkBuilder* _tmp10_;
	GObject* _tmp11_;
	GtkImage* _tmp12_;
	GtkBuilder* _tmp13_;
	GObject* _tmp14_;
	GtkLabel* _tmp15_;
	GtkBinLayout* _tmp16_;
	GtkBox* _tmp17_;
	parent_class = G_OBJECT_CLASS (dino_ui_list_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_LIST_ROW, DinoUiListRow);
	_tmp0_ = gtk_builder_new_from_resource ("/im/dino/Dino/add_conversation/list_row.ui");
	builder = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = gtk_builder_get_object (_tmp1_, "outer_box");
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_box_get_type (), GtkBox));
	_g_object_unref0 (self->outer_box);
	self->outer_box = _tmp3_;
	_tmp4_ = builder;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "picture");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, DINO_UI_TYPE_AVATAR_PICTURE, DinoUiAvatarPicture));
	_g_object_unref0 (self->picture);
	self->picture = _tmp6_;
	_tmp7_ = builder;
	_tmp8_ = gtk_builder_get_object (_tmp7_, "name_label");
	_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->name_label);
	self->name_label = _tmp9_;
	_tmp10_ = builder;
	_tmp11_ = gtk_builder_get_object (_tmp10_, "status_dot");
	_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_image_get_type (), GtkImage));
	_g_object_unref0 (self->status_dot);
	self->status_dot = _tmp12_;
	_tmp13_ = builder;
	_tmp14_ = gtk_builder_get_object (_tmp13_, "via_label");
	_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, gtk_label_get_type (), GtkLabel));
	_g_object_unref0 (self->via_label);
	self->via_label = _tmp15_;
	_tmp16_ = (GtkBinLayout*) gtk_bin_layout_new ();
	gtk_widget_set_layout_manager ((GtkWidget*) self, (GtkLayoutManager*) _tmp16_);
	_tmp17_ = self->outer_box;
	gtk_widget_set_parent ((GtkWidget*) _tmp17_, (GtkWidget*) self);
	_g_object_unref0 (builder);
	return obj;
}

static void
dino_ui_list_row_class_init (DinoUiListRowClass * klass,
                             gpointer klass_data)
{
	dino_ui_list_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiListRow_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dino_ui_list_row_real_dispose;
	G_OBJECT_CLASS (klass)->constructor = dino_ui_list_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_list_row_finalize;
}

static void
dino_ui_list_row_instance_init (DinoUiListRow * self,
                                gpointer klass)
{
	gulong* _tmp0_;
	self->priv = dino_ui_list_row_get_instance_private (self);
	_tmp0_ = g_new0 (gulong, 0);
	self->priv->handler_ids = _tmp0_;
	self->priv->handler_ids_length1 = 0;
	self->priv->_handler_ids_size_ = self->priv->handler_ids_length1;
}

static void
dino_ui_list_row_finalize (GObject * obj)
{
	DinoUiListRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_LIST_ROW, DinoUiListRow);
	_g_object_unref0 (self->outer_box);
	_g_object_unref0 (self->picture);
	_g_object_unref0 (self->name_label);
	_g_object_unref0 (self->status_dot);
	_g_object_unref0 (self->via_label);
	_g_object_unref0 (self->stream_interactor);
	_xmpp_jid_unref0 (self->jid);
	_g_object_unref0 (self->account);
	self->priv->handler_ids = (g_free (self->priv->handler_ids), NULL);
	G_OBJECT_CLASS (dino_ui_list_row_parent_class)->finalize (obj);
}

static GType
dino_ui_list_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiListRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_list_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiListRow), 0, (GInstanceInitFunc) dino_ui_list_row_instance_init, NULL };
	GType dino_ui_list_row_type_id;
	dino_ui_list_row_type_id = g_type_register_static (gtk_widget_get_type (), "DinoUiListRow", &g_define_type_info, 0);
	DinoUiListRow_private_offset = g_type_add_instance_private (dino_ui_list_row_type_id, sizeof (DinoUiListRowPrivate));
	return dino_ui_list_row_type_id;
}

GType
dino_ui_list_row_get_type (void)
{
	static volatile gsize dino_ui_list_row_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_list_row_type_id__once)) {
		GType dino_ui_list_row_type_id;
		dino_ui_list_row_type_id = dino_ui_list_row_get_type_once ();
		g_once_init_leave (&dino_ui_list_row_type_id__once, dino_ui_list_row_type_id);
	}
	return dino_ui_list_row_type_id__once;
}

