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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <adwaita.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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

enum  {
	WIDGETS_ITEM_LABELS_0_PROPERTY,
	WIDGETS_ITEM_LABELS_ITEM_PROPERTY,
	WIDGETS_ITEM_LABELS_TOP_MARGIN_PROPERTY,
	WIDGETS_ITEM_LABELS_NUM_PROPERTIES
};
static GParamSpec* widgets_item_labels_properties[WIDGETS_ITEM_LABELS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block17Data Block17Data;
enum  {
	WIDGETS_ITEM_LABELS_LABEL_CLICKED_SIGNAL,
	WIDGETS_ITEM_LABELS_NUM_SIGNALS
};
static guint widgets_item_labels_signals[WIDGETS_ITEM_LABELS_NUM_SIGNALS] = {0};

struct _WidgetsItemLabelsPrivate {
	ObjectsItem* _item;
	AdwWrapBox* box_layout;
	GtkRevealer* main_revealer;
	GeeHashMap* item_labels_map;
	GeeHashMap* signal_map;
};

struct _Block17Data {
	int _ref_count_;
	WidgetsItemLabels* self;
	ObjectsLabel* label;
};

static gint WidgetsItemLabels_private_offset;
static gpointer widgets_item_labels_parent_class = NULL;

static void widgets_item_labels_disconnect_signals (WidgetsItemLabels* self);
static gboolean widgets_item_labels_get_has_items (WidgetsItemLabels* self);
static Block17Data* block17_data_ref (Block17Data* _data17_);
static void block17_data_unref (void * _userdata_);
static void ___lambda101_ (Block17Data* _data17_);
static void ____lambda101__gtk_button_clicked (GtkButton* _sender,
                                        gpointer self);
static void _widgets_item_labels_item___lambda102_ (WidgetsItemLabels* self,
                                             ObjectsLabel* label);
static void __widgets_item_labels_item___lambda102__objects_item_item_label_deleted (ObjectsItem* _sender,
                                                                              ObjectsLabel* label,
                                                                              gpointer self);
static void _widgets_item_labels_item___lambda103_ (WidgetsItemLabels* self,
                                             ObjectsLabel* label);
static void __widgets_item_labels_item___lambda103__objects_item_item_label_added (ObjectsItem* _sender,
                                                                            ObjectsLabel* label,
                                                                            gpointer self);
static GObject * widgets_item_labels_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static void widgets_item_labels_finalize (GObject * obj);
static GType widgets_item_labels_get_type_once (void);
static void _vala_widgets_item_labels_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_widgets_item_labels_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
widgets_item_labels_get_instance_private (WidgetsItemLabels* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsItemLabels_private_offset);
}

static void
widgets_item_labels_disconnect_signals (WidgetsItemLabels* self)
{
	GeeHashMap* _tmp15_;
	g_return_if_fail (self != NULL);
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->signal_map;
		_tmp1_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_entry_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			GeeMapEntry* _tmp9_;
			gconstpointer _tmp10_;
			gconstpointer _tmp11_;
			GeeMapEntry* _tmp12_;
			gconstpointer _tmp13_;
			gconstpointer _tmp14_;
			_tmp6_ = _entry_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _entry_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			entry = (GeeMapEntry*) _tmp8_;
			_tmp9_ = entry;
			_tmp10_ = gee_map_entry_get_value (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = entry;
			_tmp13_ = gee_map_entry_get_key (_tmp12_);
			_tmp14_ = _tmp13_;
			g_signal_handler_disconnect ((GObject*) _tmp11_, (gulong) ((guintptr) _tmp14_));
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp15_ = self->priv->signal_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp15_);
}

void
widgets_item_labels_add_labels (WidgetsItemLabels* self)
{
	ObjectsItem* _tmp0_;
	GtkRevealer* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_item;
	if (_tmp0_ == NULL) {
		return;
	}
	{
		GeeArrayList* _label_list = NULL;
		ObjectsItem* _tmp1_;
		GeeArrayList* _tmp2_;
		gint _label_size = 0;
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _label_index = 0;
		_tmp1_ = self->priv->_item;
		_tmp2_ = objects_item_get_labels_list (_tmp1_);
		_label_list = _tmp2_;
		_tmp3_ = _label_list;
		_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_label_size = _tmp5_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp8_;
			gpointer _tmp9_;
			ObjectsLabel* _tmp10_;
			_label_index = _label_index + 1;
			_tmp6_ = _label_index;
			_tmp7_ = _label_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _label_list;
			_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _label_index);
			label = (ObjectsLabel*) _tmp9_;
			_tmp10_ = label;
			widgets_item_labels_add_item_label (self, _tmp10_);
			_g_object_unref0 (label);
		}
		_g_object_unref0 (_label_list);
	}
	_tmp11_ = self->priv->main_revealer;
	_tmp12_ = widgets_item_labels_get_has_items (self);
	_tmp13_ = _tmp12_;
	gtk_revealer_set_reveal_child (_tmp11_, _tmp13_);
}

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

static Block17Data*
block17_data_ref (Block17Data* _data17_)
{
	g_atomic_int_inc (&_data17_->_ref_count_);
	return _data17_;
}

static void
block17_data_unref (void * _userdata_)
{
	Block17Data* _data17_;
	_data17_ = (Block17Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
		WidgetsItemLabels* self;
		self = _data17_->self;
		_g_object_unref0 (_data17_->label);
		_g_object_unref0 (self);
		g_slice_free (Block17Data, _data17_);
	}
}

static void
___lambda101_ (Block17Data* _data17_)
{
	WidgetsItemLabels* self;
	self = _data17_->self;
	g_signal_emit (self, widgets_item_labels_signals[WIDGETS_ITEM_LABELS_LABEL_CLICKED_SIGNAL], 0, _data17_->label);
}

static void
____lambda101__gtk_button_clicked (GtkButton* _sender,
                                   gpointer self)
{
	___lambda101_ (self);
}

void
widgets_item_labels_add_item_label (WidgetsItemLabels* self,
                                    ObjectsLabel* label)
{
	Block17Data* _data17_;
	ObjectsLabel* _tmp0_;
	GeeHashMap* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GtkRevealer* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_data17_ = g_slice_new0 (Block17Data);
	_data17_->_ref_count_ = 1;
	_data17_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (label);
	_g_object_unref0 (_data17_->label);
	_data17_->label = _tmp0_;
	_tmp1_ = self->priv->item_labels_map;
	_tmp2_ = objects_base_object_get_id ((ObjectsBaseObject*) _data17_->label);
	_tmp3_ = _tmp2_;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, _tmp3_)) {
		GeeHashMap* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		WidgetsItemLabelChild* _tmp7_;
		WidgetsItemLabelChild* _tmp8_;
		GeeHashMap* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gpointer _tmp12_;
		WidgetsItemLabelChild* _tmp13_;
		AdwWrapBox* _tmp14_;
		GeeHashMap* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gpointer _tmp18_;
		WidgetsItemLabelChild* _tmp19_;
		_tmp4_ = self->priv->item_labels_map;
		_tmp5_ = objects_base_object_get_id ((ObjectsBaseObject*) _data17_->label);
		_tmp6_ = _tmp5_;
		_tmp7_ = widgets_item_label_child_new (_data17_->label);
		g_object_ref_sink (_tmp7_);
		_tmp8_ = _tmp7_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, _tmp6_, _tmp8_);
		_g_object_unref0 (_tmp8_);
		_tmp9_ = self->priv->item_labels_map;
		_tmp10_ = objects_base_object_get_id ((ObjectsBaseObject*) _data17_->label);
		_tmp11_ = _tmp10_;
		_tmp12_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, _tmp11_);
		_tmp13_ = (WidgetsItemLabelChild*) _tmp12_;
		g_signal_connect_data ((GtkButton*) _tmp13_, "clicked", (GCallback) ____lambda101__gtk_button_clicked, block17_data_ref (_data17_), (GClosureNotify) block17_data_unref, 0);
		_g_object_unref0 (_tmp13_);
		_tmp14_ = self->priv->box_layout;
		_tmp15_ = self->priv->item_labels_map;
		_tmp16_ = objects_base_object_get_id ((ObjectsBaseObject*) _data17_->label);
		_tmp17_ = _tmp16_;
		_tmp18_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp15_, _tmp17_);
		_tmp19_ = (WidgetsItemLabelChild*) _tmp18_;
		adw_wrap_box_append (_tmp14_, (GtkWidget*) _tmp19_);
		_g_object_unref0 (_tmp19_);
	}
	_tmp20_ = self->priv->main_revealer;
	_tmp21_ = widgets_item_labels_get_has_items (self);
	_tmp22_ = _tmp21_;
	gtk_revealer_set_reveal_child (_tmp20_, _tmp22_);
	block17_data_unref (_data17_);
	_data17_ = NULL;
}

void
widgets_item_labels_remove_item_label (WidgetsItemLabels* self,
                                       ObjectsLabel* label)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkRevealer* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	_tmp0_ = self->priv->item_labels_map;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) label);
	_tmp2_ = _tmp1_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		GeeHashMap* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gpointer _tmp6_;
		WidgetsItemLabelChild* _tmp7_;
		GeeHashMap* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp3_ = self->priv->item_labels_map;
		_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) label);
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp3_, _tmp5_);
		_tmp7_ = (WidgetsItemLabelChild*) _tmp6_;
		widgets_item_label_child_hide_destroy (_tmp7_);
		_g_object_unref0 (_tmp7_);
		_tmp8_ = self->priv->item_labels_map;
		_tmp9_ = objects_base_object_get_id ((ObjectsBaseObject*) label);
		_tmp10_ = _tmp9_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp8_, _tmp10_, NULL);
	}
	_tmp11_ = self->priv->main_revealer;
	_tmp12_ = widgets_item_labels_get_has_items (self);
	_tmp13_ = _tmp12_;
	gtk_revealer_set_reveal_child (_tmp11_, _tmp13_);
}

void
widgets_item_labels_update_labels (WidgetsItemLabels* self)
{
	g_return_if_fail (self != NULL);
	widgets_item_labels_reset (self);
	widgets_item_labels_add_labels (self);
}

void
widgets_item_labels_reset (WidgetsItemLabels* self)
{
	GeeHashMap* _tmp11_;
	g_return_if_fail (self != NULL);
	{
		GeeIterator* _item_label_row_it = NULL;
		GeeHashMap* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->item_labels_map;
		_tmp1_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_item_label_row_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			WidgetsItemLabelChild* item_label_row = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			AdwWrapBox* _tmp9_;
			WidgetsItemLabelChild* _tmp10_;
			_tmp6_ = _item_label_row_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _item_label_row_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			item_label_row = (WidgetsItemLabelChild*) _tmp8_;
			_tmp9_ = self->priv->box_layout;
			_tmp10_ = item_label_row;
			adw_wrap_box_remove (_tmp9_, (GtkWidget*) _tmp10_);
			_g_object_unref0 (item_label_row);
		}
		_g_object_unref0 (_item_label_row_it);
	}
	_tmp11_ = self->priv->item_labels_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp11_);
}

void
widgets_item_labels_clean_up (WidgetsItemLabels* self)
{
	g_return_if_fail (self != NULL);
	widgets_item_labels_disconnect_signals (self);
	{
		GeeIterator* _item_label_row_it = NULL;
		GeeHashMap* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->item_labels_map;
		_tmp1_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_item_label_row_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			WidgetsItemLabelChild* item_label_row = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			WidgetsItemLabelChild* _tmp9_;
			_tmp6_ = _item_label_row_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _item_label_row_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			item_label_row = (WidgetsItemLabelChild*) _tmp8_;
			_tmp9_ = item_label_row;
			widgets_item_label_child_clean_up (_tmp9_);
			_g_object_unref0 (item_label_row);
		}
		_g_object_unref0 (_item_label_row_it);
	}
}

WidgetsItemLabels*
widgets_item_labels_construct (GType object_type)
{
	WidgetsItemLabels * self = NULL;
	self = (WidgetsItemLabels*) g_object_new (object_type, NULL);
	return self;
}

WidgetsItemLabels*
widgets_item_labels_new (void)
{
	return widgets_item_labels_construct (WIDGETS_TYPE_ITEM_LABELS);
}

ObjectsItem*
widgets_item_labels_get_item (WidgetsItemLabels* self)
{
	ObjectsItem* result;
	ObjectsItem* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_item;
	result = _tmp0_;
	return result;
}

static void
_widgets_item_labels_item___lambda102_ (WidgetsItemLabels* self,
                                        ObjectsLabel* label)
{
	g_return_if_fail (label != NULL);
	widgets_item_labels_remove_item_label (self, label);
}

static void
__widgets_item_labels_item___lambda102__objects_item_item_label_deleted (ObjectsItem* _sender,
                                                                         ObjectsLabel* label,
                                                                         gpointer self)
{
	_widgets_item_labels_item___lambda102_ ((WidgetsItemLabels*) self, label);
}

static void
_widgets_item_labels_item___lambda103_ (WidgetsItemLabels* self,
                                        ObjectsLabel* label)
{
	g_return_if_fail (label != NULL);
	widgets_item_labels_add_item_label (self, label);
}

static void
__widgets_item_labels_item___lambda103__objects_item_item_label_added (ObjectsItem* _sender,
                                                                       ObjectsLabel* label,
                                                                       gpointer self)
{
	_widgets_item_labels_item___lambda103_ ((WidgetsItemLabels*) self, label);
}

void
widgets_item_labels_set_item (WidgetsItemLabels* self,
                              ObjectsItem* value)
{
	ObjectsItem* _tmp0_;
	GeeHashMap* _tmp1_;
	ObjectsItem* _tmp2_;
	gulong _tmp3_;
	ObjectsItem* _tmp4_;
	GeeHashMap* _tmp5_;
	ObjectsItem* _tmp6_;
	gulong _tmp7_;
	ObjectsItem* _tmp8_;
	g_return_if_fail (self != NULL);
	widgets_item_labels_disconnect_signals (self);
	widgets_item_labels_reset (self);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_item);
	self->priv->_item = _tmp0_;
	_tmp1_ = self->priv->signal_map;
	_tmp2_ = self->priv->_item;
	_tmp3_ = g_signal_connect_object (_tmp2_, "item-label-deleted", (GCallback) __widgets_item_labels_item___lambda102__objects_item_item_label_deleted, self, 0);
	_tmp4_ = self->priv->_item;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp1_, (gpointer) ((guintptr) _tmp3_), (GObject*) _tmp4_);
	_tmp5_ = self->priv->signal_map;
	_tmp6_ = self->priv->_item;
	_tmp7_ = g_signal_connect_object (_tmp6_, "item-label-added", (GCallback) __widgets_item_labels_item___lambda103__objects_item_item_label_added, self, 0);
	_tmp8_ = self->priv->_item;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, (gpointer) ((guintptr) _tmp7_), (GObject*) _tmp8_);
	widgets_item_labels_add_labels (self);
	g_object_notify_by_pspec ((GObject *) self, widgets_item_labels_properties[WIDGETS_ITEM_LABELS_ITEM_PROPERTY]);
}

static gboolean
widgets_item_labels_get_has_items (WidgetsItemLabels* self)
{
	gboolean result;
	GeeHashMap* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->item_labels_map;
	_tmp1_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ > 0;
	return result;
}

void
widgets_item_labels_set_top_margin (WidgetsItemLabels* self,
                                    gint value)
{
	AdwWrapBox* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->box_layout;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, widgets_item_labels_properties[WIDGETS_ITEM_LABELS_TOP_MARGIN_PROPERTY]);
}

static GObject *
widgets_item_labels_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsItemLabels * self;
	AdwWrapBox* _tmp0_ = NULL;
	AdwWrapBox* _tmp1_;
	GtkWidget* _tmp2_;
	GtkRevealer* _tmp3_ = NULL;
	GtkRevealer* _tmp4_;
	parent_class = G_OBJECT_CLASS (widgets_item_labels_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_ITEM_LABELS, WidgetsItemLabels);
	_tmp0_ = (AdwWrapBox*) adw_wrap_box_new ();
	adw_wrap_box_set_child_spacing (_tmp0_, 6);
	adw_wrap_box_set_line_spacing (_tmp0_, 6);
	gtk_widget_set_halign ((GtkWidget*) _tmp0_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->box_layout);
	self->priv->box_layout = _tmp0_;
	_tmp1_ = self->priv->box_layout;
	_tmp2_ = _g_object_ref0 ((GtkWidget*) _tmp1_);
	_tmp3_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp3_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	gtk_revealer_set_child (_tmp3_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->main_revealer);
	self->priv->main_revealer = _tmp3_;
	_tmp4_ = self->priv->main_revealer;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp4_);
	return obj;
}

static void
widgets_item_labels_class_init (WidgetsItemLabelsClass * klass,
                                gpointer klass_data)
{
	widgets_item_labels_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsItemLabels_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_item_labels_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_item_labels_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_item_labels_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_item_labels_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_ITEM_LABELS_ITEM_PROPERTY, widgets_item_labels_properties[WIDGETS_ITEM_LABELS_ITEM_PROPERTY] = g_param_spec_object ("item", "item", "item", OBJECTS_TYPE_ITEM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_ITEM_LABELS_TOP_MARGIN_PROPERTY, widgets_item_labels_properties[WIDGETS_ITEM_LABELS_TOP_MARGIN_PROPERTY] = g_param_spec_int ("top-margin", "top-margin", "top-margin", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	widgets_item_labels_signals[WIDGETS_ITEM_LABELS_LABEL_CLICKED_SIGNAL] = g_signal_new ("label-clicked", WIDGETS_TYPE_ITEM_LABELS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_LABEL);
}

static void
widgets_item_labels_instance_init (WidgetsItemLabels * self,
                                   gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	self->priv = widgets_item_labels_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, WIDGETS_TYPE_ITEM_LABEL_CHILD, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->item_labels_map = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_ULONG, NULL, NULL, G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->signal_map = _tmp1_;
}

static void
widgets_item_labels_finalize (GObject * obj)
{
	WidgetsItemLabels * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_ITEM_LABELS, WidgetsItemLabels);
	g_debug ("ItemLabels.vala:68: Destroying - Widgets.ItemLabels\n");
	_g_object_unref0 (self->priv->_item);
	_g_object_unref0 (self->priv->box_layout);
	_g_object_unref0 (self->priv->main_revealer);
	_g_object_unref0 (self->priv->item_labels_map);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (widgets_item_labels_parent_class)->finalize (obj);
}

static GType
widgets_item_labels_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsItemLabelsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_item_labels_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsItemLabels), 0, (GInstanceInitFunc) widgets_item_labels_instance_init, NULL };
	GType widgets_item_labels_type_id;
	widgets_item_labels_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsItemLabels", &g_define_type_info, 0);
	WidgetsItemLabels_private_offset = g_type_add_instance_private (widgets_item_labels_type_id, sizeof (WidgetsItemLabelsPrivate));
	return widgets_item_labels_type_id;
}

GType
widgets_item_labels_get_type (void)
{
	static volatile gsize widgets_item_labels_type_id__once = 0;
	if (g_once_init_enter (&widgets_item_labels_type_id__once)) {
		GType widgets_item_labels_type_id;
		widgets_item_labels_type_id = widgets_item_labels_get_type_once ();
		g_once_init_leave (&widgets_item_labels_type_id__once, widgets_item_labels_type_id);
	}
	return widgets_item_labels_type_id__once;
}

static void
_vala_widgets_item_labels_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	WidgetsItemLabels * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_ITEM_LABELS, WidgetsItemLabels);
	switch (property_id) {
		case WIDGETS_ITEM_LABELS_ITEM_PROPERTY:
		g_value_set_object (value, widgets_item_labels_get_item (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_item_labels_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	WidgetsItemLabels * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_ITEM_LABELS, WidgetsItemLabels);
	switch (property_id) {
		case WIDGETS_ITEM_LABELS_ITEM_PROPERTY:
		widgets_item_labels_set_item (self, g_value_get_object (value));
		break;
		case WIDGETS_ITEM_LABELS_TOP_MARGIN_PROPERTY:
		widgets_item_labels_set_top_margin (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

