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

/*
 * Copyright © 2024 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 <adwaita.h>
#include <glib-object.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include "planify.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 WIDGETS_TYPE_PINNED_ITEMS_BOX (widgets_pinned_items_box_get_type ())
#define WIDGETS_PINNED_ITEMS_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_PINNED_ITEMS_BOX, WidgetsPinnedItemsBox))
#define WIDGETS_PINNED_ITEMS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_PINNED_ITEMS_BOX, WidgetsPinnedItemsBoxClass))
#define WIDGETS_IS_PINNED_ITEMS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_PINNED_ITEMS_BOX))
#define WIDGETS_IS_PINNED_ITEMS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_PINNED_ITEMS_BOX))
#define WIDGETS_PINNED_ITEMS_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_PINNED_ITEMS_BOX, WidgetsPinnedItemsBoxClass))

typedef struct _WidgetsPinnedItemsBox WidgetsPinnedItemsBox;
typedef struct _WidgetsPinnedItemsBoxClass WidgetsPinnedItemsBoxClass;
typedef struct _WidgetsPinnedItemsBoxPrivate WidgetsPinnedItemsBoxPrivate;

#define LAYOUTS_TYPE_ITEM_BASE (layouts_item_base_get_type ())
#define LAYOUTS_ITEM_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_ITEM_BASE, LayoutsItemBase))
#define LAYOUTS_ITEM_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_ITEM_BASE, LayoutsItemBaseClass))
#define LAYOUTS_IS_ITEM_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_ITEM_BASE))
#define LAYOUTS_IS_ITEM_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_ITEM_BASE))
#define LAYOUTS_ITEM_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_ITEM_BASE, LayoutsItemBaseClass))

typedef struct _LayoutsItemBase LayoutsItemBase;
typedef struct _LayoutsItemBaseClass LayoutsItemBaseClass;

#define LAYOUTS_TYPE_ITEM_BOARD (layouts_item_board_get_type ())
#define LAYOUTS_ITEM_BOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_ITEM_BOARD, LayoutsItemBoard))
#define LAYOUTS_ITEM_BOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_ITEM_BOARD, LayoutsItemBoardClass))
#define LAYOUTS_IS_ITEM_BOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_ITEM_BOARD))
#define LAYOUTS_IS_ITEM_BOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_ITEM_BOARD))
#define LAYOUTS_ITEM_BOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_ITEM_BOARD, LayoutsItemBoardClass))

typedef struct _LayoutsItemBoard LayoutsItemBoard;
typedef struct _LayoutsItemBoardClass LayoutsItemBoardClass;
enum  {
	WIDGETS_PINNED_ITEMS_BOX_0_PROPERTY,
	WIDGETS_PINNED_ITEMS_BOX_PROJECT_PROPERTY,
	WIDGETS_PINNED_ITEMS_BOX_NUM_PROPERTIES
};
static GParamSpec* widgets_pinned_items_box_properties[WIDGETS_PINNED_ITEMS_BOX_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _WidgetsPinnedItemsBox {
	AdwBin parent_instance;
	WidgetsPinnedItemsBoxPrivate * priv;
	GeeHashMap* items_map;
};

struct _WidgetsPinnedItemsBoxClass {
	AdwBinClass parent_class;
};

struct _WidgetsPinnedItemsBoxPrivate {
	ObjectsProject* _project;
	AdwWrapBox* box_layout;
	GtkRevealer* main_revealer;
};

static gint WidgetsPinnedItemsBox_private_offset;
static gpointer widgets_pinned_items_box_parent_class = NULL;

VALA_EXTERN GType widgets_pinned_items_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsPinnedItemsBox, g_object_unref)
VALA_EXTERN GType layouts_item_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsItemBase, g_object_unref)
VALA_EXTERN GType layouts_item_board_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsItemBoard, g_object_unref)
VALA_EXTERN WidgetsPinnedItemsBox* widgets_pinned_items_box_new (ObjectsProject* project);
VALA_EXTERN WidgetsPinnedItemsBox* widgets_pinned_items_box_construct (GType object_type,
                                                           ObjectsProject* project);
static void widgets_pinned_items_box_add_items (WidgetsPinnedItemsBox* self);
VALA_EXTERN ObjectsProject* widgets_pinned_items_box_get_project (WidgetsPinnedItemsBox* self);
static void widgets_pinned_items_box_add_item (WidgetsPinnedItemsBox* self,
                                        ObjectsItem* item);
VALA_EXTERN LayoutsItemBoard* layouts_item_board_new (ObjectsItem* item);
VALA_EXTERN LayoutsItemBoard* layouts_item_board_construct (GType object_type,
                                                ObjectsItem* item);
VALA_EXTERN void layouts_item_board_set_pin_mode (LayoutsItemBoard* self,
                                      gboolean value);
static void widgets_pinned_items_box_check_reveal_child (WidgetsPinnedItemsBox* self);
static void widgets_pinned_items_box_update_pinboard (WidgetsPinnedItemsBox* self,
                                               ObjectsItem* item);
VALA_EXTERN void layouts_item_board_hide_widget (LayoutsItemBoard* self);
static void widgets_pinned_items_box_set_project (WidgetsPinnedItemsBox* self,
                                           ObjectsProject* value);
static GObject * widgets_pinned_items_box_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _widgets_pinned_items_box___lambda561_ (WidgetsPinnedItemsBox* self,
                                             ObjectsItem* item);
static void __widgets_pinned_items_box___lambda561__objects_project_item_added (ObjectsProject* _sender,
                                                                         ObjectsItem* item,
                                                                         gpointer self);
static void _widgets_pinned_items_box___lambda562_ (WidgetsPinnedItemsBox* self,
                                             ObjectsItem* item);
static void __widgets_pinned_items_box___lambda562__objects_project_item_deleted (ObjectsProject* _sender,
                                                                           ObjectsItem* item,
                                                                           gpointer self);
static void _widgets_pinned_items_box___lambda563_ (WidgetsPinnedItemsBox* self,
                                             ObjectsItem* item);
static void __widgets_pinned_items_box___lambda563__services_event_bus_item_moved (ServicesEventBus* _sender,
                                                                            ObjectsItem* item,
                                                                            const gchar* old_project_id,
                                                                            const gchar* old_section_id,
                                                                            const gchar* old_parent_id,
                                                                            gpointer self);
static void _widgets_pinned_items_box___lambda564_ (WidgetsPinnedItemsBox* self,
                                             ObjectsItem* item);
static void __widgets_pinned_items_box___lambda564__services_store_item_pin_change (ServicesStore* _sender,
                                                                             ObjectsItem* item,
                                                                             gpointer self);
static void widgets_pinned_items_box_finalize (GObject * obj);
static GType widgets_pinned_items_box_get_type_once (void);
static void _vala_widgets_pinned_items_box_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_widgets_pinned_items_box_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);

static inline gpointer
widgets_pinned_items_box_get_instance_private (WidgetsPinnedItemsBox* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsPinnedItemsBox_private_offset);
}

WidgetsPinnedItemsBox*
widgets_pinned_items_box_construct (GType object_type,
                                    ObjectsProject* project)
{
	WidgetsPinnedItemsBox * self = NULL;
	g_return_val_if_fail (project != NULL, NULL);
	self = (WidgetsPinnedItemsBox*) g_object_new (object_type, "project", project, NULL);
	return self;
}

WidgetsPinnedItemsBox*
widgets_pinned_items_box_new (ObjectsProject* project)
{
	return widgets_pinned_items_box_construct (WIDGETS_TYPE_PINNED_ITEMS_BOX, project);
}

static void
widgets_pinned_items_box_add_items (WidgetsPinnedItemsBox* self)
{
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _item_list = NULL;
		ObjectsProject* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		gint _item_size = 0;
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _item_index = 0;
		_tmp0_ = self->priv->_project;
		_tmp1_ = objects_project_get_items_pinned (_tmp0_);
		_tmp2_ = _tmp1_;
		_item_list = _tmp2_;
		_tmp3_ = _item_list;
		_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_item_size = _tmp5_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			ObjectsItem* item = NULL;
			GeeArrayList* _tmp8_;
			gpointer _tmp9_;
			ObjectsItem* _tmp10_;
			_item_index = _item_index + 1;
			_tmp6_ = _item_index;
			_tmp7_ = _item_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _item_list;
			_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _item_index);
			item = (ObjectsItem*) _tmp9_;
			_tmp10_ = item;
			widgets_pinned_items_box_add_item (self, _tmp10_);
			_g_object_unref0 (item);
		}
	}
}

static void
widgets_pinned_items_box_add_item (WidgetsPinnedItemsBox* self,
                                   ObjectsItem* item)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GeeHashMap* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	LayoutsItemBoard* _tmp8_ = NULL;
	LayoutsItemBoard* _tmp9_;
	AdwWrapBox* _tmp10_;
	GeeHashMap* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gpointer _tmp14_;
	LayoutsItemBoard* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->items_map;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp2_ = _tmp1_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		return;
	}
	_tmp3_ = objects_item_get_pinned (item);
	_tmp4_ = _tmp3_;
	if (!_tmp4_) {
		return;
	}
	_tmp5_ = self->items_map;
	_tmp6_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp7_ = _tmp6_;
	_tmp8_ = layouts_item_board_new (item);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp8_, TRUE);
	layouts_item_board_set_pin_mode (_tmp8_, TRUE);
	g_object_ref_sink (_tmp8_);
	_tmp9_ = _tmp8_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, _tmp7_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	_tmp10_ = self->priv->box_layout;
	_tmp11_ = self->items_map;
	_tmp12_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp13_ = _tmp12_;
	_tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp11_, _tmp13_);
	_tmp15_ = (LayoutsItemBoard*) _tmp14_;
	adw_wrap_box_append (_tmp10_, (GtkWidget*) _tmp15_);
	_g_object_unref0 (_tmp15_);
	widgets_pinned_items_box_check_reveal_child (self);
}

static void
widgets_pinned_items_box_update_pinboard (WidgetsPinnedItemsBox* self,
                                          ObjectsItem* item)
{
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GeeHashMap* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gpointer _tmp6_;
	LayoutsItemBoard* _tmp7_;
	AdwWrapBox* _tmp8_;
	GeeHashMap* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gpointer _tmp12_;
	LayoutsItemBoard* _tmp13_;
	GeeHashMap* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->items_map;
	_tmp1_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp2_ = _tmp1_;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp2_)) {
		return;
	}
	_tmp3_ = self->items_map;
	_tmp4_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp5_ = _tmp4_;
	_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp3_, _tmp5_);
	_tmp7_ = (LayoutsItemBoard*) _tmp6_;
	layouts_item_board_hide_widget (_tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = self->priv->box_layout;
	_tmp9_ = self->items_map;
	_tmp10_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp11_ = _tmp10_;
	_tmp12_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, _tmp11_);
	_tmp13_ = (LayoutsItemBoard*) _tmp12_;
	adw_wrap_box_remove (_tmp8_, (GtkWidget*) _tmp13_);
	_g_object_unref0 (_tmp13_);
	_tmp14_ = self->items_map;
	_tmp15_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp16_ = _tmp15_;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp14_, _tmp16_, NULL);
	widgets_pinned_items_box_check_reveal_child (self);
}

static void
widgets_pinned_items_box_check_reveal_child (WidgetsPinnedItemsBox* self)
{
	GtkRevealer* _tmp0_;
	GeeHashMap* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_revealer;
	_tmp1_ = self->items_map;
	_tmp2_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp1_);
	_tmp3_ = _tmp2_;
	gtk_revealer_set_reveal_child (_tmp0_, _tmp3_ > 0);
}

ObjectsProject*
widgets_pinned_items_box_get_project (WidgetsPinnedItemsBox* self)
{
	ObjectsProject* result;
	ObjectsProject* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_project;
	result = _tmp0_;
	return result;
}

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

static void
widgets_pinned_items_box_set_project (WidgetsPinnedItemsBox* self,
                                      ObjectsProject* value)
{
	ObjectsProject* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_pinned_items_box_get_project (self);
	if (old_value != value) {
		ObjectsProject* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_project);
		self->priv->_project = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_pinned_items_box_properties[WIDGETS_PINNED_ITEMS_BOX_PROJECT_PROPERTY]);
	}
}

static void
_widgets_pinned_items_box___lambda561_ (WidgetsPinnedItemsBox* self,
                                        ObjectsItem* item)
{
	g_return_if_fail (item != NULL);
	widgets_pinned_items_box_add_item (self, item);
}

static void
__widgets_pinned_items_box___lambda561__objects_project_item_added (ObjectsProject* _sender,
                                                                    ObjectsItem* item,
                                                                    gpointer self)
{
	_widgets_pinned_items_box___lambda561_ ((WidgetsPinnedItemsBox*) self, item);
}

static void
_widgets_pinned_items_box___lambda562_ (WidgetsPinnedItemsBox* self,
                                        ObjectsItem* item)
{
	g_return_if_fail (item != NULL);
	widgets_pinned_items_box_update_pinboard (self, item);
}

static void
__widgets_pinned_items_box___lambda562__objects_project_item_deleted (ObjectsProject* _sender,
                                                                      ObjectsItem* item,
                                                                      gpointer self)
{
	_widgets_pinned_items_box___lambda562_ ((WidgetsPinnedItemsBox*) self, item);
}

static void
_widgets_pinned_items_box___lambda563_ (WidgetsPinnedItemsBox* self,
                                        ObjectsItem* item)
{
	g_return_if_fail (item != NULL);
	widgets_pinned_items_box_update_pinboard (self, item);
}

static void
__widgets_pinned_items_box___lambda563__services_event_bus_item_moved (ServicesEventBus* _sender,
                                                                       ObjectsItem* item,
                                                                       const gchar* old_project_id,
                                                                       const gchar* old_section_id,
                                                                       const gchar* old_parent_id,
                                                                       gpointer self)
{
	_widgets_pinned_items_box___lambda563_ ((WidgetsPinnedItemsBox*) self, item);
}

static void
_widgets_pinned_items_box___lambda564_ (WidgetsPinnedItemsBox* self,
                                        ObjectsItem* item)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ObjectsProject* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	GeeHashMap* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gboolean _tmp25_ = FALSE;
	GeeHashMap* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	g_return_if_fail (item != NULL);
	_tmp0_ = objects_item_get_project_id (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_project;
	_tmp3_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp2_);
	_tmp4_ = _tmp3_;
	if (g_strcmp0 (_tmp1_, _tmp4_) != 0) {
		return;
	}
	_tmp6_ = self->items_map;
	_tmp7_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp8_ = _tmp7_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp6_, _tmp8_)) {
		gboolean _tmp9_;
		gboolean _tmp10_;
		_tmp9_ = objects_item_get_pinned (item);
		_tmp10_ = _tmp9_;
		_tmp5_ = !_tmp10_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		GeeHashMap* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		gpointer _tmp14_;
		LayoutsItemBoard* _tmp15_;
		AdwWrapBox* _tmp16_;
		GeeHashMap* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		gpointer _tmp20_;
		LayoutsItemBoard* _tmp21_;
		GeeHashMap* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		_tmp11_ = self->items_map;
		_tmp12_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
		_tmp13_ = _tmp12_;
		_tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp11_, _tmp13_);
		_tmp15_ = (LayoutsItemBoard*) _tmp14_;
		layouts_item_board_hide_widget (_tmp15_);
		_g_object_unref0 (_tmp15_);
		_tmp16_ = self->priv->box_layout;
		_tmp17_ = self->items_map;
		_tmp18_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
		_tmp19_ = _tmp18_;
		_tmp20_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp17_, _tmp19_);
		_tmp21_ = (LayoutsItemBoard*) _tmp20_;
		adw_wrap_box_remove (_tmp16_, (GtkWidget*) _tmp21_);
		_g_object_unref0 (_tmp21_);
		_tmp22_ = self->items_map;
		_tmp23_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
		_tmp24_ = _tmp23_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp22_, _tmp24_, NULL);
	}
	_tmp26_ = self->items_map;
	_tmp27_ = objects_base_object_get_id ((ObjectsBaseObject*) item);
	_tmp28_ = _tmp27_;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp26_, _tmp28_)) {
		gboolean _tmp29_;
		gboolean _tmp30_;
		_tmp29_ = objects_item_get_pinned (item);
		_tmp30_ = _tmp29_;
		_tmp25_ = _tmp30_;
	} else {
		_tmp25_ = FALSE;
	}
	if (_tmp25_) {
		widgets_pinned_items_box_add_item (self, item);
	}
	widgets_pinned_items_box_check_reveal_child (self);
}

static void
__widgets_pinned_items_box___lambda564__services_store_item_pin_change (ServicesStore* _sender,
                                                                        ObjectsItem* item,
                                                                        gpointer self)
{
	_widgets_pinned_items_box___lambda564_ ((WidgetsPinnedItemsBox*) self, item);
}

static GObject *
widgets_pinned_items_box_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsPinnedItemsBox * self;
	AdwWrapBox* _tmp0_ = NULL;
	AdwWrapBox* _tmp1_;
	GtkWidget* _tmp2_;
	GtkRevealer* _tmp3_ = NULL;
	GtkRevealer* _tmp4_;
	ObjectsProject* _tmp5_;
	ObjectsProject* _tmp6_;
	ServicesEventBus* _tmp7_;
	ServicesEventBus* _tmp8_;
	ServicesStore* _tmp9_;
	parent_class = G_OBJECT_CLASS (widgets_pinned_items_box_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_PINNED_ITEMS_BOX, WidgetsPinnedItemsBox);
	_tmp0_ = (AdwWrapBox*) adw_wrap_box_new ();
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, 20);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp0_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp0_, 12);
	adw_wrap_box_set_child_spacing (_tmp0_, 12);
	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_);
	gtk_revealer_set_reveal_child (_tmp3_, FALSE);
	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_);
	widgets_pinned_items_box_add_items (self);
	_tmp5_ = self->priv->_project;
	g_signal_connect_object (_tmp5_, "item-added", (GCallback) __widgets_pinned_items_box___lambda561__objects_project_item_added, self, 0);
	_tmp6_ = self->priv->_project;
	g_signal_connect_object (_tmp6_, "item-deleted", (GCallback) __widgets_pinned_items_box___lambda562__objects_project_item_deleted, self, 0);
	_tmp7_ = services_event_bus_get_default ();
	_tmp8_ = _tmp7_;
	g_signal_connect_object (_tmp8_, "item-moved", (GCallback) __widgets_pinned_items_box___lambda563__services_event_bus_item_moved, self, 0);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = services_store_instance ();
	g_signal_connect_object (_tmp9_, "item-pin-change", (GCallback) __widgets_pinned_items_box___lambda564__services_store_item_pin_change, self, 0);
	return obj;
}

static void
widgets_pinned_items_box_class_init (WidgetsPinnedItemsBoxClass * klass,
                                     gpointer klass_data)
{
	widgets_pinned_items_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsPinnedItemsBox_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_pinned_items_box_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_pinned_items_box_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_pinned_items_box_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_pinned_items_box_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_PINNED_ITEMS_BOX_PROJECT_PROPERTY, widgets_pinned_items_box_properties[WIDGETS_PINNED_ITEMS_BOX_PROJECT_PROPERTY] = g_param_spec_object ("project", "project", "project", OBJECTS_TYPE_PROJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
widgets_pinned_items_box_instance_init (WidgetsPinnedItemsBox * self,
                                        gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = widgets_pinned_items_box_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, LAYOUTS_TYPE_ITEM_BOARD, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->items_map = _tmp0_;
}

static void
widgets_pinned_items_box_finalize (GObject * obj)
{
	WidgetsPinnedItemsBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_PINNED_ITEMS_BOX, WidgetsPinnedItemsBox);
	g_debug ("PinnedItemsBox.vala:36: Destroying - Widgets.PinnedItemsBox\n");
	_g_object_unref0 (self->priv->_project);
	_g_object_unref0 (self->priv->box_layout);
	_g_object_unref0 (self->priv->main_revealer);
	_g_object_unref0 (self->items_map);
	G_OBJECT_CLASS (widgets_pinned_items_box_parent_class)->finalize (obj);
}

static GType
widgets_pinned_items_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsPinnedItemsBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_pinned_items_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsPinnedItemsBox), 0, (GInstanceInitFunc) widgets_pinned_items_box_instance_init, NULL };
	GType widgets_pinned_items_box_type_id;
	widgets_pinned_items_box_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsPinnedItemsBox", &g_define_type_info, 0);
	WidgetsPinnedItemsBox_private_offset = g_type_add_instance_private (widgets_pinned_items_box_type_id, sizeof (WidgetsPinnedItemsBoxPrivate));
	return widgets_pinned_items_box_type_id;
}

GType
widgets_pinned_items_box_get_type (void)
{
	static volatile gsize widgets_pinned_items_box_type_id__once = 0;
	if (g_once_init_enter (&widgets_pinned_items_box_type_id__once)) {
		GType widgets_pinned_items_box_type_id;
		widgets_pinned_items_box_type_id = widgets_pinned_items_box_get_type_once ();
		g_once_init_leave (&widgets_pinned_items_box_type_id__once, widgets_pinned_items_box_type_id);
	}
	return widgets_pinned_items_box_type_id__once;
}

static void
_vala_widgets_pinned_items_box_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	WidgetsPinnedItemsBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_PINNED_ITEMS_BOX, WidgetsPinnedItemsBox);
	switch (property_id) {
		case WIDGETS_PINNED_ITEMS_BOX_PROJECT_PROPERTY:
		g_value_set_object (value, widgets_pinned_items_box_get_project (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_pinned_items_box_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	WidgetsPinnedItemsBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_PINNED_ITEMS_BOX, WidgetsPinnedItemsBox);
	switch (property_id) {
		case WIDGETS_PINNED_ITEMS_BOX_PROJECT_PROPERTY:
		widgets_pinned_items_box_set_project (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

