/* alarm-row.c generated by valac 0.56.0, the Vala compiler
 * generated from alarm-row.vala, do not modify */

/*
 * Copyright (C) 2013  Paolo Borelli <pborelli@gnome.org>
 * Copyright (C) 2020  Zander Brown <zbrown@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 <gtk/gtk.h>
#include <glib-object.h>
#include <adwaita.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.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_ALARM_TYPE_ROW (clocks_alarm_row_get_type ())
#define CLOCKS_ALARM_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_ROW, ClocksAlarmRow))
#define CLOCKS_ALARM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_ROW, ClocksAlarmRowClass))
#define CLOCKS_ALARM_IS_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_ROW))
#define CLOCKS_ALARM_IS_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_ROW))
#define CLOCKS_ALARM_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_ROW, ClocksAlarmRowClass))

typedef struct _ClocksAlarmRow ClocksAlarmRow;
typedef struct _ClocksAlarmRowClass ClocksAlarmRowClass;
typedef struct _ClocksAlarmRowPrivate ClocksAlarmRowPrivate;

#define CLOCKS_ALARM_TYPE_ITEM (clocks_alarm_item_get_type ())
#define CLOCKS_ALARM_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem))
#define CLOCKS_ALARM_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItemClass))
#define CLOCKS_ALARM_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_ITEM))
#define CLOCKS_ALARM_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_ITEM))
#define CLOCKS_ALARM_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItemClass))

typedef struct _ClocksAlarmItem ClocksAlarmItem;
typedef struct _ClocksAlarmItemClass ClocksAlarmItemClass;

#define CLOCKS_ALARM_TYPE_FACE (clocks_alarm_face_get_type ())
#define CLOCKS_ALARM_FACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_FACE, ClocksAlarmFace))
#define CLOCKS_ALARM_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_FACE, ClocksAlarmFaceClass))
#define CLOCKS_ALARM_IS_FACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_FACE))
#define CLOCKS_ALARM_IS_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_FACE))
#define CLOCKS_ALARM_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_FACE, ClocksAlarmFaceClass))

typedef struct _ClocksAlarmFace ClocksAlarmFace;
typedef struct _ClocksAlarmFaceClass ClocksAlarmFaceClass;
enum  {
	CLOCKS_ALARM_ROW_0_PROPERTY,
	CLOCKS_ALARM_ROW_ALARM_PROPERTY,
	CLOCKS_ALARM_ROW_FACE_PROPERTY,
	CLOCKS_ALARM_ROW_NUM_PROPERTIES
};
static GParamSpec* clocks_alarm_row_properties[CLOCKS_ALARM_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define CLOCKS_UTILS_TYPE_WEEKDAYS (clocks_utils_weekdays_get_type ())
#define CLOCKS_UTILS_WEEKDAYS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_UTILS_TYPE_WEEKDAYS, ClocksUtilsWeekdays))
#define CLOCKS_UTILS_WEEKDAYS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_UTILS_TYPE_WEEKDAYS, ClocksUtilsWeekdaysClass))
#define CLOCKS_UTILS_IS_WEEKDAYS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_UTILS_TYPE_WEEKDAYS))
#define CLOCKS_UTILS_IS_WEEKDAYS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_UTILS_TYPE_WEEKDAYS))
#define CLOCKS_UTILS_WEEKDAYS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_UTILS_TYPE_WEEKDAYS, ClocksUtilsWeekdaysClass))

typedef struct _ClocksUtilsWeekdays ClocksUtilsWeekdays;
typedef struct _ClocksUtilsWeekdaysClass ClocksUtilsWeekdaysClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef enum  {
	CLOCKS_ALARM_ITEM_STATE_READY,
	CLOCKS_ALARM_ITEM_STATE_RINGING,
	CLOCKS_ALARM_ITEM_STATE_SNOOZING
} ClocksAlarmItemState;

#define CLOCKS_ALARM_ITEM_TYPE_STATE (clocks_alarm_item_state_get_type ())

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

struct _ClocksAlarmRow {
	GtkListBoxRow parent_instance;
	ClocksAlarmRowPrivate * priv;
};

struct _ClocksAlarmRowClass {
	GtkListBoxRowClass parent_class;
};

struct _ClocksAlarmRowPrivate {
	ClocksAlarmItem* _alarm;
	ClocksAlarmFace* _face;
	GtkSwitch* toggle;
	GtkLabel* title;
	GtkRevealer* title_reveal;
	GtkLabel* time;
	GtkLabel* repeats;
	GtkRevealer* repeats_reveal;
};

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

static gint ClocksAlarmRow_private_offset;
static gpointer clocks_alarm_row_parent_class = NULL;

VALA_EXTERN GType clocks_alarm_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmRow, g_object_unref)
VALA_EXTERN GType clocks_alarm_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmItem, g_object_unref)
VALA_EXTERN GType clocks_alarm_face_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmFace, g_object_unref)
VALA_EXTERN ClocksAlarmRow* clocks_alarm_row_new (ClocksAlarmItem* alarm,
                                      ClocksAlarmFace* face);
VALA_EXTERN ClocksAlarmRow* clocks_alarm_row_construct (GType object_type,
                                            ClocksAlarmItem* alarm,
                                            ClocksAlarmFace* face);
static void clocks_alarm_row_update_repeats (ClocksAlarmRow* self);
static void _clocks_alarm_row_update_repeats_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self);
static void clocks_alarm_row_update (ClocksAlarmRow* self);
static void _clocks_alarm_row_update_g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self);
VALA_EXTERN ClocksAlarmItem* clocks_alarm_row_get_alarm (ClocksAlarmRow* self);
VALA_EXTERN gpointer clocks_utils_weekdays_ref (gpointer instance);
VALA_EXTERN void clocks_utils_weekdays_unref (gpointer instance);
VALA_EXTERN GParamSpec* clocks_utils_param_spec_weekdays (const gchar* name,
                                              const gchar* nick,
                                              const gchar* blurb,
                                              GType object_type,
                                              GParamFlags flags);
VALA_EXTERN void clocks_utils_value_set_weekdays (GValue* value,
                                      gpointer v_object);
VALA_EXTERN void clocks_utils_value_take_weekdays (GValue* value,
                                       gpointer v_object);
VALA_EXTERN gpointer clocks_utils_value_get_weekdays (const GValue* value);
VALA_EXTERN GType clocks_utils_weekdays_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksUtilsWeekdays, clocks_utils_weekdays_unref)
VALA_EXTERN ClocksUtilsWeekdays* clocks_alarm_item_get_days (ClocksAlarmItem* self);
VALA_EXTERN gboolean clocks_utils_weekdays_get_empty (ClocksUtilsWeekdays* self);
VALA_EXTERN gchar* clocks_alarm_item_get_days_label (ClocksAlarmItem* self);
VALA_EXTERN gboolean clocks_alarm_item_get_active (ClocksAlarmItem* self);
VALA_EXTERN GType clocks_alarm_item_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ClocksAlarmItemState clocks_alarm_item_get_state (ClocksAlarmItem* self);
VALA_EXTERN gchar* clocks_alarm_item_get_snooze_time_label (ClocksAlarmItem* self);
VALA_EXTERN gchar* clocks_alarm_item_get_time_label (ClocksAlarmItem* self);
VALA_EXTERN GType clocks_content_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksContentItem, g_object_unref)
VALA_EXTERN const gchar* clocks_content_item_get_name (ClocksContentItem* self);
static void clocks_alarm_row_delete (ClocksAlarmRow* self);
VALA_EXTERN ClocksAlarmFace* clocks_alarm_row_get_face (ClocksAlarmRow* self);
VALA_EXTERN void clocks_alarm_face_delete (ClocksAlarmFace* self,
                               ClocksAlarmItem* alarm);
static void _clocks_alarm_row_delete_gtk_button_clicked (GtkButton* _sender,
                                                  gpointer self);
VALA_EXTERN void clocks_alarm_row_set_alarm (ClocksAlarmRow* self,
                                 ClocksAlarmItem* value);
VALA_EXTERN void clocks_alarm_row_set_face (ClocksAlarmRow* self,
                                ClocksAlarmFace* value);
static void clocks_alarm_row_finalize (GObject * obj);
static GType clocks_alarm_row_get_type_once (void);
static void _vala_clocks_alarm_row_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);
static void _vala_clocks_alarm_row_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec);

static inline gpointer
clocks_alarm_row_get_instance_private (ClocksAlarmRow* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksAlarmRow_private_offset);
}

static void
_clocks_alarm_row_update_repeats_g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self)
{
	clocks_alarm_row_update_repeats ((ClocksAlarmRow*) self);
}

static void
_clocks_alarm_row_update_g_object_notify (GObject* _sender,
                                          GParamSpec* pspec,
                                          gpointer self)
{
	clocks_alarm_row_update ((ClocksAlarmRow*) self);
}

ClocksAlarmRow*
clocks_alarm_row_construct (GType object_type,
                            ClocksAlarmItem* alarm,
                            ClocksAlarmFace* face)
{
	ClocksAlarmRow * self = NULL;
	GtkSwitch* _tmp0_;
	g_return_val_if_fail (alarm != NULL, NULL);
	g_return_val_if_fail (face != NULL, NULL);
	self = (ClocksAlarmRow*) g_object_new (object_type, "alarm", alarm, "face", face, NULL);
	g_signal_connect_object ((GObject*) alarm, "notify::days", (GCallback) _clocks_alarm_row_update_repeats_g_object_notify, self, 0);
	_tmp0_ = self->priv->toggle;
	g_object_bind_property_with_closures ((GObject*) alarm, "active", (GObject*) _tmp0_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_signal_connect_object ((GObject*) alarm, "notify::name", (GCallback) _clocks_alarm_row_update_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) alarm, "notify::active", (GCallback) _clocks_alarm_row_update_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) alarm, "notify::state", (GCallback) _clocks_alarm_row_update_g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) alarm, "notify::time", (GCallback) _clocks_alarm_row_update_g_object_notify, self, 0);
	clocks_alarm_row_update_repeats (self);
	clocks_alarm_row_update (self);
	return self;
}

ClocksAlarmRow*
clocks_alarm_row_new (ClocksAlarmItem* alarm,
                      ClocksAlarmFace* face)
{
	return clocks_alarm_row_construct (CLOCKS_ALARM_TYPE_ROW, alarm, face);
}

static void
clocks_alarm_row_update_repeats (ClocksAlarmRow* self)
{
	GtkRevealer* _tmp0_;
	ClocksAlarmItem* _tmp1_;
	ClocksUtilsWeekdays* _tmp2_;
	ClocksUtilsWeekdays* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	GtkLabel* _tmp6_;
	ClocksAlarmItem* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->repeats_reveal;
	_tmp1_ = self->priv->_alarm;
	_tmp2_ = clocks_alarm_item_get_days (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = clocks_utils_weekdays_get_empty (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, CLOCKS_UTILS_TYPE_WEEKDAYS, ClocksUtilsWeekdays));
	_tmp5_ = _tmp4_;
	gtk_revealer_set_reveal_child (_tmp0_, !_tmp5_);
	_tmp6_ = self->priv->repeats;
	_tmp7_ = self->priv->_alarm;
	_tmp8_ = clocks_alarm_item_get_days_label (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = (gchar*) _tmp9_;
	gtk_label_set_label (_tmp6_, _tmp10_);
	_g_free0 (_tmp10_);
}

static void
clocks_alarm_row_update (ClocksAlarmRow* self)
{
	ClocksAlarmItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ClocksAlarmItem* _tmp3_;
	ClocksAlarmItemState _tmp4_;
	ClocksAlarmItemState _tmp5_;
	gchar* label = NULL;
	ClocksAlarmItem* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	ClocksAlarmItem* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	ClocksAlarmItem* _tmp23_;
	ClocksAlarmItemState _tmp24_;
	ClocksAlarmItemState _tmp25_;
	gboolean _tmp42_ = FALSE;
	const gchar* _tmp43_;
	GtkRevealer* _tmp47_;
	GtkLabel* _tmp48_;
	const gchar* _tmp49_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_alarm;
	_tmp1_ = clocks_alarm_item_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		gtk_widget_add_css_class ((GtkWidget*) self, "active");
	} else {
		gtk_widget_remove_css_class ((GtkWidget*) self, "active");
	}
	_tmp3_ = self->priv->_alarm;
	_tmp4_ = clocks_alarm_item_get_state (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == CLOCKS_ALARM_ITEM_STATE_SNOOZING) {
		GtkLabel* _tmp6_;
		ClocksAlarmItem* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp6_ = self->priv->time;
		_tmp7_ = self->priv->_alarm;
		_tmp8_ = clocks_alarm_item_get_snooze_time_label (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		gtk_label_set_label (_tmp6_, _tmp10_);
		_g_free0 (_tmp10_);
	} else {
		GtkLabel* _tmp11_;
		ClocksAlarmItem* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		_tmp11_ = self->priv->time;
		_tmp12_ = self->priv->_alarm;
		_tmp13_ = clocks_alarm_item_get_time_label (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = _tmp14_;
		gtk_label_set_label (_tmp11_, _tmp15_);
		_g_free0 (_tmp15_);
	}
	_tmp16_ = self->priv->_alarm;
	_tmp17_ = clocks_content_item_get_name ((ClocksContentItem*) _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = g_strdup (_tmp18_);
	label = _tmp19_;
	_tmp20_ = self->priv->_alarm;
	_tmp21_ = clocks_content_item_get_name ((ClocksContentItem*) _tmp20_);
	_tmp22_ = _tmp21_;
	if (g_strcmp0 (_tmp22_, _ ("Alarm")) == 0) {
		_g_free0 (label);
		label = NULL;
	}
	_tmp23_ = self->priv->_alarm;
	_tmp24_ = clocks_alarm_item_get_state (_tmp23_);
	_tmp25_ = _tmp24_;
	if (_tmp25_ == CLOCKS_ALARM_ITEM_STATE_SNOOZING) {
		gboolean _tmp26_ = FALSE;
		const gchar* _tmp27_;
		_tmp27_ = label;
		if (_tmp27_ != NULL) {
			const gchar* _tmp28_;
			gint _tmp29_;
			gint _tmp30_;
			_tmp28_ = label;
			_tmp29_ = strlen ((const gchar*) _tmp28_);
			_tmp30_ = _tmp29_;
			_tmp26_ = _tmp30_ > 0;
		} else {
			_tmp26_ = FALSE;
		}
		if (_tmp26_) {
			ClocksAlarmItem* _tmp31_;
			gchar* _tmp32_;
			gchar* _tmp33_;
			gchar* _tmp34_;
			const gchar* _tmp35_;
			gchar* _tmp36_;
			_tmp31_ = self->priv->_alarm;
			_tmp32_ = clocks_alarm_item_get_time_label (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = _tmp33_;
			_tmp35_ = label;
			_tmp36_ = g_strdup_printf (_ ("Snoozed from %s: %s"), _tmp34_, (const gchar*) _tmp35_);
			_g_free0 (label);
			label = _tmp36_;
			_g_free0 (_tmp34_);
		} else {
			ClocksAlarmItem* _tmp37_;
			gchar* _tmp38_;
			gchar* _tmp39_;
			gchar* _tmp40_;
			gchar* _tmp41_;
			_tmp37_ = self->priv->_alarm;
			_tmp38_ = clocks_alarm_item_get_time_label (_tmp37_);
			_tmp39_ = _tmp38_;
			_tmp40_ = _tmp39_;
			_tmp41_ = g_strdup_printf (_ ("Snoozed from %s"), _tmp40_);
			_g_free0 (label);
			label = _tmp41_;
			_g_free0 (_tmp40_);
		}
	}
	_tmp43_ = label;
	if (_tmp43_ != NULL) {
		const gchar* _tmp44_;
		gint _tmp45_;
		gint _tmp46_;
		_tmp44_ = label;
		_tmp45_ = strlen ((const gchar*) _tmp44_);
		_tmp46_ = _tmp45_;
		_tmp42_ = _tmp46_ > 0;
	} else {
		_tmp42_ = FALSE;
	}
	_tmp47_ = self->priv->title_reveal;
	gtk_revealer_set_reveal_child (_tmp47_, _tmp42_);
	_tmp48_ = self->priv->title;
	_tmp49_ = label;
	gtk_label_set_label (_tmp48_, (const gchar*) _tmp49_);
	_g_free0 (label);
}

static void
clocks_alarm_row_delete (ClocksAlarmRow* self)
{
	ClocksAlarmFace* _tmp0_;
	ClocksAlarmItem* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_face;
	_tmp1_ = self->priv->_alarm;
	clocks_alarm_face_delete (_tmp0_, _tmp1_);
}

static void
_clocks_alarm_row_delete_gtk_button_clicked (GtkButton* _sender,
                                             gpointer self)
{
	clocks_alarm_row_delete ((ClocksAlarmRow*) self);
}

ClocksAlarmItem*
clocks_alarm_row_get_alarm (ClocksAlarmRow* self)
{
	ClocksAlarmItem* result;
	ClocksAlarmItem* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_alarm;
	result = _tmp0_;
	return result;
}

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

void
clocks_alarm_row_set_alarm (ClocksAlarmRow* self,
                            ClocksAlarmItem* value)
{
	ClocksAlarmItem* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_alarm_row_get_alarm (self);
	if (old_value != value) {
		ClocksAlarmItem* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_alarm);
		self->priv->_alarm = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_alarm_row_properties[CLOCKS_ALARM_ROW_ALARM_PROPERTY]);
	}
}

ClocksAlarmFace*
clocks_alarm_row_get_face (ClocksAlarmRow* self)
{
	ClocksAlarmFace* result;
	ClocksAlarmFace* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_face;
	result = _tmp0_;
	return result;
}

void
clocks_alarm_row_set_face (ClocksAlarmRow* self,
                           ClocksAlarmFace* value)
{
	ClocksAlarmFace* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_alarm_row_get_face (self);
	if (old_value != value) {
		ClocksAlarmFace* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_face);
		self->priv->_face = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_alarm_row_properties[CLOCKS_ALARM_ROW_FACE_PROPERTY]);
	}
}

static void
clocks_alarm_row_class_init (ClocksAlarmRowClass * klass,
                             gpointer klass_data)
{
	clocks_alarm_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksAlarmRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_alarm_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_alarm_row_set_property;
	G_OBJECT_CLASS (klass)->finalize = clocks_alarm_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_ALARM_ROW_ALARM_PROPERTY, clocks_alarm_row_properties[CLOCKS_ALARM_ROW_ALARM_PROPERTY] = g_param_spec_object ("alarm", "alarm", "alarm", CLOCKS_ALARM_TYPE_ITEM, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_ALARM_ROW_FACE_PROPERTY, clocks_alarm_row_properties[CLOCKS_ALARM_ROW_FACE_PROPERTY] = g_param_spec_object ("face", "face", "face", CLOCKS_ALARM_TYPE_FACE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/clocks/ui/alarm-row.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toggle", FALSE, ClocksAlarmRow_private_offset + G_STRUCT_OFFSET (ClocksAlarmRowPrivate, toggle));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title", FALSE, ClocksAlarmRow_private_offset + G_STRUCT_OFFSET (ClocksAlarmRowPrivate, title));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title_reveal", FALSE, ClocksAlarmRow_private_offset + G_STRUCT_OFFSET (ClocksAlarmRowPrivate, title_reveal));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "time", FALSE, ClocksAlarmRow_private_offset + G_STRUCT_OFFSET (ClocksAlarmRowPrivate, time));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "repeats", FALSE, ClocksAlarmRow_private_offset + G_STRUCT_OFFSET (ClocksAlarmRowPrivate, repeats));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "repeats_reveal", FALSE, ClocksAlarmRow_private_offset + G_STRUCT_OFFSET (ClocksAlarmRowPrivate, repeats_reveal));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "delete", G_CALLBACK(_clocks_alarm_row_delete_gtk_button_clicked));
}

static void
clocks_alarm_row_instance_init (ClocksAlarmRow * self,
                                gpointer klass)
{
	self->priv = clocks_alarm_row_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
clocks_alarm_row_finalize (GObject * obj)
{
	ClocksAlarmRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_ALARM_TYPE_ROW, ClocksAlarmRow);
	_g_object_unref0 (self->priv->_alarm);
	_g_object_unref0 (self->priv->_face);
	G_OBJECT_CLASS (clocks_alarm_row_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_alarm_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksAlarmRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_alarm_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksAlarmRow), 0, (GInstanceInitFunc) clocks_alarm_row_instance_init, NULL };
	GType clocks_alarm_row_type_id;
	clocks_alarm_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "ClocksAlarmRow", &g_define_type_info, 0);
	ClocksAlarmRow_private_offset = g_type_add_instance_private (clocks_alarm_row_type_id, sizeof (ClocksAlarmRowPrivate));
	return clocks_alarm_row_type_id;
}

GType
clocks_alarm_row_get_type (void)
{
	static volatile gsize clocks_alarm_row_type_id__once = 0;
	if (g_once_init_enter (&clocks_alarm_row_type_id__once)) {
		GType clocks_alarm_row_type_id;
		clocks_alarm_row_type_id = clocks_alarm_row_get_type_once ();
		g_once_init_leave (&clocks_alarm_row_type_id__once, clocks_alarm_row_type_id);
	}
	return clocks_alarm_row_type_id__once;
}

static void
_vala_clocks_alarm_row_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	ClocksAlarmRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_ALARM_TYPE_ROW, ClocksAlarmRow);
	switch (property_id) {
		case CLOCKS_ALARM_ROW_ALARM_PROPERTY:
		g_value_set_object (value, clocks_alarm_row_get_alarm (self));
		break;
		case CLOCKS_ALARM_ROW_FACE_PROPERTY:
		g_value_set_object (value, clocks_alarm_row_get_face (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_alarm_row_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec)
{
	ClocksAlarmRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_ALARM_TYPE_ROW, ClocksAlarmRow);
	switch (property_id) {
		case CLOCKS_ALARM_ROW_ALARM_PROPERTY:
		clocks_alarm_row_set_alarm (self, g_value_get_object (value));
		break;
		case CLOCKS_ALARM_ROW_FACE_PROPERTY:
		clocks_alarm_row_set_face (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

