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

#include <glib-object.h>
#include "libdino.h"
#include <glib.h>
#include <gee.h>
#include <gtk/gtk.h>
#include "dino_i18n.h"
#include <stdlib.h>
#include <string.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_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR (dino_ui_conversation_summary_unread_indicator_populator_get_type ())
#define DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR, DinoUiConversationSummaryUnreadIndicatorPopulator))
#define DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR, DinoUiConversationSummaryUnreadIndicatorPopulatorClass))
#define DINO_UI_CONVERSATION_SUMMARY_IS_UNREAD_INDICATOR_POPULATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR))
#define DINO_UI_CONVERSATION_SUMMARY_IS_UNREAD_INDICATOR_POPULATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR))
#define DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR, DinoUiConversationSummaryUnreadIndicatorPopulatorClass))

typedef struct _DinoUiConversationSummaryUnreadIndicatorPopulator DinoUiConversationSummaryUnreadIndicatorPopulator;
typedef struct _DinoUiConversationSummaryUnreadIndicatorPopulatorClass DinoUiConversationSummaryUnreadIndicatorPopulatorClass;
typedef struct _DinoUiConversationSummaryUnreadIndicatorPopulatorPrivate DinoUiConversationSummaryUnreadIndicatorPopulatorPrivate;

#define DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_ITEM (dino_ui_conversation_summary_unread_indicator_item_get_type ())
#define DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_ITEM, DinoUiConversationSummaryUnreadIndicatorItem))
#define DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_ITEM, DinoUiConversationSummaryUnreadIndicatorItemClass))
#define DINO_UI_CONVERSATION_SUMMARY_IS_UNREAD_INDICATOR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_ITEM))
#define DINO_UI_CONVERSATION_SUMMARY_IS_UNREAD_INDICATOR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_ITEM))
#define DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_ITEM, DinoUiConversationSummaryUnreadIndicatorItemClass))

typedef struct _DinoUiConversationSummaryUnreadIndicatorItem DinoUiConversationSummaryUnreadIndicatorItem;
typedef struct _DinoUiConversationSummaryUnreadIndicatorItemClass DinoUiConversationSummaryUnreadIndicatorItemClass;
enum  {
	DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_0_PROPERTY,
	DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_ID_PROPERTY,
	DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_NUM_PROPERTIES
};
static GParamSpec* dino_ui_conversation_summary_unread_indicator_populator_properties[DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block44Data Block44Data;
typedef struct _DinoUiConversationSummaryUnreadIndicatorItemPrivate DinoUiConversationSummaryUnreadIndicatorItemPrivate;
enum  {
	DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_ITEM_0_PROPERTY,
	DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_ITEM_NUM_PROPERTIES
};
static GParamSpec* dino_ui_conversation_summary_unread_indicator_item_properties[DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_ITEM_NUM_PROPERTIES];
#define _pango_attr_list_unref0(var) ((var == NULL) ? NULL : (var = (pango_attr_list_unref (var), NULL)))

struct _DinoUiConversationSummaryUnreadIndicatorPopulator {
	GObject parent_instance;
	DinoUiConversationSummaryUnreadIndicatorPopulatorPrivate * priv;
};

struct _DinoUiConversationSummaryUnreadIndicatorPopulatorClass {
	GObjectClass parent_class;
};

struct _DinoUiConversationSummaryUnreadIndicatorPopulatorPrivate {
	DinoStreamInteractor* stream_interactor;
	DinoEntitiesConversation* current_conversation;
	DinoUiConversationSummaryUnreadIndicatorItem* unread_indicator;
	DinoPluginsConversationItemCollection* item_collection;
};

struct _Block44Data {
	int _ref_count_;
	DinoUiConversationSummaryUnreadIndicatorPopulator* self;
	DinoStreamInteractor* stream_interactor;
};

struct _DinoUiConversationSummaryUnreadIndicatorItem {
	DinoPluginsMetaConversationItem parent_instance;
	DinoUiConversationSummaryUnreadIndicatorItemPrivate * priv;
};

struct _DinoUiConversationSummaryUnreadIndicatorItemClass {
	DinoPluginsMetaConversationItemClass parent_class;
};

static gint DinoUiConversationSummaryUnreadIndicatorPopulator_private_offset;
static gpointer dino_ui_conversation_summary_unread_indicator_populator_parent_class = NULL;
static DinoPluginsConversationItemPopulatorIface * dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_item_populator_parent_iface = NULL;
static DinoPluginsConversationAdditionPopulatorIface * dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_addition_populator_parent_iface = NULL;
static gpointer dino_ui_conversation_summary_unread_indicator_item_parent_class = NULL;

VALA_EXTERN GType dino_ui_conversation_summary_unread_indicator_populator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationSummaryUnreadIndicatorPopulator, g_object_unref)
VALA_EXTERN GType dino_ui_conversation_summary_unread_indicator_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiConversationSummaryUnreadIndicatorItem, g_object_unref)
VALA_EXTERN DinoUiConversationSummaryUnreadIndicatorPopulator* dino_ui_conversation_summary_unread_indicator_populator_new (DinoStreamInteractor* stream_interactor);
VALA_EXTERN DinoUiConversationSummaryUnreadIndicatorPopulator* dino_ui_conversation_summary_unread_indicator_populator_construct (GType object_type,
                                                                                                                      DinoStreamInteractor* stream_interactor);
static Block44Data* block44_data_ref (Block44Data* _data44_);
static void block44_data_unref (void * _userdata_);
static void __lambda123_ (DinoUiConversationSummaryUnreadIndicatorPopulator* self);
static void dino_ui_conversation_summary_unread_indicator_populator_update_unread_indicator (DinoUiConversationSummaryUnreadIndicatorPopulator* self);
static void ___lambda123__dino_chat_interaction_focused_out (DinoChatInteraction* _sender,
                                                      DinoEntitiesConversation* conversation,
                                                      gpointer self);
static void __lambda124_ (Block44Data* _data44_);
static void ___lambda124__dino_content_item_store_new_item (DinoContentItemStore* _sender,
                                                     DinoContentItem* item,
                                                     DinoEntitiesConversation* conversation,
                                                     gpointer self);
VALA_EXTERN DinoUiConversationSummaryUnreadIndicatorItem* dino_ui_conversation_summary_unread_indicator_item_new (DinoContentItem* after_item);
VALA_EXTERN DinoUiConversationSummaryUnreadIndicatorItem* dino_ui_conversation_summary_unread_indicator_item_construct (GType object_type,
                                                                                                            DinoContentItem* after_item);
static void dino_ui_conversation_summary_unread_indicator_populator_real_init (DinoPluginsConversationItemPopulator* base,
                                                                        DinoEntitiesConversation* conversation,
                                                                        DinoPluginsConversationItemCollection* item_collection,
                                                                        DinoPluginsWidgetType type);
static void dino_ui_conversation_summary_unread_indicator_populator_real_close (DinoPluginsConversationItemPopulator* base,
                                                                         DinoEntitiesConversation* conversation);
static void dino_ui_conversation_summary_unread_indicator_populator_real_populate_timespan (DinoPluginsConversationAdditionPopulator* base,
                                                                                     DinoEntitiesConversation* conversation,
                                                                                     GDateTime* after,
                                                                                     GDateTime* before);
static void dino_ui_conversation_summary_unread_indicator_populator_finalize (GObject * obj);
static GType dino_ui_conversation_summary_unread_indicator_populator_get_type_once (void);
static void _vala_dino_ui_conversation_summary_unread_indicator_populator_get_property (GObject * object,
                                                                                 guint property_id,
                                                                                 GValue * value,
                                                                                 GParamSpec * pspec);
static GObject* dino_ui_conversation_summary_unread_indicator_item_real_get_widget (DinoPluginsMetaConversationItem* base,
                                                                             DinoPluginsConversationItemWidgetInterface* outer,
                                                                             DinoPluginsWidgetType type);
static GeeList* dino_ui_conversation_summary_unread_indicator_item_real_get_item_actions (DinoPluginsMetaConversationItem* base,
                                                                                   DinoPluginsWidgetType type);
static GType dino_ui_conversation_summary_unread_indicator_item_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_ui_conversation_summary_unread_indicator_populator_get_instance_private (DinoUiConversationSummaryUnreadIndicatorPopulator* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiConversationSummaryUnreadIndicatorPopulator_private_offset);
}

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

static Block44Data*
block44_data_ref (Block44Data* _data44_)
{
	g_atomic_int_inc (&_data44_->_ref_count_);
	return _data44_;
}

static void
block44_data_unref (void * _userdata_)
{
	Block44Data* _data44_;
	_data44_ = (Block44Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data44_->_ref_count_)) {
		DinoUiConversationSummaryUnreadIndicatorPopulator* self;
		self = _data44_->self;
		_g_object_unref0 (_data44_->stream_interactor);
		_g_object_unref0 (self);
		g_slice_free (Block44Data, _data44_);
	}
}

static void
__lambda123_ (DinoUiConversationSummaryUnreadIndicatorPopulator* self)
{
	dino_ui_conversation_summary_unread_indicator_populator_update_unread_indicator (self);
}

static void
___lambda123__dino_chat_interaction_focused_out (DinoChatInteraction* _sender,
                                                 DinoEntitiesConversation* conversation,
                                                 gpointer self)
{
	__lambda123_ ((DinoUiConversationSummaryUnreadIndicatorPopulator*) self);
}

static void
__lambda124_ (Block44Data* _data44_)
{
	DinoUiConversationSummaryUnreadIndicatorPopulator* self;
	DinoModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	DinoChatInteraction* _tmp2_;
	DinoEntitiesConversation* _tmp3_;
	gboolean _tmp4_;
	self = _data44_->self;
	_tmp0_ = dino_chat_interaction_IDENTITY;
	_tmp1_ = dino_stream_interactor_get_module (_data44_->stream_interactor, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (DinoChatInteraction*) _tmp1_;
	_tmp3_ = self->priv->current_conversation;
	_tmp4_ = !dino_chat_interaction_is_active_focus (_tmp2_, _tmp3_);
	_g_object_unref0 (_tmp2_);
	if (_tmp4_) {
		dino_ui_conversation_summary_unread_indicator_populator_update_unread_indicator (self);
	}
}

static void
___lambda124__dino_content_item_store_new_item (DinoContentItemStore* _sender,
                                                DinoContentItem* item,
                                                DinoEntitiesConversation* conversation,
                                                gpointer self)
{
	__lambda124_ (self);
}

DinoUiConversationSummaryUnreadIndicatorPopulator*
dino_ui_conversation_summary_unread_indicator_populator_construct (GType object_type,
                                                                   DinoStreamInteractor* stream_interactor)
{
	DinoUiConversationSummaryUnreadIndicatorPopulator * self = NULL;
	Block44Data* _data44_;
	DinoStreamInteractor* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoModuleIdentity* _tmp2_;
	gpointer _tmp3_;
	DinoChatInteraction* _tmp4_;
	DinoModuleIdentity* _tmp5_;
	gpointer _tmp6_;
	DinoContentItemStore* _tmp7_;
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	_data44_ = g_slice_new0 (Block44Data);
	_data44_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (_data44_->stream_interactor);
	_data44_->stream_interactor = _tmp0_;
	self = (DinoUiConversationSummaryUnreadIndicatorPopulator*) g_object_new (object_type, NULL);
	_data44_->self = g_object_ref (self);
	_tmp1_ = _g_object_ref0 (_data44_->stream_interactor);
	_g_object_unref0 (self->priv->stream_interactor);
	self->priv->stream_interactor = _tmp1_;
	_tmp2_ = dino_chat_interaction_IDENTITY;
	_tmp3_ = dino_stream_interactor_get_module (_data44_->stream_interactor, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp2_);
	_tmp4_ = (DinoChatInteraction*) _tmp3_;
	g_signal_connect_object (_tmp4_, "focused-out", (GCallback) ___lambda123__dino_chat_interaction_focused_out, self, 0);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = dino_content_item_store_IDENTITY;
	_tmp6_ = dino_stream_interactor_get_module (_data44_->stream_interactor, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp5_);
	_tmp7_ = (DinoContentItemStore*) _tmp6_;
	g_signal_connect_data (_tmp7_, "new-item", (GCallback) ___lambda124__dino_content_item_store_new_item, block44_data_ref (_data44_), (GClosureNotify) block44_data_unref, 0);
	_g_object_unref0 (_tmp7_);
	block44_data_unref (_data44_);
	_data44_ = NULL;
	return self;
}

DinoUiConversationSummaryUnreadIndicatorPopulator*
dino_ui_conversation_summary_unread_indicator_populator_new (DinoStreamInteractor* stream_interactor)
{
	return dino_ui_conversation_summary_unread_indicator_populator_construct (DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR, stream_interactor);
}

static void
dino_ui_conversation_summary_unread_indicator_populator_update_unread_indicator (DinoUiConversationSummaryUnreadIndicatorPopulator* self)
{
	DinoEntitiesConversation* _tmp0_;
	DinoContentItem* read_up_to_item = NULL;
	DinoStreamInteractor* _tmp1_;
	DinoModuleIdentity* _tmp2_;
	gpointer _tmp3_;
	DinoContentItemStore* _tmp4_;
	DinoEntitiesConversation* _tmp5_;
	DinoEntitiesConversation* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	DinoContentItem* _tmp9_;
	DinoContentItem* _tmp10_;
	gint current_num_unread = 0;
	DinoStreamInteractor* _tmp11_;
	DinoModuleIdentity* _tmp12_;
	gpointer _tmp13_;
	DinoChatInteraction* _tmp14_;
	DinoEntitiesConversation* _tmp15_;
	gint _tmp16_;
	gboolean _tmp17_ = FALSE;
	gboolean _tmp21_ = FALSE;
	DinoContentItem* _tmp22_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current_conversation;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->stream_interactor;
	_tmp2_ = dino_content_item_store_IDENTITY;
	_tmp3_ = dino_stream_interactor_get_module (_tmp1_, DINO_TYPE_CONTENT_ITEM_STORE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp2_);
	_tmp4_ = (DinoContentItemStore*) _tmp3_;
	_tmp5_ = self->priv->current_conversation;
	_tmp6_ = self->priv->current_conversation;
	_tmp7_ = dino_entities_conversation_get_read_up_to_item (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = dino_content_item_store_get_item_by_id (_tmp4_, _tmp5_, _tmp8_);
	_tmp10_ = _tmp9_;
	_g_object_unref0 (_tmp4_);
	read_up_to_item = _tmp10_;
	_tmp11_ = self->priv->stream_interactor;
	_tmp12_ = dino_chat_interaction_IDENTITY;
	_tmp13_ = dino_stream_interactor_get_module (_tmp11_, DINO_TYPE_CHAT_INTERACTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp12_);
	_tmp14_ = (DinoChatInteraction*) _tmp13_;
	_tmp15_ = self->priv->current_conversation;
	_tmp16_ = dino_chat_interaction_get_num_unread (_tmp14_, _tmp15_);
	_g_object_unref0 (_tmp14_);
	current_num_unread = _tmp16_;
	if (current_num_unread == 0) {
		DinoUiConversationSummaryUnreadIndicatorItem* _tmp18_;
		_tmp18_ = self->priv->unread_indicator;
		_tmp17_ = _tmp18_ != NULL;
	} else {
		_tmp17_ = FALSE;
	}
	if (_tmp17_) {
		DinoPluginsConversationItemCollection* _tmp19_;
		DinoUiConversationSummaryUnreadIndicatorItem* _tmp20_;
		_tmp19_ = self->priv->item_collection;
		_tmp20_ = self->priv->unread_indicator;
		dino_plugins_conversation_item_collection_remove_item (_tmp19_, (DinoPluginsMetaConversationItem*) _tmp20_);
		_g_object_unref0 (self->priv->unread_indicator);
		self->priv->unread_indicator = NULL;
	}
	_tmp22_ = read_up_to_item;
	if (_tmp22_ != NULL) {
		_tmp21_ = current_num_unread > 0;
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		DinoUiConversationSummaryUnreadIndicatorItem* _tmp23_;
		DinoContentItem* _tmp26_;
		DinoUiConversationSummaryUnreadIndicatorItem* _tmp27_;
		DinoPluginsConversationItemCollection* _tmp28_;
		DinoUiConversationSummaryUnreadIndicatorItem* _tmp29_;
		_tmp23_ = self->priv->unread_indicator;
		if (_tmp23_ != NULL) {
			DinoPluginsConversationItemCollection* _tmp24_;
			DinoUiConversationSummaryUnreadIndicatorItem* _tmp25_;
			_tmp24_ = self->priv->item_collection;
			_tmp25_ = self->priv->unread_indicator;
			dino_plugins_conversation_item_collection_remove_item (_tmp24_, (DinoPluginsMetaConversationItem*) _tmp25_);
		}
		_tmp26_ = read_up_to_item;
		_tmp27_ = dino_ui_conversation_summary_unread_indicator_item_new (_tmp26_);
		_g_object_unref0 (self->priv->unread_indicator);
		self->priv->unread_indicator = _tmp27_;
		_tmp28_ = self->priv->item_collection;
		_tmp29_ = self->priv->unread_indicator;
		dino_plugins_conversation_item_collection_insert_item (_tmp28_, (DinoPluginsMetaConversationItem*) _tmp29_);
	}
	_g_object_unref0 (read_up_to_item);
}

static void
dino_ui_conversation_summary_unread_indicator_populator_real_init (DinoPluginsConversationItemPopulator* base,
                                                                   DinoEntitiesConversation* conversation,
                                                                   DinoPluginsConversationItemCollection* item_collection,
                                                                   DinoPluginsWidgetType type)
{
	DinoUiConversationSummaryUnreadIndicatorPopulator * self;
	DinoEntitiesConversation* _tmp0_;
	DinoPluginsConversationItemCollection* _tmp1_;
	self = (DinoUiConversationSummaryUnreadIndicatorPopulator*) base;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (item_collection != NULL);
	_tmp0_ = _g_object_ref0 (conversation);
	_g_object_unref0 (self->priv->current_conversation);
	self->priv->current_conversation = _tmp0_;
	_tmp1_ = _g_object_ref0 (item_collection);
	_g_object_unref0 (self->priv->item_collection);
	self->priv->item_collection = _tmp1_;
	dino_ui_conversation_summary_unread_indicator_populator_update_unread_indicator (self);
}

static void
dino_ui_conversation_summary_unread_indicator_populator_real_close (DinoPluginsConversationItemPopulator* base,
                                                                    DinoEntitiesConversation* conversation)
{
	DinoUiConversationSummaryUnreadIndicatorPopulator * self;
	self = (DinoUiConversationSummaryUnreadIndicatorPopulator*) base;
	g_return_if_fail (conversation != NULL);
}

static void
dino_ui_conversation_summary_unread_indicator_populator_real_populate_timespan (DinoPluginsConversationAdditionPopulator* base,
                                                                                DinoEntitiesConversation* conversation,
                                                                                GDateTime* after,
                                                                                GDateTime* before)
{
	DinoUiConversationSummaryUnreadIndicatorPopulator * self;
	self = (DinoUiConversationSummaryUnreadIndicatorPopulator*) base;
	g_return_if_fail (conversation != NULL);
	g_return_if_fail (after != NULL);
	g_return_if_fail (before != NULL);
}

static const gchar*
dino_ui_conversation_summary_unread_indicator_populator_real_get_id (DinoPluginsConversationItemPopulator* base)
{
	const gchar* result;
	DinoUiConversationSummaryUnreadIndicatorPopulator* self;
	self = (DinoUiConversationSummaryUnreadIndicatorPopulator*) base;
	result = "unread_indicator";
	return result;
}

static void
dino_ui_conversation_summary_unread_indicator_populator_class_init (DinoUiConversationSummaryUnreadIndicatorPopulatorClass * klass,
                                                                    gpointer klass_data)
{
	dino_ui_conversation_summary_unread_indicator_populator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiConversationSummaryUnreadIndicatorPopulator_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_conversation_summary_unread_indicator_populator_get_property;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_conversation_summary_unread_indicator_populator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_ID_PROPERTY, dino_ui_conversation_summary_unread_indicator_populator_properties[DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_item_populator_interface_init (DinoPluginsConversationItemPopulatorIface * iface,
                                                                                                                 gpointer iface_data)
{
	dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_item_populator_parent_iface = g_type_interface_peek_parent (iface);
	iface->init = (void (*) (DinoPluginsConversationItemPopulator*, DinoEntitiesConversation*, DinoPluginsConversationItemCollection*, DinoPluginsWidgetType)) dino_ui_conversation_summary_unread_indicator_populator_real_init;
	iface->close = (void (*) (DinoPluginsConversationItemPopulator*, DinoEntitiesConversation*)) dino_ui_conversation_summary_unread_indicator_populator_real_close;
	iface->get_id = dino_ui_conversation_summary_unread_indicator_populator_real_get_id;
}

static void
dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_addition_populator_interface_init (DinoPluginsConversationAdditionPopulatorIface * iface,
                                                                                                                     gpointer iface_data)
{
	dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_addition_populator_parent_iface = g_type_interface_peek_parent (iface);
	iface->populate_timespan = (void (*) (DinoPluginsConversationAdditionPopulator*, DinoEntitiesConversation*, GDateTime*, GDateTime*)) dino_ui_conversation_summary_unread_indicator_populator_real_populate_timespan;
}

static void
dino_ui_conversation_summary_unread_indicator_populator_instance_init (DinoUiConversationSummaryUnreadIndicatorPopulator * self,
                                                                       gpointer klass)
{
	self->priv = dino_ui_conversation_summary_unread_indicator_populator_get_instance_private (self);
	self->priv->unread_indicator = NULL;
	self->priv->item_collection = NULL;
}

static void
dino_ui_conversation_summary_unread_indicator_populator_finalize (GObject * obj)
{
	DinoUiConversationSummaryUnreadIndicatorPopulator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR, DinoUiConversationSummaryUnreadIndicatorPopulator);
	_g_object_unref0 (self->priv->stream_interactor);
	_g_object_unref0 (self->priv->current_conversation);
	_g_object_unref0 (self->priv->unread_indicator);
	_g_object_unref0 (self->priv->item_collection);
	G_OBJECT_CLASS (dino_ui_conversation_summary_unread_indicator_populator_parent_class)->finalize (obj);
}

static GType
dino_ui_conversation_summary_unread_indicator_populator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiConversationSummaryUnreadIndicatorPopulatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_conversation_summary_unread_indicator_populator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiConversationSummaryUnreadIndicatorPopulator), 0, (GInstanceInitFunc) dino_ui_conversation_summary_unread_indicator_populator_instance_init, NULL };
	static const GInterfaceInfo dino_plugins_conversation_item_populator_info = { (GInterfaceInitFunc) dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_item_populator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo dino_plugins_conversation_addition_populator_info = { (GInterfaceInitFunc) dino_ui_conversation_summary_unread_indicator_populator_dino_plugins_conversation_addition_populator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_ui_conversation_summary_unread_indicator_populator_type_id;
	dino_ui_conversation_summary_unread_indicator_populator_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoUiConversationSummaryUnreadIndicatorPopulator", &g_define_type_info, 0);
	g_type_add_interface_static (dino_ui_conversation_summary_unread_indicator_populator_type_id, DINO_PLUGINS_TYPE_CONVERSATION_ITEM_POPULATOR, &dino_plugins_conversation_item_populator_info);
	g_type_add_interface_static (dino_ui_conversation_summary_unread_indicator_populator_type_id, DINO_PLUGINS_TYPE_CONVERSATION_ADDITION_POPULATOR, &dino_plugins_conversation_addition_populator_info);
	DinoUiConversationSummaryUnreadIndicatorPopulator_private_offset = g_type_add_instance_private (dino_ui_conversation_summary_unread_indicator_populator_type_id, sizeof (DinoUiConversationSummaryUnreadIndicatorPopulatorPrivate));
	return dino_ui_conversation_summary_unread_indicator_populator_type_id;
}

GType
dino_ui_conversation_summary_unread_indicator_populator_get_type (void)
{
	static volatile gsize dino_ui_conversation_summary_unread_indicator_populator_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_conversation_summary_unread_indicator_populator_type_id__once)) {
		GType dino_ui_conversation_summary_unread_indicator_populator_type_id;
		dino_ui_conversation_summary_unread_indicator_populator_type_id = dino_ui_conversation_summary_unread_indicator_populator_get_type_once ();
		g_once_init_leave (&dino_ui_conversation_summary_unread_indicator_populator_type_id__once, dino_ui_conversation_summary_unread_indicator_populator_type_id);
	}
	return dino_ui_conversation_summary_unread_indicator_populator_type_id__once;
}

static void
_vala_dino_ui_conversation_summary_unread_indicator_populator_get_property (GObject * object,
                                                                            guint property_id,
                                                                            GValue * value,
                                                                            GParamSpec * pspec)
{
	DinoUiConversationSummaryUnreadIndicatorPopulator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_POPULATOR, DinoUiConversationSummaryUnreadIndicatorPopulator);
	switch (property_id) {
		case DINO_UI_CONVERSATION_SUMMARY_UNREAD_INDICATOR_POPULATOR_ID_PROPERTY:
		g_value_set_string (value, dino_plugins_conversation_item_populator_get_id ((DinoPluginsConversationItemPopulator*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

DinoUiConversationSummaryUnreadIndicatorItem*
dino_ui_conversation_summary_unread_indicator_item_construct (GType object_type,
                                                              DinoContentItem* after_item)
{
	DinoUiConversationSummaryUnreadIndicatorItem * self = NULL;
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	g_return_val_if_fail (after_item != NULL, NULL);
	self = (DinoUiConversationSummaryUnreadIndicatorItem*) dino_plugins_meta_conversation_item_construct (object_type);
	_tmp0_ = dino_content_item_get_time (after_item);
	_tmp1_ = _tmp0_;
	dino_plugins_meta_conversation_item_set_time ((DinoPluginsMetaConversationItem*) self, _tmp1_);
	dino_plugins_meta_conversation_item_set_secondary_sort_indicator ((DinoPluginsMetaConversationItem*) self, G_MAXINT);
	return self;
}

DinoUiConversationSummaryUnreadIndicatorItem*
dino_ui_conversation_summary_unread_indicator_item_new (DinoContentItem* after_item)
{
	return dino_ui_conversation_summary_unread_indicator_item_construct (DINO_UI_CONVERSATION_SUMMARY_TYPE_UNREAD_INDICATOR_ITEM, after_item);
}

static GObject*
dino_ui_conversation_summary_unread_indicator_item_real_get_widget (DinoPluginsMetaConversationItem* base,
                                                                    DinoPluginsConversationItemWidgetInterface* outer,
                                                                    DinoPluginsWidgetType type)
{
	DinoUiConversationSummaryUnreadIndicatorItem * self;
	GtkBox* box = NULL;
	GtkBox* _tmp0_ = NULL;
	GtkStyleContext* _tmp1_;
	GtkSeparator* sep = NULL;
	GtkSeparator* _tmp2_ = NULL;
	GtkLabel* label = NULL;
	const gchar* _tmp3_;
	GtkLabel* _tmp4_ = NULL;
	PangoAttrList* _tmp5_;
	PangoAttrList* _tmp6_;
	PangoAttrList* _tmp7_;
	PangoAttrList* _tmp8_;
	PangoAttribute* _tmp9_;
	GObject* result;
	self = (DinoUiConversationSummaryUnreadIndicatorItem*) base;
	g_return_val_if_fail (outer != NULL, NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp0_, TRUE);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) box);
	gtk_style_context_add_class (_tmp1_, "dino-unread-line");
	_tmp2_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_valign ((GtkWidget*) _tmp2_, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	sep = _tmp2_;
	gtk_box_append (box, (GtkWidget*) sep);
	_tmp3_ = dino_gettext ("New");
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_END);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp4_, FALSE);
	g_object_ref_sink (_tmp4_);
	label = _tmp4_;
	_tmp5_ = pango_attr_list_new ();
	_tmp6_ = _tmp5_;
	gtk_label_set_attributes (label, _tmp6_);
	_pango_attr_list_unref0 (_tmp6_);
	_tmp7_ = gtk_label_get_attributes (label);
	_tmp8_ = _tmp7_;
	_tmp9_ = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
	pango_attr_list_insert (_tmp8_, _tmp9_);
	gtk_box_append (box, (GtkWidget*) label);
	result = (GObject*) box;
	_g_object_unref0 (label);
	_g_object_unref0 (sep);
	return result;
}

static GeeList*
dino_ui_conversation_summary_unread_indicator_item_real_get_item_actions (DinoPluginsMetaConversationItem* base,
                                                                          DinoPluginsWidgetType type)
{
	DinoUiConversationSummaryUnreadIndicatorItem * self;
	GeeList* result;
	self = (DinoUiConversationSummaryUnreadIndicatorItem*) base;
	result = NULL;
	return result;
}

static void
dino_ui_conversation_summary_unread_indicator_item_class_init (DinoUiConversationSummaryUnreadIndicatorItemClass * klass,
                                                               gpointer klass_data)
{
	dino_ui_conversation_summary_unread_indicator_item_parent_class = g_type_class_peek_parent (klass);
	((DinoPluginsMetaConversationItemClass *) klass)->get_widget = (GObject* (*) (DinoPluginsMetaConversationItem*, DinoPluginsConversationItemWidgetInterface*, DinoPluginsWidgetType)) dino_ui_conversation_summary_unread_indicator_item_real_get_widget;
	((DinoPluginsMetaConversationItemClass *) klass)->get_item_actions = (GeeList* (*) (DinoPluginsMetaConversationItem*, DinoPluginsWidgetType)) dino_ui_conversation_summary_unread_indicator_item_real_get_item_actions;
}

static void
dino_ui_conversation_summary_unread_indicator_item_instance_init (DinoUiConversationSummaryUnreadIndicatorItem * self,
                                                                  gpointer klass)
{
}

static GType
dino_ui_conversation_summary_unread_indicator_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiConversationSummaryUnreadIndicatorItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_conversation_summary_unread_indicator_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiConversationSummaryUnreadIndicatorItem), 0, (GInstanceInitFunc) dino_ui_conversation_summary_unread_indicator_item_instance_init, NULL };
	GType dino_ui_conversation_summary_unread_indicator_item_type_id;
	dino_ui_conversation_summary_unread_indicator_item_type_id = g_type_register_static (DINO_PLUGINS_TYPE_META_CONVERSATION_ITEM, "DinoUiConversationSummaryUnreadIndicatorItem", &g_define_type_info, 0);
	return dino_ui_conversation_summary_unread_indicator_item_type_id;
}

GType
dino_ui_conversation_summary_unread_indicator_item_get_type (void)
{
	static volatile gsize dino_ui_conversation_summary_unread_indicator_item_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_conversation_summary_unread_indicator_item_type_id__once)) {
		GType dino_ui_conversation_summary_unread_indicator_item_type_id;
		dino_ui_conversation_summary_unread_indicator_item_type_id = dino_ui_conversation_summary_unread_indicator_item_get_type_once ();
		g_once_init_leave (&dino_ui_conversation_summary_unread_indicator_item_type_id__once, dino_ui_conversation_summary_unread_indicator_item_type_id);
	}
	return dino_ui_conversation_summary_unread_indicator_item_type_id__once;
}

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

