/* CalendarScroll.c generated by valac 0.56.19, the Vala compiler
 * generated from CalendarScroll.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 <gtk/gtk.h>
#include <gee.h>
#include <glib-object.h>
#include <adwaita.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.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

#define WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION (widgets_calendar_calendar_scroll_month_section_get_type ())
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, WidgetsCalendarCalendarScrollMonthSection))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, WidgetsCalendarCalendarScrollMonthSectionClass))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_IS_MONTH_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_IS_MONTH_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, WidgetsCalendarCalendarScrollMonthSectionClass))

typedef struct _WidgetsCalendarCalendarScrollMonthSection WidgetsCalendarCalendarScrollMonthSection;
typedef struct _WidgetsCalendarCalendarScrollMonthSectionClass WidgetsCalendarCalendarScrollMonthSectionClass;
enum  {
	WIDGETS_CALENDAR_CALENDAR_SCROLL_0_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DATE_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_NUM_PROPERTIES
};
static GParamSpec* widgets_calendar_calendar_scroll_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_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)))
typedef struct _Block23Data Block23Data;
typedef struct _WidgetsCalendarCalendarScrollMonthSectionPrivate WidgetsCalendarCalendarScrollMonthSectionPrivate;

#define WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM (widgets_calendar_calendar_scroll_day_item_get_type ())
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, WidgetsCalendarCalendarScrollDayItem))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, WidgetsCalendarCalendarScrollDayItemClass))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_IS_DAY_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_IS_DAY_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM))
#define WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, WidgetsCalendarCalendarScrollDayItemClass))

typedef struct _WidgetsCalendarCalendarScrollDayItem WidgetsCalendarCalendarScrollDayItem;
typedef struct _WidgetsCalendarCalendarScrollDayItemClass WidgetsCalendarCalendarScrollDayItemClass;
enum  {
	WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_0_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_MONTH_DATE_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_NUM_PROPERTIES
};
static GParamSpec* widgets_calendar_calendar_scroll_month_section_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block24Data Block24Data;
enum  {
	WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_DAY_SELECTED_SIGNAL,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_NUM_SIGNALS
};
static guint widgets_calendar_calendar_scroll_month_section_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_NUM_SIGNALS] = {0};
typedef struct _WidgetsCalendarCalendarScrollDayItemPrivate WidgetsCalendarCalendarScrollDayItemPrivate;
enum  {
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_0_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DAY_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DATE_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_TODAY_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_PAST_PROPERTY,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_NUM_PROPERTIES
};
static GParamSpec* widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_NUM_PROPERTIES];
enum  {
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_CLICKED_SIGNAL,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_NUM_SIGNALS
};
static guint widgets_calendar_calendar_scroll_day_item_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_NUM_SIGNALS] = {0};
typedef struct _Block25Data Block25Data;
enum  {
	WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_SELECTED_SIGNAL,
	WIDGETS_CALENDAR_CALENDAR_SCROLL_NUM_SIGNALS
};
static guint widgets_calendar_calendar_scroll_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_NUM_SIGNALS] = {0};

struct _WidgetsCalendarCalendarScrollPrivate {
	GtkScrolledWindow* scrolled_window;
	GtkBox* content_box;
	GeeArrayList* month_sections;
	gint loaded_months;
	gint loaded_past_months;
	GDateTime* _date;
};

struct _Block23Data {
	int _ref_count_;
	WidgetsCalendarCalendarScroll* self;
	gint index;
};

struct _WidgetsCalendarCalendarScrollMonthSection {
	AdwBin parent_instance;
	WidgetsCalendarCalendarScrollMonthSectionPrivate * priv;
};

struct _WidgetsCalendarCalendarScrollMonthSectionClass {
	AdwBinClass parent_class;
};

struct _WidgetsCalendarCalendarScrollMonthSectionPrivate {
	GDateTime* _month_date;
	GtkLabel* month_label;
	WidgetsCalendarCalendarWeek* calendar_week;
	GtkGrid* days_grid;
	GeeArrayList* day_items;
};

struct _Block24Data {
	int _ref_count_;
	WidgetsCalendarCalendarScrollMonthSection* self;
	WidgetsCalendarCalendarScrollDayItem* day_item;
};

struct _WidgetsCalendarCalendarScrollDayItem {
	AdwBin parent_instance;
	WidgetsCalendarCalendarScrollDayItemPrivate * priv;
};

struct _WidgetsCalendarCalendarScrollDayItemClass {
	AdwBinClass parent_class;
};

struct _WidgetsCalendarCalendarScrollDayItemPrivate {
	gint _day;
	GDateTime* _date;
	gboolean _is_today;
	gboolean _is_past;
	GtkButton* button;
};

struct _Block25Data {
	int _ref_count_;
	WidgetsCalendarCalendarScroll* self;
	GtkRevealer* today_button_revealer;
};

static gint WidgetsCalendarCalendarScroll_private_offset;
static gpointer widgets_calendar_calendar_scroll_parent_class = NULL;
static gint WidgetsCalendarCalendarScrollMonthSection_private_offset;
static gpointer widgets_calendar_calendar_scroll_month_section_parent_class = NULL;
static gint WidgetsCalendarCalendarScrollDayItem_private_offset;
static gpointer widgets_calendar_calendar_scroll_day_item_parent_class = NULL;

static GType widgets_calendar_calendar_scroll_month_section_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void widgets_calendar_calendar_scroll_load_initial_months (WidgetsCalendarCalendarScroll* self);
static void widgets_calendar_calendar_scroll_add_month_section (WidgetsCalendarCalendarScroll* self,
                                                         GDateTime* month_date);
static gboolean __lambda149_ (WidgetsCalendarCalendarScroll* self);
static void widgets_calendar_calendar_scroll_scroll_to_month_index (WidgetsCalendarCalendarScroll* self,
                                                             gint index);
static gboolean ___lambda149__gsource_func (gpointer self);
static void widgets_calendar_calendar_scroll_load_more_months (WidgetsCalendarCalendarScroll* self);
static WidgetsCalendarCalendarScrollMonthSection* widgets_calendar_calendar_scroll_month_section_new (GDateTime* month_date);
static WidgetsCalendarCalendarScrollMonthSection* widgets_calendar_calendar_scroll_month_section_construct (GType object_type,
                                                                                                     GDateTime* month_date);
static void __lambda148_ (WidgetsCalendarCalendarScroll* self,
                   GDateTime* date);
static void widgets_calendar_calendar_scroll_update_selection (WidgetsCalendarCalendarScroll* self);
static void ___lambda148__widgets_calendar_calendar_scroll_month_section_day_selected (WidgetsCalendarCalendarScrollMonthSection* _sender,
                                                                                GDateTime* date,
                                                                                gpointer self);
static void widgets_calendar_calendar_scroll_select_date (WidgetsCalendarCalendarScroll* self,
                                                   GDateTime* date);
static void widgets_calendar_calendar_scroll_ensure_month_loaded (WidgetsCalendarCalendarScroll* self,
                                                           GDateTime* target_date);
static void widgets_calendar_calendar_scroll_scroll_to_date (WidgetsCalendarCalendarScroll* self,
                                                      GDateTime* target_date);
static void ____lambda150_ (WidgetsCalendarCalendarScroll* self,
                     GDateTime* date);
static void _____lambda150__widgets_calendar_calendar_scroll_month_section_day_selected (WidgetsCalendarCalendarScrollMonthSection* _sender,
                                                                                  GDateTime* date,
                                                                                  gpointer self);
static Block23Data* block23_data_ref (Block23Data* _data23_);
static void block23_data_unref (void * _userdata_);
static gboolean __lambda151_ (Block23Data* _data23_);
static gboolean ___lambda151__gsource_func (gpointer self);
static void widgets_calendar_calendar_scroll_month_section_update_selection (WidgetsCalendarCalendarScrollMonthSection* self,
                                                                      GDateTime* selected_date);
static GType widgets_calendar_calendar_scroll_day_item_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void widgets_calendar_calendar_scroll_month_section_fill_days (WidgetsCalendarCalendarScrollMonthSection* self);
static GDateTime* widgets_calendar_calendar_scroll_month_section_get_month_date (WidgetsCalendarCalendarScrollMonthSection* self);
static Block24Data* block24_data_ref (Block24Data* _data24_);
static void block24_data_unref (void * _userdata_);
static WidgetsCalendarCalendarScrollDayItem* widgets_calendar_calendar_scroll_day_item_new (gint day,
                                                                                     GDateTime* date,
                                                                                     gboolean is_today,
                                                                                     gboolean is_past);
static WidgetsCalendarCalendarScrollDayItem* widgets_calendar_calendar_scroll_day_item_construct (GType object_type,
                                                                                           gint day,
                                                                                           GDateTime* date,
                                                                                           gboolean is_today,
                                                                                           gboolean is_past);
static void _____lambda147_ (Block24Data* _data24_);
static GDateTime* widgets_calendar_calendar_scroll_day_item_get_date (WidgetsCalendarCalendarScrollDayItem* self);
static void ______lambda147__widgets_calendar_calendar_scroll_day_item_clicked (WidgetsCalendarCalendarScrollDayItem* _sender,
                                                                         gpointer self);
static void widgets_calendar_calendar_scroll_day_item_update_selection (WidgetsCalendarCalendarScrollDayItem* self,
                                                                 GDateTime* selected_date);
static void widgets_calendar_calendar_scroll_month_section_set_month_date (WidgetsCalendarCalendarScrollMonthSection* self,
                                                                    GDateTime* value);
static GObject * widgets_calendar_calendar_scroll_month_section_constructor (GType type,
                                                                      guint n_construct_properties,
                                                                      GObjectConstructParam * construct_properties);
static void widgets_calendar_calendar_scroll_month_section_finalize (GObject * obj);
static GType widgets_calendar_calendar_scroll_month_section_get_type_once (void);
static void _vala_widgets_calendar_calendar_scroll_month_section_get_property (GObject * object,
                                                                        guint property_id,
                                                                        GValue * value,
                                                                        GParamSpec * pspec);
static void _vala_widgets_calendar_calendar_scroll_month_section_set_property (GObject * object,
                                                                        guint property_id,
                                                                        const GValue * value,
                                                                        GParamSpec * pspec);
static gint widgets_calendar_calendar_scroll_day_item_get_day (WidgetsCalendarCalendarScrollDayItem* self);
static void widgets_calendar_calendar_scroll_day_item_set_day (WidgetsCalendarCalendarScrollDayItem* self,
                                                        gint value);
static void widgets_calendar_calendar_scroll_day_item_set_date (WidgetsCalendarCalendarScrollDayItem* self,
                                                         GDateTime* value);
static gboolean widgets_calendar_calendar_scroll_day_item_get_is_today (WidgetsCalendarCalendarScrollDayItem* self);
static void widgets_calendar_calendar_scroll_day_item_set_is_today (WidgetsCalendarCalendarScrollDayItem* self,
                                                             gboolean value);
static gboolean widgets_calendar_calendar_scroll_day_item_get_is_past (WidgetsCalendarCalendarScrollDayItem* self);
static void widgets_calendar_calendar_scroll_day_item_set_is_past (WidgetsCalendarCalendarScrollDayItem* self,
                                                            gboolean value);
static GObject * widgets_calendar_calendar_scroll_day_item_constructor (GType type,
                                                                 guint n_construct_properties,
                                                                 GObjectConstructParam * construct_properties);
static void _widgets_calendar_calendar_scroll_day_item___lambda146_ (WidgetsCalendarCalendarScrollDayItem* self);
static void __widgets_calendar_calendar_scroll_day_item___lambda146__gtk_button_clicked (GtkButton* _sender,
                                                                                  gpointer self);
static void widgets_calendar_calendar_scroll_day_item_finalize (GObject * obj);
static GType widgets_calendar_calendar_scroll_day_item_get_type_once (void);
static void _vala_widgets_calendar_calendar_scroll_day_item_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static void _vala_widgets_calendar_calendar_scroll_day_item_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec);
static GObject * widgets_calendar_calendar_scroll_constructor (GType type,
                                                        guint n_construct_properties,
                                                        GObjectConstructParam * construct_properties);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
static void _widgets_calendar_calendar_scroll___lambda152_ (Block25Data* _data25_);
static void __widgets_calendar_calendar_scroll___lambda152__gtk_adjustment_value_changed (GtkAdjustment* _sender,
                                                                                   gpointer self);
static void _widgets_calendar_calendar_scroll___lambda153_ (WidgetsCalendarCalendarScroll* self);
static void __widgets_calendar_calendar_scroll___lambda153__gtk_button_clicked (GtkButton* _sender,
                                                                         gpointer self);
static void widgets_calendar_calendar_scroll_finalize (GObject * obj);
static GType widgets_calendar_calendar_scroll_get_type_once (void);
static void _vala_widgets_calendar_calendar_scroll_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_widgets_calendar_calendar_scroll_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
widgets_calendar_calendar_scroll_get_instance_private (WidgetsCalendarCalendarScroll* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsCalendarCalendarScroll_private_offset);
}

static gboolean
__lambda149_ (WidgetsCalendarCalendarScroll* self)
{
	gboolean result;
	widgets_calendar_calendar_scroll_scroll_to_month_index (self, self->priv->loaded_past_months);
	result = FALSE;
	return result;
}

static gboolean
___lambda149__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda149_ ((WidgetsCalendarCalendarScroll*) self);
	return result;
}

static void
widgets_calendar_calendar_scroll_load_initial_months (WidgetsCalendarCalendarScroll* self)
{
	GDateTime* today = NULL;
	GDateTime* _tmp0_;
	GDateTime* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_date_time_new_now_local ();
	today = _tmp0_;
	{
		gint i = 0;
		i = 3;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GDateTime* _tmp3_;
				GDateTime* _tmp4_;
				GDateTime* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ - 1;
				}
				_tmp1_ = FALSE;
				if (!(i >= 1)) {
					break;
				}
				_tmp3_ = today;
				_tmp4_ = g_date_time_add_months (_tmp3_, -i);
				_tmp5_ = _tmp4_;
				widgets_calendar_calendar_scroll_add_month_section (self, _tmp5_);
				_g_date_time_unref0 (_tmp5_);
			}
		}
	}
	self->priv->loaded_past_months = 3;
	_tmp6_ = today;
	widgets_calendar_calendar_scroll_add_month_section (self, _tmp6_);
	{
		gint i = 0;
		i = 1;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				GDateTime* _tmp9_;
				GDateTime* _tmp10_;
				GDateTime* _tmp11_;
				if (!_tmp7_) {
					gint _tmp8_;
					_tmp8_ = i;
					i = _tmp8_ + 1;
				}
				_tmp7_ = FALSE;
				if (!(i <= 2)) {
					break;
				}
				_tmp9_ = today;
				_tmp10_ = g_date_time_add_months (_tmp9_, i);
				_tmp11_ = _tmp10_;
				widgets_calendar_calendar_scroll_add_month_section (self, _tmp11_);
				_g_date_time_unref0 (_tmp11_);
			}
		}
	}
	self->priv->loaded_months = 3;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda149__gsource_func, g_object_ref (self), g_object_unref);
	_g_date_time_unref0 (today);
}

static void
widgets_calendar_calendar_scroll_load_more_months (WidgetsCalendarCalendarScroll* self)
{
	GDateTime* today = NULL;
	GDateTime* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_date_time_new_now_local ();
	today = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GDateTime* _tmp3_;
				GDateTime* _tmp4_;
				GDateTime* _tmp5_;
				gint _tmp6_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < 2)) {
					break;
				}
				_tmp3_ = today;
				_tmp4_ = g_date_time_add_months (_tmp3_, self->priv->loaded_months);
				_tmp5_ = _tmp4_;
				widgets_calendar_calendar_scroll_add_month_section (self, _tmp5_);
				_g_date_time_unref0 (_tmp5_);
				_tmp6_ = self->priv->loaded_months;
				self->priv->loaded_months = _tmp6_ + 1;
			}
		}
	}
	_g_date_time_unref0 (today);
}

static gpointer
_g_date_time_ref0 (gpointer self)
{
	return self ? g_date_time_ref (self) : NULL;
}

static void
__lambda148_ (WidgetsCalendarCalendarScroll* self,
              GDateTime* date)
{
	GDateTime* _tmp0_;
	g_return_if_fail (date != NULL);
	_tmp0_ = _g_date_time_ref0 (date);
	_g_date_time_unref0 (self->priv->_date);
	self->priv->_date = _tmp0_;
	widgets_calendar_calendar_scroll_update_selection (self);
	g_signal_emit (self, widgets_calendar_calendar_scroll_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_SELECTED_SIGNAL], 0);
}

static void
___lambda148__widgets_calendar_calendar_scroll_month_section_day_selected (WidgetsCalendarCalendarScrollMonthSection* _sender,
                                                                           GDateTime* date,
                                                                           gpointer self)
{
	__lambda148_ ((WidgetsCalendarCalendarScroll*) self, date);
}

static void
widgets_calendar_calendar_scroll_add_month_section (WidgetsCalendarCalendarScroll* self,
                                                    GDateTime* month_date)
{
	WidgetsCalendarCalendarScrollMonthSection* section = NULL;
	WidgetsCalendarCalendarScrollMonthSection* _tmp0_;
	GtkBox* _tmp1_;
	GeeArrayList* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (month_date != NULL);
	_tmp0_ = widgets_calendar_calendar_scroll_month_section_new (month_date);
	g_object_ref_sink (_tmp0_);
	section = _tmp0_;
	g_signal_connect_object (section, "day-selected", (GCallback) ___lambda148__widgets_calendar_calendar_scroll_month_section_day_selected, self, 0);
	_tmp1_ = self->priv->content_box;
	gtk_box_append (_tmp1_, (GtkWidget*) section);
	_tmp2_ = self->priv->month_sections;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp2_, section);
	_g_object_unref0 (section);
}

static void
widgets_calendar_calendar_scroll_select_date (WidgetsCalendarCalendarScroll* self,
                                              GDateTime* date)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (date != NULL);
	widgets_calendar_calendar_scroll_ensure_month_loaded (self, date);
	widgets_calendar_calendar_scroll_update_selection (self);
	widgets_calendar_calendar_scroll_scroll_to_date (self, date);
}

static void
____lambda150_ (WidgetsCalendarCalendarScroll* self,
                GDateTime* date)
{
	GDateTime* _tmp0_;
	g_return_if_fail (date != NULL);
	_tmp0_ = _g_date_time_ref0 (date);
	_g_date_time_unref0 (self->priv->_date);
	self->priv->_date = _tmp0_;
	widgets_calendar_calendar_scroll_update_selection (self);
	g_signal_emit (self, widgets_calendar_calendar_scroll_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_SELECTED_SIGNAL], 0);
}

static void
_____lambda150__widgets_calendar_calendar_scroll_month_section_day_selected (WidgetsCalendarCalendarScrollMonthSection* _sender,
                                                                             GDateTime* date,
                                                                             gpointer self)
{
	____lambda150_ ((WidgetsCalendarCalendarScroll*) self, date);
}

static void
widgets_calendar_calendar_scroll_ensure_month_loaded (WidgetsCalendarCalendarScroll* self,
                                                      GDateTime* target_date)
{
	GDateTime* today = NULL;
	GDateTime* _tmp0_;
	gint months_diff = 0;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (target_date != NULL);
	_tmp0_ = g_date_time_new_now_local ();
	today = _tmp0_;
	_tmp1_ = today;
	_tmp2_ = today;
	months_diff = ((g_date_time_get_year (target_date) - g_date_time_get_year (_tmp1_)) * 12) + (g_date_time_get_month (target_date) - g_date_time_get_month (_tmp2_));
	if (months_diff < 0) {
		while (TRUE) {
			gint _tmp3_;
			WidgetsCalendarCalendarScrollMonthSection* section = NULL;
			GDateTime* _tmp4_;
			GDateTime* _tmp5_;
			GDateTime* _tmp6_;
			WidgetsCalendarCalendarScrollMonthSection* _tmp7_;
			WidgetsCalendarCalendarScrollMonthSection* _tmp8_;
			WidgetsCalendarCalendarScrollMonthSection* _tmp9_;
			GtkBox* _tmp10_;
			WidgetsCalendarCalendarScrollMonthSection* _tmp11_;
			GeeArrayList* _tmp12_;
			WidgetsCalendarCalendarScrollMonthSection* _tmp13_;
			if (!(self->priv->loaded_past_months < (-months_diff))) {
				break;
			}
			_tmp3_ = self->priv->loaded_past_months;
			self->priv->loaded_past_months = _tmp3_ + 1;
			_tmp4_ = today;
			_tmp5_ = g_date_time_add_months (_tmp4_, -self->priv->loaded_past_months);
			_tmp6_ = _tmp5_;
			_tmp7_ = widgets_calendar_calendar_scroll_month_section_new (_tmp6_);
			g_object_ref_sink (_tmp7_);
			_tmp8_ = _tmp7_;
			_g_date_time_unref0 (_tmp6_);
			section = _tmp8_;
			_tmp9_ = section;
			g_signal_connect_object (_tmp9_, "day-selected", (GCallback) _____lambda150__widgets_calendar_calendar_scroll_month_section_day_selected, self, 0);
			_tmp10_ = self->priv->content_box;
			_tmp11_ = section;
			gtk_box_prepend (_tmp10_, (GtkWidget*) _tmp11_);
			_tmp12_ = self->priv->month_sections;
			_tmp13_ = section;
			gee_abstract_list_insert ((GeeAbstractList*) _tmp12_, 0, _tmp13_);
			_g_object_unref0 (section);
		}
		_g_date_time_unref0 (today);
		return;
	}
	while (TRUE) {
		GDateTime* _tmp14_;
		GDateTime* _tmp15_;
		GDateTime* _tmp16_;
		gint _tmp17_;
		if (!(self->priv->loaded_months <= months_diff)) {
			break;
		}
		_tmp14_ = today;
		_tmp15_ = g_date_time_add_months (_tmp14_, self->priv->loaded_months);
		_tmp16_ = _tmp15_;
		widgets_calendar_calendar_scroll_add_month_section (self, _tmp16_);
		_g_date_time_unref0 (_tmp16_);
		_tmp17_ = self->priv->loaded_months;
		self->priv->loaded_months = _tmp17_ + 1;
	}
	_g_date_time_unref0 (today);
}

static void
widgets_calendar_calendar_scroll_scroll_to_month_index (WidgetsCalendarCalendarScroll* self,
                                                        gint index)
{
	gboolean _tmp0_ = FALSE;
	WidgetsCalendarCalendarScrollMonthSection* target_section = NULL;
	GeeArrayList* _tmp4_;
	gpointer _tmp5_;
	gdouble target_y = 0.0;
	gdouble center_offset = 0.0;
	GtkScrolledWindow* _tmp11_;
	GtkAdjustment* _tmp12_;
	GtkAdjustment* _tmp13_;
	gdouble _tmp14_;
	gdouble _tmp15_;
	WidgetsCalendarCalendarScrollMonthSection* _tmp16_;
	GtkScrolledWindow* _tmp17_;
	GtkAdjustment* _tmp18_;
	GtkAdjustment* _tmp19_;
	g_return_if_fail (self != NULL);
	if (index < 0) {
		_tmp0_ = TRUE;
	} else {
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		_tmp1_ = self->priv->month_sections;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp0_ = index >= _tmp3_;
	}
	if (_tmp0_) {
		return;
	}
	_tmp4_ = self->priv->month_sections;
	_tmp5_ = gee_abstract_list_get ((GeeAbstractList*) _tmp4_, index);
	target_section = (WidgetsCalendarCalendarScrollMonthSection*) _tmp5_;
	target_y = (gdouble) 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp6_ = FALSE;
			_tmp6_ = TRUE;
			while (TRUE) {
				GeeArrayList* _tmp8_;
				gpointer _tmp9_;
				WidgetsCalendarCalendarScrollMonthSection* _tmp10_;
				if (!_tmp6_) {
					gint _tmp7_;
					_tmp7_ = i;
					i = _tmp7_ + 1;
				}
				_tmp6_ = FALSE;
				if (!(i < index)) {
					break;
				}
				_tmp8_ = self->priv->month_sections;
				_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, i);
				_tmp10_ = (WidgetsCalendarCalendarScrollMonthSection*) _tmp9_;
				target_y += (gdouble) (gtk_widget_get_allocated_height ((GtkWidget*) _tmp10_) + 12);
				_g_object_unref0 (_tmp10_);
			}
		}
	}
	_tmp11_ = self->priv->scrolled_window;
	_tmp12_ = gtk_scrolled_window_get_vadjustment (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = gtk_adjustment_get_page_size (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = target_section;
	center_offset = (_tmp15_ - gtk_widget_get_allocated_height ((GtkWidget*) _tmp16_)) / 2;
	_tmp17_ = self->priv->scrolled_window;
	_tmp18_ = gtk_scrolled_window_get_vadjustment (_tmp17_);
	_tmp19_ = _tmp18_;
	gtk_adjustment_set_value (_tmp19_, MAX ((gdouble) 0, target_y - center_offset));
	_g_object_unref0 (target_section);
}

static Block23Data*
block23_data_ref (Block23Data* _data23_)
{
	g_atomic_int_inc (&_data23_->_ref_count_);
	return _data23_;
}

static void
block23_data_unref (void * _userdata_)
{
	Block23Data* _data23_;
	_data23_ = (Block23Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data23_->_ref_count_)) {
		WidgetsCalendarCalendarScroll* self;
		self = _data23_->self;
		_g_object_unref0 (self);
		g_slice_free (Block23Data, _data23_);
	}
}

static gboolean
__lambda151_ (Block23Data* _data23_)
{
	WidgetsCalendarCalendarScroll* self;
	gboolean result;
	self = _data23_->self;
	widgets_calendar_calendar_scroll_scroll_to_month_index (self, _data23_->index);
	result = FALSE;
	return result;
}

static gboolean
___lambda151__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda151_ (self);
	return result;
}

static void
widgets_calendar_calendar_scroll_scroll_to_date (WidgetsCalendarCalendarScroll* self,
                                                 GDateTime* target_date)
{
	Block23Data* _data23_;
	GDateTime* today = NULL;
	GDateTime* _tmp0_;
	gint months_diff = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (target_date != NULL);
	_data23_ = g_slice_new0 (Block23Data);
	_data23_->_ref_count_ = 1;
	_data23_->self = g_object_ref (self);
	_tmp0_ = g_date_time_new_now_local ();
	today = _tmp0_;
	months_diff = ((g_date_time_get_year (target_date) - g_date_time_get_year (today)) * 12) + (g_date_time_get_month (target_date) - g_date_time_get_month (today));
	_data23_->index = self->priv->loaded_past_months + months_diff;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda151__gsource_func, block23_data_ref (_data23_), block23_data_unref);
	_g_date_time_unref0 (today);
	block23_data_unref (_data23_);
	_data23_ = NULL;
}

static void
widgets_calendar_calendar_scroll_update_selection (WidgetsCalendarCalendarScroll* self)
{
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _section_list = NULL;
		GeeArrayList* _tmp0_;
		gint _section_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _section_index = 0;
		_tmp0_ = self->priv->month_sections;
		_section_list = _tmp0_;
		_tmp1_ = _section_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_section_size = _tmp3_;
		_section_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			WidgetsCalendarCalendarScrollMonthSection* section = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			WidgetsCalendarCalendarScrollMonthSection* _tmp8_;
			GDateTime* _tmp9_;
			_section_index = _section_index + 1;
			_tmp4_ = _section_index;
			_tmp5_ = _section_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _section_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _section_index);
			section = (WidgetsCalendarCalendarScrollMonthSection*) _tmp7_;
			_tmp8_ = section;
			_tmp9_ = self->priv->_date;
			widgets_calendar_calendar_scroll_month_section_update_selection (_tmp8_, _tmp9_);
			_g_object_unref0 (section);
		}
	}
}

void
widgets_calendar_calendar_scroll_reset (WidgetsCalendarCalendarScroll* self)
{
	g_return_if_fail (self != NULL);
	_g_date_time_unref0 (self->priv->_date);
	self->priv->_date = NULL;
	widgets_calendar_calendar_scroll_update_selection (self);
}

void
widgets_calendar_calendar_scroll_scroll_to_selected_date (WidgetsCalendarCalendarScroll* self)
{
	GDateTime* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_date;
	if (_tmp0_ != NULL) {
		GDateTime* _tmp1_;
		_tmp1_ = self->priv->_date;
		widgets_calendar_calendar_scroll_scroll_to_date (self, _tmp1_);
	} else {
		widgets_calendar_calendar_scroll_scroll_to_month_index (self, self->priv->loaded_past_months);
	}
}

WidgetsCalendarCalendarScroll*
widgets_calendar_calendar_scroll_construct (GType object_type)
{
	WidgetsCalendarCalendarScroll * self = NULL;
	self = (WidgetsCalendarCalendarScroll*) g_object_new (object_type, NULL);
	return self;
}

WidgetsCalendarCalendarScroll*
widgets_calendar_calendar_scroll_new (void)
{
	return widgets_calendar_calendar_scroll_construct (WIDGETS_CALENDAR_TYPE_CALENDAR_SCROLL);
}

GDateTime*
widgets_calendar_calendar_scroll_get_date (WidgetsCalendarCalendarScroll* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_date;
	result = _tmp0_;
	return result;
}

void
widgets_calendar_calendar_scroll_set_date (WidgetsCalendarCalendarScroll* self,
                                           GDateTime* value)
{
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_date_time_ref0 (value);
	_g_date_time_unref0 (self->priv->_date);
	self->priv->_date = _tmp0_;
	_tmp1_ = self->priv->_date;
	if (_tmp1_ != NULL) {
		GDateTime* _tmp2_;
		_tmp2_ = self->priv->_date;
		widgets_calendar_calendar_scroll_select_date (self, _tmp2_);
	}
	g_object_notify_by_pspec ((GObject *) self, widgets_calendar_calendar_scroll_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DATE_PROPERTY]);
}

static inline gpointer
widgets_calendar_calendar_scroll_month_section_get_instance_private (WidgetsCalendarCalendarScrollMonthSection* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsCalendarCalendarScrollMonthSection_private_offset);
}

static WidgetsCalendarCalendarScrollMonthSection*
widgets_calendar_calendar_scroll_month_section_construct (GType object_type,
                                                          GDateTime* month_date)
{
	WidgetsCalendarCalendarScrollMonthSection * self = NULL;
	g_return_val_if_fail (month_date != NULL, NULL);
	self = (WidgetsCalendarCalendarScrollMonthSection*) g_object_new (object_type, "month-date", month_date, NULL);
	return self;
}

static WidgetsCalendarCalendarScrollMonthSection*
widgets_calendar_calendar_scroll_month_section_new (GDateTime* month_date)
{
	return widgets_calendar_calendar_scroll_month_section_construct (WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, month_date);
}

static Block24Data*
block24_data_ref (Block24Data* _data24_)
{
	g_atomic_int_inc (&_data24_->_ref_count_);
	return _data24_;
}

static void
block24_data_unref (void * _userdata_)
{
	Block24Data* _data24_;
	_data24_ = (Block24Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
		WidgetsCalendarCalendarScrollMonthSection* self;
		self = _data24_->self;
		_g_object_unref0 (_data24_->day_item);
		_g_object_unref0 (self);
		g_slice_free (Block24Data, _data24_);
	}
}

static void
_____lambda147_ (Block24Data* _data24_)
{
	WidgetsCalendarCalendarScrollMonthSection* self;
	WidgetsCalendarCalendarScrollDayItem* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	self = _data24_->self;
	_tmp0_ = _data24_->day_item;
	_tmp1_ = widgets_calendar_calendar_scroll_day_item_get_date (_tmp0_);
	_tmp2_ = _tmp1_;
	g_signal_emit (self, widgets_calendar_calendar_scroll_month_section_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_DAY_SELECTED_SIGNAL], 0, _tmp2_);
}

static void
______lambda147__widgets_calendar_calendar_scroll_day_item_clicked (WidgetsCalendarCalendarScrollDayItem* _sender,
                                                                    gpointer self)
{
	_____lambda147_ (self);
}

static void
widgets_calendar_calendar_scroll_month_section_fill_days (WidgetsCalendarCalendarScrollMonthSection* self)
{
	GDateTime* today = NULL;
	GDateTime* _tmp0_;
	GDateTime* today_date = NULL;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	GDateTime* _tmp4_;
	GDateTime* _tmp5_;
	GDateTime* _tmp6_;
	gint max_days = 0;
	GDateTime* _tmp15_;
	GDateTime* _tmp16_;
	gint start_week = 0;
	ServicesSettings* _tmp17_;
	ServicesSettings* _tmp18_;
	GSettings* _tmp19_;
	gint _tmp20_;
	GDateTime* first_day_date = NULL;
	GDateTime* _tmp21_;
	GDateTime* _tmp22_;
	GDateTime* _tmp23_;
	gint day_of_week = 0;
	GDateTime* _tmp24_;
	gint col = 0;
	gint row = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_date_time_new_now_local ();
	today = _tmp0_;
	_tmp1_ = today;
	_tmp2_ = today;
	_tmp3_ = today;
	_tmp4_ = g_date_time_new_local (g_date_time_get_year (_tmp1_), g_date_time_get_month (_tmp2_), g_date_time_get_day_of_month (_tmp3_), 0, 0, (gdouble) 0);
	today_date = _tmp4_;
	_tmp5_ = self->priv->_month_date;
	_tmp6_ = today;
	if (g_date_time_get_year (_tmp5_) == g_date_time_get_year (_tmp6_)) {
		GtkLabel* _tmp7_;
		GDateTime* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp7_ = self->priv->month_label;
		_tmp8_ = self->priv->_month_date;
		_tmp9_ = g_date_time_format (_tmp8_, "%B");
		_tmp10_ = _tmp9_;
		gtk_label_set_label (_tmp7_, _tmp10_);
		_g_free0 (_tmp10_);
	} else {
		GtkLabel* _tmp11_;
		GDateTime* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		_tmp11_ = self->priv->month_label;
		_tmp12_ = self->priv->_month_date;
		_tmp13_ = g_date_time_format (_tmp12_, "%B %Y");
		_tmp14_ = _tmp13_;
		gtk_label_set_label (_tmp11_, _tmp14_);
		_g_free0 (_tmp14_);
	}
	_tmp15_ = self->priv->_month_date;
	_tmp16_ = self->priv->_month_date;
	max_days = utils_datetime_get_days_of_month (g_date_time_get_month (_tmp15_), g_date_time_get_year (_tmp16_));
	_tmp17_ = services_settings_get_default ();
	_tmp18_ = _tmp17_;
	_tmp19_ = _tmp18_->settings;
	_tmp20_ = g_settings_get_enum (_tmp19_, "start-week");
	_g_object_unref0 (_tmp18_);
	start_week = _tmp20_;
	_tmp21_ = self->priv->_month_date;
	_tmp22_ = self->priv->_month_date;
	_tmp23_ = g_date_time_new_local (g_date_time_get_year (_tmp21_), g_date_time_get_month (_tmp22_), 1, 0, 0, (gdouble) 0);
	first_day_date = _tmp23_;
	_tmp24_ = first_day_date;
	day_of_week = g_date_time_get_day_of_week (_tmp24_) % 7;
	col = ((day_of_week - start_week) + 7) % 7;
	row = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp25_ = FALSE;
			_tmp25_ = TRUE;
			while (TRUE) {
				GtkGrid* _tmp27_;
				GtkLabel* _tmp28_;
				GtkLabel* _tmp29_;
				if (!_tmp25_) {
					gint _tmp26_;
					_tmp26_ = i;
					i = _tmp26_ + 1;
				}
				_tmp25_ = FALSE;
				if (!(i < col)) {
					break;
				}
				_tmp27_ = self->priv->days_grid;
				_tmp28_ = (GtkLabel*) gtk_label_new (NULL);
				g_object_ref_sink (_tmp28_);
				_tmp29_ = _tmp28_;
				gtk_grid_attach (_tmp27_, (GtkWidget*) _tmp29_, i, 0, 1, 1);
				_g_object_unref0 (_tmp29_);
			}
		}
	}
	{
		gint day = 0;
		day = 1;
		{
			gboolean _tmp30_ = FALSE;
			_tmp30_ = TRUE;
			while (TRUE) {
				Block24Data* _data24_;
				GDateTime* day_datetime = NULL;
				GDateTime* _tmp32_;
				GDateTime* _tmp33_;
				GDateTime* _tmp34_;
				gboolean is_today = FALSE;
				GDateTime* _tmp35_;
				GDateTime* _tmp36_;
				gboolean is_past = FALSE;
				GDateTime* _tmp37_;
				GDateTime* _tmp38_;
				GDateTime* _tmp39_;
				WidgetsCalendarCalendarScrollDayItem* _tmp40_;
				WidgetsCalendarCalendarScrollDayItem* _tmp41_;
				GtkGrid* _tmp42_;
				WidgetsCalendarCalendarScrollDayItem* _tmp43_;
				GeeArrayList* _tmp44_;
				WidgetsCalendarCalendarScrollDayItem* _tmp45_;
				gint _tmp46_;
				_data24_ = g_slice_new0 (Block24Data);
				_data24_->_ref_count_ = 1;
				_data24_->self = g_object_ref (self);
				if (!_tmp30_) {
					gint _tmp31_;
					_tmp31_ = day;
					day = _tmp31_ + 1;
				}
				_tmp30_ = FALSE;
				if (!(day <= max_days)) {
					block24_data_unref (_data24_);
					_data24_ = NULL;
					break;
				}
				_tmp32_ = self->priv->_month_date;
				_tmp33_ = self->priv->_month_date;
				_tmp34_ = g_date_time_new_local (g_date_time_get_year (_tmp32_), g_date_time_get_month (_tmp33_), day, 0, 0, (gdouble) 0);
				day_datetime = _tmp34_;
				_tmp35_ = day_datetime;
				_tmp36_ = today_date;
				is_today = g_date_time_compare (_tmp35_, _tmp36_) == 0;
				_tmp37_ = day_datetime;
				_tmp38_ = today_date;
				is_past = g_date_time_compare (_tmp37_, _tmp38_) < 0;
				_tmp39_ = day_datetime;
				_tmp40_ = widgets_calendar_calendar_scroll_day_item_new (day, _tmp39_, is_today, is_past);
				g_object_ref_sink (_tmp40_);
				_data24_->day_item = _tmp40_;
				_tmp41_ = _data24_->day_item;
				g_signal_connect_data (_tmp41_, "clicked", (GCallback) ______lambda147__widgets_calendar_calendar_scroll_day_item_clicked, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
				_tmp42_ = self->priv->days_grid;
				_tmp43_ = _data24_->day_item;
				gtk_grid_attach (_tmp42_, (GtkWidget*) _tmp43_, col, row, 1, 1);
				_tmp44_ = self->priv->day_items;
				_tmp45_ = _data24_->day_item;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp44_, _tmp45_);
				_tmp46_ = col;
				col = _tmp46_ + 1;
				if (col >= 7) {
					gint _tmp47_;
					col = 0;
					_tmp47_ = row;
					row = _tmp47_ + 1;
				}
				_g_date_time_unref0 (day_datetime);
				block24_data_unref (_data24_);
				_data24_ = NULL;
			}
		}
	}
	_g_date_time_unref0 (first_day_date);
	_g_date_time_unref0 (today_date);
	_g_date_time_unref0 (today);
}

static void
widgets_calendar_calendar_scroll_month_section_update_selection (WidgetsCalendarCalendarScrollMonthSection* self,
                                                                 GDateTime* selected_date)
{
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _item_list = NULL;
		GeeArrayList* _tmp0_;
		gint _item_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _item_index = 0;
		_tmp0_ = self->priv->day_items;
		_item_list = _tmp0_;
		_tmp1_ = _item_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_item_size = _tmp3_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			WidgetsCalendarCalendarScrollDayItem* item = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			WidgetsCalendarCalendarScrollDayItem* _tmp8_;
			_item_index = _item_index + 1;
			_tmp4_ = _item_index;
			_tmp5_ = _item_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _item_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _item_index);
			item = (WidgetsCalendarCalendarScrollDayItem*) _tmp7_;
			_tmp8_ = item;
			widgets_calendar_calendar_scroll_day_item_update_selection (_tmp8_, selected_date);
			_g_object_unref0 (item);
		}
	}
}

static GDateTime*
widgets_calendar_calendar_scroll_month_section_get_month_date (WidgetsCalendarCalendarScrollMonthSection* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_month_date;
	result = _tmp0_;
	return result;
}

static void
widgets_calendar_calendar_scroll_month_section_set_month_date (WidgetsCalendarCalendarScrollMonthSection* self,
                                                               GDateTime* value)
{
	GDateTime* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_calendar_calendar_scroll_month_section_get_month_date (self);
	if (old_value != value) {
		GDateTime* _tmp0_;
		_tmp0_ = _g_date_time_ref0 (value);
		_g_date_time_unref0 (self->priv->_month_date);
		self->priv->_month_date = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_calendar_calendar_scroll_month_section_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_MONTH_DATE_PROPERTY]);
	}
}

static GObject *
widgets_calendar_calendar_scroll_month_section_constructor (GType type,
                                                            guint n_construct_properties,
                                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsCalendarCalendarScrollMonthSection * self;
	GeeArrayList* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_;
	GtkLabel* _tmp3_ = NULL;
	WidgetsCalendarCalendarWeek* _tmp4_ = NULL;
	GtkGrid* _tmp5_ = NULL;
	GtkBox* main_box = NULL;
	GtkBox* _tmp6_ = NULL;
	GtkBox* _tmp7_;
	GtkLabel* _tmp8_;
	GtkBox* _tmp9_;
	WidgetsCalendarCalendarWeek* _tmp10_;
	GtkBox* _tmp11_;
	GtkGrid* _tmp12_;
	GtkBox* _tmp13_;
	GtkSeparator* _tmp14_ = NULL;
	GtkSeparator* _tmp15_;
	GtkBox* _tmp16_;
	parent_class = G_OBJECT_CLASS (widgets_calendar_calendar_scroll_month_section_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, WidgetsCalendarCalendarScrollMonthSection);
	_tmp0_ = gee_array_list_new (WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->day_items);
	self->priv->day_items = _tmp0_;
	_tmp1_ = g_strdup ("font-bold");
	_tmp2_ = g_new0 (gchar*, 1 + 1);
	_tmp2_[0] = _tmp1_;
	_tmp3_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp3_, _tmp2_);
	_tmp2_ = (_vala_array_free (_tmp2_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 9);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->month_label);
	self->priv->month_label = _tmp3_;
	_tmp4_ = widgets_calendar_calendar_week_new ();
	widgets_calendar_calendar_week_set_margin_horizontal (_tmp4_, 0);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp4_, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp4_, 0);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->calendar_week);
	self->priv->calendar_week = _tmp4_;
	_tmp5_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_homogeneous (_tmp5_, TRUE);
	gtk_grid_set_row_homogeneous (_tmp5_, TRUE);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->days_grid);
	self->priv->days_grid = _tmp5_;
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp6_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp6_, 6);
	g_object_ref_sink (_tmp6_);
	main_box = _tmp6_;
	_tmp7_ = main_box;
	_tmp8_ = self->priv->month_label;
	gtk_box_append (_tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = main_box;
	_tmp10_ = self->priv->calendar_week;
	gtk_box_append (_tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = main_box;
	_tmp12_ = self->priv->days_grid;
	gtk_box_append (_tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = main_box;
	_tmp14_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp14_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp14_, 6);
	g_object_ref_sink (_tmp14_);
	_tmp15_ = _tmp14_;
	gtk_box_append (_tmp13_, (GtkWidget*) _tmp15_);
	_g_object_unref0 (_tmp15_);
	_tmp16_ = main_box;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp16_);
	widgets_calendar_calendar_scroll_month_section_fill_days (self);
	_g_object_unref0 (main_box);
	return obj;
}

static void
widgets_calendar_calendar_scroll_month_section_class_init (WidgetsCalendarCalendarScrollMonthSectionClass * klass,
                                                           gpointer klass_data)
{
	widgets_calendar_calendar_scroll_month_section_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsCalendarCalendarScrollMonthSection_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_calendar_calendar_scroll_month_section_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_calendar_calendar_scroll_month_section_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_calendar_calendar_scroll_month_section_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_calendar_calendar_scroll_month_section_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_MONTH_DATE_PROPERTY, widgets_calendar_calendar_scroll_month_section_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_MONTH_DATE_PROPERTY] = g_param_spec_boxed ("month-date", "month-date", "month-date", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	widgets_calendar_calendar_scroll_month_section_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_DAY_SELECTED_SIGNAL] = g_signal_new ("day-selected", WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, G_TYPE_DATE_TIME);
}

static void
widgets_calendar_calendar_scroll_month_section_instance_init (WidgetsCalendarCalendarScrollMonthSection * self,
                                                              gpointer klass)
{
	self->priv = widgets_calendar_calendar_scroll_month_section_get_instance_private (self);
}

static void
widgets_calendar_calendar_scroll_month_section_finalize (GObject * obj)
{
	WidgetsCalendarCalendarScrollMonthSection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, WidgetsCalendarCalendarScrollMonthSection);
	_g_date_time_unref0 (self->priv->_month_date);
	_g_object_unref0 (self->priv->month_label);
	_g_object_unref0 (self->priv->calendar_week);
	_g_object_unref0 (self->priv->days_grid);
	_g_object_unref0 (self->priv->day_items);
	G_OBJECT_CLASS (widgets_calendar_calendar_scroll_month_section_parent_class)->finalize (obj);
}

static GType
widgets_calendar_calendar_scroll_month_section_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsCalendarCalendarScrollMonthSectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_calendar_calendar_scroll_month_section_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsCalendarCalendarScrollMonthSection), 0, (GInstanceInitFunc) widgets_calendar_calendar_scroll_month_section_instance_init, NULL };
	GType widgets_calendar_calendar_scroll_month_section_type_id;
	widgets_calendar_calendar_scroll_month_section_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsCalendarCalendarScrollMonthSection", &g_define_type_info, 0);
	WidgetsCalendarCalendarScrollMonthSection_private_offset = g_type_add_instance_private (widgets_calendar_calendar_scroll_month_section_type_id, sizeof (WidgetsCalendarCalendarScrollMonthSectionPrivate));
	return widgets_calendar_calendar_scroll_month_section_type_id;
}

static GType
widgets_calendar_calendar_scroll_month_section_get_type (void)
{
	static volatile gsize widgets_calendar_calendar_scroll_month_section_type_id__once = 0;
	if (g_once_init_enter (&widgets_calendar_calendar_scroll_month_section_type_id__once)) {
		GType widgets_calendar_calendar_scroll_month_section_type_id;
		widgets_calendar_calendar_scroll_month_section_type_id = widgets_calendar_calendar_scroll_month_section_get_type_once ();
		g_once_init_leave (&widgets_calendar_calendar_scroll_month_section_type_id__once, widgets_calendar_calendar_scroll_month_section_type_id);
	}
	return widgets_calendar_calendar_scroll_month_section_type_id__once;
}

static void
_vala_widgets_calendar_calendar_scroll_month_section_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec)
{
	WidgetsCalendarCalendarScrollMonthSection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, WidgetsCalendarCalendarScrollMonthSection);
	switch (property_id) {
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_MONTH_DATE_PROPERTY:
		g_value_set_boxed (value, widgets_calendar_calendar_scroll_month_section_get_month_date (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_calendar_calendar_scroll_month_section_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec)
{
	WidgetsCalendarCalendarScrollMonthSection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, WidgetsCalendarCalendarScrollMonthSection);
	switch (property_id) {
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_MONTH_SECTION_MONTH_DATE_PROPERTY:
		widgets_calendar_calendar_scroll_month_section_set_month_date (self, g_value_get_boxed (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
widgets_calendar_calendar_scroll_day_item_get_instance_private (WidgetsCalendarCalendarScrollDayItem* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsCalendarCalendarScrollDayItem_private_offset);
}

static WidgetsCalendarCalendarScrollDayItem*
widgets_calendar_calendar_scroll_day_item_construct (GType object_type,
                                                     gint day,
                                                     GDateTime* date,
                                                     gboolean is_today,
                                                     gboolean is_past)
{
	WidgetsCalendarCalendarScrollDayItem * self = NULL;
	g_return_val_if_fail (date != NULL, NULL);
	self = (WidgetsCalendarCalendarScrollDayItem*) g_object_new (object_type, "day", day, "date", date, "is-today", is_today, "is-past", is_past, "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_CENTER, NULL);
	return self;
}

static WidgetsCalendarCalendarScrollDayItem*
widgets_calendar_calendar_scroll_day_item_new (gint day,
                                               GDateTime* date,
                                               gboolean is_today,
                                               gboolean is_past)
{
	return widgets_calendar_calendar_scroll_day_item_construct (WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, day, date, is_today, is_past);
}

static void
widgets_calendar_calendar_scroll_day_item_update_selection (WidgetsCalendarCalendarScrollDayItem* self,
                                                            GDateTime* selected_date)
{
	GtkButton* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->button;
	gtk_widget_remove_css_class ((GtkWidget*) _tmp0_, "selected");
	if (selected_date != NULL) {
		GDateTime* _tmp4_;
		_tmp4_ = self->priv->_date;
		_tmp3_ = g_date_time_get_year (_tmp4_) == g_date_time_get_year (selected_date);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		GDateTime* _tmp5_;
		_tmp5_ = self->priv->_date;
		_tmp2_ = g_date_time_get_month (_tmp5_) == g_date_time_get_month (selected_date);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		GDateTime* _tmp6_;
		_tmp6_ = self->priv->_date;
		_tmp1_ = g_date_time_get_day_of_month (_tmp6_) == g_date_time_get_day_of_month (selected_date);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GtkButton* _tmp7_;
		_tmp7_ = self->priv->button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp7_, "selected");
	}
}

static gint
widgets_calendar_calendar_scroll_day_item_get_day (WidgetsCalendarCalendarScrollDayItem* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_day;
	return result;
}

static void
widgets_calendar_calendar_scroll_day_item_set_day (WidgetsCalendarCalendarScrollDayItem* self,
                                                   gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_calendar_calendar_scroll_day_item_get_day (self);
	if (old_value != value) {
		self->priv->_day = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DAY_PROPERTY]);
	}
}

static GDateTime*
widgets_calendar_calendar_scroll_day_item_get_date (WidgetsCalendarCalendarScrollDayItem* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_date;
	result = _tmp0_;
	return result;
}

static void
widgets_calendar_calendar_scroll_day_item_set_date (WidgetsCalendarCalendarScrollDayItem* self,
                                                    GDateTime* value)
{
	GDateTime* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_calendar_calendar_scroll_day_item_get_date (self);
	if (old_value != value) {
		GDateTime* _tmp0_;
		_tmp0_ = _g_date_time_ref0 (value);
		_g_date_time_unref0 (self->priv->_date);
		self->priv->_date = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DATE_PROPERTY]);
	}
}

static gboolean
widgets_calendar_calendar_scroll_day_item_get_is_today (WidgetsCalendarCalendarScrollDayItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_today;
	return result;
}

static void
widgets_calendar_calendar_scroll_day_item_set_is_today (WidgetsCalendarCalendarScrollDayItem* self,
                                                        gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_calendar_calendar_scroll_day_item_get_is_today (self);
	if (old_value != value) {
		self->priv->_is_today = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_TODAY_PROPERTY]);
	}
}

static gboolean
widgets_calendar_calendar_scroll_day_item_get_is_past (WidgetsCalendarCalendarScrollDayItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_past;
	return result;
}

static void
widgets_calendar_calendar_scroll_day_item_set_is_past (WidgetsCalendarCalendarScrollDayItem* self,
                                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_calendar_calendar_scroll_day_item_get_is_past (self);
	if (old_value != value) {
		self->priv->_is_past = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_PAST_PROPERTY]);
	}
}

static void
_widgets_calendar_calendar_scroll_day_item___lambda146_ (WidgetsCalendarCalendarScrollDayItem* self)
{
	g_signal_emit (self, widgets_calendar_calendar_scroll_day_item_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_CLICKED_SIGNAL], 0);
}

static void
__widgets_calendar_calendar_scroll_day_item___lambda146__gtk_button_clicked (GtkButton* _sender,
                                                                             gpointer self)
{
	_widgets_calendar_calendar_scroll_day_item___lambda146_ ((WidgetsCalendarCalendarScrollDayItem*) self);
}

static GObject *
widgets_calendar_calendar_scroll_day_item_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsCalendarCalendarScrollDayItem * self;
	gint _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	GtkButton* _tmp6_ = NULL;
	GtkButton* _tmp7_;
	GDateTime* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gboolean _tmp11_;
	GtkButton* _tmp15_;
	GtkButton* _tmp16_;
	parent_class = G_OBJECT_CLASS (widgets_calendar_calendar_scroll_day_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, WidgetsCalendarCalendarScrollDayItem);
	_tmp0_ = self->priv->_day;
	_tmp1_ = g_strdup_printf ("%i", _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup ("flat");
	_tmp4_ = g_strdup ("calendar-day");
	_tmp5_ = g_new0 (gchar*, 2 + 1);
	_tmp5_[0] = _tmp3_;
	_tmp5_[1] = _tmp4_;
	_tmp6_ = (GtkButton*) gtk_button_new_with_label (_tmp2_);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp6_, _tmp5_);
	_tmp5_ = (_vala_array_free (_tmp5_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp6_;
	_g_free0 (_tmp2_);
	_tmp7_ = self->priv->button;
	_tmp8_ = self->priv->_date;
	_tmp9_ = g_date_time_format (_tmp8_, _ ("%A, %B %e, %Y"));
	_tmp10_ = _tmp9_;
	gtk_accessible_update_property ((GtkAccessible*) _tmp7_, GTK_ACCESSIBLE_PROPERTY_LABEL, _tmp10_, -1, -1);
	_g_free0 (_tmp10_);
	_tmp11_ = self->priv->_is_today;
	if (_tmp11_) {
		GtkButton* _tmp12_;
		_tmp12_ = self->priv->button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp12_, "today");
	} else {
		gboolean _tmp13_;
		_tmp13_ = self->priv->_is_past;
		if (_tmp13_) {
			GtkButton* _tmp14_;
			_tmp14_ = self->priv->button;
			gtk_widget_add_css_class ((GtkWidget*) _tmp14_, "dimmed");
		}
	}
	_tmp15_ = self->priv->button;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp15_);
	_tmp16_ = self->priv->button;
	g_signal_connect_object (_tmp16_, "clicked", (GCallback) __widgets_calendar_calendar_scroll_day_item___lambda146__gtk_button_clicked, self, 0);
	return obj;
}

static void
widgets_calendar_calendar_scroll_day_item_class_init (WidgetsCalendarCalendarScrollDayItemClass * klass,
                                                      gpointer klass_data)
{
	widgets_calendar_calendar_scroll_day_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsCalendarCalendarScrollDayItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_calendar_calendar_scroll_day_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_calendar_calendar_scroll_day_item_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_calendar_calendar_scroll_day_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_calendar_calendar_scroll_day_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DAY_PROPERTY, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DAY_PROPERTY] = g_param_spec_int ("day", "day", "day", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DATE_PROPERTY, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DATE_PROPERTY] = g_param_spec_boxed ("date", "date", "date", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_TODAY_PROPERTY, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_TODAY_PROPERTY] = g_param_spec_boolean ("is-today", "is-today", "is-today", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_PAST_PROPERTY, widgets_calendar_calendar_scroll_day_item_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_PAST_PROPERTY] = g_param_spec_boolean ("is-past", "is-past", "is-past", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	widgets_calendar_calendar_scroll_day_item_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_CLICKED_SIGNAL] = g_signal_new ("clicked", WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
widgets_calendar_calendar_scroll_day_item_instance_init (WidgetsCalendarCalendarScrollDayItem * self,
                                                         gpointer klass)
{
	self->priv = widgets_calendar_calendar_scroll_day_item_get_instance_private (self);
}

static void
widgets_calendar_calendar_scroll_day_item_finalize (GObject * obj)
{
	WidgetsCalendarCalendarScrollDayItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, WidgetsCalendarCalendarScrollDayItem);
	_g_date_time_unref0 (self->priv->_date);
	_g_object_unref0 (self->priv->button);
	G_OBJECT_CLASS (widgets_calendar_calendar_scroll_day_item_parent_class)->finalize (obj);
}

static GType
widgets_calendar_calendar_scroll_day_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsCalendarCalendarScrollDayItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_calendar_calendar_scroll_day_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsCalendarCalendarScrollDayItem), 0, (GInstanceInitFunc) widgets_calendar_calendar_scroll_day_item_instance_init, NULL };
	GType widgets_calendar_calendar_scroll_day_item_type_id;
	widgets_calendar_calendar_scroll_day_item_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsCalendarCalendarScrollDayItem", &g_define_type_info, 0);
	WidgetsCalendarCalendarScrollDayItem_private_offset = g_type_add_instance_private (widgets_calendar_calendar_scroll_day_item_type_id, sizeof (WidgetsCalendarCalendarScrollDayItemPrivate));
	return widgets_calendar_calendar_scroll_day_item_type_id;
}

static GType
widgets_calendar_calendar_scroll_day_item_get_type (void)
{
	static volatile gsize widgets_calendar_calendar_scroll_day_item_type_id__once = 0;
	if (g_once_init_enter (&widgets_calendar_calendar_scroll_day_item_type_id__once)) {
		GType widgets_calendar_calendar_scroll_day_item_type_id;
		widgets_calendar_calendar_scroll_day_item_type_id = widgets_calendar_calendar_scroll_day_item_get_type_once ();
		g_once_init_leave (&widgets_calendar_calendar_scroll_day_item_type_id__once, widgets_calendar_calendar_scroll_day_item_type_id);
	}
	return widgets_calendar_calendar_scroll_day_item_type_id__once;
}

static void
_vala_widgets_calendar_calendar_scroll_day_item_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	WidgetsCalendarCalendarScrollDayItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, WidgetsCalendarCalendarScrollDayItem);
	switch (property_id) {
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DAY_PROPERTY:
		g_value_set_int (value, widgets_calendar_calendar_scroll_day_item_get_day (self));
		break;
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DATE_PROPERTY:
		g_value_set_boxed (value, widgets_calendar_calendar_scroll_day_item_get_date (self));
		break;
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_TODAY_PROPERTY:
		g_value_set_boolean (value, widgets_calendar_calendar_scroll_day_item_get_is_today (self));
		break;
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_PAST_PROPERTY:
		g_value_set_boolean (value, widgets_calendar_calendar_scroll_day_item_get_is_past (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_calendar_calendar_scroll_day_item_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec)
{
	WidgetsCalendarCalendarScrollDayItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_DAY_ITEM, WidgetsCalendarCalendarScrollDayItem);
	switch (property_id) {
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DAY_PROPERTY:
		widgets_calendar_calendar_scroll_day_item_set_day (self, g_value_get_int (value));
		break;
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_DATE_PROPERTY:
		widgets_calendar_calendar_scroll_day_item_set_date (self, g_value_get_boxed (value));
		break;
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_TODAY_PROPERTY:
		widgets_calendar_calendar_scroll_day_item_set_is_today (self, g_value_get_boolean (value));
		break;
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_ITEM_IS_PAST_PROPERTY:
		widgets_calendar_calendar_scroll_day_item_set_is_past (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static Block25Data*
block25_data_ref (Block25Data* _data25_)
{
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}

static void
block25_data_unref (void * _userdata_)
{
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		WidgetsCalendarCalendarScroll* self;
		self = _data25_->self;
		_g_object_unref0 (_data25_->today_button_revealer);
		_g_object_unref0 (self);
		g_slice_free (Block25Data, _data25_);
	}
}

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

static void
_widgets_calendar_calendar_scroll___lambda152_ (Block25Data* _data25_)
{
	WidgetsCalendarCalendarScroll* self;
	GtkScrolledWindow* _tmp0_;
	GtkAdjustment* _tmp1_;
	GtkAdjustment* _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	GtkScrolledWindow* _tmp5_;
	GtkAdjustment* _tmp6_;
	GtkAdjustment* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	GtkScrolledWindow* _tmp10_;
	GtkAdjustment* _tmp11_;
	GtkAdjustment* _tmp12_;
	gdouble _tmp13_;
	gdouble _tmp14_;
	gdouble current_month_y = 0.0;
	gdouble threshold = 0.0;
	GeeArrayList* _tmp20_;
	gpointer _tmp21_;
	WidgetsCalendarCalendarScrollMonthSection* _tmp22_;
	gdouble _tmp23_;
	gboolean _tmp24_ = FALSE;
	GtkScrolledWindow* _tmp25_;
	GtkAdjustment* _tmp26_;
	GtkAdjustment* _tmp27_;
	gdouble _tmp28_;
	gdouble _tmp29_;
	gboolean away_from_today = FALSE;
	GtkRevealer* _tmp35_;
	self = _data25_->self;
	_tmp0_ = self->priv->scrolled_window;
	_tmp1_ = gtk_scrolled_window_get_vadjustment (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_adjustment_get_value (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->scrolled_window;
	_tmp6_ = gtk_scrolled_window_get_vadjustment (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = gtk_adjustment_get_page_size (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->priv->scrolled_window;
	_tmp11_ = gtk_scrolled_window_get_vadjustment (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = gtk_adjustment_get_upper (_tmp12_);
	_tmp14_ = _tmp13_;
	if ((_tmp4_ + _tmp9_) >= (_tmp14_ - 100)) {
		widgets_calendar_calendar_scroll_load_more_months (self);
	}
	current_month_y = (gdouble) 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp15_ = FALSE;
			_tmp15_ = TRUE;
			while (TRUE) {
				GeeArrayList* _tmp17_;
				gpointer _tmp18_;
				WidgetsCalendarCalendarScrollMonthSection* _tmp19_;
				if (!_tmp15_) {
					gint _tmp16_;
					_tmp16_ = i;
					i = _tmp16_ + 1;
				}
				_tmp15_ = FALSE;
				if (!(i < self->priv->loaded_past_months)) {
					break;
				}
				_tmp17_ = self->priv->month_sections;
				_tmp18_ = gee_abstract_list_get ((GeeAbstractList*) _tmp17_, i);
				_tmp19_ = (WidgetsCalendarCalendarScrollMonthSection*) _tmp18_;
				current_month_y += (gdouble) (gtk_widget_get_allocated_height ((GtkWidget*) _tmp19_) + 12);
				_g_object_unref0 (_tmp19_);
			}
		}
	}
	_tmp20_ = self->priv->month_sections;
	_tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _tmp20_, self->priv->loaded_past_months);
	_tmp22_ = (WidgetsCalendarCalendarScrollMonthSection*) _tmp21_;
	_tmp23_ = (gdouble) gtk_widget_get_allocated_height ((GtkWidget*) _tmp22_);
	_g_object_unref0 (_tmp22_);
	threshold = _tmp23_;
	_tmp25_ = self->priv->scrolled_window;
	_tmp26_ = gtk_scrolled_window_get_vadjustment (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = gtk_adjustment_get_value (_tmp27_);
	_tmp29_ = _tmp28_;
	if (_tmp29_ < (current_month_y - threshold)) {
		_tmp24_ = TRUE;
	} else {
		GtkScrolledWindow* _tmp30_;
		GtkAdjustment* _tmp31_;
		GtkAdjustment* _tmp32_;
		gdouble _tmp33_;
		gdouble _tmp34_;
		_tmp30_ = self->priv->scrolled_window;
		_tmp31_ = gtk_scrolled_window_get_vadjustment (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = gtk_adjustment_get_value (_tmp32_);
		_tmp34_ = _tmp33_;
		_tmp24_ = _tmp34_ > (current_month_y + threshold);
	}
	away_from_today = _tmp24_;
	_tmp35_ = _data25_->today_button_revealer;
	gtk_revealer_set_reveal_child (_tmp35_, away_from_today);
}

static void
__widgets_calendar_calendar_scroll___lambda152__gtk_adjustment_value_changed (GtkAdjustment* _sender,
                                                                              gpointer self)
{
	_widgets_calendar_calendar_scroll___lambda152_ (self);
}

static void
_widgets_calendar_calendar_scroll___lambda153_ (WidgetsCalendarCalendarScroll* self)
{
	widgets_calendar_calendar_scroll_scroll_to_month_index (self, self->priv->loaded_past_months);
}

static void
__widgets_calendar_calendar_scroll___lambda153__gtk_button_clicked (GtkButton* _sender,
                                                                    gpointer self)
{
	_widgets_calendar_calendar_scroll___lambda153_ ((WidgetsCalendarCalendarScroll*) self);
}

static GObject *
widgets_calendar_calendar_scroll_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsCalendarCalendarScroll * self;
	Block25Data* _data25_;
	GeeArrayList* _tmp0_;
	GtkBox* _tmp1_;
	GtkBox* _tmp2_;
	GtkWidget* _tmp3_;
	GtkScrolledWindow* _tmp4_ = NULL;
	GtkButton* today_button = NULL;
	GtkButton* _tmp5_ = NULL;
	GtkButton* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkWidget* _tmp9_;
	GtkRevealer* _tmp10_ = NULL;
	GtkOverlay* overlay = NULL;
	GtkScrolledWindow* _tmp11_;
	GtkWidget* _tmp12_;
	GtkOverlay* _tmp13_ = NULL;
	GtkOverlay* _tmp14_;
	GtkRevealer* _tmp15_;
	GtkOverlay* _tmp16_;
	GtkScrolledWindow* _tmp17_;
	GtkAdjustment* _tmp18_;
	GtkAdjustment* _tmp19_;
	GtkButton* _tmp20_;
	parent_class = G_OBJECT_CLASS (widgets_calendar_calendar_scroll_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_TYPE_CALENDAR_SCROLL, WidgetsCalendarCalendarScroll);
	_data25_ = g_slice_new0 (Block25Data);
	_data25_->_ref_count_ = 1;
	_data25_->self = g_object_ref (self);
	_tmp0_ = gee_array_list_new (WIDGETS_CALENDAR_CALENDAR_SCROLL_TYPE_MONTH_SECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->month_sections);
	self->priv->month_sections = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->content_box);
	self->priv->content_box = _tmp1_;
	_tmp2_ = self->priv->content_box;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	g_object_set (_tmp4_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set (_tmp4_, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
	gtk_scrolled_window_set_child (_tmp4_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	g_object_set ((GtkWidget*) _tmp4_, "height-request", 300, NULL);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->scrolled_window);
	self->priv->scrolled_window = _tmp4_;
	_tmp5_ = (GtkButton*) gtk_button_new_with_label (_ ("Today"));
	gtk_widget_set_halign ((GtkWidget*) _tmp5_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp5_, GTK_ALIGN_END);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp5_, 12);
	g_object_ref_sink (_tmp5_);
	today_button = _tmp5_;
	_tmp6_ = today_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp6_, "pill");
	_tmp7_ = today_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp7_, "suggested-action");
	_tmp8_ = today_button;
	_tmp9_ = _g_object_ref0 ((GtkWidget*) _tmp8_);
	_tmp10_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp10_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	gtk_revealer_set_transition_type (_tmp10_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
	gtk_revealer_set_reveal_child (_tmp10_, FALSE);
	gtk_widget_set_valign ((GtkWidget*) _tmp10_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp10_);
	_data25_->today_button_revealer = _tmp10_;
	_tmp11_ = self->priv->scrolled_window;
	_tmp12_ = _g_object_ref0 ((GtkWidget*) _tmp11_);
	_tmp13_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_overlay_set_child (_tmp13_, _tmp12_);
	_g_object_unref0 (_tmp12_);
	g_object_ref_sink (_tmp13_);
	overlay = _tmp13_;
	_tmp14_ = overlay;
	_tmp15_ = _data25_->today_button_revealer;
	gtk_overlay_add_overlay (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = overlay;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp16_);
	widgets_calendar_calendar_scroll_load_initial_months (self);
	_tmp17_ = self->priv->scrolled_window;
	_tmp18_ = gtk_scrolled_window_get_vadjustment (_tmp17_);
	_tmp19_ = _tmp18_;
	g_signal_connect_data (_tmp19_, "value-changed", (GCallback) __widgets_calendar_calendar_scroll___lambda152__gtk_adjustment_value_changed, block25_data_ref (_data25_), (GClosureNotify) block25_data_unref, 0);
	_tmp20_ = today_button;
	g_signal_connect_object (_tmp20_, "clicked", (GCallback) __widgets_calendar_calendar_scroll___lambda153__gtk_button_clicked, self, 0);
	_g_object_unref0 (overlay);
	_g_object_unref0 (today_button);
	block25_data_unref (_data25_);
	_data25_ = NULL;
	return obj;
}

static void
widgets_calendar_calendar_scroll_class_init (WidgetsCalendarCalendarScrollClass * klass,
                                             gpointer klass_data)
{
	widgets_calendar_calendar_scroll_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsCalendarCalendarScroll_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_calendar_calendar_scroll_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_calendar_calendar_scroll_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_calendar_calendar_scroll_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_calendar_calendar_scroll_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_CALENDAR_CALENDAR_SCROLL_DATE_PROPERTY, widgets_calendar_calendar_scroll_properties[WIDGETS_CALENDAR_CALENDAR_SCROLL_DATE_PROPERTY] = g_param_spec_boxed ("date", "date", "date", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	widgets_calendar_calendar_scroll_signals[WIDGETS_CALENDAR_CALENDAR_SCROLL_DAY_SELECTED_SIGNAL] = g_signal_new ("day-selected", WIDGETS_CALENDAR_TYPE_CALENDAR_SCROLL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
widgets_calendar_calendar_scroll_instance_init (WidgetsCalendarCalendarScroll * self,
                                                gpointer klass)
{
	self->priv = widgets_calendar_calendar_scroll_get_instance_private (self);
	self->priv->loaded_months = 0;
	self->priv->loaded_past_months = 0;
}

static void
widgets_calendar_calendar_scroll_finalize (GObject * obj)
{
	WidgetsCalendarCalendarScroll * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_CALENDAR_TYPE_CALENDAR_SCROLL, WidgetsCalendarCalendarScroll);
	_g_object_unref0 (self->priv->scrolled_window);
	_g_object_unref0 (self->priv->content_box);
	_g_object_unref0 (self->priv->month_sections);
	_g_date_time_unref0 (self->priv->_date);
	G_OBJECT_CLASS (widgets_calendar_calendar_scroll_parent_class)->finalize (obj);
}

static GType
widgets_calendar_calendar_scroll_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsCalendarCalendarScrollClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_calendar_calendar_scroll_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsCalendarCalendarScroll), 0, (GInstanceInitFunc) widgets_calendar_calendar_scroll_instance_init, NULL };
	GType widgets_calendar_calendar_scroll_type_id;
	widgets_calendar_calendar_scroll_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsCalendarCalendarScroll", &g_define_type_info, 0);
	WidgetsCalendarCalendarScroll_private_offset = g_type_add_instance_private (widgets_calendar_calendar_scroll_type_id, sizeof (WidgetsCalendarCalendarScrollPrivate));
	return widgets_calendar_calendar_scroll_type_id;
}

GType
widgets_calendar_calendar_scroll_get_type (void)
{
	static volatile gsize widgets_calendar_calendar_scroll_type_id__once = 0;
	if (g_once_init_enter (&widgets_calendar_calendar_scroll_type_id__once)) {
		GType widgets_calendar_calendar_scroll_type_id;
		widgets_calendar_calendar_scroll_type_id = widgets_calendar_calendar_scroll_get_type_once ();
		g_once_init_leave (&widgets_calendar_calendar_scroll_type_id__once, widgets_calendar_calendar_scroll_type_id);
	}
	return widgets_calendar_calendar_scroll_type_id__once;
}

static void
_vala_widgets_calendar_calendar_scroll_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	WidgetsCalendarCalendarScroll * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CALENDAR_TYPE_CALENDAR_SCROLL, WidgetsCalendarCalendarScroll);
	switch (property_id) {
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DATE_PROPERTY:
		g_value_set_boxed (value, widgets_calendar_calendar_scroll_get_date (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_calendar_calendar_scroll_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	WidgetsCalendarCalendarScroll * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_CALENDAR_TYPE_CALENDAR_SCROLL, WidgetsCalendarCalendarScroll);
	switch (property_id) {
		case WIDGETS_CALENDAR_CALENDAR_SCROLL_DATE_PROPERTY:
		widgets_calendar_calendar_scroll_set_date (self, g_value_get_boxed (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

