/* widgets.c generated by valac 0.56.3, the Vala compiler
 * generated from widgets.vala, do not modify */

/*
 * Copyright (C) 2013  Paolo Borelli <pborelli@gnome.org>
 *
 * 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 2
 * 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.
 */

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>

#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 CLOCKS_TYPE_CONTENT_ITEM (clocks_content_item_get_type ())
#define CLOCKS_CONTENT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItem))
#define CLOCKS_IS_CONTENT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_CONTENT_ITEM))
#define CLOCKS_CONTENT_ITEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItemIface))

typedef struct _ClocksContentItem ClocksContentItem;
typedef struct _ClocksContentItemIface ClocksContentItemIface;

#define CLOCKS_TYPE_CONTENT_STORE (clocks_content_store_get_type ())
#define CLOCKS_CONTENT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_CONTENT_STORE, ClocksContentStore))
#define CLOCKS_CONTENT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_CONTENT_STORE, ClocksContentStoreClass))
#define CLOCKS_IS_CONTENT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_CONTENT_STORE))
#define CLOCKS_IS_CONTENT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_CONTENT_STORE))
#define CLOCKS_CONTENT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_CONTENT_STORE, ClocksContentStoreClass))

typedef struct _ClocksContentStore ClocksContentStore;
typedef struct _ClocksContentStoreClass ClocksContentStoreClass;
typedef struct _ClocksContentStorePrivate ClocksContentStorePrivate;
enum  {
	CLOCKS_CONTENT_STORE_0_PROPERTY,
	CLOCKS_CONTENT_STORE_NUM_PROPERTIES
};
static GParamSpec* clocks_content_store_properties[CLOCKS_CONTENT_STORE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef void (*ClocksContentStoreForeachFunc) (ClocksContentItem* item, gpointer user_data);
typedef gboolean (*ClocksContentStoreFindFunc) (ClocksContentItem* item, gpointer user_data);
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
typedef ClocksContentItem* (*ClocksContentStoreDeserializeItemFunc) (GVariant* v, gpointer user_data);
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))

#define CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON (clocks_am_pm_toggle_button_get_type ())
#define CLOCKS_AM_PM_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON, ClocksAmPmToggleButton))
#define CLOCKS_AM_PM_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON, ClocksAmPmToggleButtonClass))
#define CLOCKS_IS_AM_PM_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON))
#define CLOCKS_IS_AM_PM_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON))
#define CLOCKS_AM_PM_TOGGLE_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON, ClocksAmPmToggleButtonClass))

typedef struct _ClocksAmPmToggleButton ClocksAmPmToggleButton;
typedef struct _ClocksAmPmToggleButtonClass ClocksAmPmToggleButtonClass;
typedef struct _ClocksAmPmToggleButtonPrivate ClocksAmPmToggleButtonPrivate;
typedef enum  {
	CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM,
	CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_PM
} ClocksAmPmToggleButtonAmPm;

#define CLOCKS_AM_PM_TOGGLE_BUTTON_TYPE_AM_PM (clocks_am_pm_toggle_button_am_pm_get_type ())
enum  {
	CLOCKS_AM_PM_TOGGLE_BUTTON_0_PROPERTY,
	CLOCKS_AM_PM_TOGGLE_BUTTON_CHOICE_PROPERTY,
	CLOCKS_AM_PM_TOGGLE_BUTTON_NUM_PROPERTIES
};
static GParamSpec* clocks_am_pm_toggle_button_properties[CLOCKS_AM_PM_TOGGLE_BUTTON_NUM_PROPERTIES];
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _ClocksContentItemIface {
	GTypeInterface parent_iface;
	void (*serialize) (ClocksContentItem* self, GVariantBuilder* builder);
	const gchar* (*get_name) (ClocksContentItem* self);
	void (*set_name) (ClocksContentItem* self, const gchar* value);
};

struct _ClocksContentStore {
	GObject parent_instance;
	ClocksContentStorePrivate * priv;
};

struct _ClocksContentStoreClass {
	GObjectClass parent_class;
};

struct _ClocksContentStorePrivate {
	GListStore* store;
	GCompareDataFunc sort_func;
	gpointer sort_func_target;
	GDestroyNotify sort_func_target_destroy_notify;
};

struct _ClocksAmPmToggleButton {
	GtkButton parent_instance;
	ClocksAmPmToggleButtonPrivate * priv;
};

struct _ClocksAmPmToggleButtonClass {
	GtkButtonClass parent_class;
};

struct _ClocksAmPmToggleButtonPrivate {
	ClocksAmPmToggleButtonAmPm _choice;
	GtkStack* stack;
	GtkLabel* am_label;
	GtkLabel* pm_label;
};

static gint ClocksContentStore_private_offset;
static gpointer clocks_content_store_parent_class = NULL;
static GListModelInterface * clocks_content_store_g_list_model_parent_iface = NULL;
static gint ClocksAmPmToggleButton_private_offset;
static gpointer clocks_am_pm_toggle_button_parent_class = NULL;

VALA_EXTERN GType clocks_content_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksContentItem, g_object_unref)
VALA_EXTERN void clocks_content_item_serialize (ClocksContentItem* self,
                                    GVariantBuilder* builder);
VALA_EXTERN const gchar* clocks_content_item_get_name (ClocksContentItem* self);
VALA_EXTERN void clocks_content_item_set_name (ClocksContentItem* self,
                                   const gchar* value);
static GType clocks_content_item_get_type_once (void);
VALA_EXTERN GType clocks_content_store_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksContentStore, g_object_unref)
VALA_EXTERN ClocksContentStore* clocks_content_store_new (void);
VALA_EXTERN ClocksContentStore* clocks_content_store_construct (GType object_type);
static void __lambda4_ (ClocksContentStore* self,
                 guint position,
                 guint removed,
                 guint added);
static void ___lambda4__g_list_model_items_changed (GListModel* _sender,
                                             guint position,
                                             guint removed,
                                             guint added,
                                             gpointer self);
static GType clocks_content_store_real_get_item_type (GListModel* base);
static guint clocks_content_store_real_get_n_items (GListModel* base);
static GObject* clocks_content_store_real_get_item (GListModel* base,
                                             guint position);
VALA_EXTERN void clocks_content_store_set_sorting (ClocksContentStore* self,
                                       GCompareDataFunc sort,
                                       gpointer sort_target,
                                       GDestroyNotify sort_target_destroy_notify);
VALA_EXTERN void clocks_content_store_add (ClocksContentStore* self,
                               ClocksContentItem* item);
VALA_EXTERN gint clocks_content_store_get_index (ClocksContentStore* self,
                                     ClocksContentItem* item);
VALA_EXTERN void clocks_content_store_remove (ClocksContentStore* self,
                                  ClocksContentItem* item);
VALA_EXTERN void clocks_content_store_foreach (ClocksContentStore* self,
                                   ClocksContentStoreForeachFunc func,
                                   gpointer func_target);
VALA_EXTERN ClocksContentItem* clocks_content_store_find (ClocksContentStore* self,
                                              ClocksContentStoreFindFunc func,
                                              gpointer func_target);
VALA_EXTERN void clocks_content_store_delete_item (ClocksContentStore* self,
                                       ClocksContentItem* item);
VALA_EXTERN GVariant* clocks_content_store_serialize (ClocksContentStore* self);
VALA_EXTERN void clocks_content_store_deserialize (ClocksContentStore* self,
                                       GVariant* variant,
                                       ClocksContentStoreDeserializeItemFunc deserialize_item,
                                       gpointer deserialize_item_target);
static void clocks_content_store_finalize (GObject * obj);
static GType clocks_content_store_get_type_once (void);
VALA_EXTERN GType clocks_am_pm_toggle_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAmPmToggleButton, g_object_unref)
VALA_EXTERN GType clocks_am_pm_toggle_button_am_pm_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ClocksAmPmToggleButton* clocks_am_pm_toggle_button_new (void);
VALA_EXTERN ClocksAmPmToggleButton* clocks_am_pm_toggle_button_construct (GType object_type);
static void __lambda55_ (ClocksAmPmToggleButton* self);
VALA_EXTERN ClocksAmPmToggleButtonAmPm clocks_am_pm_toggle_button_get_choice (ClocksAmPmToggleButton* self);
VALA_EXTERN void clocks_am_pm_toggle_button_set_choice (ClocksAmPmToggleButton* self,
                                            ClocksAmPmToggleButtonAmPm value);
static void ___lambda55__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
static void clocks_am_pm_toggle_button_finalize (GObject * obj);
static GType clocks_am_pm_toggle_button_get_type_once (void);
static void _vala_clocks_am_pm_toggle_button_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_clocks_am_pm_toggle_button_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
clocks_content_item_serialize (ClocksContentItem* self,
                               GVariantBuilder* builder)
{
	ClocksContentItemIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = CLOCKS_CONTENT_ITEM_GET_INTERFACE (self);
	if (_iface_->serialize) {
		_iface_->serialize (self, builder);
	}
}

const gchar*
clocks_content_item_get_name (ClocksContentItem* self)
{
	ClocksContentItemIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = CLOCKS_CONTENT_ITEM_GET_INTERFACE (self);
	if (_iface_->get_name) {
		return _iface_->get_name (self);
	}
	return NULL;
}

void
clocks_content_item_set_name (ClocksContentItem* self,
                              const gchar* value)
{
	ClocksContentItemIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = CLOCKS_CONTENT_ITEM_GET_INTERFACE (self);
	if (_iface_->set_name) {
		_iface_->set_name (self, value);
	}
}

static void
clocks_content_item_default_init (ClocksContentItemIface * iface,
                                  gpointer iface_data)
{
	g_object_interface_install_property (iface, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

 G_GNUC_NO_INLINE static GType
clocks_content_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksContentItemIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_content_item_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType clocks_content_item_type_id;
	clocks_content_item_type_id = g_type_register_static (G_TYPE_INTERFACE, "ClocksContentItem", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (clocks_content_item_type_id, G_TYPE_OBJECT);
	return clocks_content_item_type_id;
}

GType
clocks_content_item_get_type (void)
{
	static volatile gsize clocks_content_item_type_id__once = 0;
	if (g_once_init_enter (&clocks_content_item_type_id__once)) {
		GType clocks_content_item_type_id;
		clocks_content_item_type_id = clocks_content_item_get_type_once ();
		g_once_init_leave (&clocks_content_item_type_id__once, clocks_content_item_type_id);
	}
	return clocks_content_item_type_id__once;
}

static inline gpointer
clocks_content_store_get_instance_private (ClocksContentStore* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksContentStore_private_offset);
}

static void
__lambda4_ (ClocksContentStore* self,
            guint position,
            guint removed,
            guint added)
{
	g_list_model_items_changed ((GListModel*) self, position, removed, added);
}

static void
___lambda4__g_list_model_items_changed (GListModel* _sender,
                                        guint position,
                                        guint removed,
                                        guint added,
                                        gpointer self)
{
	__lambda4_ ((ClocksContentStore*) self, position, removed, added);
}

ClocksContentStore*
clocks_content_store_construct (GType object_type)
{
	ClocksContentStore * self = NULL;
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	self = (ClocksContentStore*) g_object_new (object_type, NULL);
	_tmp0_ = g_list_store_new (CLOCKS_TYPE_CONTENT_ITEM);
	_g_object_unref0 (self->priv->store);
	self->priv->store = _tmp0_;
	_tmp1_ = self->priv->store;
	g_signal_connect_object ((GListModel*) _tmp1_, "items-changed", (GCallback) ___lambda4__g_list_model_items_changed, self, 0);
	return self;
}

ClocksContentStore*
clocks_content_store_new (void)
{
	return clocks_content_store_construct (CLOCKS_TYPE_CONTENT_STORE);
}

static GType
clocks_content_store_real_get_item_type (GListModel* base)
{
	ClocksContentStore * self;
	GListStore* _tmp0_;
	GType result;
	self = (ClocksContentStore*) base;
	_tmp0_ = self->priv->store;
	result = g_list_model_get_item_type ((GListModel*) _tmp0_);
	return result;
}

static guint
clocks_content_store_real_get_n_items (GListModel* base)
{
	ClocksContentStore * self;
	GListStore* _tmp0_;
	guint result;
	self = (ClocksContentStore*) base;
	_tmp0_ = self->priv->store;
	result = g_list_model_get_n_items ((GListModel*) _tmp0_);
	return result;
}

static GObject*
clocks_content_store_real_get_item (GListModel* base,
                                    guint position)
{
	ClocksContentStore * self;
	GListStore* _tmp0_;
	GObject* _tmp1_;
	GObject* result;
	self = (ClocksContentStore*) base;
	_tmp0_ = self->priv->store;
	_tmp1_ = g_list_model_get_item ((GListModel*) _tmp0_, position);
	result = _tmp1_;
	return result;
}

void
clocks_content_store_set_sorting (ClocksContentStore* self,
                                  GCompareDataFunc sort,
                                  gpointer sort_target,
                                  GDestroyNotify sort_target_destroy_notify)
{
	GCompareDataFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	GListStore* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = sort;
	_tmp0__target = sort_target;
	_tmp0__target_destroy_notify = sort_target_destroy_notify;
	sort = NULL;
	sort_target = NULL;
	sort_target_destroy_notify = NULL;
	(self->priv->sort_func_target_destroy_notify == NULL) ? NULL : (self->priv->sort_func_target_destroy_notify (self->priv->sort_func_target), NULL);
	self->priv->sort_func = NULL;
	self->priv->sort_func_target = NULL;
	self->priv->sort_func_target_destroy_notify = NULL;
	self->priv->sort_func = _tmp0_;
	self->priv->sort_func_target = _tmp0__target;
	self->priv->sort_func_target_destroy_notify = _tmp0__target_destroy_notify;
	_tmp1_ = self->priv->store;
	_vala_assert (g_list_model_get_n_items ((GListModel*) _tmp1_) == ((guint) 0), "store.get_n_items () == 0");
	(sort_target_destroy_notify == NULL) ? NULL : (sort_target_destroy_notify (sort_target), NULL);
	sort = NULL;
	sort_target = NULL;
	sort_target_destroy_notify = NULL;
}

void
clocks_content_store_add (ClocksContentStore* self,
                          ClocksContentItem* item)
{
	GCompareDataFunc _tmp0_;
	gpointer _tmp0__target;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->priv->sort_func;
	_tmp0__target = self->priv->sort_func_target;
	if (_tmp0_ == NULL) {
		GListStore* _tmp1_;
		_tmp1_ = self->priv->store;
		g_list_store_append (_tmp1_, (GObject*) item);
	} else {
		GListStore* _tmp2_;
		GCompareDataFunc _tmp3_;
		gpointer _tmp3__target;
		_tmp2_ = self->priv->store;
		_tmp3_ = self->priv->sort_func;
		_tmp3__target = self->priv->sort_func_target;
		g_list_store_insert_sorted (_tmp2_, (GObject*) item, _tmp3_, _tmp3__target);
	}
}

gint
clocks_content_store_get_index (ClocksContentStore* self,
                                ClocksContentItem* item)
{
	gint position = 0;
	guint n = 0U;
	GListStore* _tmp0_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (item != NULL, 0);
	position = -1;
	_tmp0_ = self->priv->store;
	n = g_list_model_get_n_items ((GListModel*) _tmp0_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				ClocksContentItem* compared_item = NULL;
				GListStore* _tmp3_;
				GObject* _tmp4_;
				ClocksContentItem* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(((guint) i) < n)) {
					break;
				}
				_tmp3_ = self->priv->store;
				_tmp4_ = g_list_model_get_object ((GListModel*) _tmp3_, (guint) i);
				compared_item = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItem);
				_tmp5_ = compared_item;
				if (_tmp5_ == item) {
					position = i;
					_g_object_unref0 (compared_item);
					break;
				}
				_g_object_unref0 (compared_item);
			}
		}
	}
	result = position;
	return result;
}

void
clocks_content_store_remove (ClocksContentStore* self,
                             ClocksContentItem* item)
{
	gint index = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	index = clocks_content_store_get_index (self, item);
	if (index != -1) {
		GListStore* _tmp0_;
		_tmp0_ = self->priv->store;
		g_list_store_remove (_tmp0_, (guint) index);
	}
}

void
clocks_content_store_foreach (ClocksContentStore* self,
                              ClocksContentStoreForeachFunc func,
                              gpointer func_target)
{
	guint n = 0U;
	GListStore* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->store;
	n = g_list_model_get_n_items ((GListModel*) _tmp0_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GListStore* _tmp3_;
				GObject* _tmp4_;
				ClocksContentItem* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(((guint) i) < n)) {
					break;
				}
				_tmp3_ = self->priv->store;
				_tmp4_ = g_list_model_get_object ((GListModel*) _tmp3_, (guint) i);
				_tmp5_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItem);
				func (_tmp5_, func_target);
				_g_object_unref0 (_tmp5_);
			}
		}
	}
}

ClocksContentItem*
clocks_content_store_find (ClocksContentStore* self,
                           ClocksContentStoreFindFunc func,
                           gpointer func_target)
{
	guint n = 0U;
	GListStore* _tmp0_;
	ClocksContentItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->store;
	n = g_list_model_get_n_items ((GListModel*) _tmp0_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				ClocksContentItem* item = NULL;
				GListStore* _tmp3_;
				GObject* _tmp4_;
				ClocksContentItem* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(((guint) i) < n)) {
					break;
				}
				_tmp3_ = self->priv->store;
				_tmp4_ = g_list_model_get_object ((GListModel*) _tmp3_, (guint) i);
				item = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItem);
				_tmp5_ = item;
				if (func (_tmp5_, func_target)) {
					result = item;
					return result;
				}
				_g_object_unref0 (item);
			}
		}
	}
	result = NULL;
	return result;
}

void
clocks_content_store_delete_item (ClocksContentStore* self,
                                  ClocksContentItem* item)
{
	guint n = 0U;
	GListStore* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->priv->store;
	n = g_list_model_get_n_items ((GListModel*) _tmp0_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GObject* o = NULL;
				GListStore* _tmp3_;
				GObject* _tmp4_;
				GObject* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(((guint) i) < n)) {
					break;
				}
				_tmp3_ = self->priv->store;
				_tmp4_ = g_list_model_get_object ((GListModel*) _tmp3_, (guint) i);
				o = _tmp4_;
				_tmp5_ = o;
				if (_tmp5_ == G_TYPE_CHECK_INSTANCE_CAST (item, G_TYPE_OBJECT, GObject)) {
					GListStore* _tmp6_;
					GCompareDataFunc _tmp7_;
					gpointer _tmp7__target;
					_tmp6_ = self->priv->store;
					g_list_store_remove (_tmp6_, (guint) i);
					_tmp7_ = self->priv->sort_func;
					_tmp7__target = self->priv->sort_func_target;
					if (_tmp7_ != NULL) {
						GListStore* _tmp8_;
						GCompareDataFunc _tmp9_;
						gpointer _tmp9__target;
						_tmp8_ = self->priv->store;
						_tmp9_ = self->priv->sort_func;
						_tmp9__target = self->priv->sort_func_target;
						g_list_store_sort (_tmp8_, _tmp9_, _tmp9__target);
					}
					_g_object_unref0 (o);
					return;
				}
				_g_object_unref0 (o);
			}
		}
	}
}

GVariant*
clocks_content_store_serialize (ClocksContentStore* self)
{
	GVariantBuilder* builder = NULL;
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	guint n = 0U;
	GListStore* _tmp4_;
	GVariantBuilder* _tmp11_;
	GVariant* _tmp12_;
	GVariant* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_variant_type_new ("aa{sv}");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	builder = _tmp3_;
	_tmp4_ = self->priv->store;
	n = g_list_model_get_n_items ((GListModel*) _tmp4_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				GListStore* _tmp7_;
				GObject* _tmp8_;
				ClocksContentItem* _tmp9_;
				GVariantBuilder* _tmp10_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				if (!(((guint) i) < n)) {
					break;
				}
				_tmp7_ = self->priv->store;
				_tmp8_ = g_list_model_get_object ((GListModel*) _tmp7_, (guint) i);
				_tmp9_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItem);
				_tmp10_ = builder;
				clocks_content_item_serialize (_tmp9_, _tmp10_);
				_g_object_unref0 (_tmp9_);
			}
		}
	}
	_tmp11_ = builder;
	_tmp12_ = g_variant_builder_end (_tmp11_);
	g_variant_ref_sink (_tmp12_);
	result = _tmp12_;
	_g_variant_builder_unref0 (builder);
	return result;
}

void
clocks_content_store_deserialize (ClocksContentStore* self,
                                  GVariant* variant,
                                  ClocksContentStoreDeserializeItemFunc deserialize_item,
                                  gpointer deserialize_item_target)
{
	GVariant* item = NULL;
	GVariantIter* iter = NULL;
	GVariantIter* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (variant != NULL);
	_tmp0_ = g_variant_iter_new (variant);
	iter = _tmp0_;
	while (TRUE) {
		GVariantIter* _tmp1_;
		GVariant* _tmp2_ = NULL;
		gboolean _tmp3_;
		ClocksContentItem* i = NULL;
		GVariant* _tmp4_;
		ClocksContentItem* _tmp5_;
		ClocksContentItem* _tmp6_;
		_tmp1_ = iter;
		_tmp3_ = g_variant_iter_next (_tmp1_, "@a{sv}", &_tmp2_, NULL);
		_g_variant_unref0 (item);
		item = _tmp2_;
		if (!_tmp3_) {
			break;
		}
		_tmp4_ = item;
		_tmp5_ = deserialize_item (_tmp4_, deserialize_item_target);
		i = _tmp5_;
		_tmp6_ = i;
		if (_tmp6_ != NULL) {
			ClocksContentItem* _tmp7_;
			_tmp7_ = i;
			clocks_content_store_add (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItem));
		}
		_g_object_unref0 (i);
	}
	_g_variant_iter_free0 (iter);
	_g_variant_unref0 (item);
}

static void
clocks_content_store_class_init (ClocksContentStoreClass * klass,
                                 gpointer klass_data)
{
	clocks_content_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksContentStore_private_offset);
	G_OBJECT_CLASS (klass)->finalize = clocks_content_store_finalize;
}

static void
clocks_content_store_g_list_model_interface_init (GListModelInterface * iface,
                                                  gpointer iface_data)
{
	clocks_content_store_g_list_model_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_item_type = (GType (*) (GListModel*)) clocks_content_store_real_get_item_type;
	iface->get_n_items = (guint (*) (GListModel*)) clocks_content_store_real_get_n_items;
	iface->get_item = (GObject* (*) (GListModel*, guint)) clocks_content_store_real_get_item;
}

static void
clocks_content_store_instance_init (ClocksContentStore * self,
                                    gpointer klass)
{
	self->priv = clocks_content_store_get_instance_private (self);
}

static void
clocks_content_store_finalize (GObject * obj)
{
	ClocksContentStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_CONTENT_STORE, ClocksContentStore);
	_g_object_unref0 (self->priv->store);
	(self->priv->sort_func_target_destroy_notify == NULL) ? NULL : (self->priv->sort_func_target_destroy_notify (self->priv->sort_func_target), NULL);
	self->priv->sort_func = NULL;
	self->priv->sort_func_target = NULL;
	self->priv->sort_func_target_destroy_notify = NULL;
	G_OBJECT_CLASS (clocks_content_store_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_content_store_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksContentStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_content_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksContentStore), 0, (GInstanceInitFunc) clocks_content_store_instance_init, NULL };
	static const GInterfaceInfo g_list_model_info = { (GInterfaceInitFunc) clocks_content_store_g_list_model_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType clocks_content_store_type_id;
	clocks_content_store_type_id = g_type_register_static (G_TYPE_OBJECT, "ClocksContentStore", &g_define_type_info, 0);
	g_type_add_interface_static (clocks_content_store_type_id, g_list_model_get_type (), &g_list_model_info);
	ClocksContentStore_private_offset = g_type_add_instance_private (clocks_content_store_type_id, sizeof (ClocksContentStorePrivate));
	return clocks_content_store_type_id;
}

GType
clocks_content_store_get_type (void)
{
	static volatile gsize clocks_content_store_type_id__once = 0;
	if (g_once_init_enter (&clocks_content_store_type_id__once)) {
		GType clocks_content_store_type_id;
		clocks_content_store_type_id = clocks_content_store_get_type_once ();
		g_once_init_leave (&clocks_content_store_type_id__once, clocks_content_store_type_id);
	}
	return clocks_content_store_type_id__once;
}

static inline gpointer
clocks_am_pm_toggle_button_get_instance_private (ClocksAmPmToggleButton* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksAmPmToggleButton_private_offset);
}

 G_GNUC_NO_INLINE static GType
clocks_am_pm_toggle_button_am_pm_get_type_once (void)
{
	static const GEnumValue values[] = {{CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM, "CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM", "am"}, {CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_PM, "CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_PM", "pm"}, {0, NULL, NULL}};
	GType clocks_am_pm_toggle_button_am_pm_type_id;
	clocks_am_pm_toggle_button_am_pm_type_id = g_enum_register_static ("ClocksAmPmToggleButtonAmPm", values);
	return clocks_am_pm_toggle_button_am_pm_type_id;
}

GType
clocks_am_pm_toggle_button_am_pm_get_type (void)
{
	static volatile gsize clocks_am_pm_toggle_button_am_pm_type_id__once = 0;
	if (g_once_init_enter (&clocks_am_pm_toggle_button_am_pm_type_id__once)) {
		GType clocks_am_pm_toggle_button_am_pm_type_id;
		clocks_am_pm_toggle_button_am_pm_type_id = clocks_am_pm_toggle_button_am_pm_get_type_once ();
		g_once_init_leave (&clocks_am_pm_toggle_button_am_pm_type_id__once, clocks_am_pm_toggle_button_am_pm_type_id);
	}
	return clocks_am_pm_toggle_button_am_pm_type_id__once;
}

static void
__lambda55_ (ClocksAmPmToggleButton* self)
{
	ClocksAmPmToggleButtonAmPm _tmp0_ = 0;
	ClocksAmPmToggleButtonAmPm _tmp1_;
	ClocksAmPmToggleButtonAmPm _tmp2_;
	_tmp1_ = clocks_am_pm_toggle_button_get_choice (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM) {
		_tmp0_ = CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_PM;
	} else {
		_tmp0_ = CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM;
	}
	clocks_am_pm_toggle_button_set_choice (self, _tmp0_);
}

static void
___lambda55__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda55_ ((ClocksAmPmToggleButton*) self);
}

ClocksAmPmToggleButton*
clocks_am_pm_toggle_button_construct (GType object_type)
{
	ClocksAmPmToggleButton * self = NULL;
	GtkStack* _tmp0_;
	gchar* str = NULL;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	GtkLabel* _tmp6_;
	GDateTime* _tmp7_;
	GDateTime* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	GtkLabel* _tmp11_;
	GtkStack* _tmp12_;
	GtkLabel* _tmp13_;
	GtkStack* _tmp14_;
	GtkLabel* _tmp15_;
	GtkStack* _tmp16_;
	GtkStack* _tmp17_;
	GtkLabel* _tmp18_;
	self = (ClocksAmPmToggleButton*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->stack);
	self->priv->stack = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) self, "clocks-ampm-toggle-button");
	_tmp1_ = g_date_time_new_utc (1, 1, 1, 0, 0, (gdouble) 0);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_date_time_format (_tmp2_, "%p");
	_tmp4_ = _tmp3_;
	_g_date_time_unref0 (_tmp2_);
	str = _tmp4_;
	_tmp5_ = str;
	_tmp6_ = (GtkLabel*) gtk_label_new (_tmp5_);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->am_label);
	self->priv->am_label = _tmp6_;
	_tmp7_ = g_date_time_new_utc (1, 1, 1, 12, 0, (gdouble) 0);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_date_time_format (_tmp8_, "%p");
	_g_free0 (str);
	str = _tmp9_;
	_g_date_time_unref0 (_tmp8_);
	_tmp10_ = str;
	_tmp11_ = (GtkLabel*) gtk_label_new (_tmp10_);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->pm_label);
	self->priv->pm_label = _tmp11_;
	_tmp12_ = self->priv->stack;
	_tmp13_ = self->priv->am_label;
	gtk_stack_add_child (_tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = self->priv->stack;
	_tmp15_ = self->priv->pm_label;
	gtk_stack_add_child (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = self->priv->stack;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) _tmp16_);
	g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) ___lambda55__gtk_button_clicked, self, 0);
	clocks_am_pm_toggle_button_set_choice (self, CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM);
	_tmp17_ = self->priv->stack;
	_tmp18_ = self->priv->am_label;
	gtk_stack_set_visible_child (_tmp17_, (GtkWidget*) _tmp18_);
	_g_free0 (str);
	return self;
}

ClocksAmPmToggleButton*
clocks_am_pm_toggle_button_new (void)
{
	return clocks_am_pm_toggle_button_construct (CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON);
}

ClocksAmPmToggleButtonAmPm
clocks_am_pm_toggle_button_get_choice (ClocksAmPmToggleButton* self)
{
	ClocksAmPmToggleButtonAmPm result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_choice;
	return result;
}

void
clocks_am_pm_toggle_button_set_choice (ClocksAmPmToggleButton* self,
                                       ClocksAmPmToggleButtonAmPm value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_choice != value) {
		GtkLabel* _tmp0_ = NULL;
		GtkStack* _tmp3_;
		self->priv->_choice = value;
		if (self->priv->_choice == CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM) {
			GtkLabel* _tmp1_;
			_tmp1_ = self->priv->am_label;
			_tmp0_ = _tmp1_;
		} else {
			GtkLabel* _tmp2_;
			_tmp2_ = self->priv->pm_label;
			_tmp0_ = _tmp2_;
		}
		_tmp3_ = self->priv->stack;
		gtk_stack_set_visible_child (_tmp3_, (GtkWidget*) _tmp0_);
	}
	g_object_notify_by_pspec ((GObject *) self, clocks_am_pm_toggle_button_properties[CLOCKS_AM_PM_TOGGLE_BUTTON_CHOICE_PROPERTY]);
}

static void
clocks_am_pm_toggle_button_class_init (ClocksAmPmToggleButtonClass * klass,
                                       gpointer klass_data)
{
	clocks_am_pm_toggle_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksAmPmToggleButton_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_am_pm_toggle_button_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_am_pm_toggle_button_set_property;
	G_OBJECT_CLASS (klass)->finalize = clocks_am_pm_toggle_button_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_AM_PM_TOGGLE_BUTTON_CHOICE_PROPERTY, clocks_am_pm_toggle_button_properties[CLOCKS_AM_PM_TOGGLE_BUTTON_CHOICE_PROPERTY] = g_param_spec_enum ("choice", "choice", "choice", CLOCKS_AM_PM_TOGGLE_BUTTON_TYPE_AM_PM, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
clocks_am_pm_toggle_button_instance_init (ClocksAmPmToggleButton * self,
                                          gpointer klass)
{
	self->priv = clocks_am_pm_toggle_button_get_instance_private (self);
}

static void
clocks_am_pm_toggle_button_finalize (GObject * obj)
{
	ClocksAmPmToggleButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON, ClocksAmPmToggleButton);
	_g_object_unref0 (self->priv->stack);
	_g_object_unref0 (self->priv->am_label);
	_g_object_unref0 (self->priv->pm_label);
	G_OBJECT_CLASS (clocks_am_pm_toggle_button_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_am_pm_toggle_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksAmPmToggleButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_am_pm_toggle_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksAmPmToggleButton), 0, (GInstanceInitFunc) clocks_am_pm_toggle_button_instance_init, NULL };
	GType clocks_am_pm_toggle_button_type_id;
	clocks_am_pm_toggle_button_type_id = g_type_register_static (gtk_button_get_type (), "ClocksAmPmToggleButton", &g_define_type_info, 0);
	ClocksAmPmToggleButton_private_offset = g_type_add_instance_private (clocks_am_pm_toggle_button_type_id, sizeof (ClocksAmPmToggleButtonPrivate));
	return clocks_am_pm_toggle_button_type_id;
}

GType
clocks_am_pm_toggle_button_get_type (void)
{
	static volatile gsize clocks_am_pm_toggle_button_type_id__once = 0;
	if (g_once_init_enter (&clocks_am_pm_toggle_button_type_id__once)) {
		GType clocks_am_pm_toggle_button_type_id;
		clocks_am_pm_toggle_button_type_id = clocks_am_pm_toggle_button_get_type_once ();
		g_once_init_leave (&clocks_am_pm_toggle_button_type_id__once, clocks_am_pm_toggle_button_type_id);
	}
	return clocks_am_pm_toggle_button_type_id__once;
}

static void
_vala_clocks_am_pm_toggle_button_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	ClocksAmPmToggleButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON, ClocksAmPmToggleButton);
	switch (property_id) {
		case CLOCKS_AM_PM_TOGGLE_BUTTON_CHOICE_PROPERTY:
		g_value_set_enum (value, clocks_am_pm_toggle_button_get_choice (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_am_pm_toggle_button_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	ClocksAmPmToggleButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_AM_PM_TOGGLE_BUTTON, ClocksAmPmToggleButton);
	switch (property_id) {
		case CLOCKS_AM_PM_TOGGLE_BUTTON_CHOICE_PROPERTY:
		clocks_am_pm_toggle_button_set_choice (self, g_value_get_enum (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;
}

