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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	WIDGETS_SCHEDULE_BUTTON_0_PROPERTY,
	WIDGETS_SCHEDULE_BUTTON_IS_BOARD_PROPERTY,
	WIDGETS_SCHEDULE_BUTTON_LABEL_PROPERTY,
	WIDGETS_SCHEDULE_BUTTON_DUEDATE_PROPERTY,
	WIDGETS_SCHEDULE_BUTTON_VISIBLE_NO_DATE_PROPERTY,
	WIDGETS_SCHEDULE_BUTTON_VISIBLE_CLEAR_BUTTON_PROPERTY,
	WIDGETS_SCHEDULE_BUTTON_NUM_PROPERTIES
};
static GParamSpec* widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#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)))
enum  {
	WIDGETS_SCHEDULE_BUTTON_DUEDATE_CHANGED_SIGNAL,
	WIDGETS_SCHEDULE_BUTTON_PICKER_OPENED_SIGNAL,
	WIDGETS_SCHEDULE_BUTTON_NUM_SIGNALS
};
static guint widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_NUM_SIGNALS] = {0};

struct _WidgetsScheduleButtonPrivate {
	gboolean _is_board;
	gchar* _label;
	GtkMenuButton* button;
	GtkLabel* due_label;
	GtkBox* schedule_box;
	GtkImage* due_image;
	WidgetsDateTimePickerDateTimePicker* datetime_picker;
	GtkRevealer* clear_revealer;
	ObjectsDueDate* _duedate;
	GeeHashMap* signal_map;
};

static gint WidgetsScheduleButton_private_offset;
static gpointer widgets_schedule_button_parent_class = NULL;

static void widgets_schedule_button_build_ui (WidgetsScheduleButton* self);
static void __lambda219_ (WidgetsScheduleButton* self);
static void ___lambda219__widgets_date_time_picker_date_time_picker_duedate_changed (WidgetsDateTimePickerDateTimePicker* _sender,
                                                                              gpointer self);
static void __lambda220_ (WidgetsScheduleButton* self);
static void ___lambda220__gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                      gdouble x,
                                                      gdouble y,
                                                      gpointer self);
static void __lambda221_ (WidgetsScheduleButton* self);
static void ___lambda221__gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                      gpointer self);
static void __lambda222_ (WidgetsScheduleButton* self);
static void ___lambda222__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void widgets_schedule_button_build_card_ui (WidgetsScheduleButton* self);
static void __lambda223_ (WidgetsScheduleButton* self);
static void ___lambda223__widgets_date_time_picker_date_time_picker_duedate_changed (WidgetsDateTimePickerDateTimePicker* _sender,
                                                                              gpointer self);
static GObject * widgets_schedule_button_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties);
static void _widgets_schedule_button___lambda224_ (WidgetsScheduleButton* self);
static void __widgets_schedule_button___lambda224__gtk_popover_closed (GtkPopover* _sender,
                                                                gpointer self);
static void _widgets_schedule_button___lambda225_ (WidgetsScheduleButton* self);
static void __widgets_schedule_button___lambda225__gtk_widget_show (GtkWidget* _sender,
                                                             gpointer self);
static void widgets_schedule_button_finalize (GObject * obj);
static GType widgets_schedule_button_get_type_once (void);
static void _vala_widgets_schedule_button_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_widgets_schedule_button_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_schedule_button_get_instance_private (WidgetsScheduleButton* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsScheduleButton_private_offset);
}

WidgetsScheduleButton*
widgets_schedule_button_construct (GType object_type,
                                   const gchar* label)
{
	WidgetsScheduleButton * self = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (WidgetsScheduleButton*) g_object_new (object_type, "is-board", FALSE, "valign", GTK_ALIGN_CENTER, "tooltip-text", _ ("The date you plan to work on this task"), "label", label, NULL);
	return self;
}

WidgetsScheduleButton*
widgets_schedule_button_new (const gchar* label)
{
	return widgets_schedule_button_construct (WIDGETS_TYPE_SCHEDULE_BUTTON, label);
}

WidgetsScheduleButton*
widgets_schedule_button_construct_for_board (GType object_type,
                                             const gchar* label)
{
	WidgetsScheduleButton * self = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (WidgetsScheduleButton*) g_object_new (object_type, "is-board", TRUE, "tooltip-text", _ ("The date you plan to work on this task"), "label", label, NULL);
	return self;
}

WidgetsScheduleButton*
widgets_schedule_button_new_for_board (const gchar* label)
{
	return widgets_schedule_button_construct_for_board (WIDGETS_TYPE_SCHEDULE_BUTTON, label);
}

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

static void
__lambda219_ (WidgetsScheduleButton* self)
{
	WidgetsDateTimePickerDateTimePicker* _tmp0_;
	ObjectsDueDate* _tmp1_;
	ObjectsDueDate* _tmp2_;
	GtkRevealer* _tmp3_;
	_tmp0_ = self->priv->datetime_picker;
	_tmp1_ = widgets_date_time_picker_date_time_picker_get_duedate (_tmp0_);
	_tmp2_ = _tmp1_;
	widgets_schedule_button_set_duedate (self, _tmp2_);
	_tmp3_ = self->priv->clear_revealer;
	gtk_revealer_set_reveal_child (_tmp3_, FALSE);
	g_signal_emit (self, widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_DUEDATE_CHANGED_SIGNAL], 0);
}

static void
___lambda219__widgets_date_time_picker_date_time_picker_duedate_changed (WidgetsDateTimePickerDateTimePicker* _sender,
                                                                         gpointer self)
{
	__lambda219_ ((WidgetsScheduleButton*) self);
}

static void
__lambda220_ (WidgetsScheduleButton* self)
{
	gboolean _tmp0_ = FALSE;
	ObjectsDueDate* _tmp1_;
	ObjectsDueDate* _tmp2_;
	GtkRevealer* _tmp7_;
	_tmp1_ = widgets_schedule_button_get_duedate (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		ObjectsDueDate* _tmp3_;
		ObjectsDueDate* _tmp4_;
		GDateTime* _tmp5_;
		GDateTime* _tmp6_;
		_tmp3_ = widgets_schedule_button_get_duedate (self);
		_tmp4_ = _tmp3_;
		_tmp5_ = objects_due_date_get_datetime (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp7_ = self->priv->clear_revealer;
	gtk_revealer_set_reveal_child (_tmp7_, _tmp0_);
}

static void
___lambda220__gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                 gdouble x,
                                                 gdouble y,
                                                 gpointer self)
{
	__lambda220_ ((WidgetsScheduleButton*) self);
}

static void
__lambda221_ (WidgetsScheduleButton* self)
{
	GtkRevealer* _tmp0_;
	_tmp0_ = self->priv->clear_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, FALSE);
}

static void
___lambda221__gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                 gpointer self)
{
	__lambda221_ ((WidgetsScheduleButton*) self);
}

static void
__lambda222_ (WidgetsScheduleButton* self)
{
	widgets_schedule_button_reset (self);
}

static void
___lambda222__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda222_ ((WidgetsScheduleButton*) self);
}

static void
widgets_schedule_button_build_ui (WidgetsScheduleButton* self)
{
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	const gchar* _tmp2_;
	GtkLabel* _tmp3_ = NULL;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkImage* _tmp6_;
	GtkBox* _tmp7_;
	GtkLabel* _tmp8_;
	GtkBox* _tmp9_;
	GtkWidget* _tmp10_;
	WidgetsDateTimePickerDateTimePicker* _tmp11_;
	GtkPopover* _tmp12_;
	gchar* _tmp13_;
	gchar** _tmp14_;
	GtkMenuButton* _tmp15_ = NULL;
	GtkButton* clear_button = NULL;
	gchar* _tmp16_;
	gchar** _tmp17_;
	gchar* _tmp18_;
	GtkButton* _tmp19_ = NULL;
	GtkWidget* _tmp20_;
	GtkRevealer* _tmp21_ = NULL;
	GtkMenuButton* _tmp22_;
	GtkRevealer* _tmp23_;
	WidgetsDateTimePickerDateTimePicker* _tmp24_;
	GtkEventControllerMotion* motion_gesture = NULL;
	GtkEventControllerMotion* _tmp25_;
	GtkEventController* _tmp26_;
	GeeHashMap* _tmp27_;
	gulong _tmp28_;
	GeeHashMap* _tmp29_;
	gulong _tmp30_;
	GeeHashMap* _tmp31_;
	gulong _tmp32_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->due_image);
	self->priv->due_image = _tmp0_;
	_tmp1_ = self->priv->due_image;
	g_object_set (_tmp1_, "icon-name", "month-symbolic", NULL);
	_tmp2_ = self->priv->_label;
	_tmp3_ = (GtkLabel*) gtk_label_new (_tmp2_);
	gtk_label_set_xalign (_tmp3_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp3_, TRUE);
	gtk_label_set_ellipsize (_tmp3_, PANGO_ELLIPSIZE_END);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->due_label);
	self->priv->due_label = _tmp3_;
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->schedule_box);
	self->priv->schedule_box = _tmp4_;
	_tmp5_ = self->priv->schedule_box;
	_tmp6_ = self->priv->due_image;
	gtk_box_append (_tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = self->priv->schedule_box;
	_tmp8_ = self->priv->due_label;
	gtk_box_append (_tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = self->priv->schedule_box;
	_tmp10_ = _g_object_ref0 ((GtkWidget*) _tmp9_);
	_tmp11_ = self->priv->datetime_picker;
	_tmp12_ = _g_object_ref0 ((GtkPopover*) _tmp11_);
	_tmp13_ = g_strdup ("flat");
	_tmp14_ = g_new0 (gchar*, 1 + 1);
	_tmp14_[0] = _tmp13_;
	_tmp15_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_menu_button_set_child (_tmp15_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	gtk_menu_button_set_popover (_tmp15_, _tmp12_);
	_g_object_unref0 (_tmp12_);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp15_, _tmp14_);
	_tmp14_ = (_vala_array_free (_tmp14_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp15_;
	_tmp16_ = g_strdup ("flat");
	_tmp17_ = g_new0 (gchar*, 1 + 1);
	_tmp17_[0] = _tmp16_;
	_tmp18_ = g_strdup (_ ("Remove date"));
	_tmp19_ = (GtkButton*) gtk_button_new_from_icon_name ("window-close");
	gtk_widget_set_css_classes ((GtkWidget*) _tmp19_, _tmp17_);
	_tmp17_ = (_vala_array_free (_tmp17_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp19_, _tmp18_);
	_g_free0 (_tmp18_);
	g_object_ref_sink (_tmp19_);
	clear_button = _tmp19_;
	_tmp20_ = _g_object_ref0 ((GtkWidget*) clear_button);
	_tmp21_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp21_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	gtk_revealer_set_child (_tmp21_, _tmp20_);
	_g_object_unref0 (_tmp20_);
	g_object_ref_sink (_tmp21_);
	_g_object_unref0 (self->priv->clear_revealer);
	self->priv->clear_revealer = _tmp21_;
	_tmp22_ = self->priv->button;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp22_, 0, 0, 1, 1);
	_tmp23_ = self->priv->clear_revealer;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp23_, 1, 0, 1, 1);
	_tmp24_ = self->priv->datetime_picker;
	g_signal_connect_object (_tmp24_, "duedate-changed", (GCallback) ___lambda219__widgets_date_time_picker_date_time_picker_duedate_changed, self, 0);
	_tmp25_ = (GtkEventControllerMotion*) gtk_event_controller_motion_new ();
	motion_gesture = _tmp25_;
	_tmp26_ = _g_object_ref0 ((GtkEventController*) motion_gesture);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp26_);
	_tmp27_ = self->priv->signal_map;
	_tmp28_ = g_signal_connect_object (motion_gesture, "enter", (GCallback) ___lambda220__gtk_event_controller_motion_enter, self, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp27_, (gpointer) ((guintptr) _tmp28_), (GObject*) motion_gesture);
	_tmp29_ = self->priv->signal_map;
	_tmp30_ = g_signal_connect_object (motion_gesture, "leave", (GCallback) ___lambda221__gtk_event_controller_motion_leave, self, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp29_, (gpointer) ((guintptr) _tmp30_), (GObject*) motion_gesture);
	_tmp31_ = self->priv->signal_map;
	_tmp32_ = g_signal_connect_object (clear_button, "clicked", (GCallback) ___lambda222__gtk_button_clicked, self, 0);
	gee_abstract_map_set ((GeeAbstractMap*) _tmp31_, (gpointer) ((guintptr) _tmp32_), (GObject*) clear_button);
	_g_object_unref0 (motion_gesture);
	_g_object_unref0 (clear_button);
}

static void
__lambda223_ (WidgetsScheduleButton* self)
{
	WidgetsDateTimePickerDateTimePicker* _tmp0_;
	ObjectsDueDate* _tmp1_;
	ObjectsDueDate* _tmp2_;
	_tmp0_ = self->priv->datetime_picker;
	_tmp1_ = widgets_date_time_picker_date_time_picker_get_duedate (_tmp0_);
	_tmp2_ = _tmp1_;
	widgets_schedule_button_set_duedate (self, _tmp2_);
	g_signal_emit (self, widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_DUEDATE_CHANGED_SIGNAL], 0);
}

static void
___lambda223__widgets_date_time_picker_date_time_picker_duedate_changed (WidgetsDateTimePickerDateTimePicker* _sender,
                                                                         gpointer self)
{
	__lambda223_ ((WidgetsScheduleButton*) self);
}

static void
widgets_schedule_button_build_card_ui (WidgetsScheduleButton* self)
{
	GtkImage* _tmp0_;
	GtkLabel* title_label = NULL;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	GtkLabel* _tmp6_ = NULL;
	gchar* _tmp7_;
	gchar** _tmp8_;
	GtkLabel* _tmp9_ = NULL;
	GtkGrid* card_grid = NULL;
	GtkGrid* _tmp10_ = NULL;
	GtkImage* _tmp11_;
	GtkLabel* _tmp12_;
	WidgetsDateTimePickerDateTimePicker* _tmp13_;
	GtkPopover* _tmp14_;
	GtkWidget* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar** _tmp20_;
	GtkMenuButton* _tmp21_ = NULL;
	GtkMenuButton* _tmp22_;
	GeeHashMap* _tmp23_;
	WidgetsDateTimePickerDateTimePicker* _tmp24_;
	gulong _tmp25_;
	WidgetsDateTimePickerDateTimePicker* _tmp26_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkImage*) gtk_image_new_from_icon_name ("month-symbolic");
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->due_image);
	self->priv->due_image = _tmp0_;
	_tmp1_ = self->priv->_label;
	_tmp2_ = g_strdup ("title-4");
	_tmp3_ = g_strdup ("caption");
	_tmp4_ = g_strdup ("font-bold");
	_tmp5_ = g_new0 (gchar*, 3 + 1);
	_tmp5_[0] = _tmp2_;
	_tmp5_[1] = _tmp3_;
	_tmp5_[2] = _tmp4_;
	_tmp6_ = (GtkLabel*) gtk_label_new (_tmp1_);
	gtk_widget_set_halign ((GtkWidget*) _tmp6_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp6_, _tmp5_);
	_tmp5_ = (_vala_array_free (_tmp5_, 3, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp6_);
	title_label = _tmp6_;
	_tmp7_ = g_strdup ("caption");
	_tmp8_ = g_new0 (gchar*, 1 + 1);
	_tmp8_[0] = _tmp7_;
	_tmp9_ = (GtkLabel*) gtk_label_new (_ ("When do you plan to work on this?"));
	gtk_label_set_xalign (_tmp9_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp9_, TRUE);
	gtk_widget_set_halign ((GtkWidget*) _tmp9_, GTK_ALIGN_START);
	gtk_label_set_ellipsize (_tmp9_, PANGO_ELLIPSIZE_END);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp9_, _tmp8_);
	_tmp8_ = (_vala_array_free (_tmp8_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->due_label);
	self->priv->due_label = _tmp9_;
	_tmp10_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp10_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp10_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp10_, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp10_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp10_, 6);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp10_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp10_, TRUE);
	g_object_ref_sink (_tmp10_);
	card_grid = _tmp10_;
	_tmp11_ = self->priv->due_image;
	gtk_grid_attach (card_grid, (GtkWidget*) _tmp11_, 0, 0, 1, 2);
	gtk_grid_attach (card_grid, (GtkWidget*) title_label, 1, 0, 1, 1);
	_tmp12_ = self->priv->due_label;
	gtk_grid_attach (card_grid, (GtkWidget*) _tmp12_, 1, 1, 1, 1);
	_tmp13_ = self->priv->datetime_picker;
	_tmp14_ = _g_object_ref0 ((GtkPopover*) _tmp13_);
	_tmp15_ = _g_object_ref0 ((GtkWidget*) card_grid);
	_tmp16_ = g_strdup ("flat");
	_tmp17_ = g_strdup ("card");
	_tmp18_ = g_strdup ("activatable");
	_tmp19_ = g_strdup ("menu-button-no-padding");
	_tmp20_ = g_new0 (gchar*, 4 + 1);
	_tmp20_[0] = _tmp16_;
	_tmp20_[1] = _tmp17_;
	_tmp20_[2] = _tmp18_;
	_tmp20_[3] = _tmp19_;
	_tmp21_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_menu_button_set_popover (_tmp21_, _tmp14_);
	_g_object_unref0 (_tmp14_);
	gtk_menu_button_set_child (_tmp21_, _tmp15_);
	_g_object_unref0 (_tmp15_);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp21_, _tmp20_);
	_tmp20_ = (_vala_array_free (_tmp20_, 4, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp21_, TRUE);
	g_object_ref_sink (_tmp21_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp21_;
	_tmp22_ = self->priv->button;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp22_, 0, 0, 1, 1);
	_tmp23_ = self->priv->signal_map;
	_tmp24_ = self->priv->datetime_picker;
	_tmp25_ = g_signal_connect_object (_tmp24_, "duedate-changed", (GCallback) ___lambda223__widgets_date_time_picker_date_time_picker_duedate_changed, self, 0);
	_tmp26_ = self->priv->datetime_picker;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp23_, (gpointer) ((guintptr) _tmp25_), (GObject*) _tmp26_);
	_g_object_unref0 (card_grid);
	_g_object_unref0 (title_label);
}

void
widgets_schedule_button_update_from_item (WidgetsScheduleButton* self,
                                          ObjectsItem* item)
{
	gboolean _tmp0_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	GtkLabel* _tmp14_;
	ObjectsDueDate* _tmp15_;
	ObjectsDueDate* _tmp16_;
	GDateTime* _tmp17_;
	GDateTime* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	GtkLabel* _tmp21_;
	GtkLabel* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	GtkImage* _tmp25_;
	GtkLabel* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	ObjectsDueDate* _tmp29_;
	ObjectsDueDate* _tmp30_;
	ObjectsDueDate* _tmp31_;
	ObjectsDueDate* _tmp32_;
	GDateTime* _tmp33_;
	GDateTime* _tmp34_;
	ObjectsDueDate* _tmp47_;
	ObjectsDueDate* _tmp48_;
	gboolean _tmp49_;
	gboolean _tmp50_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->priv->_is_board;
	if (_tmp0_) {
		GtkLabel* _tmp1_;
		GtkImage* _tmp2_;
		_tmp1_ = self->priv->due_label;
		gtk_label_set_label (_tmp1_, _ ("When do you plan to work on this?"));
		gtk_widget_set_tooltip_text ((GtkWidget*) self, _ ("The date you plan to work on this task"));
		_tmp2_ = self->priv->due_image;
		g_object_set (_tmp2_, "icon-name", "month-symbolic", NULL);
	} else {
		GtkLabel* _tmp3_;
		const gchar* _tmp4_;
		GtkImage* _tmp5_;
		_tmp3_ = self->priv->due_label;
		_tmp4_ = self->priv->_label;
		gtk_label_set_label (_tmp3_, _tmp4_);
		gtk_widget_set_tooltip_text ((GtkWidget*) self, _ ("The date you plan to work on this task"));
		_tmp5_ = self->priv->due_image;
		g_object_set (_tmp5_, "icon-name", "month-symbolic", NULL);
	}
	_tmp6_ = objects_item_get_has_due (item);
	_tmp7_ = _tmp6_;
	if (!_tmp7_) {
		WidgetsDateTimePickerDateTimePicker* _tmp8_;
		gboolean _tmp9_;
		gboolean _tmp10_;
		_tmp8_ = self->priv->datetime_picker;
		_tmp9_ = gtk_widget_get_visible ((GtkWidget*) _tmp8_);
		_tmp10_ = _tmp9_;
		if (!_tmp10_) {
			WidgetsDateTimePickerDateTimePicker* _tmp11_;
			ObjectsDueDate* _tmp12_;
			ObjectsDueDate* _tmp13_;
			_tmp11_ = self->priv->datetime_picker;
			widgets_date_time_picker_date_time_picker_reset (_tmp11_);
			_tmp12_ = objects_due_date_new ();
			_tmp13_ = _tmp12_;
			widgets_schedule_button_set_duedate (self, _tmp13_);
			_g_object_unref0 (_tmp13_);
		}
		return;
	}
	_tmp14_ = self->priv->due_label;
	_tmp15_ = objects_item_get_due (item);
	_tmp16_ = _tmp15_;
	_tmp17_ = objects_due_date_get_datetime (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = utils_datetime_get_relative_date_from_date (_tmp18_);
	_tmp20_ = _tmp19_;
	gtk_label_set_label (_tmp14_, _tmp20_);
	_g_free0 (_tmp20_);
	_tmp21_ = self->priv->due_label;
	_tmp22_ = self->priv->due_label;
	_tmp23_ = gtk_label_get_label (_tmp22_);
	_tmp24_ = _tmp23_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp21_, _tmp24_);
	_tmp25_ = self->priv->due_image;
	_tmp26_ = self->priv->due_label;
	_tmp27_ = gtk_label_get_label (_tmp26_);
	_tmp28_ = _tmp27_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp25_, _tmp28_);
	_tmp29_ = objects_item_get_due (item);
	_tmp30_ = _tmp29_;
	widgets_schedule_button_set_duedate (self, _tmp30_);
	_tmp31_ = objects_item_get_due (item);
	_tmp32_ = _tmp31_;
	_tmp33_ = objects_due_date_get_datetime (_tmp32_);
	_tmp34_ = _tmp33_;
	if (utils_datetime_is_today (_tmp34_)) {
		GtkImage* _tmp35_;
		_tmp35_ = self->priv->due_image;
		g_object_set (_tmp35_, "icon-name", "star-outline-thick-symbolic", NULL);
	} else {
		ObjectsDueDate* _tmp36_;
		ObjectsDueDate* _tmp37_;
		GDateTime* _tmp38_;
		GDateTime* _tmp39_;
		_tmp36_ = objects_item_get_due (item);
		_tmp37_ = _tmp36_;
		_tmp38_ = objects_due_date_get_datetime (_tmp37_);
		_tmp39_ = _tmp38_;
		if (utils_datetime_is_tomorrow (_tmp39_)) {
			GtkImage* _tmp40_;
			_tmp40_ = self->priv->due_image;
			g_object_set (_tmp40_, "icon-name", "today-calendar-symbolic", NULL);
		} else {
			ObjectsDueDate* _tmp41_;
			ObjectsDueDate* _tmp42_;
			GDateTime* _tmp43_;
			GDateTime* _tmp44_;
			_tmp41_ = objects_item_get_due (item);
			_tmp42_ = _tmp41_;
			_tmp43_ = objects_due_date_get_datetime (_tmp42_);
			_tmp44_ = _tmp43_;
			if (utils_datetime_is_overdue (_tmp44_)) {
				GtkImage* _tmp45_;
				_tmp45_ = self->priv->due_image;
				g_object_set (_tmp45_, "icon-name", "month-symbolic", NULL);
			} else {
				GtkImage* _tmp46_;
				_tmp46_ = self->priv->due_image;
				g_object_set (_tmp46_, "icon-name", "month-symbolic", NULL);
			}
		}
	}
	_tmp47_ = objects_item_get_due (item);
	_tmp48_ = _tmp47_;
	_tmp49_ = objects_due_date_get_is_recurring (_tmp48_);
	_tmp50_ = _tmp49_;
	if (_tmp50_) {
		gchar* end_label = NULL;
		gchar* _tmp51_;
		ObjectsDueDate* _tmp52_;
		ObjectsDueDate* _tmp53_;
		RecurrencyEndType _tmp54_;
		RecurrencyEndType _tmp55_;
		GtkImage* _tmp84_;
		gchar* repeat_text = NULL;
		ObjectsDueDate* _tmp85_;
		ObjectsDueDate* _tmp86_;
		RecurrencyType _tmp87_;
		RecurrencyType _tmp88_;
		ObjectsDueDate* _tmp89_;
		ObjectsDueDate* _tmp90_;
		gint _tmp91_;
		gint _tmp92_;
		ObjectsDueDate* _tmp93_;
		ObjectsDueDate* _tmp94_;
		const gchar* _tmp95_;
		const gchar* _tmp96_;
		const gchar* _tmp97_;
		ObjectsDueDate* _tmp98_;
		ObjectsDueDate* _tmp99_;
		gboolean _tmp100_;
		gboolean _tmp101_;
		gchar* _tmp102_;
		gchar* _tmp103_;
		gchar* _tmp104_;
		gchar* _tmp105_;
		GtkLabel* _tmp106_;
		GtkLabel* _tmp107_;
		const gchar* _tmp108_;
		const gchar* _tmp109_;
		const gchar* _tmp110_;
		gchar* _tmp111_;
		gchar* _tmp112_;
		gchar* _tmp113_;
		gchar* _tmp114_;
		GtkLabel* _tmp115_;
		const gchar* _tmp116_;
		_tmp51_ = g_strdup ("");
		end_label = _tmp51_;
		_tmp52_ = objects_item_get_due (item);
		_tmp53_ = _tmp52_;
		_tmp54_ = objects_due_date_get_end_type (_tmp53_);
		_tmp55_ = _tmp54_;
		if (_tmp55_ == RECURRENCY_END_TYPE_ON_DATE) {
			gchar* date_label = NULL;
			ObjectsDueDate* _tmp56_;
			ObjectsDueDate* _tmp57_;
			const gchar* _tmp58_;
			const gchar* _tmp59_;
			GDateTime* _tmp60_;
			GDateTime* _tmp61_;
			GDateTime* _tmp62_;
			GDateTime* _tmp63_;
			gchar* _tmp64_;
			gchar* _tmp65_;
			gchar* _tmp66_;
			gchar* _tmp67_;
			const gchar* _tmp68_;
			gchar* _tmp69_;
			_tmp56_ = objects_item_get_due (item);
			_tmp57_ = _tmp56_;
			_tmp58_ = objects_due_date_get_recurrency_end (_tmp57_);
			_tmp59_ = _tmp58_;
			_tmp60_ = utils_datetime_get_date_from_string (_tmp59_);
			_tmp61_ = _tmp60_;
			_tmp62_ = utils_datetime_get_date_only (_tmp61_);
			_tmp63_ = _tmp62_;
			_tmp64_ = utils_datetime_get_default_date_format_from_date (_tmp63_);
			_tmp65_ = _tmp64_;
			_g_date_time_unref0 (_tmp63_);
			_g_date_time_unref0 (_tmp61_);
			date_label = _tmp65_;
			_tmp66_ = g_strconcat (_ ("until"), " ", NULL);
			_tmp67_ = _tmp66_;
			_tmp68_ = date_label;
			_tmp69_ = g_strconcat (_tmp67_, _tmp68_, NULL);
			_g_free0 (end_label);
			end_label = _tmp69_;
			_g_free0 (_tmp67_);
			_g_free0 (date_label);
		} else {
			ObjectsDueDate* _tmp70_;
			ObjectsDueDate* _tmp71_;
			RecurrencyEndType _tmp72_;
			RecurrencyEndType _tmp73_;
			_tmp70_ = objects_item_get_due (item);
			_tmp71_ = _tmp70_;
			_tmp72_ = objects_due_date_get_end_type (_tmp71_);
			_tmp73_ = _tmp72_;
			if (_tmp73_ == RECURRENCY_END_TYPE_AFTER) {
				gint count = 0;
				ObjectsDueDate* _tmp74_;
				ObjectsDueDate* _tmp75_;
				gint _tmp76_;
				gint _tmp77_;
				const gchar* _tmp78_ = NULL;
				gchar* _tmp79_;
				gchar* _tmp80_;
				gchar* _tmp81_;
				gchar* _tmp82_;
				gchar* _tmp83_;
				_tmp74_ = objects_item_get_due (item);
				_tmp75_ = _tmp74_;
				_tmp76_ = objects_due_date_get_recurrency_count (_tmp75_);
				_tmp77_ = _tmp76_;
				count = _tmp77_;
				if (count > 1) {
					_tmp78_ = _ ("times");
				} else {
					_tmp78_ = _ ("time");
				}
				_tmp79_ = g_strconcat (_ ("for"), " ", NULL);
				_tmp80_ = _tmp79_;
				_tmp81_ = g_strdup_printf ("%d %s", count, _tmp78_);
				_tmp82_ = _tmp81_;
				_tmp83_ = g_strconcat (_tmp80_, _tmp82_, NULL);
				_g_free0 (end_label);
				end_label = _tmp83_;
				_g_free0 (_tmp82_);
				_g_free0 (_tmp80_);
			}
		}
		_tmp84_ = self->priv->due_image;
		g_object_set (_tmp84_, "icon-name", "playlist-repeat-symbolic", NULL);
		_tmp85_ = objects_item_get_due (item);
		_tmp86_ = _tmp85_;
		_tmp87_ = objects_due_date_get_recurrency_type (_tmp86_);
		_tmp88_ = _tmp87_;
		_tmp89_ = objects_item_get_due (item);
		_tmp90_ = _tmp89_;
		_tmp91_ = objects_due_date_get_recurrency_interval (_tmp90_);
		_tmp92_ = _tmp91_;
		_tmp93_ = objects_item_get_due (item);
		_tmp94_ = _tmp93_;
		_tmp95_ = objects_due_date_get_recurrency_weeks (_tmp94_);
		_tmp96_ = _tmp95_;
		_tmp97_ = end_label;
		_tmp98_ = objects_item_get_due (item);
		_tmp99_ = _tmp98_;
		_tmp100_ = objects_due_date_get_recurrency_last_day_of_month (_tmp99_);
		_tmp101_ = _tmp100_;
		_tmp102_ = utils_datetime_get_recurrency_weeks (_tmp88_, _tmp92_, _tmp96_, _tmp97_, _tmp101_);
		_tmp103_ = _tmp102_;
		_tmp104_ = g_utf8_strdown (_tmp103_, (gssize) -1);
		_tmp105_ = _tmp104_;
		_g_free0 (_tmp103_);
		repeat_text = _tmp105_;
		_tmp106_ = self->priv->due_label;
		_tmp107_ = self->priv->due_label;
		_tmp108_ = gtk_label_get_label (_tmp107_);
		_tmp109_ = _tmp108_;
		_tmp110_ = repeat_text;
		_tmp111_ = g_strdup_printf (", <small>%s</small>", _tmp110_);
		_tmp112_ = _tmp111_;
		_tmp113_ = g_strconcat (_tmp109_, _tmp112_, NULL);
		_tmp114_ = _tmp113_;
		gtk_label_set_label (_tmp107_, _tmp114_);
		_g_free0 (_tmp114_);
		_g_free0 (_tmp112_);
		_tmp115_ = self->priv->due_label;
		_tmp116_ = repeat_text;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp115_, _tmp116_);
		_g_free0 (repeat_text);
		_g_free0 (end_label);
	}
}

void
widgets_schedule_button_reset (WidgetsScheduleButton* self)
{
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	const gchar* _tmp2_;
	GtkLabel* _tmp3_;
	const gchar* _tmp4_;
	GtkLabel* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	WidgetsDateTimePickerDateTimePicker* _tmp8_;
	ObjectsDueDate* _tmp9_;
	ObjectsDueDate* _tmp10_;
	ObjectsDueDate* _tmp11_;
	ObjectsDueDate* _tmp12_;
	WidgetsDateTimePickerDateTimePicker* _tmp13_;
	ObjectsDueDate* _tmp14_;
	ObjectsDueDate* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->due_image;
	g_object_set (_tmp0_, "icon-name", "month-symbolic", NULL);
	_tmp1_ = self->priv->due_image;
	_tmp2_ = self->priv->_label;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp1_, _tmp2_);
	_tmp3_ = self->priv->due_label;
	_tmp4_ = self->priv->_label;
	gtk_label_set_label (_tmp3_, _tmp4_);
	_tmp5_ = self->priv->due_label;
	_tmp6_ = self->priv->_label;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp5_, _tmp6_);
	_tmp7_ = self->priv->_label;
	gtk_widget_set_tooltip_text ((GtkWidget*) self, _tmp7_);
	_tmp8_ = self->priv->datetime_picker;
	widgets_date_time_picker_date_time_picker_reset (_tmp8_);
	_tmp9_ = objects_due_date_new ();
	_tmp10_ = _tmp9_;
	widgets_schedule_button_set_duedate (self, _tmp10_);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = widgets_schedule_button_get_duedate (self);
	_tmp12_ = _tmp11_;
	objects_due_date_set_datetime (_tmp12_, NULL);
	_tmp13_ = self->priv->datetime_picker;
	_tmp14_ = widgets_schedule_button_get_duedate (self);
	_tmp15_ = _tmp14_;
	widgets_date_time_picker_date_time_picker_set_duedate (_tmp13_, _tmp15_);
	g_signal_emit (self, widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_DUEDATE_CHANGED_SIGNAL], 0);
}

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

void
widgets_schedule_button_open_picker (WidgetsScheduleButton* self)
{
	GtkMenuButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->button;
	gtk_menu_button_set_active (_tmp0_, TRUE);
}

gboolean
widgets_schedule_button_get_is_board (WidgetsScheduleButton* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_board;
	return result;
}

static void
widgets_schedule_button_set_is_board (WidgetsScheduleButton* self,
                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_schedule_button_get_is_board (self);
	if (old_value != value) {
		self->priv->_is_board = value;
		g_object_notify_by_pspec ((GObject *) self, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_IS_BOARD_PROPERTY]);
	}
}

const gchar*
widgets_schedule_button_get_label (WidgetsScheduleButton* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}

static void
widgets_schedule_button_set_label (WidgetsScheduleButton* self,
                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_schedule_button_get_label (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_label);
		self->priv->_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_LABEL_PROPERTY]);
	}
}

ObjectsDueDate*
widgets_schedule_button_get_duedate (WidgetsScheduleButton* self)
{
	ObjectsDueDate* result;
	ObjectsDueDate* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_duedate;
	result = _tmp0_;
	return result;
}

void
widgets_schedule_button_set_duedate (WidgetsScheduleButton* self,
                                     ObjectsDueDate* value)
{
	ObjectsDueDate* _tmp0_;
	ObjectsDueDate* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_duedate);
	self->priv->_duedate = _tmp0_;
	_tmp1_ = self->priv->_duedate;
	_tmp2_ = objects_due_date_get_datetime (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		WidgetsDateTimePickerDateTimePicker* _tmp4_;
		WidgetsDateTimePickerDateTimePicker* _tmp5_;
		ObjectsDueDate* _tmp6_;
		_tmp4_ = self->priv->datetime_picker;
		widgets_date_time_picker_date_time_picker_set_visible_no_date (_tmp4_, TRUE);
		_tmp5_ = self->priv->datetime_picker;
		_tmp6_ = self->priv->_duedate;
		widgets_date_time_picker_date_time_picker_set_duedate (_tmp5_, _tmp6_);
	} else {
		WidgetsDateTimePickerDateTimePicker* _tmp7_;
		WidgetsDateTimePickerDateTimePicker* _tmp8_;
		ObjectsDueDate* _tmp9_;
		_tmp7_ = self->priv->datetime_picker;
		widgets_date_time_picker_date_time_picker_set_visible_no_date (_tmp7_, FALSE);
		_tmp8_ = self->priv->datetime_picker;
		_tmp9_ = self->priv->_duedate;
		widgets_date_time_picker_date_time_picker_set_duedate (_tmp8_, _tmp9_);
	}
	g_object_notify_by_pspec ((GObject *) self, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_DUEDATE_PROPERTY]);
}

void
widgets_schedule_button_set_visible_no_date (WidgetsScheduleButton* self,
                                             gboolean value)
{
	WidgetsDateTimePickerDateTimePicker* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->datetime_picker;
	widgets_date_time_picker_date_time_picker_set_visible_no_date (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_VISIBLE_NO_DATE_PROPERTY]);
}

void
widgets_schedule_button_set_visible_clear_button (WidgetsScheduleButton* self,
                                                  gboolean value)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->clear_revealer;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_VISIBLE_CLEAR_BUTTON_PROPERTY]);
}

static void
_widgets_schedule_button___lambda224_ (WidgetsScheduleButton* self)
{
	g_signal_emit (self, widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_PICKER_OPENED_SIGNAL], 0, FALSE);
}

static void
__widgets_schedule_button___lambda224__gtk_popover_closed (GtkPopover* _sender,
                                                           gpointer self)
{
	_widgets_schedule_button___lambda224_ ((WidgetsScheduleButton*) self);
}

static void
_widgets_schedule_button___lambda225_ (WidgetsScheduleButton* self)
{
	g_signal_emit (self, widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_PICKER_OPENED_SIGNAL], 0, TRUE);
}

static void
__widgets_schedule_button___lambda225__gtk_widget_show (GtkWidget* _sender,
                                                        gpointer self)
{
	_widgets_schedule_button___lambda225_ ((WidgetsScheduleButton*) self);
}

static GObject *
widgets_schedule_button_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsScheduleButton * self;
	WidgetsDateTimePickerDateTimePicker* _tmp0_;
	gboolean _tmp1_;
	GeeHashMap* _tmp2_;
	WidgetsDateTimePickerDateTimePicker* _tmp3_;
	gulong _tmp4_;
	WidgetsDateTimePickerDateTimePicker* _tmp5_;
	GeeHashMap* _tmp6_;
	WidgetsDateTimePickerDateTimePicker* _tmp7_;
	gulong _tmp8_;
	WidgetsDateTimePickerDateTimePicker* _tmp9_;
	parent_class = G_OBJECT_CLASS (widgets_schedule_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SCHEDULE_BUTTON, WidgetsScheduleButton);
	_tmp0_ = widgets_date_time_picker_date_time_picker_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->datetime_picker);
	self->priv->datetime_picker = _tmp0_;
	_tmp1_ = self->priv->_is_board;
	if (_tmp1_) {
		widgets_schedule_button_build_card_ui (self);
	} else {
		widgets_schedule_button_build_ui (self);
	}
	_tmp2_ = self->priv->signal_map;
	_tmp3_ = self->priv->datetime_picker;
	_tmp4_ = g_signal_connect_object ((GtkPopover*) _tmp3_, "closed", (GCallback) __widgets_schedule_button___lambda224__gtk_popover_closed, self, 0);
	_tmp5_ = self->priv->datetime_picker;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, (gpointer) ((guintptr) _tmp4_), (GObject*) _tmp5_);
	_tmp6_ = self->priv->signal_map;
	_tmp7_ = self->priv->datetime_picker;
	_tmp8_ = g_signal_connect_object ((GtkWidget*) _tmp7_, "show", (GCallback) __widgets_schedule_button___lambda225__gtk_widget_show, self, 0);
	_tmp9_ = self->priv->datetime_picker;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp6_, (gpointer) ((guintptr) _tmp8_), (GObject*) _tmp9_);
	return obj;
}

static void
widgets_schedule_button_class_init (WidgetsScheduleButtonClass * klass,
                                    gpointer klass_data)
{
	widgets_schedule_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsScheduleButton_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_schedule_button_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_schedule_button_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_schedule_button_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_schedule_button_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCHEDULE_BUTTON_IS_BOARD_PROPERTY, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_IS_BOARD_PROPERTY] = g_param_spec_boolean ("is-board", "is-board", "is-board", 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_SCHEDULE_BUTTON_LABEL_PROPERTY, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCHEDULE_BUTTON_DUEDATE_PROPERTY, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_DUEDATE_PROPERTY] = g_param_spec_object ("duedate", "duedate", "duedate", OBJECTS_TYPE_DUE_DATE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCHEDULE_BUTTON_VISIBLE_NO_DATE_PROPERTY, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_VISIBLE_NO_DATE_PROPERTY] = g_param_spec_boolean ("visible-no-date", "visible-no-date", "visible-no-date", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_SCHEDULE_BUTTON_VISIBLE_CLEAR_BUTTON_PROPERTY, widgets_schedule_button_properties[WIDGETS_SCHEDULE_BUTTON_VISIBLE_CLEAR_BUTTON_PROPERTY] = g_param_spec_boolean ("visible-clear-button", "visible-clear-button", "visible-clear-button", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_DUEDATE_CHANGED_SIGNAL] = g_signal_new ("duedate-changed", WIDGETS_TYPE_SCHEDULE_BUTTON, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	widgets_schedule_button_signals[WIDGETS_SCHEDULE_BUTTON_PICKER_OPENED_SIGNAL] = g_signal_new ("picker-opened", WIDGETS_TYPE_SCHEDULE_BUTTON, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
widgets_schedule_button_instance_init (WidgetsScheduleButton * self,
                                       gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = widgets_schedule_button_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->signal_map = _tmp0_;
}

static void
widgets_schedule_button_finalize (GObject * obj)
{
	WidgetsScheduleButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SCHEDULE_BUTTON, WidgetsScheduleButton);
	g_debug ("ScheduleButton.vala:87: Destroying - Widgets.DateTimePicker.ScheduleBu" \
"tton\n");
	_g_free0 (self->priv->_label);
	_g_object_unref0 (self->priv->button);
	_g_object_unref0 (self->priv->due_label);
	_g_object_unref0 (self->priv->schedule_box);
	_g_object_unref0 (self->priv->due_image);
	_g_object_unref0 (self->priv->datetime_picker);
	_g_object_unref0 (self->priv->clear_revealer);
	_g_object_unref0 (self->priv->_duedate);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (widgets_schedule_button_parent_class)->finalize (obj);
}

static GType
widgets_schedule_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsScheduleButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_schedule_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsScheduleButton), 0, (GInstanceInitFunc) widgets_schedule_button_instance_init, NULL };
	GType widgets_schedule_button_type_id;
	widgets_schedule_button_type_id = g_type_register_static (gtk_grid_get_type (), "WidgetsScheduleButton", &g_define_type_info, 0);
	WidgetsScheduleButton_private_offset = g_type_add_instance_private (widgets_schedule_button_type_id, sizeof (WidgetsScheduleButtonPrivate));
	return widgets_schedule_button_type_id;
}

GType
widgets_schedule_button_get_type (void)
{
	static volatile gsize widgets_schedule_button_type_id__once = 0;
	if (g_once_init_enter (&widgets_schedule_button_type_id__once)) {
		GType widgets_schedule_button_type_id;
		widgets_schedule_button_type_id = widgets_schedule_button_get_type_once ();
		g_once_init_leave (&widgets_schedule_button_type_id__once, widgets_schedule_button_type_id);
	}
	return widgets_schedule_button_type_id__once;
}

static void
_vala_widgets_schedule_button_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	WidgetsScheduleButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SCHEDULE_BUTTON, WidgetsScheduleButton);
	switch (property_id) {
		case WIDGETS_SCHEDULE_BUTTON_IS_BOARD_PROPERTY:
		g_value_set_boolean (value, widgets_schedule_button_get_is_board (self));
		break;
		case WIDGETS_SCHEDULE_BUTTON_LABEL_PROPERTY:
		g_value_set_string (value, widgets_schedule_button_get_label (self));
		break;
		case WIDGETS_SCHEDULE_BUTTON_DUEDATE_PROPERTY:
		g_value_set_object (value, widgets_schedule_button_get_duedate (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_schedule_button_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	WidgetsScheduleButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_SCHEDULE_BUTTON, WidgetsScheduleButton);
	switch (property_id) {
		case WIDGETS_SCHEDULE_BUTTON_IS_BOARD_PROPERTY:
		widgets_schedule_button_set_is_board (self, g_value_get_boolean (value));
		break;
		case WIDGETS_SCHEDULE_BUTTON_LABEL_PROPERTY:
		widgets_schedule_button_set_label (self, g_value_get_string (value));
		break;
		case WIDGETS_SCHEDULE_BUTTON_DUEDATE_PROPERTY:
		widgets_schedule_button_set_duedate (self, g_value_get_object (value));
		break;
		case WIDGETS_SCHEDULE_BUTTON_VISIBLE_NO_DATE_PROPERTY:
		widgets_schedule_button_set_visible_no_date (self, g_value_get_boolean (value));
		break;
		case WIDGETS_SCHEDULE_BUTTON_VISIBLE_CLEAR_BUTTON_PROPERTY:
		widgets_schedule_button_set_visible_clear_button (self, g_value_get_boolean (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;
}

