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

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

enum  {
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_0_PROPERTY,
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_12_PROPERTY,
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_24_PROPERTY,
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_PROPERTY,
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_NUM_PROPERTIES
};
static GParamSpec* widgets_date_time_picker_time_picker_properties[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
enum  {
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_CHANGED_SIGNAL,
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_ACTIVATED_SIGNAL,
	WIDGETS_DATE_TIME_PICKER_TIME_PICKER_NUM_SIGNALS
};
static guint widgets_date_time_picker_time_picker_signals[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_NUM_SIGNALS] = {0};

struct _WidgetsDateTimePickerTimePickerPrivate {
	GtkEntry* time_entry;
	gchar* _format_12;
	gchar* _format_24;
	GDateTime* _time;
	gchar* old_string;
	GeeHashMap* signal_map;
};

static gint WidgetsDateTimePickerTimePicker_private_offset;
static gpointer widgets_date_time_picker_time_picker_parent_class = NULL;

static void widgets_date_time_picker_time_picker_is_unfocused (WidgetsDateTimePickerTimePicker* self);
static void widgets_date_time_picker_time_picker_parse_time (WidgetsDateTimePickerTimePicker* self,
                                                      const gchar* timestr);
static gint* _int_dup (gint* self);
static gboolean _int_equal (const gint * s1,
                     const gint * s2);
static void widgets_date_time_picker_time_picker_update_text (WidgetsDateTimePickerTimePicker* self,
                                                       gboolean no_signal);
static GObject * widgets_date_time_picker_time_picker_constructor (GType type,
                                                            guint n_construct_properties,
                                                            GObjectConstructParam * construct_properties);
static void _widgets_date_time_picker_time_picker___lambda135_ (WidgetsDateTimePickerTimePicker* self);
static void __widgets_date_time_picker_time_picker___lambda135__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                                           gpointer self);
static gboolean _widgets_date_time_picker_time_picker___lambda136_ (WidgetsDateTimePickerTimePicker* self,
                                                             gdouble dx,
                                                             gdouble dy);
static gboolean __widgets_date_time_picker_time_picker___lambda136__gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                                                                 gdouble dx,
                                                                                                 gdouble dy,
                                                                                                 gpointer self);
static void _widgets_date_time_picker_time_picker___lambda137_ (WidgetsDateTimePickerTimePicker* self);
static void __widgets_date_time_picker_time_picker___lambda137__gtk_entry_activate (GtkEntry* _sender,
                                                                             gpointer self);
static void widgets_date_time_picker_time_picker_finalize (GObject * obj);
static GType widgets_date_time_picker_time_picker_get_type_once (void);
static void _vala_widgets_date_time_picker_time_picker_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_widgets_date_time_picker_time_picker_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
widgets_date_time_picker_time_picker_get_instance_private (WidgetsDateTimePickerTimePicker* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsDateTimePickerTimePicker_private_offset);
}

static void
widgets_date_time_picker_time_picker_is_unfocused (WidgetsDateTimePickerTimePicker* self)
{
	const gchar* _tmp0_;
	GtkEntry* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->old_string;
	_tmp1_ = self->priv->time_entry;
	_tmp2_ = gtk_editable_get_text ((GtkEditable*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (g_utf8_collate (_tmp0_, _tmp3_) != 0) {
		GtkEntry* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		GtkEntry* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		_tmp4_ = self->priv->time_entry;
		_tmp5_ = gtk_editable_get_text ((GtkEditable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_strdup (_tmp6_);
		_g_free0 (self->priv->old_string);
		self->priv->old_string = _tmp7_;
		_tmp8_ = self->priv->time_entry;
		_tmp9_ = gtk_editable_get_text ((GtkEditable*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_strdup (_tmp10_);
		_tmp12_ = _tmp11_;
		widgets_date_time_picker_time_picker_parse_time (self, _tmp12_);
		_g_free0 (_tmp12_);
	}
}

static gchar*
string_to_utf8 (const gchar* self,
                gint* result_length1)
{
	gint string_length = 0;
	gint _tmp0_;
	gint _tmp1_;
	gchar* _result_ = NULL;
	gchar* _tmp2_;
	gint _result__length1;
	gint __result__size_;
	gint _tmp3_;
	gchar* _tmp4_;
	gint _tmp4__length1;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = _tmp1_;
	_tmp2_ = g_new0 (gchar, string_length + 1);
	_result_ = _tmp2_;
	_result__length1 = string_length + 1;
	__result__size_ = _result__length1;
	_tmp3_ = _result__length1;
	_result__length1 = _tmp3_ - 1;
	memcpy (_result_, self, (gsize) string_length);
	_tmp4_ = _result_;
	_tmp4__length1 = _result__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
_int_equal (const gint * s1,
            const gint * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	return (*s1) == (*s2);
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
widgets_date_time_picker_time_picker_parse_time (WidgetsDateTimePickerTimePicker* self,
                                                 const gchar* timestr)
{
	gchar* current = NULL;
	gchar* _tmp0_;
	gboolean is_hours = FALSE;
	gboolean is_suffix = FALSE;
	gboolean has_suffix = FALSE;
	gint* hour = NULL;
	gint* minute = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_ = 0;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp5__length1;
	gboolean _tmp65_ = FALSE;
	gboolean _tmp66_ = FALSE;
	gint* _tmp71_;
	gboolean _tmp96_ = FALSE;
	gint* _tmp97_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (timestr != NULL);
	_tmp0_ = g_strdup ("");
	current = _tmp0_;
	is_hours = TRUE;
	is_suffix = FALSE;
	has_suffix = FALSE;
	hour = NULL;
	minute = NULL;
	_tmp1_ = g_utf8_strdown (timestr, (gssize) -1);
	_tmp2_ = _tmp1_;
	_tmp4_ = string_to_utf8 (_tmp2_, &_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp5__length1 = _tmp3_;
	_g_free0 (_tmp2_);
	{
		gchar* c_collection = NULL;
		gint c_collection_length1 = 0;
		gint _c_collection_size_ = 0;
		gint c_it = 0;
		c_collection = _tmp5_;
		c_collection_length1 = _tmp5__length1;
		for (c_it = 0; c_it < c_collection_length1; c_it = c_it + 1) {
			gchar c = '\0';
			c = c_collection[c_it];
			{
				if (g_ascii_isdigit (c)) {
					const gchar* _tmp6_;
					gchar* _tmp7_;
					_tmp6_ = current;
					_tmp7_ = g_strdup_printf ("%s%c", _tmp6_, (gint) c);
					_g_free0 (current);
					current = _tmp7_;
				} else {
					gboolean _tmp25_ = FALSE;
					gchar* _tmp26_;
					gchar* _tmp27_;
					gboolean _tmp28_;
					if (!is_suffix) {
						const gchar* _tmp8_;
						gboolean _tmp17_ = FALSE;
						gchar* _tmp18_;
						gchar* _tmp19_;
						gboolean _tmp20_;
						_tmp8_ = current;
						if (g_strcmp0 (_tmp8_, "") != 0) {
							if (is_hours) {
								const gchar* _tmp9_;
								gint _tmp10_;
								gint* _tmp11_;
								gchar* _tmp12_;
								is_hours = FALSE;
								_tmp9_ = current;
								_tmp10_ = atoi (_tmp9_);
								_tmp11_ = __int_dup0 (&_tmp10_);
								_g_free0 (hour);
								hour = _tmp11_;
								_tmp12_ = g_strdup ("");
								_g_free0 (current);
								current = _tmp12_;
							} else {
								const gchar* _tmp13_;
								gint _tmp14_;
								gint* _tmp15_;
								gchar* _tmp16_;
								_tmp13_ = current;
								_tmp14_ = atoi (_tmp13_);
								_tmp15_ = __int_dup0 (&_tmp14_);
								_g_free0 (minute);
								minute = _tmp15_;
								_tmp16_ = g_strdup ("");
								_g_free0 (current);
								current = _tmp16_;
							}
						}
						_tmp18_ = g_strdup_printf ("%c", c);
						_tmp19_ = _tmp18_;
						_tmp20_ = string_contains (_tmp19_, "a");
						_g_free0 (_tmp19_);
						if (_tmp20_) {
							_tmp17_ = TRUE;
						} else {
							gchar* _tmp21_;
							gchar* _tmp22_;
							_tmp21_ = g_strdup_printf ("%c", c);
							_tmp22_ = _tmp21_;
							_tmp17_ = string_contains (_tmp22_, "p");
							_g_free0 (_tmp22_);
						}
						if (_tmp17_) {
							const gchar* _tmp23_;
							gchar* _tmp24_;
							is_suffix = TRUE;
							_tmp23_ = current;
							_tmp24_ = g_strdup_printf ("%s%c", _tmp23_, (gint) c);
							_g_free0 (current);
							current = _tmp24_;
						}
					}
					_tmp26_ = g_strdup_printf ("%c", c);
					_tmp27_ = _tmp26_;
					_tmp28_ = string_contains (_tmp27_, "m");
					_g_free0 (_tmp27_);
					if (_tmp28_) {
						_tmp25_ = is_suffix;
					} else {
						_tmp25_ = FALSE;
					}
					if (_tmp25_) {
						gint* _tmp29_;
						gboolean _tmp33_ = FALSE;
						const gchar* _tmp34_;
						gboolean _tmp50_ = FALSE;
						const gchar* _tmp51_;
						GDateTime* _tmp58_;
						GDateTime* _tmp59_;
						gint* _tmp60_;
						GDateTime* _tmp61_;
						GDateTime* _tmp62_;
						GDateTime* _tmp63_;
						GDateTime* _tmp64_;
						_tmp29_ = hour;
						if (_tmp29_ == NULL) {
							c_collection = (g_free (c_collection), NULL);
							_g_free0 (minute);
							_g_free0 (hour);
							_g_free0 (current);
							return;
						} else {
							gint* _tmp30_;
							_tmp30_ = minute;
							if (_tmp30_ == NULL) {
								gint _tmp31_;
								gint* _tmp32_;
								_tmp31_ = 0;
								_tmp32_ = __int_dup0 (&_tmp31_);
								_g_free0 (minute);
								minute = _tmp32_;
							}
						}
						_tmp34_ = current;
						if (string_contains (_tmp34_, "a")) {
							_tmp33_ = TRUE;
						} else {
							gint* _tmp35_;
							_tmp35_ = hour;
							_tmp33_ = (*_tmp35_) >= 12;
						}
						if (_tmp33_) {
							GDateTime* _tmp36_;
							GDateTime* _tmp37_;
							gint* _tmp38_;
							GDateTime* _tmp39_;
							GDateTime* _tmp40_;
							GDateTime* _tmp41_;
							GDateTime* _tmp42_;
							_tmp36_ = widgets_date_time_picker_time_picker_get_time (self);
							_tmp37_ = _tmp36_;
							_tmp38_ = hour;
							_tmp39_ = widgets_date_time_picker_time_picker_get_time (self);
							_tmp40_ = _tmp39_;
							_tmp41_ = g_date_time_add_hours (_tmp37_, (*_tmp38_) - g_date_time_get_hour (_tmp40_));
							_tmp42_ = _tmp41_;
							widgets_date_time_picker_time_picker_set_time (self, _tmp42_);
							_g_date_time_unref0 (_tmp42_);
						} else {
							GDateTime* _tmp43_;
							GDateTime* _tmp44_;
							gint* _tmp45_;
							GDateTime* _tmp46_;
							GDateTime* _tmp47_;
							GDateTime* _tmp48_;
							GDateTime* _tmp49_;
							_tmp43_ = widgets_date_time_picker_time_picker_get_time (self);
							_tmp44_ = _tmp43_;
							_tmp45_ = hour;
							_tmp46_ = widgets_date_time_picker_time_picker_get_time (self);
							_tmp47_ = _tmp46_;
							_tmp48_ = g_date_time_add_hours (_tmp44_, ((*_tmp45_) + 12) - g_date_time_get_hour (_tmp47_));
							_tmp49_ = _tmp48_;
							widgets_date_time_picker_time_picker_set_time (self, _tmp49_);
							_g_date_time_unref0 (_tmp49_);
						}
						_tmp51_ = current;
						if (string_contains (_tmp51_, "a")) {
							gint* _tmp52_;
							gint _tmp53_;
							_tmp52_ = hour;
							_tmp53_ = 12;
							_tmp50_ = _int_equal (_tmp52_, &_tmp53_) == TRUE;
						} else {
							_tmp50_ = FALSE;
						}
						if (_tmp50_) {
							GDateTime* _tmp54_;
							GDateTime* _tmp55_;
							GDateTime* _tmp56_;
							GDateTime* _tmp57_;
							_tmp54_ = widgets_date_time_picker_time_picker_get_time (self);
							_tmp55_ = _tmp54_;
							_tmp56_ = g_date_time_add_hours (_tmp55_, -12);
							_tmp57_ = _tmp56_;
							widgets_date_time_picker_time_picker_set_time (self, _tmp57_);
							_g_date_time_unref0 (_tmp57_);
						}
						_tmp58_ = widgets_date_time_picker_time_picker_get_time (self);
						_tmp59_ = _tmp58_;
						_tmp60_ = minute;
						_tmp61_ = widgets_date_time_picker_time_picker_get_time (self);
						_tmp62_ = _tmp61_;
						_tmp63_ = g_date_time_add_minutes (_tmp59_, (*_tmp60_) - g_date_time_get_minute (_tmp62_));
						_tmp64_ = _tmp63_;
						widgets_date_time_picker_time_picker_set_time (self, _tmp64_);
						_g_date_time_unref0 (_tmp64_);
						has_suffix = TRUE;
					}
				}
			}
		}
		c_collection = (g_free (c_collection), NULL);
	}
	if (is_hours == FALSE) {
		_tmp66_ = is_suffix == FALSE;
	} else {
		_tmp66_ = FALSE;
	}
	if (_tmp66_) {
		const gchar* _tmp67_;
		_tmp67_ = current;
		_tmp65_ = g_strcmp0 (_tmp67_, "") != 0;
	} else {
		_tmp65_ = FALSE;
	}
	if (_tmp65_) {
		const gchar* _tmp68_;
		gint _tmp69_;
		gint* _tmp70_;
		_tmp68_ = current;
		_tmp69_ = atoi (_tmp68_);
		_tmp70_ = __int_dup0 (&_tmp69_);
		_g_free0 (minute);
		minute = _tmp70_;
	}
	_tmp71_ = hour;
	if (_tmp71_ == NULL) {
		const gchar* _tmp72_;
		gint _tmp73_;
		gint _tmp74_;
		_tmp72_ = current;
		_tmp73_ = strlen (_tmp72_);
		_tmp74_ = _tmp73_;
		if (_tmp74_ < 3) {
			const gchar* _tmp75_;
			gint _tmp76_;
			gint* _tmp77_;
			gint _tmp78_;
			gint* _tmp79_;
			_tmp75_ = current;
			_tmp76_ = atoi (_tmp75_);
			_tmp77_ = __int_dup0 (&_tmp76_);
			_g_free0 (hour);
			hour = _tmp77_;
			_tmp78_ = 0;
			_tmp79_ = __int_dup0 (&_tmp78_);
			_g_free0 (minute);
			minute = _tmp79_;
		} else {
			const gchar* _tmp80_;
			gint _tmp81_;
			gint _tmp82_;
			_tmp80_ = current;
			_tmp81_ = strlen (_tmp80_);
			_tmp82_ = _tmp81_;
			if (_tmp82_ == 4) {
				const gchar* _tmp83_;
				gchar* _tmp84_;
				gchar* _tmp85_;
				gint _tmp86_;
				gint* _tmp87_;
				const gchar* _tmp88_;
				gchar* _tmp89_;
				gchar* _tmp90_;
				gint _tmp91_;
				gint* _tmp92_;
				gboolean _tmp93_ = FALSE;
				gint* _tmp94_;
				_tmp83_ = current;
				_tmp84_ = string_slice (_tmp83_, (glong) 0, (glong) 2);
				_tmp85_ = _tmp84_;
				_tmp86_ = atoi (_tmp85_);
				_tmp87_ = __int_dup0 (&_tmp86_);
				_g_free0 (hour);
				hour = _tmp87_;
				_g_free0 (_tmp85_);
				_tmp88_ = current;
				_tmp89_ = string_slice (_tmp88_, (glong) 2, (glong) 4);
				_tmp90_ = _tmp89_;
				_tmp91_ = atoi (_tmp90_);
				_tmp92_ = __int_dup0 (&_tmp91_);
				_g_free0 (minute);
				minute = _tmp92_;
				_g_free0 (_tmp90_);
				_tmp94_ = hour;
				if ((*_tmp94_) > 23) {
					_tmp93_ = TRUE;
				} else {
					gint* _tmp95_;
					_tmp95_ = minute;
					_tmp93_ = (*_tmp95_) > 59;
				}
				if (_tmp93_) {
					_g_free0 (hour);
					hour = NULL;
					_g_free0 (minute);
					minute = NULL;
				}
			}
		}
	}
	_tmp97_ = hour;
	if (_tmp97_ == NULL) {
		_tmp96_ = TRUE;
	} else {
		gint* _tmp98_;
		_tmp98_ = minute;
		_tmp96_ = _tmp98_ == NULL;
	}
	if (_tmp96_) {
		widgets_date_time_picker_time_picker_update_text (self, FALSE);
		_g_free0 (minute);
		_g_free0 (hour);
		_g_free0 (current);
		return;
	}
	if (has_suffix == FALSE) {
		GDateTime* _tmp99_;
		GDateTime* _tmp100_;
		gint* _tmp101_;
		GDateTime* _tmp102_;
		GDateTime* _tmp103_;
		GDateTime* _tmp104_;
		GDateTime* _tmp105_;
		GDateTime* _tmp106_;
		GDateTime* _tmp107_;
		gint* _tmp108_;
		GDateTime* _tmp109_;
		GDateTime* _tmp110_;
		GDateTime* _tmp111_;
		GDateTime* _tmp112_;
		_tmp99_ = widgets_date_time_picker_time_picker_get_time (self);
		_tmp100_ = _tmp99_;
		_tmp101_ = hour;
		_tmp102_ = widgets_date_time_picker_time_picker_get_time (self);
		_tmp103_ = _tmp102_;
		_tmp104_ = g_date_time_add_hours (_tmp100_, (*_tmp101_) - g_date_time_get_hour (_tmp103_));
		_tmp105_ = _tmp104_;
		widgets_date_time_picker_time_picker_set_time (self, _tmp105_);
		_g_date_time_unref0 (_tmp105_);
		_tmp106_ = widgets_date_time_picker_time_picker_get_time (self);
		_tmp107_ = _tmp106_;
		_tmp108_ = minute;
		_tmp109_ = widgets_date_time_picker_time_picker_get_time (self);
		_tmp110_ = _tmp109_;
		_tmp111_ = g_date_time_add_minutes (_tmp107_, (*_tmp108_) - g_date_time_get_minute (_tmp110_));
		_tmp112_ = _tmp111_;
		widgets_date_time_picker_time_picker_set_time (self, _tmp112_);
		_g_date_time_unref0 (_tmp112_);
	}
	widgets_date_time_picker_time_picker_update_text (self, FALSE);
	_g_free0 (minute);
	_g_free0 (hour);
	_g_free0 (current);
}

static void
widgets_date_time_picker_time_picker_update_text (WidgetsDateTimePickerTimePicker* self,
                                                  gboolean no_signal)
{
	GtkEntry* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	g_return_if_fail (self != NULL);
	if (utils_datetime_is_clock_format_12h ()) {
		GtkEntry* _tmp0_;
		GDateTime* _tmp1_;
		GDateTime* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp0_ = self->priv->time_entry;
		_tmp1_ = widgets_date_time_picker_time_picker_get_time (self);
		_tmp2_ = _tmp1_;
		_tmp3_ = self->priv->_format_12;
		_tmp4_ = g_date_time_format (_tmp2_, _tmp3_);
		_tmp5_ = _tmp4_;
		gtk_editable_set_text ((GtkEditable*) _tmp0_, _tmp5_);
		_g_free0 (_tmp5_);
	} else {
		GtkEntry* _tmp6_;
		GDateTime* _tmp7_;
		GDateTime* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp6_ = self->priv->time_entry;
		_tmp7_ = widgets_date_time_picker_time_picker_get_time (self);
		_tmp8_ = _tmp7_;
		_tmp9_ = self->priv->_format_24;
		_tmp10_ = g_date_time_format (_tmp8_, _tmp9_);
		_tmp11_ = _tmp10_;
		gtk_editable_set_text ((GtkEditable*) _tmp6_, _tmp11_);
		_g_free0 (_tmp11_);
	}
	_tmp12_ = self->priv->time_entry;
	_tmp13_ = gtk_editable_get_text ((GtkEditable*) _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strdup (_tmp14_);
	_g_free0 (self->priv->old_string);
	self->priv->old_string = _tmp15_;
	if (no_signal == FALSE) {
		g_signal_emit (self, widgets_date_time_picker_time_picker_signals[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_CHANGED_SIGNAL], 0);
	}
}

void
widgets_date_time_picker_time_picker_reset (WidgetsDateTimePickerTimePicker* self)
{
	g_return_if_fail (self != NULL);
	_g_date_time_unref0 (self->priv->_time);
	self->priv->_time = NULL;
	widgets_date_time_picker_time_picker_update_text (self, FALSE);
}

void
widgets_date_time_picker_time_picker_clean_up (WidgetsDateTimePickerTimePicker* self)
{
	GeeHashMap* _tmp15_;
	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_);
}

void
widgets_date_time_picker_time_picker_grab_entry_focus (WidgetsDateTimePickerTimePicker* self)
{
	GtkEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->time_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
}

WidgetsDateTimePickerTimePicker*
widgets_date_time_picker_time_picker_construct (GType object_type)
{
	WidgetsDateTimePickerTimePicker * self = NULL;
	self = (WidgetsDateTimePickerTimePicker*) g_object_new (object_type, NULL);
	return self;
}

WidgetsDateTimePickerTimePicker*
widgets_date_time_picker_time_picker_new (void)
{
	return widgets_date_time_picker_time_picker_construct (WIDGETS_DATE_TIME_PICKER_TYPE_TIME_PICKER);
}

const gchar*
widgets_date_time_picker_time_picker_get_format_12 (WidgetsDateTimePickerTimePicker* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_format_12;
	result = _tmp0_;
	return result;
}

static void
widgets_date_time_picker_time_picker_set_format_12 (WidgetsDateTimePickerTimePicker* self,
                                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_date_time_picker_time_picker_get_format_12 (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_format_12);
		self->priv->_format_12 = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_date_time_picker_time_picker_properties[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_12_PROPERTY]);
	}
}

const gchar*
widgets_date_time_picker_time_picker_get_format_24 (WidgetsDateTimePickerTimePicker* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_format_24;
	result = _tmp0_;
	return result;
}

static void
widgets_date_time_picker_time_picker_set_format_24 (WidgetsDateTimePickerTimePicker* self,
                                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_date_time_picker_time_picker_get_format_24 (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_format_24);
		self->priv->_format_24 = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_date_time_picker_time_picker_properties[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_24_PROPERTY]);
	}
}

GDateTime*
widgets_date_time_picker_time_picker_get_time (WidgetsDateTimePickerTimePicker* self)
{
	GDateTime* result;
	GDateTime* _tmp0_;
	GDateTime* _tmp5_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_time;
	if (_tmp0_ == NULL) {
		GDateTime* _tmp1_;
		GDateTime* _tmp2_;
		GDateTime* _tmp3_;
		GDateTime* _tmp4_;
		_tmp1_ = g_date_time_new_now_local ();
		_tmp2_ = _tmp1_;
		_tmp3_ = g_date_time_add_minutes (_tmp2_, 10);
		_tmp4_ = _tmp3_;
		widgets_date_time_picker_time_picker_set_time (self, _tmp4_);
		_g_date_time_unref0 (_tmp4_);
		_g_date_time_unref0 (_tmp2_);
	}
	_tmp5_ = self->priv->_time;
	result = _tmp5_;
	return result;
}

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

void
widgets_date_time_picker_time_picker_set_time (WidgetsDateTimePickerTimePicker* self,
                                               GDateTime* value)
{
	GDateTime* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_date_time_ref0 (value);
	_g_date_time_unref0 (self->priv->_time);
	self->priv->_time = _tmp0_;
	widgets_date_time_picker_time_picker_update_text (self, TRUE);
	g_object_notify_by_pspec ((GObject *) self, widgets_date_time_picker_time_picker_properties[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_PROPERTY]);
}

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

static void
_widgets_date_time_picker_time_picker___lambda135_ (WidgetsDateTimePickerTimePicker* self)
{
	widgets_date_time_picker_time_picker_is_unfocused (self);
}

static void
__widgets_date_time_picker_time_picker___lambda135__gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                                      gpointer self)
{
	_widgets_date_time_picker_time_picker___lambda135_ ((WidgetsDateTimePickerTimePicker*) self);
}

static gboolean
_widgets_date_time_picker_time_picker___lambda136_ (WidgetsDateTimePickerTimePicker* self,
                                                    gdouble dx,
                                                    gdouble dy)
{
	gdouble _tmp0_ = 0.0;
	gdouble largest = 0.0;
	gboolean result;
	if (fabs (dx) > fabs (dy)) {
		_tmp0_ = dx;
	} else {
		_tmp0_ = dy;
	}
	largest = _tmp0_;
	if (largest < ((gdouble) 0)) {
		GDateTime* _tmp1_;
		GDateTime* _tmp2_;
		_tmp1_ = self->priv->_time;
		_tmp2_ = g_date_time_add_minutes (_tmp1_, 1);
		_g_date_time_unref0 (self->priv->_time);
		self->priv->_time = _tmp2_;
	} else {
		GDateTime* _tmp3_;
		GDateTime* _tmp4_;
		_tmp3_ = self->priv->_time;
		_tmp4_ = g_date_time_add_minutes (_tmp3_, -1);
		_g_date_time_unref0 (self->priv->_time);
		self->priv->_time = _tmp4_;
	}
	widgets_date_time_picker_time_picker_update_text (self, FALSE);
	result = FALSE;
	return result;
}

static gboolean
__widgets_date_time_picker_time_picker___lambda136__gtk_event_controller_scroll_scroll (GtkEventControllerScroll* _sender,
                                                                                        gdouble dx,
                                                                                        gdouble dy,
                                                                                        gpointer self)
{
	gboolean result;
	result = _widgets_date_time_picker_time_picker___lambda136_ ((WidgetsDateTimePickerTimePicker*) self, dx, dy);
	return result;
}

static void
_widgets_date_time_picker_time_picker___lambda137_ (WidgetsDateTimePickerTimePicker* self)
{
	widgets_date_time_picker_time_picker_is_unfocused (self);
	g_signal_emit (self, widgets_date_time_picker_time_picker_signals[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_ACTIVATED_SIGNAL], 0);
}

static void
__widgets_date_time_picker_time_picker___lambda137__gtk_entry_activate (GtkEntry* _sender,
                                                                        gpointer self)
{
	_widgets_date_time_picker_time_picker___lambda137_ ((WidgetsDateTimePickerTimePicker*) self);
}

static GObject *
widgets_date_time_picker_time_picker_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsDateTimePickerTimePicker * self;
	const gchar* _tmp0_;
	const gchar* _tmp3_;
	GtkEntry* _tmp6_ = NULL;
	GtkEntry* _tmp7_;
	GtkEventControllerFocus* focus_controller = NULL;
	GtkEventControllerFocus* _tmp8_;
	GtkEventControllerScroll* scroll_controller = NULL;
	GtkEventControllerScroll* _tmp9_;
	GtkEntry* _tmp10_;
	GtkEventControllerFocus* _tmp11_;
	GtkEventController* _tmp12_;
	GtkEntry* _tmp13_;
	GtkEventControllerScroll* _tmp14_;
	GtkEventController* _tmp15_;
	GeeHashMap* _tmp16_;
	GtkEventControllerFocus* _tmp17_;
	gulong _tmp18_;
	GtkEventControllerFocus* _tmp19_;
	GeeHashMap* _tmp20_;
	GtkEventControllerScroll* _tmp21_;
	gulong _tmp22_;
	GtkEventControllerScroll* _tmp23_;
	GeeHashMap* _tmp24_;
	GtkEntry* _tmp25_;
	gulong _tmp26_;
	GtkEntry* _tmp27_;
	parent_class = G_OBJECT_CLASS (widgets_date_time_picker_time_picker_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_DATE_TIME_PICKER_TYPE_TIME_PICKER, WidgetsDateTimePickerTimePicker);
	_tmp0_ = self->priv->_format_12;
	if (_tmp0_ == NULL) {
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = utils_datetime_get_default_time_format (TRUE, FALSE);
		_tmp2_ = _tmp1_;
		widgets_date_time_picker_time_picker_set_format_12 (self, _tmp2_);
		_g_free0 (_tmp2_);
	}
	_tmp3_ = self->priv->_format_24;
	if (_tmp3_ == NULL) {
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp4_ = utils_datetime_get_default_time_format (FALSE, FALSE);
		_tmp5_ = _tmp4_;
		widgets_date_time_picker_time_picker_set_format_24 (self, _tmp5_);
		_g_free0 (_tmp5_);
	}
	_tmp6_ = (GtkEntry*) gtk_entry_new ();
	gtk_editable_set_max_width_chars ((GtkEditable*) _tmp6_, 9);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp6_, TRUE);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->time_entry);
	self->priv->time_entry = _tmp6_;
	_tmp7_ = self->priv->time_entry;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp7_);
	widgets_date_time_picker_time_picker_update_text (self, FALSE);
	_tmp8_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	focus_controller = _tmp8_;
	_tmp9_ = (GtkEventControllerScroll*) gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES | GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
	scroll_controller = _tmp9_;
	_tmp10_ = self->priv->time_entry;
	_tmp11_ = focus_controller;
	_tmp12_ = _g_object_ref0 ((GtkEventController*) _tmp11_);
	gtk_widget_add_controller ((GtkWidget*) _tmp10_, _tmp12_);
	_tmp13_ = self->priv->time_entry;
	_tmp14_ = scroll_controller;
	_tmp15_ = _g_object_ref0 ((GtkEventController*) _tmp14_);
	gtk_widget_add_controller ((GtkWidget*) _tmp13_, _tmp15_);
	_tmp16_ = self->priv->signal_map;
	_tmp17_ = focus_controller;
	_tmp18_ = g_signal_connect_object (_tmp17_, "leave", (GCallback) __widgets_date_time_picker_time_picker___lambda135__gtk_event_controller_focus_leave, self, 0);
	_tmp19_ = focus_controller;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp16_, (gpointer) ((guintptr) _tmp18_), (GObject*) _tmp19_);
	_tmp20_ = self->priv->signal_map;
	_tmp21_ = scroll_controller;
	_tmp22_ = g_signal_connect_object (_tmp21_, "scroll", (GCallback) __widgets_date_time_picker_time_picker___lambda136__gtk_event_controller_scroll_scroll, self, 0);
	_tmp23_ = scroll_controller;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp20_, (gpointer) ((guintptr) _tmp22_), (GObject*) _tmp23_);
	_tmp24_ = self->priv->signal_map;
	_tmp25_ = self->priv->time_entry;
	_tmp26_ = g_signal_connect_object (_tmp25_, "activate", (GCallback) __widgets_date_time_picker_time_picker___lambda137__gtk_entry_activate, self, 0);
	_tmp27_ = self->priv->time_entry;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp24_, (gpointer) ((guintptr) _tmp26_), (GObject*) _tmp27_);
	_g_object_unref0 (scroll_controller);
	_g_object_unref0 (focus_controller);
	return obj;
}

static void
widgets_date_time_picker_time_picker_class_init (WidgetsDateTimePickerTimePickerClass * klass,
                                                 gpointer klass_data)
{
	widgets_date_time_picker_time_picker_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsDateTimePickerTimePicker_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_date_time_picker_time_picker_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_date_time_picker_time_picker_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_date_time_picker_time_picker_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_date_time_picker_time_picker_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_12_PROPERTY, widgets_date_time_picker_time_picker_properties[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_12_PROPERTY] = g_param_spec_string ("format-12", "format-12", "format-12", 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_DATE_TIME_PICKER_TIME_PICKER_FORMAT_24_PROPERTY, widgets_date_time_picker_time_picker_properties[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_24_PROPERTY] = g_param_spec_string ("format-24", "format-24", "format-24", 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_DATE_TIME_PICKER_TIME_PICKER_TIME_PROPERTY, widgets_date_time_picker_time_picker_properties[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_PROPERTY] = g_param_spec_boxed ("time", "time", "time", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	widgets_date_time_picker_time_picker_signals[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_CHANGED_SIGNAL] = g_signal_new ("time-changed", WIDGETS_DATE_TIME_PICKER_TYPE_TIME_PICKER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	widgets_date_time_picker_time_picker_signals[WIDGETS_DATE_TIME_PICKER_TIME_PICKER_ACTIVATED_SIGNAL] = g_signal_new ("activated", WIDGETS_DATE_TIME_PICKER_TYPE_TIME_PICKER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
widgets_date_time_picker_time_picker_instance_init (WidgetsDateTimePickerTimePicker * self,
                                                    gpointer klass)
{
	gchar* _tmp0_;
	GeeHashMap* _tmp1_;
	self->priv = widgets_date_time_picker_time_picker_get_instance_private (self);
	self->priv->_time = NULL;
	_tmp0_ = g_strdup ("");
	self->priv->old_string = _tmp0_;
	_tmp1_ = 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 = _tmp1_;
}

static void
widgets_date_time_picker_time_picker_finalize (GObject * obj)
{
	WidgetsDateTimePickerTimePicker * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_DATE_TIME_PICKER_TYPE_TIME_PICKER, WidgetsDateTimePickerTimePicker);
	g_debug ("TimePicker.vala:52: Destroying - Widgets.DateTimePicker.TimePicker\n");
	_g_object_unref0 (self->priv->time_entry);
	_g_free0 (self->priv->_format_12);
	_g_free0 (self->priv->_format_24);
	_g_date_time_unref0 (self->priv->_time);
	_g_free0 (self->priv->old_string);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (widgets_date_time_picker_time_picker_parent_class)->finalize (obj);
}

static GType
widgets_date_time_picker_time_picker_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsDateTimePickerTimePickerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_date_time_picker_time_picker_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsDateTimePickerTimePicker), 0, (GInstanceInitFunc) widgets_date_time_picker_time_picker_instance_init, NULL };
	GType widgets_date_time_picker_time_picker_type_id;
	widgets_date_time_picker_time_picker_type_id = g_type_register_static (adw_bin_get_type (), "WidgetsDateTimePickerTimePicker", &g_define_type_info, 0);
	WidgetsDateTimePickerTimePicker_private_offset = g_type_add_instance_private (widgets_date_time_picker_time_picker_type_id, sizeof (WidgetsDateTimePickerTimePickerPrivate));
	return widgets_date_time_picker_time_picker_type_id;
}

GType
widgets_date_time_picker_time_picker_get_type (void)
{
	static volatile gsize widgets_date_time_picker_time_picker_type_id__once = 0;
	if (g_once_init_enter (&widgets_date_time_picker_time_picker_type_id__once)) {
		GType widgets_date_time_picker_time_picker_type_id;
		widgets_date_time_picker_time_picker_type_id = widgets_date_time_picker_time_picker_get_type_once ();
		g_once_init_leave (&widgets_date_time_picker_time_picker_type_id__once, widgets_date_time_picker_time_picker_type_id);
	}
	return widgets_date_time_picker_time_picker_type_id__once;
}

static void
_vala_widgets_date_time_picker_time_picker_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	WidgetsDateTimePickerTimePicker * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_DATE_TIME_PICKER_TYPE_TIME_PICKER, WidgetsDateTimePickerTimePicker);
	switch (property_id) {
		case WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_12_PROPERTY:
		g_value_set_string (value, widgets_date_time_picker_time_picker_get_format_12 (self));
		break;
		case WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_24_PROPERTY:
		g_value_set_string (value, widgets_date_time_picker_time_picker_get_format_24 (self));
		break;
		case WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_PROPERTY:
		g_value_set_boxed (value, widgets_date_time_picker_time_picker_get_time (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_date_time_picker_time_picker_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	WidgetsDateTimePickerTimePicker * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_DATE_TIME_PICKER_TYPE_TIME_PICKER, WidgetsDateTimePickerTimePicker);
	switch (property_id) {
		case WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_12_PROPERTY:
		widgets_date_time_picker_time_picker_set_format_12 (self, g_value_get_string (value));
		break;
		case WIDGETS_DATE_TIME_PICKER_TIME_PICKER_FORMAT_24_PROPERTY:
		widgets_date_time_picker_time_picker_set_format_24 (self, g_value_get_string (value));
		break;
		case WIDGETS_DATE_TIME_PICKER_TIME_PICKER_TIME_PROPERTY:
		widgets_date_time_picker_time_picker_set_time (self, g_value_get_boxed (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

