/* DateTime.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from DateTime.vala, do not modify */

/*
 * Copyright 2021-2023 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <granite-7.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TASKS_WIDGETS_ENTRY_POPOVER_TYPE_GENERIC (tasks_widgets_entry_popover_generic_get_type ())
#define TASKS_WIDGETS_ENTRY_POPOVER_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_GENERIC, TasksWidgetsEntryPopoverGeneric))
#define TASKS_WIDGETS_ENTRY_POPOVER_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_GENERIC, TasksWidgetsEntryPopoverGenericClass))
#define TASKS_WIDGETS_ENTRY_POPOVER_IS_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_GENERIC))
#define TASKS_WIDGETS_ENTRY_POPOVER_IS_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_GENERIC))
#define TASKS_WIDGETS_ENTRY_POPOVER_GENERIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_GENERIC, TasksWidgetsEntryPopoverGenericClass))

typedef struct _TasksWidgetsEntryPopoverGeneric TasksWidgetsEntryPopoverGeneric;
typedef struct _TasksWidgetsEntryPopoverGenericClass TasksWidgetsEntryPopoverGenericClass;
typedef struct _TasksWidgetsEntryPopoverGenericPrivate TasksWidgetsEntryPopoverGenericPrivate;

#define TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME (tasks_widgets_entry_popover_date_time_get_type ())
#define TASKS_WIDGETS_ENTRY_POPOVER_DATE_TIME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME, TasksWidgetsEntryPopoverDateTime))
#define TASKS_WIDGETS_ENTRY_POPOVER_DATE_TIME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME, TasksWidgetsEntryPopoverDateTimeClass))
#define TASKS_WIDGETS_ENTRY_POPOVER_IS_DATE_TIME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME))
#define TASKS_WIDGETS_ENTRY_POPOVER_IS_DATE_TIME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME))
#define TASKS_WIDGETS_ENTRY_POPOVER_DATE_TIME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME, TasksWidgetsEntryPopoverDateTimeClass))

typedef struct _TasksWidgetsEntryPopoverDateTime TasksWidgetsEntryPopoverDateTime;
typedef struct _TasksWidgetsEntryPopoverDateTimeClass TasksWidgetsEntryPopoverDateTimeClass;
typedef struct _TasksWidgetsEntryPopoverDateTimePrivate TasksWidgetsEntryPopoverDateTimePrivate;
enum  {
	TASKS_WIDGETS_ENTRY_POPOVER_DATE_TIME_0_PROPERTY,
	TASKS_WIDGETS_ENTRY_POPOVER_DATE_TIME_NUM_PROPERTIES
};
static GParamSpec* tasks_widgets_entry_popover_date_time_properties[TASKS_WIDGETS_ENTRY_POPOVER_DATE_TIME_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define TASKS_TYPE_POPOVER_MENUITEM (tasks_popover_menuitem_get_type ())
#define TASKS_POPOVER_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitem))
#define TASKS_POPOVER_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitemClass))
#define TASKS_IS_POPOVER_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASKS_TYPE_POPOVER_MENUITEM))
#define TASKS_IS_POPOVER_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TASKS_TYPE_POPOVER_MENUITEM))
#define TASKS_POPOVER_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitemClass))

typedef struct _TasksPopoverMenuitem TasksPopoverMenuitem;
typedef struct _TasksPopoverMenuitemClass TasksPopoverMenuitemClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _TasksWidgetsEntryPopoverGeneric {
	GtkWidget parent_instance;
	TasksWidgetsEntryPopoverGenericPrivate * priv;
};

struct _TasksWidgetsEntryPopoverGenericClass {
	GtkWidgetClass parent_class;
};

struct _TasksWidgetsEntryPopoverDateTime {
	TasksWidgetsEntryPopoverGeneric parent_instance;
	TasksWidgetsEntryPopoverDateTimePrivate * priv;
};

struct _TasksWidgetsEntryPopoverDateTimeClass {
	TasksWidgetsEntryPopoverGenericClass parent_class;
};

struct _TasksWidgetsEntryPopoverDateTimePrivate {
	GtkCalendar* calendar;
	GraniteTimePicker* timepicker;
	GtkRevealer* timepicker_revealer;
};

static gint TasksWidgetsEntryPopoverDateTime_private_offset;
static gpointer tasks_widgets_entry_popover_date_time_parent_class = NULL;

VALA_EXTERN GType tasks_widgets_entry_popover_generic_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TasksWidgetsEntryPopoverGeneric, g_object_unref)
VALA_EXTERN GType tasks_widgets_entry_popover_date_time_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TasksWidgetsEntryPopoverDateTime, g_object_unref)
VALA_EXTERN TasksWidgetsEntryPopoverDateTime* tasks_widgets_entry_popover_date_time_new (void);
VALA_EXTERN TasksWidgetsEntryPopoverDateTime* tasks_widgets_entry_popover_date_time_construct (GType object_type);
VALA_EXTERN void tasks_widgets_entry_popover_date_time_hide_timepicker (TasksWidgetsEntryPopoverDateTime* self);
static void tasks_widgets_entry_popover_date_time_on_popover_show (TasksWidgetsEntryPopoverDateTime* self);
VALA_EXTERN gconstpointer tasks_widgets_entry_popover_generic_get_value (TasksWidgetsEntryPopoverGeneric* self);
static GDateTime* tasks_widgets_entry_popover_date_time_get_next_full_hour (TasksWidgetsEntryPopoverDateTime* self,
                                                                     GDateTime* datetime);
VALA_EXTERN void tasks_widgets_entry_popover_generic_set_value (TasksWidgetsEntryPopoverGeneric* self,
                                                    gconstpointer value);
static void tasks_widgets_entry_popover_date_time_on_today_button_clicked (TasksWidgetsEntryPopoverDateTime* self);
static void tasks_widgets_entry_popover_date_time_on_calendar_day_selected (TasksWidgetsEntryPopoverDateTime* self);
static void tasks_widgets_entry_popover_date_time_on_timepicker_time_changed (TasksWidgetsEntryPopoverDateTime* self);
static GObject * tasks_widgets_entry_popover_date_time_constructor (GType type,
                                                             guint n_construct_properties,
                                                             GObjectConstructParam * construct_properties);
VALA_EXTERN GType tasks_popover_menuitem_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TasksPopoverMenuitem, g_object_unref)
VALA_EXTERN TasksPopoverMenuitem* tasks_popover_menuitem_new (void);
VALA_EXTERN TasksPopoverMenuitem* tasks_popover_menuitem_construct (GType object_type);
VALA_EXTERN void tasks_popover_menuitem_set_text (TasksPopoverMenuitem* self,
                                      const gchar* value);
VALA_EXTERN GtkPopover* tasks_widgets_entry_popover_generic_get_popover (TasksWidgetsEntryPopoverGeneric* self);
static void _tasks_widgets_entry_popover_date_time_on_popover_show_gtk_widget_show (GtkWidget* _sender,
                                                                             gpointer self);
static void _tasks_widgets_entry_popover_date_time_on_today_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                        gpointer self);
static void _tasks_widgets_entry_popover_date_time_on_calendar_day_selected_gtk_calendar_day_selected (GtkCalendar* _sender,
                                                                                                gpointer self);
static void _tasks_widgets_entry_popover_date_time_on_timepicker_time_changed_granite_time_picker_time_changed (GraniteTimePicker* _sender,
                                                                                                         gpointer self);
static void tasks_widgets_entry_popover_date_time_finalize (GObject * obj);
static GType tasks_widgets_entry_popover_date_time_get_type_once (void);

static inline gpointer
tasks_widgets_entry_popover_date_time_get_instance_private (TasksWidgetsEntryPopoverDateTime* self)
{
	return G_STRUCT_MEMBER_P (self, TasksWidgetsEntryPopoverDateTime_private_offset);
}

TasksWidgetsEntryPopoverDateTime*
tasks_widgets_entry_popover_date_time_construct (GType object_type)
{
	TasksWidgetsEntryPopoverDateTime * self = NULL;
	self = (TasksWidgetsEntryPopoverDateTime*) g_object_new (object_type, "t-type", G_TYPE_DATE_TIME, "t-dup-func", (GBoxedCopyFunc) g_date_time_ref, "t-destroy-func", (GDestroyNotify) g_date_time_unref, "icon-name", "office-calendar-symbolic", "placeholder", _ ("Set Due"), NULL);
	return self;
}

TasksWidgetsEntryPopoverDateTime*
tasks_widgets_entry_popover_date_time_new (void)
{
	return tasks_widgets_entry_popover_date_time_construct (TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME);
}

void
tasks_widgets_entry_popover_date_time_hide_timepicker (TasksWidgetsEntryPopoverDateTime* self)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->timepicker_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, FALSE);
}

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

static void
tasks_widgets_entry_popover_date_time_on_popover_show (TasksWidgetsEntryPopoverDateTime* self)
{
	GDateTime* selected_datetime = NULL;
	gconstpointer _tmp0_;
	gconstpointer _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	GtkCalendar* _tmp8_;
	GDateTime* _tmp9_;
	GraniteTimePicker* _tmp10_;
	GDateTime* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tasks_widgets_entry_popover_generic_get_value ((TasksWidgetsEntryPopoverGeneric*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_date_time_ref0 ((GDateTime*) _tmp1_);
	selected_datetime = _tmp2_;
	_tmp3_ = selected_datetime;
	if (_tmp3_ == NULL) {
		GDateTime* _tmp4_;
		GDateTime* _tmp5_;
		GDateTime* _tmp6_;
		GDateTime* _tmp7_;
		_tmp4_ = g_date_time_new_now_local ();
		_tmp5_ = _tmp4_;
		_tmp6_ = tasks_widgets_entry_popover_date_time_get_next_full_hour (self, _tmp5_);
		_g_date_time_unref0 (selected_datetime);
		selected_datetime = _tmp6_;
		_g_date_time_unref0 (_tmp5_);
		_tmp7_ = selected_datetime;
		tasks_widgets_entry_popover_generic_set_value ((TasksWidgetsEntryPopoverGeneric*) self, _tmp7_);
	}
	_tmp8_ = self->priv->calendar;
	_tmp9_ = selected_datetime;
	gtk_calendar_select_day (_tmp8_, _tmp9_);
	_tmp10_ = self->priv->timepicker;
	_tmp11_ = selected_datetime;
	granite_time_picker_set_time (_tmp10_, _tmp11_);
	_g_date_time_unref0 (selected_datetime);
}

static void
tasks_widgets_entry_popover_date_time_on_today_button_clicked (TasksWidgetsEntryPopoverDateTime* self)
{
	GtkCalendar* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->calendar;
	_tmp1_ = g_date_time_new_now_local ();
	_tmp2_ = _tmp1_;
	gtk_calendar_select_day (_tmp0_, _tmp2_);
	_g_date_time_unref0 (_tmp2_);
}

static void
tasks_widgets_entry_popover_date_time_on_calendar_day_selected (TasksWidgetsEntryPopoverDateTime* self)
{
	GDateTime* selected_datetime = NULL;
	GtkCalendar* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GtkCalendar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	GtkCalendar* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gconstpointer _tmp9_;
	gconstpointer _tmp10_;
	gconstpointer _tmp11_;
	gconstpointer _tmp12_;
	GDateTime* _tmp13_;
	GraniteTimePicker* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->calendar;
	g_object_get (_tmp0_, "year", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->calendar;
	g_object_get (_tmp3_, "month", &_tmp4_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->calendar;
	g_object_get (_tmp6_, "day", &_tmp7_, NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = tasks_widgets_entry_popover_generic_get_value ((TasksWidgetsEntryPopoverGeneric*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = tasks_widgets_entry_popover_generic_get_value ((TasksWidgetsEntryPopoverGeneric*) self);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_date_time_new_local (_tmp2_, _tmp5_ + 1, _tmp8_, g_date_time_get_hour ((GDateTime*) _tmp10_), g_date_time_get_minute ((GDateTime*) _tmp12_), (gdouble) 0);
	selected_datetime = _tmp13_;
	_tmp14_ = self->priv->timepicker;
	granite_time_picker_set_time (_tmp14_, selected_datetime);
	tasks_widgets_entry_popover_generic_set_value ((TasksWidgetsEntryPopoverGeneric*) self, selected_datetime);
	_g_date_time_unref0 (selected_datetime);
}

static void
tasks_widgets_entry_popover_date_time_on_timepicker_time_changed (TasksWidgetsEntryPopoverDateTime* self)
{
	GraniteTimePicker* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->timepicker;
	_tmp1_ = granite_time_picker_get_time (_tmp0_);
	_tmp2_ = _tmp1_;
	tasks_widgets_entry_popover_generic_set_value ((TasksWidgetsEntryPopoverGeneric*) self, _tmp2_);
}

static GDateTime*
tasks_widgets_entry_popover_date_time_get_next_full_hour (TasksWidgetsEntryPopoverDateTime* self,
                                                          GDateTime* datetime)
{
	GDateTime* next_full_hour = NULL;
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	GDateTime* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (datetime != NULL, NULL);
	_tmp0_ = g_date_time_add_minutes (datetime, 60 - g_date_time_get_minute (datetime));
	next_full_hour = _tmp0_;
	_tmp1_ = next_full_hour;
	_tmp2_ = next_full_hour;
	_tmp3_ = g_date_time_add_seconds (_tmp1_, -g_date_time_get_seconds (_tmp2_));
	_g_date_time_unref0 (next_full_hour);
	next_full_hour = _tmp3_;
	result = next_full_hour;
	return result;
}

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

static void
_tasks_widgets_entry_popover_date_time_on_popover_show_gtk_widget_show (GtkWidget* _sender,
                                                                        gpointer self)
{
	tasks_widgets_entry_popover_date_time_on_popover_show ((TasksWidgetsEntryPopoverDateTime*) self);
}

static void
_tasks_widgets_entry_popover_date_time_on_today_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                   gpointer self)
{
	tasks_widgets_entry_popover_date_time_on_today_button_clicked ((TasksWidgetsEntryPopoverDateTime*) self);
}

static void
_tasks_widgets_entry_popover_date_time_on_calendar_day_selected_gtk_calendar_day_selected (GtkCalendar* _sender,
                                                                                           gpointer self)
{
	tasks_widgets_entry_popover_date_time_on_calendar_day_selected ((TasksWidgetsEntryPopoverDateTime*) self);
}

static void
_tasks_widgets_entry_popover_date_time_on_timepicker_time_changed_granite_time_picker_time_changed (GraniteTimePicker* _sender,
                                                                                                    gpointer self)
{
	tasks_widgets_entry_popover_date_time_on_timepicker_time_changed ((TasksWidgetsEntryPopoverDateTime*) self);
}

static GObject *
tasks_widgets_entry_popover_date_time_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TasksWidgetsEntryPopoverDateTime * self;
	GtkCalendar* _tmp0_ = NULL;
	GraniteTimePicker* _tmp1_ = NULL;
	GraniteTimePicker* _tmp2_;
	GtkWidget* _tmp3_;
	GtkRevealer* _tmp4_ = NULL;
	GtkSeparator* today_separator = NULL;
	GtkSeparator* _tmp5_ = NULL;
	TasksPopoverMenuitem* today_button = NULL;
	gchar* _tmp6_;
	TasksPopoverMenuitem* _tmp7_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp8_ = NULL;
	GtkBox* _tmp9_;
	TasksPopoverMenuitem* _tmp10_;
	GtkBox* _tmp11_;
	GtkSeparator* _tmp12_;
	GtkBox* _tmp13_;
	GtkCalendar* _tmp14_;
	GtkBox* _tmp15_;
	GtkRevealer* _tmp16_;
	GtkPopover* _tmp17_;
	GtkPopover* _tmp18_;
	GtkBox* _tmp19_;
	GtkPopover* _tmp20_;
	GtkPopover* _tmp21_;
	TasksPopoverMenuitem* _tmp22_;
	GtkCalendar* _tmp23_;
	GraniteTimePicker* _tmp24_;
	parent_class = G_OBJECT_CLASS (tasks_widgets_entry_popover_date_time_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME, TasksWidgetsEntryPopoverDateTime);
	_tmp0_ = (GtkCalendar*) gtk_calendar_new ();
	gtk_widget_set_margin_top ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp0_, 6);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->calendar);
	self->priv->calendar = _tmp0_;
	_tmp1_ = granite_time_picker_new ();
	gtk_widget_set_margin_top ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp1_, 12);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->timepicker);
	self->priv->timepicker = _tmp1_;
	_tmp2_ = self->priv->timepicker;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp4_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	gtk_revealer_set_reveal_child (_tmp4_, TRUE);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->timepicker_revealer);
	self->priv->timepicker_revealer = _tmp4_;
	_tmp5_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 3);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp5_, 3);
	g_object_ref_sink (_tmp5_);
	today_separator = _tmp5_;
	_tmp6_ = g_strdup (_ ("Today"));
	_tmp7_ = tasks_popover_menuitem_new ();
	tasks_popover_menuitem_set_text (_tmp7_, _tmp6_);
	_g_free0 (_tmp6_);
	g_object_ref_sink (_tmp7_);
	today_button = _tmp7_;
	_tmp8_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp8_, 3);
	g_object_ref_sink (_tmp8_);
	box = _tmp8_;
	_tmp9_ = box;
	_tmp10_ = today_button;
	gtk_box_append (_tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = box;
	_tmp12_ = today_separator;
	gtk_box_append (_tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = box;
	_tmp14_ = self->priv->calendar;
	gtk_box_append (_tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = box;
	_tmp16_ = self->priv->timepicker_revealer;
	gtk_box_append (_tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = tasks_widgets_entry_popover_generic_get_popover ((TasksWidgetsEntryPopoverGeneric*) self);
	_tmp18_ = _tmp17_;
	_tmp19_ = box;
	gtk_popover_set_child (_tmp18_, (GtkWidget*) _tmp19_);
	_tmp20_ = tasks_widgets_entry_popover_generic_get_popover ((TasksWidgetsEntryPopoverGeneric*) self);
	_tmp21_ = _tmp20_;
	g_signal_connect_object ((GtkWidget*) _tmp21_, "show", (GCallback) _tasks_widgets_entry_popover_date_time_on_popover_show_gtk_widget_show, self, 0);
	_tmp22_ = today_button;
	g_signal_connect_object ((GtkButton*) _tmp22_, "clicked", (GCallback) _tasks_widgets_entry_popover_date_time_on_today_button_clicked_gtk_button_clicked, self, 0);
	_tmp23_ = self->priv->calendar;
	g_signal_connect_object (_tmp23_, "day-selected", (GCallback) _tasks_widgets_entry_popover_date_time_on_calendar_day_selected_gtk_calendar_day_selected, self, 0);
	_tmp24_ = self->priv->timepicker;
	g_signal_connect_object (_tmp24_, "time-changed", (GCallback) _tasks_widgets_entry_popover_date_time_on_timepicker_time_changed_granite_time_picker_time_changed, self, 0);
	_g_object_unref0 (box);
	_g_object_unref0 (today_button);
	_g_object_unref0 (today_separator);
	return obj;
}

static void
tasks_widgets_entry_popover_date_time_class_init (TasksWidgetsEntryPopoverDateTimeClass * klass,
                                                  gpointer klass_data)
{
	tasks_widgets_entry_popover_date_time_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TasksWidgetsEntryPopoverDateTime_private_offset);
	G_OBJECT_CLASS (klass)->constructor = tasks_widgets_entry_popover_date_time_constructor;
	G_OBJECT_CLASS (klass)->finalize = tasks_widgets_entry_popover_date_time_finalize;
}

static void
tasks_widgets_entry_popover_date_time_instance_init (TasksWidgetsEntryPopoverDateTime * self,
                                                     gpointer klass)
{
	self->priv = tasks_widgets_entry_popover_date_time_get_instance_private (self);
}

static void
tasks_widgets_entry_popover_date_time_finalize (GObject * obj)
{
	TasksWidgetsEntryPopoverDateTime * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TASKS_WIDGETS_ENTRY_POPOVER_TYPE_DATE_TIME, TasksWidgetsEntryPopoverDateTime);
	_g_object_unref0 (self->priv->calendar);
	_g_object_unref0 (self->priv->timepicker);
	_g_object_unref0 (self->priv->timepicker_revealer);
	G_OBJECT_CLASS (tasks_widgets_entry_popover_date_time_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tasks_widgets_entry_popover_date_time_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TasksWidgetsEntryPopoverDateTimeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tasks_widgets_entry_popover_date_time_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TasksWidgetsEntryPopoverDateTime), 0, (GInstanceInitFunc) tasks_widgets_entry_popover_date_time_instance_init, NULL };
	GType tasks_widgets_entry_popover_date_time_type_id;
	tasks_widgets_entry_popover_date_time_type_id = g_type_register_static (TASKS_WIDGETS_ENTRY_POPOVER_TYPE_GENERIC, "TasksWidgetsEntryPopoverDateTime", &g_define_type_info, 0);
	TasksWidgetsEntryPopoverDateTime_private_offset = g_type_add_instance_private (tasks_widgets_entry_popover_date_time_type_id, sizeof (TasksWidgetsEntryPopoverDateTimePrivate));
	return tasks_widgets_entry_popover_date_time_type_id;
}

GType
tasks_widgets_entry_popover_date_time_get_type (void)
{
	static gsize tasks_widgets_entry_popover_date_time_type_id__once = 0;
	if (g_once_init_enter (&tasks_widgets_entry_popover_date_time_type_id__once)) {
		GType tasks_widgets_entry_popover_date_time_type_id;
		tasks_widgets_entry_popover_date_time_type_id = tasks_widgets_entry_popover_date_time_get_type_once ();
		g_once_init_leave (&tasks_widgets_entry_popover_date_time_type_id__once, tasks_widgets_entry_popover_date_time_type_id);
	}
	return tasks_widgets_entry_popover_date_time_type_id__once;
}

