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

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

#define CLOCKS_ALARM_TYPE_DURATION (clocks_alarm_duration_get_type ())
#define CLOCKS_ALARM_DURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDuration))
#define CLOCKS_ALARM_DURATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDurationClass))
#define CLOCKS_ALARM_IS_DURATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_DURATION))
#define CLOCKS_ALARM_IS_DURATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_DURATION))
#define CLOCKS_ALARM_DURATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDurationClass))

typedef struct _ClocksAlarmDuration ClocksAlarmDuration;
typedef struct _ClocksAlarmDurationClass ClocksAlarmDurationClass;
typedef struct _ClocksAlarmDurationPrivate ClocksAlarmDurationPrivate;
enum  {
	CLOCKS_ALARM_DURATION_0_PROPERTY,
	CLOCKS_ALARM_DURATION_MINUTES_PROPERTY,
	CLOCKS_ALARM_DURATION_LABEL_PROPERTY,
	CLOCKS_ALARM_DURATION_NUM_PROPERTIES
};
static GParamSpec* clocks_alarm_duration_properties[CLOCKS_ALARM_DURATION_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define CLOCKS_ALARM_TYPE_DURATION_MODEL (clocks_alarm_duration_model_get_type ())
#define CLOCKS_ALARM_DURATION_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_DURATION_MODEL, ClocksAlarmDurationModel))
#define CLOCKS_ALARM_DURATION_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_DURATION_MODEL, ClocksAlarmDurationModelClass))
#define CLOCKS_ALARM_IS_DURATION_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_DURATION_MODEL))
#define CLOCKS_ALARM_IS_DURATION_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_DURATION_MODEL))
#define CLOCKS_ALARM_DURATION_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_DURATION_MODEL, ClocksAlarmDurationModelClass))

typedef struct _ClocksAlarmDurationModel ClocksAlarmDurationModel;
typedef struct _ClocksAlarmDurationModelClass ClocksAlarmDurationModelClass;
typedef struct _ClocksAlarmDurationModelPrivate ClocksAlarmDurationModelPrivate;
enum  {
	CLOCKS_ALARM_DURATION_MODEL_0_PROPERTY,
	CLOCKS_ALARM_DURATION_MODEL_NUM_PROPERTIES
};
static GParamSpec* clocks_alarm_duration_model_properties[CLOCKS_ALARM_DURATION_MODEL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define CLOCKS_ALARM_TYPE_SETUP_DIALOG (clocks_alarm_setup_dialog_get_type ())
#define CLOCKS_ALARM_SETUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_SETUP_DIALOG, ClocksAlarmSetupDialog))
#define CLOCKS_ALARM_SETUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_SETUP_DIALOG, ClocksAlarmSetupDialogClass))
#define CLOCKS_ALARM_IS_SETUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_SETUP_DIALOG))
#define CLOCKS_ALARM_IS_SETUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_SETUP_DIALOG))
#define CLOCKS_ALARM_SETUP_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_SETUP_DIALOG, ClocksAlarmSetupDialogClass))

typedef struct _ClocksAlarmSetupDialog ClocksAlarmSetupDialog;
typedef struct _ClocksAlarmSetupDialogClass ClocksAlarmSetupDialogClass;
typedef struct _ClocksAlarmSetupDialogPrivate ClocksAlarmSetupDialogPrivate;

#define CLOCKS_TYPE_SOUND (clocks_sound_get_type ())
#define CLOCKS_SOUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_SOUND, ClocksSound))
#define CLOCKS_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_SOUND, ClocksSoundClass))
#define CLOCKS_IS_SOUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_SOUND))
#define CLOCKS_IS_SOUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_SOUND))
#define CLOCKS_SOUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_SOUND, ClocksSoundClass))

typedef struct _ClocksSound ClocksSound;
typedef struct _ClocksSoundClass ClocksSoundClass;
typedef enum  {
	CLOCKS_UTILS_WALL_CLOCK_FORMAT_TWELVE,
	CLOCKS_UTILS_WALL_CLOCK_FORMAT_TWENTYFOUR
} ClocksUtilsWallClockFormat;

#define CLOCKS_UTILS_WALL_CLOCK_TYPE_FORMAT (clocks_utils_wall_clock_format_get_type ())

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

#define CLOCKS_ALARM_TYPE_DAY_PICKER_ROW (clocks_alarm_day_picker_row_get_type ())
#define CLOCKS_ALARM_DAY_PICKER_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_DAY_PICKER_ROW, ClocksAlarmDayPickerRow))
#define CLOCKS_ALARM_DAY_PICKER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_DAY_PICKER_ROW, ClocksAlarmDayPickerRowClass))
#define CLOCKS_ALARM_IS_DAY_PICKER_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_DAY_PICKER_ROW))
#define CLOCKS_ALARM_IS_DAY_PICKER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_DAY_PICKER_ROW))
#define CLOCKS_ALARM_DAY_PICKER_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_DAY_PICKER_ROW, ClocksAlarmDayPickerRowClass))

typedef struct _ClocksAlarmDayPickerRow ClocksAlarmDayPickerRow;
typedef struct _ClocksAlarmDayPickerRowClass ClocksAlarmDayPickerRowClass;

#define CLOCKS_TYPE_SOUND_CHOOSER (clocks_sound_chooser_get_type ())
#define CLOCKS_SOUND_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooser))
#define CLOCKS_SOUND_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooserClass))
#define CLOCKS_IS_SOUND_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_SOUND_CHOOSER))
#define CLOCKS_IS_SOUND_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_SOUND_CHOOSER))
#define CLOCKS_SOUND_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_SOUND_CHOOSER, ClocksSoundChooserClass))

typedef struct _ClocksSoundChooser ClocksSoundChooser;
typedef struct _ClocksSoundChooserClass ClocksSoundChooserClass;

#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;
enum  {
	CLOCKS_ALARM_SETUP_DIALOG_0_PROPERTY,
	CLOCKS_ALARM_SETUP_DIALOG_SOUND_PROPERTY,
	CLOCKS_ALARM_SETUP_DIALOG_NUM_PROPERTIES
};
static GParamSpec* clocks_alarm_setup_dialog_properties[CLOCKS_ALARM_SETUP_DIALOG_NUM_PROPERTIES];
typedef enum  {
	CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_CANCEL,
	CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_ADD
} ClocksAlarmSetupDialogResponse;

#define CLOCKS_ALARM_SETUP_DIALOG_TYPE_RESPONSE (clocks_alarm_setup_dialog_response_get_type ())

#define CLOCKS_UTILS_TYPE_WALL_CLOCK (clocks_utils_wall_clock_get_type ())
#define CLOCKS_UTILS_WALL_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_UTILS_TYPE_WALL_CLOCK, ClocksUtilsWallClock))
#define CLOCKS_UTILS_WALL_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_UTILS_TYPE_WALL_CLOCK, ClocksUtilsWallClockClass))
#define CLOCKS_UTILS_IS_WALL_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_UTILS_TYPE_WALL_CLOCK))
#define CLOCKS_UTILS_IS_WALL_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_UTILS_TYPE_WALL_CLOCK))
#define CLOCKS_UTILS_WALL_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_UTILS_TYPE_WALL_CLOCK, ClocksUtilsWallClockClass))

typedef struct _ClocksUtilsWallClock ClocksUtilsWallClock;
typedef struct _ClocksUtilsWallClockClass ClocksUtilsWallClockClass;
#define _gtk_expression_unref0(var) ((var == NULL) ? NULL : (var = (gtk_expression_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 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_ALARM_TYPE_ALARM_TIME (clocks_alarm_alarm_time_get_type ())
typedef struct _ClocksAlarmAlarmTime ClocksAlarmAlarmTime;
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 ())

#define CLOCKS_ALARM_TYPE_SOUND_MODEL (clocks_alarm_sound_model_get_type ())
#define CLOCKS_ALARM_SOUND_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_SOUND_MODEL, ClocksAlarmSoundModel))
#define CLOCKS_ALARM_SOUND_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_SOUND_MODEL, ClocksAlarmSoundModelClass))
#define CLOCKS_ALARM_IS_SOUND_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_SOUND_MODEL))
#define CLOCKS_ALARM_IS_SOUND_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_SOUND_MODEL))
#define CLOCKS_ALARM_SOUND_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_SOUND_MODEL, ClocksAlarmSoundModelClass))

typedef struct _ClocksAlarmSoundModel ClocksAlarmSoundModel;
typedef struct _ClocksAlarmSoundModelClass ClocksAlarmSoundModelClass;
#define _clocks_utils_weekdays_unref0(var) ((var == NULL) ? NULL : (var = (clocks_utils_weekdays_unref (var), NULL)))
enum  {
	CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_SIGNAL,
	CLOCKS_ALARM_SETUP_DIALOG_NUM_SIGNALS
};
static guint clocks_alarm_setup_dialog_signals[CLOCKS_ALARM_SETUP_DIALOG_NUM_SIGNALS] = {0};
#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 _ClocksAlarmDuration {
	GObject parent_instance;
	ClocksAlarmDurationPrivate * priv;
};

struct _ClocksAlarmDurationClass {
	GObjectClass parent_class;
};

struct _ClocksAlarmDurationPrivate {
	gint _minutes;
	gchar* _label;
};

struct _ClocksAlarmDurationModel {
	GObject parent_instance;
	ClocksAlarmDurationModelPrivate * priv;
};

struct _ClocksAlarmDurationModelClass {
	GObjectClass parent_class;
};

struct _ClocksAlarmDurationModelPrivate {
	ClocksAlarmDuration* store[6];
};

struct _ClocksAlarmSetupDialog {
	AdwDialog parent_instance;
	ClocksAlarmSetupDialogPrivate * priv;
};

struct _ClocksAlarmSetupDialogClass {
	AdwDialogClass parent_class;
};

struct _ClocksAlarmSetupDialogPrivate {
	ClocksSound* _sound;
	ClocksUtilsWallClockFormat format;
	GtkBox* time_box;
	GtkSpinButton* h_spinbutton;
	GtkSpinButton* m_spinbutton;
	AdwEntryRow* name_entry;
	AdwActionRow* sound_row;
	AdwComboRow* snooze_duration;
	AdwComboRow* ring_duration;
	ClocksAmPmToggleButton* am_pm_button;
	ClocksAlarmDayPickerRow* repeats;
	AdwBin* am_pm_bin;
	AdwBanner* banner;
	AdwPreferencesGroup* delete_group;
	GtkButton* ok_button;
	ClocksSoundChooser* sound_chooser;
	GList* other_alarms;
	ClocksAlarmDurationModel* duration_model;
};

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 _ClocksAlarmAlarmTime {
	gint hour;
	gint minute;
};

static gint ClocksAlarmDuration_private_offset;
static gpointer clocks_alarm_duration_parent_class = NULL;
static gint ClocksAlarmDurationModel_private_offset;
static gpointer clocks_alarm_duration_model_parent_class = NULL;
static GListModelInterface * clocks_alarm_duration_model_g_list_model_parent_iface = NULL;
static gint ClocksAlarmSetupDialog_private_offset;
static gpointer clocks_alarm_setup_dialog_parent_class = NULL;

VALA_EXTERN GType clocks_alarm_duration_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmDuration, g_object_unref)
VALA_EXTERN ClocksAlarmDuration* clocks_alarm_duration_new (gint minutes,
                                                const gchar* label);
VALA_EXTERN ClocksAlarmDuration* clocks_alarm_duration_construct (GType object_type,
                                                      gint minutes,
                                                      const gchar* label);
VALA_EXTERN void clocks_alarm_duration_set_minutes (ClocksAlarmDuration* self,
                                        gint value);
VALA_EXTERN void clocks_alarm_duration_set_label (ClocksAlarmDuration* self,
                                      const gchar* value);
VALA_EXTERN gint clocks_alarm_duration_get_minutes (ClocksAlarmDuration* self);
VALA_EXTERN const gchar* clocks_alarm_duration_get_label (ClocksAlarmDuration* self);
static void clocks_alarm_duration_finalize (GObject * obj);
static GType clocks_alarm_duration_get_type_once (void);
static void _vala_clocks_alarm_duration_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_clocks_alarm_duration_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);
VALA_EXTERN GType clocks_alarm_duration_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmDurationModel, g_object_unref)
static GType clocks_alarm_duration_model_real_get_item_type (GListModel* base);
static guint clocks_alarm_duration_model_real_get_n_items (GListModel* base);
static GObject* clocks_alarm_duration_model_real_get_item (GListModel* base,
                                                    guint n);
VALA_EXTERN gint clocks_alarm_duration_model_find_by_duration (ClocksAlarmDurationModel* self,
                                                   gint minutes);
VALA_EXTERN ClocksAlarmDurationModel* clocks_alarm_duration_model_new (void);
VALA_EXTERN ClocksAlarmDurationModel* clocks_alarm_duration_model_construct (GType object_type);
static GObject * clocks_alarm_duration_model_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
static void clocks_alarm_duration_model_finalize (GObject * obj);
static GType clocks_alarm_duration_model_get_type_once (void);
VALA_EXTERN GType clocks_alarm_setup_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmSetupDialog, g_object_unref)
VALA_EXTERN GType clocks_sound_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksSound, g_object_unref)
VALA_EXTERN GType clocks_utils_wall_clock_format_get_type (void) G_GNUC_CONST ;
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_alarm_day_picker_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmDayPickerRow, g_object_unref)
VALA_EXTERN GType clocks_sound_chooser_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksSoundChooser, 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_setup_dialog_response_get_type (void) G_GNUC_CONST ;
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN ClocksAlarmSetupDialog* clocks_alarm_setup_dialog_new (ClocksAlarmItem* alarm,
                                                       GListModel* all_alarms);
VALA_EXTERN ClocksAlarmSetupDialog* clocks_alarm_setup_dialog_construct (GType object_type,
                                                             ClocksAlarmItem* alarm,
                                                             GListModel* all_alarms);
static gchar* clocks_alarm_setup_dialog_duration_label (ClocksAlarmDuration* item);
VALA_EXTERN GType clocks_utils_wall_clock_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksUtilsWallClock, g_object_unref)
VALA_EXTERN ClocksUtilsWallClock* clocks_utils_wall_clock_get_default (void);
VALA_EXTERN ClocksUtilsWallClockFormat clocks_utils_wall_clock_get_format (ClocksUtilsWallClock* self);
VALA_EXTERN ClocksAmPmToggleButton* clocks_am_pm_toggle_button_new (void);
VALA_EXTERN ClocksAmPmToggleButton* clocks_am_pm_toggle_button_construct (GType object_type);
static void __lambda79_ (ClocksAlarmSetupDialog* self);
static void clocks_alarm_setup_dialog_avoid_duplicate_alarm (ClocksAlarmSetupDialog* self);
static void ___lambda79__gtk_button_clicked (GtkButton* _sender,
                                      gpointer self);
VALA_EXTERN void clocks_alarm_setup_dialog_set_from_alarm (ClocksAlarmSetupDialog* self,
                                               ClocksAlarmItem* alarm);
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 GDateTime* clocks_utils_wall_clock_get_date_time (ClocksUtilsWallClock* self);
VALA_EXTERN GFile* clocks_alarm_sound_model_build_default_file (void);
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);
VALA_EXTERN GType clocks_alarm_alarm_time_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ClocksAlarmAlarmTime* clocks_alarm_alarm_time_dup (const ClocksAlarmAlarmTime* self);
VALA_EXTERN void clocks_alarm_alarm_time_free (ClocksAlarmAlarmTime* self);
VALA_EXTERN void clocks_alarm_item_get_time (ClocksAlarmItem* self,
                                 ClocksAlarmAlarmTime * result);
VALA_EXTERN ClocksUtilsWeekdays* clocks_alarm_item_get_days (ClocksAlarmItem* self);
VALA_EXTERN gboolean clocks_alarm_item_get_active (ClocksAlarmItem* self);
VALA_EXTERN gint clocks_alarm_item_get_ring_minutes (ClocksAlarmItem* self);
VALA_EXTERN gint clocks_alarm_item_get_snooze_minutes (ClocksAlarmItem* self);
VALA_EXTERN GFile* clocks_alarm_item_get_sound_file (ClocksAlarmItem* self);
VALA_EXTERN GType clocks_am_pm_toggle_button_am_pm_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void clocks_am_pm_toggle_button_set_choice (ClocksAmPmToggleButton* self,
                                            ClocksAmPmToggleButtonAmPm value);
VALA_EXTERN void clocks_alarm_day_picker_row_load (ClocksAlarmDayPickerRow* self,
                                       ClocksUtilsWeekdays* current_days);
VALA_EXTERN ClocksSound* clocks_sound_chooser_get_silent_sound (ClocksSoundChooser* self);
VALA_EXTERN GFile* clocks_sound_get_file (ClocksSound* self);
VALA_EXTERN void clocks_alarm_setup_dialog_set_sound (ClocksAlarmSetupDialog* self,
                                          ClocksSound* value);
VALA_EXTERN GType clocks_alarm_sound_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksAlarmSoundModel, g_object_unref)
VALA_EXTERN GListModel* clocks_sound_chooser_get_model (ClocksSoundChooser* self);
VALA_EXTERN ClocksSound* clocks_alarm_sound_model_find_by_file (ClocksAlarmSoundModel* self,
                                                    GFile* file);
VALA_EXTERN ClocksSound* clocks_alarm_setup_dialog_get_sound (ClocksAlarmSetupDialog* self);
VALA_EXTERN void clocks_alarm_setup_dialog_apply_to_alarm (ClocksAlarmSetupDialog* self,
                                               ClocksAlarmItem* alarm);
VALA_EXTERN ClocksAmPmToggleButtonAmPm clocks_am_pm_toggle_button_get_choice (ClocksAmPmToggleButton* self);
VALA_EXTERN ClocksUtilsWeekdays* clocks_alarm_day_picker_row_store (ClocksAlarmDayPickerRow* self);
VALA_EXTERN void clocks_content_item_set_name (ClocksContentItem* self,
                                   const gchar* value);
VALA_EXTERN void clocks_alarm_item_set_time (ClocksAlarmItem* self,
                                 ClocksAlarmAlarmTime * value);
VALA_EXTERN void clocks_alarm_item_set_days (ClocksAlarmItem* self,
                                 ClocksUtilsWeekdays* value);
VALA_EXTERN void clocks_alarm_item_set_snooze_minutes (ClocksAlarmItem* self,
                                           gint value);
VALA_EXTERN void clocks_alarm_item_set_ring_minutes (ClocksAlarmItem* self,
                                         gint value);
VALA_EXTERN void clocks_alarm_item_set_sound_file (ClocksAlarmItem* self,
                                       GFile* value);
VALA_EXTERN void clocks_alarm_item_reset (ClocksAlarmItem* self);
VALA_EXTERN ClocksAlarmItem* clocks_alarm_item_new (const gchar* id);
VALA_EXTERN ClocksAlarmItem* clocks_alarm_item_construct (GType object_type,
                                              const gchar* id);
VALA_EXTERN gboolean clocks_alarm_item_check_duplicate_alarm (ClocksAlarmItem* self,
                                                  GList* alarms);
static void clocks_alarm_setup_dialog_update_accessibility (ClocksAlarmSetupDialog* self);
VALA_EXTERN const gchar* clocks_sound_get_label (ClocksSound* self);
static void clocks_alarm_setup_dialog_days_changed (ClocksAlarmSetupDialog* self);
static void _clocks_alarm_setup_dialog_days_changed_clocks_alarm_day_picker_row_days_changed (ClocksAlarmDayPickerRow* _sender,
                                                                                       gpointer self);
static void clocks_alarm_setup_dialog_entry_changed (ClocksAlarmSetupDialog* self,
                                              GtkEditable* editable);
static void _clocks_alarm_setup_dialog_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                                    gpointer self);
static void clocks_alarm_setup_dialog_spinbuttons_changed (ClocksAlarmSetupDialog* self,
                                                    GtkEditable* editable);
static void _clocks_alarm_setup_dialog_spinbuttons_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender,
                                                                                   gpointer self);
static gboolean clocks_alarm_setup_dialog_show_leading_zeros (ClocksAlarmSetupDialog* self,
                                                       GtkSpinButton* spin_button);
static gboolean _clocks_alarm_setup_dialog_show_leading_zeros_gtk_spin_button_output (GtkSpinButton* _sender,
                                                                               gpointer self);
static void clocks_alarm_setup_dialog_delete (ClocksAlarmSetupDialog* self);
static void _clocks_alarm_setup_dialog_delete_adw_button_row_activated (AdwButtonRow* _sender,
                                                                 gpointer self);
static void clocks_alarm_setup_dialog_add (ClocksAlarmSetupDialog* self);
static void _clocks_alarm_setup_dialog_add_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self);
static void clocks_alarm_setup_dialog_cancel (ClocksAlarmSetupDialog* self);
static void _clocks_alarm_setup_dialog_cancel_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
static GObject * clocks_alarm_setup_dialog_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static void _clocks_alarm_setup_dialog___lambda80_ (ClocksAlarmSetupDialog* self);
static void __clocks_alarm_setup_dialog___lambda80__g_object_notify (GObject* _sender,
                                                              GParamSpec* pspec,
                                                              gpointer self);
static void clocks_alarm_setup_dialog_finalize (GObject * obj);
static GType clocks_alarm_setup_dialog_get_type_once (void);
static void _vala_clocks_alarm_setup_dialog_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_clocks_alarm_setup_dialog_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
clocks_alarm_duration_get_instance_private (ClocksAlarmDuration* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksAlarmDuration_private_offset);
}

ClocksAlarmDuration*
clocks_alarm_duration_construct (GType object_type,
                                 gint minutes,
                                 const gchar* label)
{
	ClocksAlarmDuration * self = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (ClocksAlarmDuration*) g_object_new (object_type, NULL);
	clocks_alarm_duration_set_minutes (self, minutes);
	clocks_alarm_duration_set_label (self, label);
	return self;
}

ClocksAlarmDuration*
clocks_alarm_duration_new (gint minutes,
                           const gchar* label)
{
	return clocks_alarm_duration_construct (CLOCKS_ALARM_TYPE_DURATION, minutes, label);
}

gint
clocks_alarm_duration_get_minutes (ClocksAlarmDuration* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_minutes;
	return result;
}

void
clocks_alarm_duration_set_minutes (ClocksAlarmDuration* self,
                                   gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_alarm_duration_get_minutes (self);
	if (old_value != value) {
		self->priv->_minutes = value;
		g_object_notify_by_pspec ((GObject *) self, clocks_alarm_duration_properties[CLOCKS_ALARM_DURATION_MINUTES_PROPERTY]);
	}
}

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

void
clocks_alarm_duration_set_label (ClocksAlarmDuration* self,
                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_alarm_duration_get_label (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_label);
		self->priv->_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_alarm_duration_properties[CLOCKS_ALARM_DURATION_LABEL_PROPERTY]);
	}
}

static void
clocks_alarm_duration_class_init (ClocksAlarmDurationClass * klass,
                                  gpointer klass_data)
{
	clocks_alarm_duration_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksAlarmDuration_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_alarm_duration_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_alarm_duration_set_property;
	G_OBJECT_CLASS (klass)->finalize = clocks_alarm_duration_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_ALARM_DURATION_MINUTES_PROPERTY, clocks_alarm_duration_properties[CLOCKS_ALARM_DURATION_MINUTES_PROPERTY] = g_param_spec_int ("minutes", "minutes", "minutes", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_ALARM_DURATION_LABEL_PROPERTY, clocks_alarm_duration_properties[CLOCKS_ALARM_DURATION_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
clocks_alarm_duration_instance_init (ClocksAlarmDuration * self,
                                     gpointer klass)
{
	self->priv = clocks_alarm_duration_get_instance_private (self);
	self->priv->_minutes = 0;
}

static void
clocks_alarm_duration_finalize (GObject * obj)
{
	ClocksAlarmDuration * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDuration);
	_g_free0 (self->priv->_label);
	G_OBJECT_CLASS (clocks_alarm_duration_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_alarm_duration_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksAlarmDurationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_alarm_duration_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksAlarmDuration), 0, (GInstanceInitFunc) clocks_alarm_duration_instance_init, NULL };
	GType clocks_alarm_duration_type_id;
	clocks_alarm_duration_type_id = g_type_register_static (G_TYPE_OBJECT, "ClocksAlarmDuration", &g_define_type_info, 0);
	ClocksAlarmDuration_private_offset = g_type_add_instance_private (clocks_alarm_duration_type_id, sizeof (ClocksAlarmDurationPrivate));
	return clocks_alarm_duration_type_id;
}

GType
clocks_alarm_duration_get_type (void)
{
	static gsize clocks_alarm_duration_type_id__once = 0;
	if (g_once_init_enter (&clocks_alarm_duration_type_id__once)) {
		GType clocks_alarm_duration_type_id;
		clocks_alarm_duration_type_id = clocks_alarm_duration_get_type_once ();
		g_once_init_leave (&clocks_alarm_duration_type_id__once, clocks_alarm_duration_type_id);
	}
	return clocks_alarm_duration_type_id__once;
}

static void
_vala_clocks_alarm_duration_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	ClocksAlarmDuration * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDuration);
	switch (property_id) {
		case CLOCKS_ALARM_DURATION_MINUTES_PROPERTY:
		g_value_set_int (value, clocks_alarm_duration_get_minutes (self));
		break;
		case CLOCKS_ALARM_DURATION_LABEL_PROPERTY:
		g_value_set_string (value, clocks_alarm_duration_get_label (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_alarm_duration_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	ClocksAlarmDuration * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDuration);
	switch (property_id) {
		case CLOCKS_ALARM_DURATION_MINUTES_PROPERTY:
		clocks_alarm_duration_set_minutes (self, g_value_get_int (value));
		break;
		case CLOCKS_ALARM_DURATION_LABEL_PROPERTY:
		clocks_alarm_duration_set_label (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
clocks_alarm_duration_model_get_instance_private (ClocksAlarmDurationModel* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksAlarmDurationModel_private_offset);
}

static GType
clocks_alarm_duration_model_real_get_item_type (GListModel* base)
{
	ClocksAlarmDurationModel * self;
	GType result;
	self = (ClocksAlarmDurationModel*) base;
	result = CLOCKS_ALARM_TYPE_DURATION;
	return result;
}

static guint
clocks_alarm_duration_model_real_get_n_items (GListModel* base)
{
	ClocksAlarmDurationModel * self;
	guint result;
	self = (ClocksAlarmDurationModel*) base;
	result = (guint) 6;
	return result;
}

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

static GObject*
clocks_alarm_duration_model_real_get_item (GListModel* base,
                                           guint n)
{
	ClocksAlarmDurationModel * self;
	ClocksAlarmDuration* _tmp0_;
	GObject* _tmp1_;
	GObject* result;
	self = (ClocksAlarmDurationModel*) base;
	if (n > ((guint) 5)) {
		result = NULL;
		return result;
	}
	_tmp0_ = self->priv->store[n];
	_tmp1_ = _g_object_ref0 ((GObject*) _tmp0_);
	result = _tmp1_;
	return result;
}

gint
clocks_alarm_duration_model_find_by_duration (ClocksAlarmDurationModel* self,
                                              gint minutes)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				ClocksAlarmDuration* d = NULL;
				GObject* _tmp2_;
				ClocksAlarmDuration* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(((guint) i) < g_list_model_get_n_items ((GListModel*) self))) {
					break;
				}
				_tmp2_ = g_list_model_get_item ((GListModel*) self, (guint) i);
				d = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDuration);
				_tmp3_ = d;
				_tmp4_ = clocks_alarm_duration_get_minutes (_tmp3_);
				_tmp5_ = _tmp4_;
				if (_tmp5_ == minutes) {
					result = i;
					_g_object_unref0 (d);
					return result;
				}
				_g_object_unref0 (d);
			}
		}
	}
	result = -1;
	return result;
}

ClocksAlarmDurationModel*
clocks_alarm_duration_model_construct (GType object_type)
{
	ClocksAlarmDurationModel * self = NULL;
	self = (ClocksAlarmDurationModel*) g_object_new (object_type, NULL);
	return self;
}

ClocksAlarmDurationModel*
clocks_alarm_duration_model_new (void)
{
	return clocks_alarm_duration_model_construct (CLOCKS_ALARM_TYPE_DURATION_MODEL);
}

static GObject *
clocks_alarm_duration_model_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ClocksAlarmDurationModel * self;
	ClocksAlarmDuration* _tmp0_;
	ClocksAlarmDuration* _tmp1_;
	ClocksAlarmDuration* _tmp2_;
	ClocksAlarmDuration* _tmp3_;
	ClocksAlarmDuration* _tmp4_;
	ClocksAlarmDuration* _tmp5_;
	parent_class = G_OBJECT_CLASS (clocks_alarm_duration_model_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_ALARM_TYPE_DURATION_MODEL, ClocksAlarmDurationModel);
	_tmp0_ = clocks_alarm_duration_new (1, _ ("1 minute"));
	_g_object_unref0 (self->priv->store[0]);
	self->priv->store[0] = _tmp0_;
	_tmp1_ = clocks_alarm_duration_new (5, _ ("5 minutes"));
	_g_object_unref0 (self->priv->store[1]);
	self->priv->store[1] = _tmp1_;
	_tmp2_ = clocks_alarm_duration_new (10, _ ("10 minutes"));
	_g_object_unref0 (self->priv->store[2]);
	self->priv->store[2] = _tmp2_;
	_tmp3_ = clocks_alarm_duration_new (15, _ ("15 minutes"));
	_g_object_unref0 (self->priv->store[3]);
	self->priv->store[3] = _tmp3_;
	_tmp4_ = clocks_alarm_duration_new (20, _ ("20 minutes"));
	_g_object_unref0 (self->priv->store[4]);
	self->priv->store[4] = _tmp4_;
	_tmp5_ = clocks_alarm_duration_new (30, _ ("30 minutes"));
	_g_object_unref0 (self->priv->store[5]);
	self->priv->store[5] = _tmp5_;
	return obj;
}

static void
clocks_alarm_duration_model_class_init (ClocksAlarmDurationModelClass * klass,
                                        gpointer klass_data)
{
	clocks_alarm_duration_model_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksAlarmDurationModel_private_offset);
	G_OBJECT_CLASS (klass)->constructor = clocks_alarm_duration_model_constructor;
	G_OBJECT_CLASS (klass)->finalize = clocks_alarm_duration_model_finalize;
}

static void
clocks_alarm_duration_model_g_list_model_interface_init (GListModelInterface * iface,
                                                         gpointer iface_data)
{
	clocks_alarm_duration_model_g_list_model_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_item_type = (GType (*) (GListModel*)) clocks_alarm_duration_model_real_get_item_type;
	iface->get_n_items = (guint (*) (GListModel*)) clocks_alarm_duration_model_real_get_n_items;
	iface->get_item = (GObject* (*) (GListModel*, guint)) clocks_alarm_duration_model_real_get_item;
}

static void
clocks_alarm_duration_model_instance_init (ClocksAlarmDurationModel * self,
                                           gpointer klass)
{
	self->priv = clocks_alarm_duration_model_get_instance_private (self);
}

static void
clocks_alarm_duration_model_finalize (GObject * obj)
{
	ClocksAlarmDurationModel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_ALARM_TYPE_DURATION_MODEL, ClocksAlarmDurationModel);
	_vala_array_destroy (self->priv->store, 6, (GDestroyNotify) g_object_unref);
	G_OBJECT_CLASS (clocks_alarm_duration_model_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_alarm_duration_model_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksAlarmDurationModelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_alarm_duration_model_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksAlarmDurationModel), 0, (GInstanceInitFunc) clocks_alarm_duration_model_instance_init, NULL };
	static const GInterfaceInfo g_list_model_info = { (GInterfaceInitFunc) clocks_alarm_duration_model_g_list_model_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType clocks_alarm_duration_model_type_id;
	clocks_alarm_duration_model_type_id = g_type_register_static (G_TYPE_OBJECT, "ClocksAlarmDurationModel", &g_define_type_info, 0);
	g_type_add_interface_static (clocks_alarm_duration_model_type_id, g_list_model_get_type (), &g_list_model_info);
	ClocksAlarmDurationModel_private_offset = g_type_add_instance_private (clocks_alarm_duration_model_type_id, sizeof (ClocksAlarmDurationModelPrivate));
	return clocks_alarm_duration_model_type_id;
}

GType
clocks_alarm_duration_model_get_type (void)
{
	static gsize clocks_alarm_duration_model_type_id__once = 0;
	if (g_once_init_enter (&clocks_alarm_duration_model_type_id__once)) {
		GType clocks_alarm_duration_model_type_id;
		clocks_alarm_duration_model_type_id = clocks_alarm_duration_model_get_type_once ();
		g_once_init_leave (&clocks_alarm_duration_model_type_id__once, clocks_alarm_duration_model_type_id);
	}
	return clocks_alarm_duration_model_type_id__once;
}

static inline gpointer
clocks_alarm_setup_dialog_get_instance_private (ClocksAlarmSetupDialog* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksAlarmSetupDialog_private_offset);
}

 G_GNUC_NO_INLINE static GType
clocks_alarm_setup_dialog_response_get_type_once (void)
{
	static const GEnumValue values[] = {{CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_CANCEL, "CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_CANCEL", "cancel"}, {CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_ADD, "CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_ADD", "add"}, {0, NULL, NULL}};
	GType clocks_alarm_setup_dialog_response_type_id;
	clocks_alarm_setup_dialog_response_type_id = g_enum_register_static ("ClocksAlarmSetupDialogResponse", values);
	return clocks_alarm_setup_dialog_response_type_id;
}

GType
clocks_alarm_setup_dialog_response_get_type (void)
{
	static gsize clocks_alarm_setup_dialog_response_type_id__once = 0;
	if (g_once_init_enter (&clocks_alarm_setup_dialog_response_type_id__once)) {
		GType clocks_alarm_setup_dialog_response_type_id;
		clocks_alarm_setup_dialog_response_type_id = clocks_alarm_setup_dialog_response_get_type_once ();
		g_once_init_leave (&clocks_alarm_setup_dialog_response_type_id__once, clocks_alarm_setup_dialog_response_type_id);
	}
	return clocks_alarm_setup_dialog_response_type_id__once;
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
__lambda79_ (ClocksAlarmSetupDialog* self)
{
	clocks_alarm_setup_dialog_avoid_duplicate_alarm (self);
}

static void
___lambda79__gtk_button_clicked (GtkButton* _sender,
                                 gpointer self)
{
	__lambda79_ ((ClocksAlarmSetupDialog*) self);
}

ClocksAlarmSetupDialog*
clocks_alarm_setup_dialog_construct (GType object_type,
                                     ClocksAlarmItem* alarm,
                                     GListModel* all_alarms)
{
	ClocksAlarmSetupDialog * self = NULL;
	const gchar* _tmp0_ = NULL;
	AdwPreferencesGroup* _tmp2_;
	guint n = 0U;
	ClocksAlarmDurationModel* _tmp8_;
	GtkCClosureExpression* expression = NULL;
	GtkExpression** _tmp9_;
	GtkCClosureExpression* _tmp10_;
	AdwComboRow* _tmp11_;
	GtkCClosureExpression* _tmp12_;
	AdwComboRow* _tmp13_;
	ClocksAlarmDurationModel* _tmp14_;
	AdwComboRow* _tmp15_;
	GtkCClosureExpression* _tmp16_;
	AdwComboRow* _tmp17_;
	ClocksAlarmDurationModel* _tmp18_;
	GtkBox* _tmp19_;
	ClocksUtilsWallClock* _tmp20_;
	ClocksUtilsWallClock* _tmp21_;
	ClocksUtilsWallClockFormat _tmp22_;
	ClocksUtilsWallClockFormat _tmp23_;
	ClocksAmPmToggleButton* _tmp24_;
	ClocksAmPmToggleButton* _tmp25_;
	g_return_val_if_fail (all_alarms != NULL, NULL);
	if (alarm != NULL) {
		_tmp0_ = _ ("Edit Alarm");
	} else {
		_tmp0_ = _ ("New Alarm");
	}
	self = (ClocksAlarmSetupDialog*) g_object_new (object_type, "title", _tmp0_, NULL);
	if (alarm != NULL) {
		GtkButton* _tmp1_;
		_tmp1_ = self->priv->ok_button;
		gtk_button_set_label (_tmp1_, _ ("_Done"));
	}
	_tmp2_ = self->priv->delete_group;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, alarm != NULL);
	(self->priv->other_alarms == NULL) ? NULL : (self->priv->other_alarms = (_g_list_free__g_object_unref0_ (self->priv->other_alarms), NULL));
	self->priv->other_alarms = NULL;
	n = g_list_model_get_n_items (all_alarms);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp3_ = FALSE;
			_tmp3_ = TRUE;
			while (TRUE) {
				ClocksAlarmItem* item = NULL;
				GObject* _tmp5_;
				ClocksAlarmItem* _tmp6_;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = i;
					i = _tmp4_ + 1;
				}
				_tmp3_ = FALSE;
				if (!(((guint) i) < n)) {
					break;
				}
				_tmp5_ = g_list_model_get_object (all_alarms, (guint) i);
				item = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem);
				_tmp6_ = item;
				if (alarm != _tmp6_) {
					GObject* _tmp7_;
					_tmp7_ = g_list_model_get_object (all_alarms, (guint) i);
					self->priv->other_alarms = g_list_prepend (self->priv->other_alarms, G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem));
				}
				_g_object_unref0 (item);
			}
		}
	}
	_tmp8_ = clocks_alarm_duration_model_new ();
	_g_object_unref0 (self->priv->duration_model);
	self->priv->duration_model = _tmp8_;
	_tmp9_ = g_new0 (GtkExpression*, 0 + 1);
	_tmp10_ = (GtkCClosureExpression*) gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, _tmp9_, (GCallback) clocks_alarm_setup_dialog_duration_label, NULL, NULL);
	expression = _tmp10_;
	_tmp11_ = self->priv->snooze_duration;
	_tmp12_ = expression;
	adw_combo_row_set_expression (_tmp11_, (GtkExpression*) _tmp12_);
	_tmp13_ = self->priv->snooze_duration;
	_tmp14_ = self->priv->duration_model;
	adw_combo_row_set_model (_tmp13_, (GListModel*) _tmp14_);
	_tmp15_ = self->priv->ring_duration;
	_tmp16_ = expression;
	adw_combo_row_set_expression (_tmp15_, (GtkExpression*) _tmp16_);
	_tmp17_ = self->priv->ring_duration;
	_tmp18_ = self->priv->duration_model;
	adw_combo_row_set_model (_tmp17_, (GListModel*) _tmp18_);
	_tmp19_ = self->priv->time_box;
	gtk_widget_set_direction ((GtkWidget*) _tmp19_, GTK_TEXT_DIR_LTR);
	_tmp20_ = clocks_utils_wall_clock_get_default ();
	_tmp21_ = _tmp20_;
	_tmp22_ = clocks_utils_wall_clock_get_format (_tmp21_);
	_tmp23_ = _tmp22_;
	self->priv->format = _tmp23_;
	_g_object_unref0 (_tmp21_);
	_tmp24_ = clocks_am_pm_toggle_button_new ();
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->am_pm_button);
	self->priv->am_pm_button = _tmp24_;
	_tmp25_ = self->priv->am_pm_button;
	g_signal_connect_object ((GtkButton*) _tmp25_, "clicked", (GCallback) ___lambda79__gtk_button_clicked, self, 0);
	if (self->priv->format == CLOCKS_UTILS_WALL_CLOCK_FORMAT_TWENTYFOUR) {
		GtkSpinButton* _tmp26_;
		AdwBin* _tmp27_;
		_tmp26_ = self->priv->h_spinbutton;
		gtk_spin_button_set_range (_tmp26_, (gdouble) 0, (gdouble) 23);
		_tmp27_ = self->priv->am_pm_bin;
		gtk_widget_set_visible ((GtkWidget*) _tmp27_, FALSE);
	} else {
		GtkSpinButton* _tmp28_;
		ClocksAmPmToggleButton* _tmp29_;
		ClocksAmPmToggleButton* _tmp30_;
		ClocksAmPmToggleButton* _tmp31_;
		ClocksAmPmToggleButton* _tmp32_;
		AdwBin* _tmp33_;
		AdwBin* _tmp34_;
		ClocksAmPmToggleButton* _tmp35_;
		_tmp28_ = self->priv->h_spinbutton;
		gtk_spin_button_set_range (_tmp28_, (gdouble) 1, (gdouble) 12);
		_tmp29_ = self->priv->am_pm_button;
		gtk_widget_set_hexpand ((GtkWidget*) _tmp29_, FALSE);
		_tmp30_ = self->priv->am_pm_button;
		gtk_widget_set_vexpand ((GtkWidget*) _tmp30_, FALSE);
		_tmp31_ = self->priv->am_pm_button;
		gtk_widget_set_halign ((GtkWidget*) _tmp31_, GTK_ALIGN_CENTER);
		_tmp32_ = self->priv->am_pm_button;
		gtk_widget_set_valign ((GtkWidget*) _tmp32_, GTK_ALIGN_CENTER);
		_tmp33_ = self->priv->am_pm_bin;
		gtk_widget_set_visible ((GtkWidget*) _tmp33_, TRUE);
		_tmp34_ = self->priv->am_pm_bin;
		_tmp35_ = self->priv->am_pm_button;
		adw_bin_set_child (_tmp34_, (GtkWidget*) _tmp35_);
	}
	clocks_alarm_setup_dialog_set_from_alarm (self, alarm);
	_gtk_expression_unref0 (expression);
	return self;
}

ClocksAlarmSetupDialog*
clocks_alarm_setup_dialog_new (ClocksAlarmItem* alarm,
                               GListModel* all_alarms)
{
	return clocks_alarm_setup_dialog_construct (CLOCKS_ALARM_TYPE_SETUP_DIALOG, alarm, all_alarms);
}

static gchar*
clocks_alarm_setup_dialog_duration_label (ClocksAlarmDuration* item)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = clocks_alarm_duration_get_label (item);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

void
clocks_alarm_setup_dialog_set_from_alarm (ClocksAlarmSetupDialog* self,
                                          ClocksAlarmItem* alarm)
{
	gchar* name = NULL;
	gboolean active = FALSE;
	gint hour = 0;
	gint minute = 0;
	gint snooze_minutes = 0;
	gint ring_minutes = 0;
	GFile* sound_file = NULL;
	ClocksUtilsWeekdays* days = NULL;
	AdwComboRow* _tmp29_;
	ClocksAlarmDurationModel* _tmp30_;
	AdwComboRow* _tmp31_;
	ClocksAlarmDurationModel* _tmp32_;
	GtkSpinButton* _tmp33_;
	GtkSpinButton* _tmp34_;
	AdwEntryRow* _tmp35_;
	const gchar* _tmp36_;
	ClocksUtilsWeekdays* _tmp37_;
	ClocksSound* silent_sound = NULL;
	ClocksSoundChooser* _tmp40_;
	ClocksSound* _tmp41_;
	ClocksSound* _tmp42_;
	ClocksSound* _tmp43_;
	GFile* _tmp44_;
	ClocksSound* _tmp45_;
	GFile* _tmp46_;
	GFile* _tmp47_;
	ClocksAlarmSoundModel* sound_model = NULL;
	ClocksSoundChooser* _tmp49_;
	GListModel* _tmp50_;
	GListModel* _tmp51_;
	ClocksAlarmSoundModel* _tmp52_;
	ClocksAlarmSoundModel* _tmp53_;
	ClocksAlarmSoundModel* _tmp54_;
	GFile* _tmp55_;
	ClocksSound* _tmp56_;
	ClocksSound* _tmp57_;
	ClocksSound* _tmp58_;
	GFile* _tmp59_;
	gchar* _tmp60_;
	gchar* _tmp61_;
	GFile* _tmp62_;
	ClocksAlarmSoundModel* _tmp63_;
	GFile* _tmp64_;
	ClocksSound* _tmp65_;
	ClocksSound* _tmp66_;
	ClocksSound* _tmp67_;
	g_return_if_fail (self != NULL);
	if (alarm == NULL) {
		ClocksUtilsWallClock* wc = NULL;
		ClocksUtilsWallClock* _tmp0_;
		gchar* _tmp1_;
		ClocksUtilsWallClock* _tmp2_;
		GDateTime* _tmp3_;
		GDateTime* _tmp4_;
		ClocksUtilsWallClock* _tmp5_;
		GDateTime* _tmp6_;
		GDateTime* _tmp7_;
		GFile* _tmp8_;
		_tmp0_ = clocks_utils_wall_clock_get_default ();
		wc = _tmp0_;
		_tmp1_ = g_strdup ("");
		_g_free0 (name);
		name = _tmp1_;
		_tmp2_ = wc;
		_tmp3_ = clocks_utils_wall_clock_get_date_time (_tmp2_);
		_tmp4_ = _tmp3_;
		hour = g_date_time_get_hour (_tmp4_);
		_tmp5_ = wc;
		_tmp6_ = clocks_utils_wall_clock_get_date_time (_tmp5_);
		_tmp7_ = _tmp6_;
		minute = g_date_time_get_minute (_tmp7_);
		days = NULL;
		active = TRUE;
		ring_minutes = 5;
		snooze_minutes = 10;
		_tmp8_ = clocks_alarm_sound_model_build_default_file ();
		_g_object_unref0 (sound_file);
		sound_file = _tmp8_;
		_g_object_unref0 (wc);
	} else {
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		ClocksAlarmAlarmTime _tmp12_ = {0};
		ClocksAlarmAlarmTime _tmp13_;
		ClocksAlarmAlarmTime _tmp14_ = {0};
		ClocksAlarmAlarmTime _tmp15_;
		ClocksUtilsWeekdays* _tmp16_;
		ClocksUtilsWeekdays* _tmp17_;
		gboolean _tmp18_;
		gboolean _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		gint _tmp23_;
		GFile* _tmp24_;
		GFile* _tmp25_;
		GFile* _tmp26_;
		_tmp9_ = clocks_content_item_get_name ((ClocksContentItem*) G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem));
		_tmp10_ = _tmp9_;
		_tmp11_ = g_strdup (_tmp10_);
		_g_free0 (name);
		name = _tmp11_;
		clocks_alarm_item_get_time (G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem), &_tmp12_);
		_tmp13_ = _tmp12_;
		hour = _tmp13_.hour;
		clocks_alarm_item_get_time (G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem), &_tmp14_);
		_tmp15_ = _tmp14_;
		minute = _tmp15_.minute;
		_tmp16_ = clocks_alarm_item_get_days (G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem));
		_tmp17_ = _tmp16_;
		days = _tmp17_;
		_tmp18_ = clocks_alarm_item_get_active (G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem));
		_tmp19_ = _tmp18_;
		active = _tmp19_;
		_tmp20_ = clocks_alarm_item_get_ring_minutes (G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem));
		_tmp21_ = _tmp20_;
		ring_minutes = _tmp21_;
		_tmp22_ = clocks_alarm_item_get_snooze_minutes (G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem));
		_tmp23_ = _tmp22_;
		snooze_minutes = _tmp23_;
		_tmp24_ = clocks_alarm_item_get_sound_file (G_TYPE_CHECK_INSTANCE_CAST (alarm, CLOCKS_ALARM_TYPE_ITEM, ClocksAlarmItem));
		_tmp25_ = _tmp24_;
		_tmp26_ = _g_object_ref0 (_tmp25_);
		_g_object_unref0 (sound_file);
		sound_file = _tmp26_;
	}
	if (self->priv->format == CLOCKS_UTILS_WALL_CLOCK_FORMAT_TWELVE) {
		if (hour < 12) {
			ClocksAmPmToggleButton* _tmp27_;
			_tmp27_ = self->priv->am_pm_button;
			clocks_am_pm_toggle_button_set_choice (_tmp27_, CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM);
		} else {
			ClocksAmPmToggleButton* _tmp28_;
			_tmp28_ = self->priv->am_pm_button;
			clocks_am_pm_toggle_button_set_choice (_tmp28_, CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_PM);
			hour -= 12;
		}
		if (hour == 0) {
			hour = 12;
		}
	}
	_tmp29_ = self->priv->ring_duration;
	_tmp30_ = self->priv->duration_model;
	adw_combo_row_set_selected (_tmp29_, (guint) clocks_alarm_duration_model_find_by_duration (_tmp30_, ring_minutes));
	_tmp31_ = self->priv->snooze_duration;
	_tmp32_ = self->priv->duration_model;
	adw_combo_row_set_selected (_tmp31_, (guint) clocks_alarm_duration_model_find_by_duration (_tmp32_, snooze_minutes));
	_tmp33_ = self->priv->h_spinbutton;
	gtk_spin_button_set_value (_tmp33_, (gdouble) hour);
	_tmp34_ = self->priv->m_spinbutton;
	gtk_spin_button_set_value (_tmp34_, (gdouble) minute);
	_tmp35_ = self->priv->name_entry;
	_tmp36_ = name;
	gtk_editable_set_text ((GtkEditable*) _tmp35_, (const gchar*) _tmp36_);
	_tmp37_ = days;
	if (_tmp37_ != NULL) {
		ClocksAlarmDayPickerRow* _tmp38_;
		ClocksUtilsWeekdays* _tmp39_;
		_tmp38_ = self->priv->repeats;
		_tmp39_ = days;
		clocks_alarm_day_picker_row_load (_tmp38_, G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, CLOCKS_UTILS_TYPE_WEEKDAYS, ClocksUtilsWeekdays));
	}
	_tmp40_ = self->priv->sound_chooser;
	_tmp41_ = clocks_sound_chooser_get_silent_sound (_tmp40_);
	_tmp42_ = _tmp41_;
	_tmp43_ = _g_object_ref0 (_tmp42_);
	silent_sound = _tmp43_;
	_tmp44_ = sound_file;
	_tmp45_ = silent_sound;
	_tmp46_ = clocks_sound_get_file (_tmp45_);
	_tmp47_ = _tmp46_;
	if (g_file_equal (_tmp44_, _tmp47_)) {
		ClocksSound* _tmp48_;
		_tmp48_ = silent_sound;
		clocks_alarm_setup_dialog_set_sound (self, _tmp48_);
		_g_object_unref0 (silent_sound);
		_g_object_unref0 (sound_file);
		_g_free0 (name);
		return;
	}
	_tmp49_ = self->priv->sound_chooser;
	_tmp50_ = clocks_sound_chooser_get_model (_tmp49_);
	_tmp51_ = _tmp50_;
	_tmp52_ = _g_object_ref0 (CLOCKS_ALARM_IS_SOUND_MODEL (_tmp51_) ? ((ClocksAlarmSoundModel*) _tmp51_) : NULL);
	sound_model = _tmp52_;
	_tmp53_ = sound_model;
	_vala_assert (_tmp53_ != NULL, "sound_model != null");
	_tmp54_ = sound_model;
	_tmp55_ = sound_file;
	_tmp56_ = clocks_alarm_sound_model_find_by_file (_tmp54_, _tmp55_);
	_tmp57_ = _tmp56_;
	clocks_alarm_setup_dialog_set_sound (self, _tmp57_);
	_g_object_unref0 (_tmp57_);
	_tmp58_ = self->priv->_sound;
	if (_tmp58_ != NULL) {
		_g_object_unref0 (sound_model);
		_g_object_unref0 (silent_sound);
		_g_object_unref0 (sound_file);
		_g_free0 (name);
		return;
	}
	_tmp59_ = sound_file;
	_tmp60_ = g_file_get_uri (_tmp59_);
	_tmp61_ = _tmp60_;
	g_critical ("alarm-setup-dialog.vala:261: Couldn't find alarm sound object for \"%s" \
"\".", _tmp61_);
	_g_free0 (_tmp61_);
	_tmp62_ = clocks_alarm_sound_model_build_default_file ();
	_g_object_unref0 (sound_file);
	sound_file = _tmp62_;
	_tmp63_ = sound_model;
	_tmp64_ = sound_file;
	_tmp65_ = clocks_alarm_sound_model_find_by_file (_tmp63_, _tmp64_);
	_tmp66_ = _tmp65_;
	clocks_alarm_setup_dialog_set_sound (self, _tmp66_);
	_g_object_unref0 (_tmp66_);
	_tmp67_ = self->priv->_sound;
	_vala_assert (_tmp67_ != NULL, "sound != null");
	_g_object_unref0 (sound_model);
	_g_object_unref0 (silent_sound);
	_g_object_unref0 (sound_file);
	_g_free0 (name);
}

void
clocks_alarm_setup_dialog_apply_to_alarm (ClocksAlarmSetupDialog* self,
                                          ClocksAlarmItem* alarm)
{
	gchar* name = NULL;
	AdwEntryRow* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gint hour = 0;
	GtkSpinButton* _tmp3_;
	gint minute = 0;
	GtkSpinButton* _tmp4_;
	ClocksAlarmDuration* snooze_item = NULL;
	ClocksAlarmDurationModel* _tmp5_;
	AdwComboRow* _tmp6_;
	GObject* _tmp7_;
	ClocksAlarmDuration* ring_item = NULL;
	ClocksAlarmDurationModel* _tmp8_;
	AdwComboRow* _tmp9_;
	GObject* _tmp10_;
	ClocksAlarmAlarmTime time = {0};
	ClocksAlarmAlarmTime _tmp16_ = {0};
	ClocksUtilsWeekdays* days = NULL;
	ClocksAlarmDayPickerRow* _tmp17_;
	ClocksUtilsWeekdays* _tmp18_;
	const gchar* _tmp19_;
	ClocksAlarmAlarmTime _tmp20_;
	ClocksUtilsWeekdays* _tmp21_;
	ClocksAlarmDuration* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	ClocksAlarmDuration* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	GFile* _tmp28_ = NULL;
	gboolean _tmp29_ = FALSE;
	ClocksSound* _tmp30_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (alarm != NULL);
	_tmp0_ = self->priv->name_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	name = _tmp2_;
	_tmp3_ = self->priv->h_spinbutton;
	hour = gtk_spin_button_get_value_as_int (_tmp3_);
	_tmp4_ = self->priv->m_spinbutton;
	minute = gtk_spin_button_get_value_as_int (_tmp4_);
	_tmp5_ = self->priv->duration_model;
	_tmp6_ = self->priv->snooze_duration;
	_tmp7_ = g_list_model_get_item ((GListModel*) _tmp5_, adw_combo_row_get_selected (_tmp6_));
	snooze_item = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDuration);
	_tmp8_ = self->priv->duration_model;
	_tmp9_ = self->priv->ring_duration;
	_tmp10_ = g_list_model_get_item ((GListModel*) _tmp8_, adw_combo_row_get_selected (_tmp9_));
	ring_item = G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, CLOCKS_ALARM_TYPE_DURATION, ClocksAlarmDuration);
	if (self->priv->format == CLOCKS_UTILS_WALL_CLOCK_FORMAT_TWELVE) {
		ClocksAmPmToggleButtonAmPm choice = 0;
		ClocksAmPmToggleButton* _tmp11_;
		ClocksAmPmToggleButtonAmPm _tmp12_;
		ClocksAmPmToggleButtonAmPm _tmp13_;
		gboolean _tmp14_ = FALSE;
		_tmp11_ = self->priv->am_pm_button;
		_tmp12_ = clocks_am_pm_toggle_button_get_choice (_tmp11_);
		_tmp13_ = _tmp12_;
		choice = _tmp13_;
		if (choice == CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_AM) {
			_tmp14_ = hour == 12;
		} else {
			_tmp14_ = FALSE;
		}
		if (_tmp14_) {
			hour = 0;
		} else {
			gboolean _tmp15_ = FALSE;
			if (choice == CLOCKS_AM_PM_TOGGLE_BUTTON_AM_PM_PM) {
				_tmp15_ = hour != 12;
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				hour += 12;
			}
		}
	}
	_tmp16_.hour = hour;
	_tmp16_.minute = minute;
	time = _tmp16_;
	_tmp17_ = self->priv->repeats;
	_tmp18_ = clocks_alarm_day_picker_row_store (_tmp17_);
	days = _tmp18_;
	g_object_freeze_notify ((GObject*) alarm);
	_tmp19_ = name;
	clocks_content_item_set_name ((ClocksContentItem*) alarm, _tmp19_);
	_tmp20_ = time;
	clocks_alarm_item_set_time (alarm, &_tmp20_);
	_tmp21_ = days;
	clocks_alarm_item_set_days (alarm, _tmp21_);
	_tmp22_ = snooze_item;
	_tmp23_ = clocks_alarm_duration_get_minutes (_tmp22_);
	_tmp24_ = _tmp23_;
	clocks_alarm_item_set_snooze_minutes (alarm, _tmp24_);
	_tmp25_ = ring_item;
	_tmp26_ = clocks_alarm_duration_get_minutes (_tmp25_);
	_tmp27_ = _tmp26_;
	clocks_alarm_item_set_ring_minutes (alarm, _tmp27_);
	_tmp30_ = self->priv->_sound;
	if (_tmp30_ != NULL) {
		ClocksSound* _tmp31_;
		GFile* _tmp32_;
		GFile* _tmp33_;
		_tmp31_ = self->priv->_sound;
		_tmp32_ = clocks_sound_get_file (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp29_ = _tmp33_ != NULL;
	} else {
		_tmp29_ = FALSE;
	}
	if (_tmp29_) {
		ClocksSound* _tmp34_;
		GFile* _tmp35_;
		GFile* _tmp36_;
		GFile* _tmp37_;
		_tmp34_ = self->priv->_sound;
		_tmp35_ = clocks_sound_get_file (_tmp34_);
		_tmp36_ = _tmp35_;
		_tmp37_ = _g_object_ref0 (_tmp36_);
		_g_object_unref0 (_tmp28_);
		_tmp28_ = _tmp37_;
	} else {
		GFile* _tmp38_;
		_tmp38_ = clocks_alarm_sound_model_build_default_file ();
		_g_object_unref0 (_tmp28_);
		_tmp28_ = _tmp38_;
	}
	clocks_alarm_item_set_sound_file (alarm, _tmp28_);
	clocks_alarm_item_reset (alarm);
	g_object_thaw_notify ((GObject*) alarm);
	_g_object_unref0 (_tmp28_);
	_clocks_utils_weekdays_unref0 (days);
	_g_object_unref0 (ring_item);
	_g_object_unref0 (snooze_item);
	_g_free0 (name);
}

static void
clocks_alarm_setup_dialog_avoid_duplicate_alarm (ClocksAlarmSetupDialog* self)
{
	ClocksAlarmItem* alarm = NULL;
	ClocksAlarmItem* _tmp0_;
	gboolean duplicate = FALSE;
	GList* _tmp1_;
	GtkButton* _tmp2_;
	AdwBanner* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = clocks_alarm_item_new (NULL);
	alarm = _tmp0_;
	clocks_alarm_setup_dialog_apply_to_alarm (self, alarm);
	_tmp1_ = self->priv->other_alarms;
	duplicate = clocks_alarm_item_check_duplicate_alarm (alarm, _tmp1_);
	_tmp2_ = self->priv->ok_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, !duplicate);
	_tmp3_ = self->priv->banner;
	adw_banner_set_revealed (_tmp3_, duplicate);
	_g_object_unref0 (alarm);
}

static void
clocks_alarm_setup_dialog_update_accessibility (ClocksAlarmSetupDialog* self)
{
	const gchar* _tmp0_ = NULL;
	ClocksSound* _tmp1_;
	AdwActionRow* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_sound;
	if (_tmp1_ != NULL) {
		ClocksSound* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp2_ = self->priv->_sound;
		_tmp3_ = clocks_sound_get_label (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = "";
	}
	_tmp5_ = self->priv->sound_row;
	gtk_accessible_update_property ((GtkAccessible*) _tmp5_, GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT, _tmp0_, -1);
}

static void
clocks_alarm_setup_dialog_days_changed (ClocksAlarmSetupDialog* self)
{
	g_return_if_fail (self != NULL);
	clocks_alarm_setup_dialog_avoid_duplicate_alarm (self);
}

static void
_clocks_alarm_setup_dialog_days_changed_clocks_alarm_day_picker_row_days_changed (ClocksAlarmDayPickerRow* _sender,
                                                                                  gpointer self)
{
	clocks_alarm_setup_dialog_days_changed ((ClocksAlarmSetupDialog*) self);
}

static void
clocks_alarm_setup_dialog_entry_changed (ClocksAlarmSetupDialog* self,
                                         GtkEditable* editable)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (editable != NULL);
	clocks_alarm_setup_dialog_avoid_duplicate_alarm (self);
}

static void
_clocks_alarm_setup_dialog_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                               gpointer self)
{
	clocks_alarm_setup_dialog_entry_changed ((ClocksAlarmSetupDialog*) self, _sender);
}

static void
clocks_alarm_setup_dialog_spinbuttons_changed (ClocksAlarmSetupDialog* self,
                                               GtkEditable* editable)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (editable != NULL);
	clocks_alarm_setup_dialog_avoid_duplicate_alarm (self);
}

static void
_clocks_alarm_setup_dialog_spinbuttons_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender,
                                                                              gpointer self)
{
	clocks_alarm_setup_dialog_spinbuttons_changed ((ClocksAlarmSetupDialog*) self, _sender);
}

static gboolean
clocks_alarm_setup_dialog_show_leading_zeros (ClocksAlarmSetupDialog* self,
                                              GtkSpinButton* spin_button)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (spin_button != NULL, FALSE);
	_tmp0_ = g_strdup_printf ("%02i", gtk_spin_button_get_value_as_int (spin_button));
	_tmp1_ = _tmp0_;
	gtk_editable_set_text ((GtkEditable*) spin_button, _tmp1_);
	_g_free0 (_tmp1_);
	result = TRUE;
	return result;
}

static gboolean
_clocks_alarm_setup_dialog_show_leading_zeros_gtk_spin_button_output (GtkSpinButton* _sender,
                                                                      gpointer self)
{
	gboolean result;
	result = clocks_alarm_setup_dialog_show_leading_zeros ((ClocksAlarmSetupDialog*) self, _sender);
	return result;
}

static void
clocks_alarm_setup_dialog_delete (ClocksAlarmSetupDialog* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, clocks_alarm_setup_dialog_signals[CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_SIGNAL], 0, CLOCKS_ALARM_DELETE_ALARM);
}

static void
_clocks_alarm_setup_dialog_delete_adw_button_row_activated (AdwButtonRow* _sender,
                                                            gpointer self)
{
	clocks_alarm_setup_dialog_delete ((ClocksAlarmSetupDialog*) self);
}

static void
clocks_alarm_setup_dialog_add (ClocksAlarmSetupDialog* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, clocks_alarm_setup_dialog_signals[CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_SIGNAL], 0, CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_ADD);
}

static void
_clocks_alarm_setup_dialog_add_gtk_button_clicked (GtkButton* _sender,
                                                   gpointer self)
{
	clocks_alarm_setup_dialog_add ((ClocksAlarmSetupDialog*) self);
}

static void
clocks_alarm_setup_dialog_cancel (ClocksAlarmSetupDialog* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, clocks_alarm_setup_dialog_signals[CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_SIGNAL], 0, CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_CANCEL);
}

static void
_clocks_alarm_setup_dialog_cancel_gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	clocks_alarm_setup_dialog_cancel ((ClocksAlarmSetupDialog*) self);
}

ClocksSound*
clocks_alarm_setup_dialog_get_sound (ClocksAlarmSetupDialog* self)
{
	ClocksSound* result;
	ClocksSound* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sound;
	result = _tmp0_;
	return result;
}

void
clocks_alarm_setup_dialog_set_sound (ClocksAlarmSetupDialog* self,
                                     ClocksSound* value)
{
	ClocksSound* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_alarm_setup_dialog_get_sound (self);
	if (old_value != value) {
		ClocksSound* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sound);
		self->priv->_sound = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_alarm_setup_dialog_properties[CLOCKS_ALARM_SETUP_DIALOG_SOUND_PROPERTY]);
	}
}

static void
_clocks_alarm_setup_dialog___lambda80_ (ClocksAlarmSetupDialog* self)
{
	clocks_alarm_setup_dialog_update_accessibility (self);
}

static void
__clocks_alarm_setup_dialog___lambda80__g_object_notify (GObject* _sender,
                                                         GParamSpec* pspec,
                                                         gpointer self)
{
	_clocks_alarm_setup_dialog___lambda80_ ((ClocksAlarmSetupDialog*) self);
}

static GObject *
clocks_alarm_setup_dialog_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ClocksAlarmSetupDialog * self;
	parent_class = G_OBJECT_CLASS (clocks_alarm_setup_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_ALARM_TYPE_SETUP_DIALOG, ClocksAlarmSetupDialog);
	g_signal_connect_object ((GObject*) self, "notify::sound", (GCallback) __clocks_alarm_setup_dialog___lambda80__g_object_notify, self, 0);
	clocks_alarm_setup_dialog_update_accessibility (self);
	return obj;
}

static void
clocks_alarm_setup_dialog_class_init (ClocksAlarmSetupDialogClass * klass,
                                      gpointer klass_data)
{
	clocks_alarm_setup_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksAlarmSetupDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_alarm_setup_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_alarm_setup_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = clocks_alarm_setup_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = clocks_alarm_setup_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_ALARM_SETUP_DIALOG_SOUND_PROPERTY, clocks_alarm_setup_dialog_properties[CLOCKS_ALARM_SETUP_DIALOG_SOUND_PROPERTY] = g_param_spec_object ("sound", "sound", "sound", CLOCKS_TYPE_SOUND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/clocks/ui/alarm-setup-dialog.ui");
	clocks_alarm_setup_dialog_signals[CLOCKS_ALARM_SETUP_DIALOG_RESPONSE_SIGNAL] = g_signal_new ("response", CLOCKS_ALARM_TYPE_SETUP_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__ENUM, G_TYPE_NONE, 1, CLOCKS_ALARM_SETUP_DIALOG_TYPE_RESPONSE);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "time_box", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, time_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "h_spinbutton", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, h_spinbutton));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "m_spinbutton", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, m_spinbutton));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "name_entry", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, name_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sound_row", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, sound_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "snooze_duration", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, snooze_duration));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "ring_duration", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, ring_duration));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "repeats", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, repeats));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "am_pm_bin", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, am_pm_bin));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "banner", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, banner));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "delete_group", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, delete_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "ok_button", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, ok_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sound_chooser", FALSE, ClocksAlarmSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksAlarmSetupDialogPrivate, sound_chooser));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "days_changed", G_CALLBACK(_clocks_alarm_setup_dialog_days_changed_clocks_alarm_day_picker_row_days_changed));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "entry_changed", G_CALLBACK(_clocks_alarm_setup_dialog_entry_changed_gtk_editable_changed));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "spinbuttons_changed", G_CALLBACK(_clocks_alarm_setup_dialog_spinbuttons_changed_gtk_spin_button_value_changed));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "show_leading_zeros", G_CALLBACK(_clocks_alarm_setup_dialog_show_leading_zeros_gtk_spin_button_output));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "delete", G_CALLBACK(_clocks_alarm_setup_dialog_delete_adw_button_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "add", G_CALLBACK(_clocks_alarm_setup_dialog_add_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "cancel", G_CALLBACK(_clocks_alarm_setup_dialog_cancel_gtk_button_clicked));
	g_type_ensure (CLOCKS_ALARM_TYPE_DAY_PICKER_ROW);
	g_type_ensure (CLOCKS_ALARM_TYPE_DURATION);
	g_type_ensure (CLOCKS_TYPE_SOUND_CHOOSER);
	g_type_ensure (CLOCKS_ALARM_TYPE_SOUND_MODEL);
}

static void
clocks_alarm_setup_dialog_instance_init (ClocksAlarmSetupDialog * self,
                                         gpointer klass)
{
	self->priv = clocks_alarm_setup_dialog_get_instance_private (self);
	g_type_ensure (CLOCKS_ALARM_TYPE_DAY_PICKER_ROW);
	g_type_ensure (CLOCKS_TYPE_SOUND_CHOOSER);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
clocks_alarm_setup_dialog_finalize (GObject * obj)
{
	ClocksAlarmSetupDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_ALARM_TYPE_SETUP_DIALOG, ClocksAlarmSetupDialog);
	_g_object_unref0 (self->priv->_sound);
	_g_object_unref0 (self->priv->am_pm_button);
	(self->priv->other_alarms == NULL) ? NULL : (self->priv->other_alarms = (_g_list_free__g_object_unref0_ (self->priv->other_alarms), NULL));
	_g_object_unref0 (self->priv->duration_model);
	G_OBJECT_CLASS (clocks_alarm_setup_dialog_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_alarm_setup_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksAlarmSetupDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_alarm_setup_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksAlarmSetupDialog), 0, (GInstanceInitFunc) clocks_alarm_setup_dialog_instance_init, NULL };
	GType clocks_alarm_setup_dialog_type_id;
	clocks_alarm_setup_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "ClocksAlarmSetupDialog", &g_define_type_info, 0);
	ClocksAlarmSetupDialog_private_offset = g_type_add_instance_private (clocks_alarm_setup_dialog_type_id, sizeof (ClocksAlarmSetupDialogPrivate));
	return clocks_alarm_setup_dialog_type_id;
}

GType
clocks_alarm_setup_dialog_get_type (void)
{
	static gsize clocks_alarm_setup_dialog_type_id__once = 0;
	if (g_once_init_enter (&clocks_alarm_setup_dialog_type_id__once)) {
		GType clocks_alarm_setup_dialog_type_id;
		clocks_alarm_setup_dialog_type_id = clocks_alarm_setup_dialog_get_type_once ();
		g_once_init_leave (&clocks_alarm_setup_dialog_type_id__once, clocks_alarm_setup_dialog_type_id);
	}
	return clocks_alarm_setup_dialog_type_id__once;
}

static void
_vala_clocks_alarm_setup_dialog_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	ClocksAlarmSetupDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_ALARM_TYPE_SETUP_DIALOG, ClocksAlarmSetupDialog);
	switch (property_id) {
		case CLOCKS_ALARM_SETUP_DIALOG_SOUND_PROPERTY:
		g_value_set_object (value, clocks_alarm_setup_dialog_get_sound (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_alarm_setup_dialog_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	ClocksAlarmSetupDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_ALARM_TYPE_SETUP_DIALOG, ClocksAlarmSetupDialog);
	switch (property_id) {
		case CLOCKS_ALARM_SETUP_DIALOG_SOUND_PROPERTY:
		clocks_alarm_setup_dialog_set_sound (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

