/* CalendarView.c generated by valac 0.56.19, the Vala compiler
 * generated from CalendarView.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 <gee.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <adwaita.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.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_CALENDAR_CALENDAR_VIEW_0_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_VIEW_CURRENT_DATE_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_VIEW_NUM_PROPERTIES
};
static GParamSpec* widgets_calendar_calendar_view_properties[WIDGETS_CALENDAR_CALENDAR_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block21Data Block21Data;
enum  {
	WIDGETS_CALENDAR_CALENDAR_VIEW_DAY_SELECTED_SIGNAL,
	WIDGETS_CALENDAR_CALENDAR_VIEW_NUM_SIGNALS
};
static guint widgets_calendar_calendar_view_signals[WIDGETS_CALENDAR_CALENDAR_VIEW_NUM_SIGNALS] = {0};

struct _WidgetsCalendarCalendarViewPrivate {
	GeeArrayList* days_arraylist;
	GtkGrid* days_grid;
	GDateTime* _current_date;
	GeeHashMap* signals_map;
};

struct _Block21Data {
	int _ref_count_;
	WidgetsCalendarCalendarView* self;
	WidgetsCalendarCalendarDay* calendar_day;
};

static gint WidgetsCalendarCalendarView_private_offset;
static gpointer widgets_calendar_calendar_view_parent_class = NULL;

static GDateTime* widgets_calendar_calendar_view_generate_date (WidgetsCalendarCalendarView* self,
                                                         GDateTime* date,
                                                         gint day);
static void widgets_calendar_calendar_view_day_selected_style (WidgetsCalendarCalendarView* self,
                                                        gint day);
static GObject * widgets_calendar_calendar_view_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static void _widgets_calendar_calendar_view______lambda160_ (Block21Data* _data21_);
static void __widgets_calendar_calendar_view______lambda160__widgets_calendar_calendar_day_day_selected (WidgetsCalendarCalendarDay* _sender,
                                                                                                  gpointer self);
static void widgets_calendar_calendar_view_finalize (GObject * obj);
static GType widgets_calendar_calendar_view_get_type_once (void);
static void _vala_widgets_calendar_calendar_view_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
widgets_calendar_calendar_view_get_instance_private (WidgetsCalendarCalendarView* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsCalendarCalendarView_private_offset);
}

WidgetsCalendarCalendarView*
widgets_calendar_calendar_view_construct (GType object_type)
{
	WidgetsCalendarCalendarView * self = NULL;
	self = (WidgetsCalendarCalendarView*) g_object_new (object_type, "margin-start", 6, "margin-end", 6, NULL);
	return self;
}

WidgetsCalendarCalendarView*
widgets_calendar_calendar_view_new (void)
{
	return widgets_calendar_calendar_view_construct (WIDGETS_CALENDAR_TYPE_CALENDAR_VIEW);
}

void
widgets_calendar_calendar_view_fill_grid_days (WidgetsCalendarCalendarView* self,
                                               gint start_day,
                                               gint max_day,
                                               GDateTime* day,
                                               gboolean show_day,
                                               gboolean block_past_days)
{
	gint day_number = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (day != NULL);
	day_number = 1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				WidgetsCalendarCalendarDay* item = NULL;
				GeeArrayList* _tmp2_;
				gpointer _tmp3_;
				WidgetsCalendarCalendarDay* _tmp4_;
				WidgetsCalendarCalendarDay* _tmp5_;
				WidgetsCalendarCalendarDay* _tmp6_;
				GtkWidget* _tmp7_;
				GtkWidget* _tmp8_;
				WidgetsCalendarCalendarDay* _tmp9_;
				GtkWidget* _tmp10_;
				GtkWidget* _tmp11_;
				gboolean _tmp12_ = FALSE;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < 42)) {
					break;
				}
				_tmp2_ = self->priv->days_arraylist;
				_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, i);
				item = (WidgetsCalendarCalendarDay*) _tmp3_;
				_tmp4_ = item;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, TRUE);
				_tmp5_ = item;
				gtk_widget_set_visible ((GtkWidget*) _tmp5_, TRUE);
				_tmp6_ = item;
				_tmp7_ = adw_bin_get_child ((AdwBin*) _tmp6_);
				_tmp8_ = _tmp7_;
				gtk_widget_remove_css_class (_tmp8_, "today");
				_tmp9_ = item;
				_tmp10_ = adw_bin_get_child ((AdwBin*) _tmp9_);
				_tmp11_ = _tmp10_;
				gtk_widget_remove_css_class (_tmp11_, "selected");
				if (i < start_day) {
					_tmp12_ = TRUE;
				} else {
					_tmp12_ = i >= (max_day + start_day);
				}
				if (_tmp12_) {
					WidgetsCalendarCalendarDay* _tmp13_;
					_tmp13_ = item;
					gtk_widget_set_visible ((GtkWidget*) _tmp13_, FALSE);
				} else {
					GDateTime* day_datetime = NULL;
					GDateTime* _tmp14_;
					gboolean _tmp15_ = FALSE;
					GDateTime* _tmp20_;
					GDateTime* _tmp21_;
					GDateTime* _tmp22_;
					gboolean _tmp26_ = FALSE;
					WidgetsCalendarCalendarDay* _tmp33_;
					WidgetsCalendarCalendarDay* _tmp34_;
					GDateTime* _tmp35_;
					WidgetsCalendarCalendarDay* _tmp36_;
					GDateTime* _tmp37_;
					gchar* _tmp38_;
					gchar* _tmp39_;
					_tmp14_ = widgets_calendar_calendar_view_generate_date (self, day, day_number);
					day_datetime = _tmp14_;
					if (block_past_days) {
						GDateTime* _tmp16_;
						GDateTime* _tmp17_;
						GDateTime* _tmp18_;
						_tmp16_ = day_datetime;
						_tmp17_ = widgets_calendar_calendar_view_get_current_date (self);
						_tmp18_ = _tmp17_;
						_tmp15_ = g_date_time_compare (_tmp16_, _tmp18_) <= -1;
					} else {
						_tmp15_ = FALSE;
					}
					if (_tmp15_) {
						WidgetsCalendarCalendarDay* _tmp19_;
						_tmp19_ = item;
						gtk_widget_set_sensitive ((GtkWidget*) _tmp19_, FALSE);
					}
					_tmp20_ = day_datetime;
					_tmp21_ = widgets_calendar_calendar_view_get_current_date (self);
					_tmp22_ = _tmp21_;
					if (g_date_time_compare (_tmp20_, _tmp22_) == 0) {
						WidgetsCalendarCalendarDay* _tmp23_;
						GtkWidget* _tmp24_;
						GtkWidget* _tmp25_;
						_tmp23_ = item;
						_tmp24_ = adw_bin_get_child ((AdwBin*) _tmp23_);
						_tmp25_ = _tmp24_;
						gtk_widget_add_css_class (_tmp25_, "today");
					}
					if (show_day) {
						GDateTime* _tmp27_;
						GDateTime* _tmp28_;
						GDateTime* _tmp29_;
						_tmp27_ = utils_datetime_get_date_only (day);
						_tmp28_ = _tmp27_;
						_tmp29_ = day_datetime;
						_tmp26_ = g_date_time_compare (_tmp28_, _tmp29_) == 0;
						_g_date_time_unref0 (_tmp28_);
					} else {
						_tmp26_ = FALSE;
					}
					if (_tmp26_) {
						WidgetsCalendarCalendarDay* _tmp30_;
						GtkWidget* _tmp31_;
						GtkWidget* _tmp32_;
						_tmp30_ = item;
						_tmp31_ = adw_bin_get_child ((AdwBin*) _tmp30_);
						_tmp32_ = _tmp31_;
						gtk_widget_add_css_class (_tmp32_, "selected");
					}
					_tmp33_ = item;
					widgets_calendar_calendar_day_set_day (_tmp33_, day_number);
					_tmp34_ = item;
					_tmp35_ = day_datetime;
					widgets_calendar_calendar_day_set_date (_tmp34_, _tmp35_);
					_tmp36_ = item;
					_tmp37_ = day_datetime;
					_tmp38_ = utils_datetime_get_relative_date_from_date (_tmp37_);
					_tmp39_ = _tmp38_;
					gtk_widget_set_tooltip_text ((GtkWidget*) _tmp36_, _tmp39_);
					_g_free0 (_tmp39_);
					day_number = day_number + 1;
					_g_date_time_unref0 (day_datetime);
				}
				_g_object_unref0 (item);
			}
		}
	}
}

void
widgets_calendar_calendar_view_clear_style (WidgetsCalendarCalendarView* self)
{
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				WidgetsCalendarCalendarDay* item = NULL;
				GeeArrayList* _tmp2_;
				gpointer _tmp3_;
				WidgetsCalendarCalendarDay* _tmp4_;
				GtkWidget* _tmp5_;
				GtkWidget* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < 42)) {
					break;
				}
				_tmp2_ = self->priv->days_arraylist;
				_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, i);
				item = (WidgetsCalendarCalendarDay*) _tmp3_;
				_tmp4_ = item;
				_tmp5_ = adw_bin_get_child ((AdwBin*) _tmp4_);
				_tmp6_ = _tmp5_;
				gtk_widget_remove_css_class (_tmp6_, "selected");
				_g_object_unref0 (item);
			}
		}
	}
}

static GDateTime*
widgets_calendar_calendar_view_generate_date (WidgetsCalendarCalendarView* self,
                                              GDateTime* date,
                                              gint day)
{
	GDateTime* _tmp0_;
	GDateTime* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (date != NULL, NULL);
	_tmp0_ = g_date_time_new_local (g_date_time_get_year (date), g_date_time_get_month (date), day, 0, 0, (gdouble) 0);
	result = _tmp0_;
	return result;
}

static void
widgets_calendar_calendar_view_day_selected_style (WidgetsCalendarCalendarView* self,
                                                   gint day)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, widgets_calendar_calendar_view_signals[WIDGETS_CALENDAR_CALENDAR_VIEW_DAY_SELECTED_SIGNAL], 0, day);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				WidgetsCalendarCalendarDay* day_item = NULL;
				GeeArrayList* _tmp2_;
				gpointer _tmp3_;
				WidgetsCalendarCalendarDay* _tmp4_;
				GtkWidget* _tmp5_;
				GtkWidget* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < 42)) {
					break;
				}
				_tmp2_ = self->priv->days_arraylist;
				_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, i);
				day_item = (WidgetsCalendarCalendarDay*) _tmp3_;
				_tmp4_ = day_item;
				_tmp5_ = adw_bin_get_child ((AdwBin*) _tmp4_);
				_tmp6_ = _tmp5_;
				gtk_widget_remove_css_class (_tmp6_, "selected");
				_g_object_unref0 (day_item);
			}
		}
	}
}

void
widgets_calendar_calendar_view_clean_up (WidgetsCalendarCalendarView* self)
{
	GeeHashMap* _tmp26_;
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				WidgetsCalendarCalendarDay* item = NULL;
				GeeArrayList* _tmp2_;
				gpointer _tmp3_;
				WidgetsCalendarCalendarDay* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < 42)) {
					break;
				}
				_tmp2_ = self->priv->days_arraylist;
				_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, i);
				item = (WidgetsCalendarCalendarDay*) _tmp3_;
				_tmp4_ = item;
				widgets_calendar_calendar_day_clean_up (_tmp4_);
				_g_object_unref0 (item);
			}
		}
	}
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp5_;
		GeeSet* _tmp6_;
		GeeSet* _tmp7_;
		GeeSet* _tmp8_;
		GeeIterator* _tmp9_;
		GeeIterator* _tmp10_;
		_tmp5_ = self->priv->signals_map;
		_tmp6_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = _tmp7_;
		_tmp9_ = gee_iterable_iterator ((GeeIterable*) _tmp8_);
		_tmp10_ = _tmp9_;
		_g_object_unref0 (_tmp8_);
		_entry_it = _tmp10_;
		while (TRUE) {
			GeeIterator* _tmp11_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp12_;
			gpointer _tmp13_;
			GeeMapEntry* _tmp14_;
			gconstpointer _tmp15_;
			gconstpointer _tmp16_;
			GeeMapEntry* _tmp17_;
			gconstpointer _tmp18_;
			gconstpointer _tmp19_;
			_tmp11_ = _entry_it;
			if (!gee_iterator_next (_tmp11_)) {
				break;
			}
			_tmp12_ = _entry_it;
			_tmp13_ = gee_iterator_get (_tmp12_);
			entry = (GeeMapEntry*) _tmp13_;
			_tmp14_ = entry;
			_tmp15_ = gee_map_entry_get_value (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = entry;
			_tmp18_ = gee_map_entry_get_key (_tmp17_);
			_tmp19_ = _tmp18_;
			if (g_signal_handler_is_connected ((GObject*) _tmp16_, (gulong) ((guintptr) _tmp19_))) {
				GeeMapEntry* _tmp20_;
				gconstpointer _tmp21_;
				gconstpointer _tmp22_;
				GeeMapEntry* _tmp23_;
				gconstpointer _tmp24_;
				gconstpointer _tmp25_;
				_tmp20_ = entry;
				_tmp21_ = gee_map_entry_get_value (_tmp20_);
				_tmp22_ = _tmp21_;
				_tmp23_ = entry;
				_tmp24_ = gee_map_entry_get_key (_tmp23_);
				_tmp25_ = _tmp24_;
				g_signal_handler_disconnect ((GObject*) _tmp22_, (gulong) ((guintptr) _tmp25_));
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp26_ = self->priv->signals_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp26_);
}

GDateTime*
widgets_calendar_calendar_view_get_current_date (WidgetsCalendarCalendarView* self)
{
	GDateTime* result;
	GDateTime* today = NULL;
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_date_time_new_now_local ();
	today = _tmp0_;
	_tmp1_ = g_date_time_new_local (g_date_time_get_year (today), g_date_time_get_month (today), g_date_time_get_day_of_month (today), 0, 0, (gdouble) 0);
	_g_date_time_unref0 (self->priv->_current_date);
	self->priv->_current_date = _tmp1_;
	_tmp2_ = self->priv->_current_date;
	result = _tmp2_;
	_g_date_time_unref0 (today);
	return result;
}

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		WidgetsCalendarCalendarView* self;
		self = _data21_->self;
		_g_object_unref0 (_data21_->calendar_day);
		_g_object_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

static void
_widgets_calendar_calendar_view______lambda160_ (Block21Data* _data21_)
{
	WidgetsCalendarCalendarView* self;
	WidgetsCalendarCalendarDay* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	self = _data21_->self;
	_tmp0_ = _data21_->calendar_day;
	_tmp1_ = widgets_calendar_calendar_day_get_day (_tmp0_);
	_tmp2_ = _tmp1_;
	widgets_calendar_calendar_view_day_selected_style (self, _tmp2_);
}

static void
__widgets_calendar_calendar_view______lambda160__widgets_calendar_calendar_day_day_selected (WidgetsCalendarCalendarDay* _sender,
                                                                                             gpointer self)
{
	_widgets_calendar_calendar_view______lambda160_ (self);
}

static GObject *
widgets_calendar_calendar_view_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsCalendarCalendarView * self;
	GeeArrayList* _tmp0_;
	GtkGrid* _tmp1_ = NULL;
	gint col = 0;
	gint row = 0;
	GtkGrid* _tmp15_;
	parent_class = G_OBJECT_CLASS (widgets_calendar_calendar_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_TYPE_CALENDAR_VIEW, WidgetsCalendarCalendarView);
	_tmp0_ = gee_array_list_new (WIDGETS_CALENDAR_TYPE_CALENDAR_DAY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->days_arraylist);
	self->priv->days_arraylist = _tmp0_;
	_tmp1_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_homogeneous (_tmp1_, TRUE);
	gtk_grid_set_row_homogeneous (_tmp1_, TRUE);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->days_grid);
	self->priv->days_grid = _tmp1_;
	col = 0;
	row = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				Block21Data* _data21_;
				WidgetsCalendarCalendarDay* _tmp4_;
				GeeHashMap* _tmp5_;
				WidgetsCalendarCalendarDay* _tmp6_;
				gulong _tmp7_;
				WidgetsCalendarCalendarDay* _tmp8_;
				GtkGrid* _tmp9_;
				WidgetsCalendarCalendarDay* _tmp10_;
				gboolean _tmp11_ = FALSE;
				WidgetsCalendarCalendarDay* _tmp12_;
				GeeArrayList* _tmp13_;
				WidgetsCalendarCalendarDay* _tmp14_;
				_data21_ = g_slice_new0 (Block21Data);
				_data21_->_ref_count_ = 1;
				_data21_->self = g_object_ref (self);
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				if (!(i < 42)) {
					block21_data_unref (_data21_);
					_data21_ = NULL;
					break;
				}
				_tmp4_ = widgets_calendar_calendar_day_new ();
				g_object_ref_sink (_tmp4_);
				_data21_->calendar_day = _tmp4_;
				_tmp5_ = self->priv->signals_map;
				_tmp6_ = _data21_->calendar_day;
				_tmp7_ = g_signal_connect_data (_tmp6_, "day-selected", (GCallback) __widgets_calendar_calendar_view______lambda160__widgets_calendar_calendar_day_day_selected, block21_data_ref (_data21_), (GClosureNotify) block21_data_unref, 0);
				_tmp8_ = _data21_->calendar_day;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, (gpointer) ((guintptr) _tmp7_), (GObject*) _tmp8_);
				_tmp9_ = self->priv->days_grid;
				_tmp10_ = _data21_->calendar_day;
				gtk_grid_attach (_tmp9_, (GtkWidget*) _tmp10_, col, row, 1, 1);
				col = col + 1;
				if (col != 0) {
					_tmp11_ = (col % 7) == 0;
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					row = row + 1;
					col = 0;
				}
				_tmp12_ = _data21_->calendar_day;
				gtk_widget_set_visible ((GtkWidget*) _tmp12_, FALSE);
				_tmp13_ = self->priv->days_arraylist;
				_tmp14_ = _data21_->calendar_day;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp13_, _tmp14_);
				block21_data_unref (_data21_);
				_data21_ = NULL;
			}
		}
	}
	_tmp15_ = self->priv->days_grid;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp15_);
	return obj;
}

static void
widgets_calendar_calendar_view_class_init (WidgetsCalendarCalendarViewClass * klass,
                                           gpointer klass_data)
{
	widgets_calendar_calendar_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsCalendarCalendarView_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_calendar_calendar_view_get_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_calendar_calendar_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_calendar_calendar_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CALENDAR_CALENDAR_VIEW_CURRENT_DATE_PROPERTY, widgets_calendar_calendar_view_properties[WIDGETS_CALENDAR_CALENDAR_VIEW_CURRENT_DATE_PROPERTY] = g_param_spec_boxed ("current-date", "current-date", "current-date", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	widgets_calendar_calendar_view_signals[WIDGETS_CALENDAR_CALENDAR_VIEW_DAY_SELECTED_SIGNAL] = g_signal_new ("day-selected", WIDGETS_CALENDAR_TYPE_CALENDAR_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}

static void
widgets_calendar_calendar_view_instance_init (WidgetsCalendarCalendarView * self,
                                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = widgets_calendar_calendar_view_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_ULONG, NULL, NULL, G_TYPE_OBJECT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->signals_map = _tmp0_;
}

static void
widgets_calendar_calendar_view_finalize (GObject * obj)
{
	WidgetsCalendarCalendarView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_TYPE_CALENDAR_VIEW, WidgetsCalendarCalendarView);
	g_debug ("CalendarView.vala:55: Destroying - Widgets.Calendar.CalendarView\n");
	_g_object_unref0 (self->priv->days_arraylist);
	_g_object_unref0 (self->priv->days_grid);
	_g_date_time_unref0 (self->priv->_current_date);
	_g_object_unref0 (self->priv->signals_map);
	G_OBJECT_CLASS (widgets_calendar_calendar_view_parent_class)->finalize (obj);
}

static GType
widgets_calendar_calendar_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsCalendarCalendarViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_calendar_calendar_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsCalendarCalendarView), 0, (GInstanceInitFunc) widgets_calendar_calendar_view_instance_init, NULL };
	GType widgets_calendar_calendar_view_type_id;
	widgets_calendar_calendar_view_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsCalendarCalendarView", &g_define_type_info, 0);
	WidgetsCalendarCalendarView_private_offset = g_type_add_instance_private (widgets_calendar_calendar_view_type_id, sizeof (WidgetsCalendarCalendarViewPrivate));
	return widgets_calendar_calendar_view_type_id;
}

GType
widgets_calendar_calendar_view_get_type (void)
{
	static volatile gsize widgets_calendar_calendar_view_type_id__once = 0;
	if (g_once_init_enter (&widgets_calendar_calendar_view_type_id__once)) {
		GType widgets_calendar_calendar_view_type_id;
		widgets_calendar_calendar_view_type_id = widgets_calendar_calendar_view_get_type_once ();
		g_once_init_leave (&widgets_calendar_calendar_view_type_id__once, widgets_calendar_calendar_view_type_id);
	}
	return widgets_calendar_calendar_view_type_id__once;
}

static void
_vala_widgets_calendar_calendar_view_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	WidgetsCalendarCalendarView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CALENDAR_TYPE_CALENDAR_VIEW, WidgetsCalendarCalendarView);
	switch (property_id) {
		case WIDGETS_CALENDAR_CALENDAR_VIEW_CURRENT_DATE_PROPERTY:
		g_value_set_boxed (value, widgets_calendar_calendar_view_get_current_date (self));
		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;
}

