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

/* TimerBreakType.vala
 *
 * Copyright 2020 Dylan McCall <dylan@dylanmccall.ca>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "settings.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include "common.h"
#include <gio/gio.h>
#include "config.h"

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

enum  {
	BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_0_PROPERTY,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_TIME_SECONDS_PROPERTY,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_IS_CUSTOM_PROPERTY,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_LABEL_PROPERTY,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_NUM_PROPERTIES
};
static GParamSpec* break_timer_settings_timer_break_break_time_option_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_0_PROPERTY,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_INTERVAL_PROPERTY,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_DURATION_PROPERTY,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_NUM_PROPERTIES
};
static GParamSpec* break_timer_settings_timer_break_timer_break_type_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_TIMER_STATUS_CHANGED_SIGNAL,
	BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_NUM_SIGNALS
};
static guint break_timer_settings_timer_break_timer_break_type_signals[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_NUM_SIGNALS] = {0};

struct _BreakTimerSettingsTimerBreakBreakTimeOptionPrivate {
	gint _time_seconds;
	gboolean _is_custom;
	gchar* _label;
};

struct _BreakTimerSettingsTimerBreakTimerBreakTypePrivate {
	gint _interval;
	gint _duration;
	GDBusConnection* dbus_connection;
	BreakTimerCommonIBreakTimer_TimerBreak* break_server;
	guint update_timeout_id;
};

static gint BreakTimerSettingsTimerBreakBreakTimeOption_private_offset;
static gpointer break_timer_settings_timer_break_break_time_option_parent_class = NULL;
static gint BreakTimerSettingsTimerBreakTimerBreakType_private_offset;
static gpointer break_timer_settings_timer_break_timer_break_type_parent_class = NULL;

static void break_timer_settings_timer_break_break_time_option_finalize (GObject * obj);
static GType break_timer_settings_timer_break_break_time_option_get_type_once (void);
static void _vala_break_timer_settings_timer_break_break_time_option_get_property (GObject * object,
                                                                            guint property_id,
                                                                            GValue * value,
                                                                            GParamSpec * pspec);
static void _vala_break_timer_settings_timer_break_break_time_option_set_property (GObject * object,
                                                                            guint property_id,
                                                                            const GValue * value,
                                                                            GParamSpec * pspec);
static gboolean break_timer_settings_timer_break_timer_break_type_real_init (BreakTimerSettingsBreakBreakType* base,
                                                                      GCancellable* cancellable,
                                                                      GError** error);
static void break_timer_settings_timer_break_timer_break_type_breakdaemon_appeared (BreakTimerSettingsTimerBreakTimerBreakType* self);
static void _break_timer_settings_timer_break_timer_break_type_breakdaemon_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                                          const gchar* name,
                                                                                                          const gchar* name_owner,
                                                                                                          gpointer self);
static void break_timer_settings_timer_break_timer_break_type_breakdaemon_disappeared (BreakTimerSettingsTimerBreakTimerBreakType* self);
static void _break_timer_settings_timer_break_timer_break_type_breakdaemon_disappeared_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                                             const gchar* name,
                                                                                                             gpointer self);
static gboolean break_timer_settings_timer_break_timer_break_type_update_status_cb (BreakTimerSettingsTimerBreakTimerBreakType* self);
static BreakTimerCommonTimerBreakStatus* break_timer_settings_timer_break_timer_break_type_get_status (BreakTimerSettingsTimerBreakTimerBreakType* self);
static BreakTimerCommonTimerBreakStatus* _break_timer_common_timer_break_status_dup (BreakTimerCommonTimerBreakStatus* self);
static gboolean _break_timer_settings_timer_break_timer_break_type_update_status_cb_gsource_func (gpointer self);
static void break_timer_settings_timer_break_timer_break_type_finalize (GObject * obj);
static GType break_timer_settings_timer_break_timer_break_type_get_type_once (void);
static void _vala_break_timer_settings_timer_break_timer_break_type_get_property (GObject * object,
                                                                           guint property_id,
                                                                           GValue * value,
                                                                           GParamSpec * pspec);
static void _vala_break_timer_settings_timer_break_timer_break_type_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
break_timer_settings_timer_break_break_time_option_get_instance_private (BreakTimerSettingsTimerBreakBreakTimeOption* self)
{
	return G_STRUCT_MEMBER_P (self, BreakTimerSettingsTimerBreakBreakTimeOption_private_offset);
}

BreakTimerSettingsTimerBreakBreakTimeOption*
break_timer_settings_timer_break_break_time_option_construct (GType object_type,
                                                              gint time_seconds)
{
	BreakTimerSettingsTimerBreakBreakTimeOption * self = NULL;
	BreakTimerCommonNaturalTime* _tmp0_;
	BreakTimerCommonNaturalTime* _tmp1_;
	gint _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	self = (BreakTimerSettingsTimerBreakBreakTimeOption*) g_object_new (object_type, NULL);
	break_timer_settings_timer_break_break_time_option_set_time_seconds (self, time_seconds);
	_tmp0_ = break_timer_common_natural_time_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_time_seconds;
	_tmp3_ = break_timer_common_natural_time_get_label_for_seconds (_tmp1_, _tmp2_, NULL);
	_tmp4_ = _tmp3_;
	break_timer_settings_timer_break_break_time_option_set_label (self, _tmp4_);
	_g_free0 (_tmp4_);
	return self;
}

BreakTimerSettingsTimerBreakBreakTimeOption*
break_timer_settings_timer_break_break_time_option_new (gint time_seconds)
{
	return break_timer_settings_timer_break_break_time_option_construct (BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_BREAK_TIME_OPTION, time_seconds);
}

gboolean
break_timer_settings_timer_break_break_time_option_equals (BreakTimerSettingsTimerBreakBreakTimeOption* self,
                                                           BreakTimerSettingsTimerBreakBreakTimeOption* other)
{
	gint _tmp0_;
	gint _tmp1_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (other != NULL, FALSE);
	_tmp0_ = self->priv->_time_seconds;
	_tmp1_ = other->priv->_time_seconds;
	result = _tmp0_ == _tmp1_;
	return result;
}

gint
break_timer_settings_timer_break_break_time_option_get_time_seconds (BreakTimerSettingsTimerBreakBreakTimeOption* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_time_seconds;
	return result;
}

void
break_timer_settings_timer_break_break_time_option_set_time_seconds (BreakTimerSettingsTimerBreakBreakTimeOption* self,
                                                                     gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = break_timer_settings_timer_break_break_time_option_get_time_seconds (self);
	if (old_value != value) {
		self->priv->_time_seconds = value;
		g_object_notify_by_pspec ((GObject *) self, break_timer_settings_timer_break_break_time_option_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_TIME_SECONDS_PROPERTY]);
	}
}

gboolean
break_timer_settings_timer_break_break_time_option_get_is_custom (BreakTimerSettingsTimerBreakBreakTimeOption* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_custom;
	return result;
}

void
break_timer_settings_timer_break_break_time_option_set_is_custom (BreakTimerSettingsTimerBreakBreakTimeOption* self,
                                                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = break_timer_settings_timer_break_break_time_option_get_is_custom (self);
	if (old_value != value) {
		self->priv->_is_custom = value;
		g_object_notify_by_pspec ((GObject *) self, break_timer_settings_timer_break_break_time_option_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_IS_CUSTOM_PROPERTY]);
	}
}

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

void
break_timer_settings_timer_break_break_time_option_set_label (BreakTimerSettingsTimerBreakBreakTimeOption* self,
                                                              const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = break_timer_settings_timer_break_break_time_option_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, break_timer_settings_timer_break_break_time_option_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_LABEL_PROPERTY]);
	}
}

static void
break_timer_settings_timer_break_break_time_option_class_init (BreakTimerSettingsTimerBreakBreakTimeOptionClass * klass,
                                                               gpointer klass_data)
{
	break_timer_settings_timer_break_break_time_option_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BreakTimerSettingsTimerBreakBreakTimeOption_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_break_timer_settings_timer_break_break_time_option_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_break_timer_settings_timer_break_break_time_option_set_property;
	G_OBJECT_CLASS (klass)->finalize = break_timer_settings_timer_break_break_time_option_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_TIME_SECONDS_PROPERTY, break_timer_settings_timer_break_break_time_option_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_TIME_SECONDS_PROPERTY] = g_param_spec_int ("time-seconds", "time-seconds", "time-seconds", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_IS_CUSTOM_PROPERTY, break_timer_settings_timer_break_break_time_option_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_IS_CUSTOM_PROPERTY] = g_param_spec_boolean ("is-custom", "is-custom", "is-custom", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_LABEL_PROPERTY, break_timer_settings_timer_break_break_time_option_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
break_timer_settings_timer_break_break_time_option_instance_init (BreakTimerSettingsTimerBreakBreakTimeOption * self,
                                                                  gpointer klass)
{
	self->priv = break_timer_settings_timer_break_break_time_option_get_instance_private (self);
	self->priv->_is_custom = FALSE;
}

static void
break_timer_settings_timer_break_break_time_option_finalize (GObject * obj)
{
	BreakTimerSettingsTimerBreakBreakTimeOption * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_BREAK_TIME_OPTION, BreakTimerSettingsTimerBreakBreakTimeOption);
	_g_free0 (self->priv->_label);
	G_OBJECT_CLASS (break_timer_settings_timer_break_break_time_option_parent_class)->finalize (obj);
}

static GType
break_timer_settings_timer_break_break_time_option_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BreakTimerSettingsTimerBreakBreakTimeOptionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) break_timer_settings_timer_break_break_time_option_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BreakTimerSettingsTimerBreakBreakTimeOption), 0, (GInstanceInitFunc) break_timer_settings_timer_break_break_time_option_instance_init, NULL };
	GType break_timer_settings_timer_break_break_time_option_type_id;
	break_timer_settings_timer_break_break_time_option_type_id = g_type_register_static (G_TYPE_OBJECT, "BreakTimerSettingsTimerBreakBreakTimeOption", &g_define_type_info, 0);
	BreakTimerSettingsTimerBreakBreakTimeOption_private_offset = g_type_add_instance_private (break_timer_settings_timer_break_break_time_option_type_id, sizeof (BreakTimerSettingsTimerBreakBreakTimeOptionPrivate));
	return break_timer_settings_timer_break_break_time_option_type_id;
}

GType
break_timer_settings_timer_break_break_time_option_get_type (void)
{
	static volatile gsize break_timer_settings_timer_break_break_time_option_type_id__once = 0;
	if (g_once_init_enter (&break_timer_settings_timer_break_break_time_option_type_id__once)) {
		GType break_timer_settings_timer_break_break_time_option_type_id;
		break_timer_settings_timer_break_break_time_option_type_id = break_timer_settings_timer_break_break_time_option_get_type_once ();
		g_once_init_leave (&break_timer_settings_timer_break_break_time_option_type_id__once, break_timer_settings_timer_break_break_time_option_type_id);
	}
	return break_timer_settings_timer_break_break_time_option_type_id__once;
}

static void
_vala_break_timer_settings_timer_break_break_time_option_get_property (GObject * object,
                                                                       guint property_id,
                                                                       GValue * value,
                                                                       GParamSpec * pspec)
{
	BreakTimerSettingsTimerBreakBreakTimeOption * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_BREAK_TIME_OPTION, BreakTimerSettingsTimerBreakBreakTimeOption);
	switch (property_id) {
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_TIME_SECONDS_PROPERTY:
		g_value_set_int (value, break_timer_settings_timer_break_break_time_option_get_time_seconds (self));
		break;
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_IS_CUSTOM_PROPERTY:
		g_value_set_boolean (value, break_timer_settings_timer_break_break_time_option_get_is_custom (self));
		break;
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_LABEL_PROPERTY:
		g_value_set_string (value, break_timer_settings_timer_break_break_time_option_get_label (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_break_timer_settings_timer_break_break_time_option_set_property (GObject * object,
                                                                       guint property_id,
                                                                       const GValue * value,
                                                                       GParamSpec * pspec)
{
	BreakTimerSettingsTimerBreakBreakTimeOption * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_BREAK_TIME_OPTION, BreakTimerSettingsTimerBreakBreakTimeOption);
	switch (property_id) {
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_TIME_SECONDS_PROPERTY:
		break_timer_settings_timer_break_break_time_option_set_time_seconds (self, g_value_get_int (value));
		break;
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_IS_CUSTOM_PROPERTY:
		break_timer_settings_timer_break_break_time_option_set_is_custom (self, g_value_get_boolean (value));
		break;
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_BREAK_TIME_OPTION_LABEL_PROPERTY:
		break_timer_settings_timer_break_break_time_option_set_label (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
break_timer_settings_timer_break_timer_break_type_get_instance_private (BreakTimerSettingsTimerBreakTimerBreakType* self)
{
	return G_STRUCT_MEMBER_P (self, BreakTimerSettingsTimerBreakTimerBreakType_private_offset);
}

BreakTimerSettingsTimerBreakTimerBreakType*
break_timer_settings_timer_break_timer_break_type_construct (GType object_type,
                                                             const gchar* name,
                                                             GSettings* settings)
{
	BreakTimerSettingsTimerBreakTimerBreakType * self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	self = (BreakTimerSettingsTimerBreakTimerBreakType*) break_timer_settings_break_break_type_construct (object_type, name, settings);
	g_settings_bind (settings, "interval-seconds", (GObject*) self, "interval", G_SETTINGS_BIND_GET);
	g_settings_bind (settings, "duration-seconds", (GObject*) self, "duration", G_SETTINGS_BIND_GET);
	return self;
}

static void
_break_timer_settings_timer_break_timer_break_type_breakdaemon_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                                     const gchar* name,
                                                                                                     const gchar* name_owner,
                                                                                                     gpointer self)
{
	break_timer_settings_timer_break_timer_break_type_breakdaemon_appeared ((BreakTimerSettingsTimerBreakTimerBreakType*) self);
}

static void
_break_timer_settings_timer_break_timer_break_type_breakdaemon_disappeared_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                                        const gchar* name,
                                                                                                        gpointer self)
{
	break_timer_settings_timer_break_timer_break_type_breakdaemon_disappeared ((BreakTimerSettingsTimerBreakTimerBreakType*) self);
}

static gboolean
break_timer_settings_timer_break_timer_break_type_real_init (BreakTimerSettingsBreakBreakType* base,
                                                             GCancellable* cancellable,
                                                             GError** error)
{
	BreakTimerSettingsTimerBreakTimerBreakType * self;
	GDBusConnection* _tmp0_ = NULL;
	GDBusConnection* _tmp1_;
	GDBusConnection* _tmp3_;
	GDBusConnection* _tmp4_;
	gboolean _tmp5_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = (BreakTimerSettingsTimerBreakTimerBreakType*) base;
	_tmp1_ = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, &_inner_error0_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp2_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		return _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	_g_object_unref0 (self->priv->dbus_connection);
	self->priv->dbus_connection = _tmp3_;
	_tmp4_ = self->priv->dbus_connection;
	g_bus_watch_name_on_connection_with_closures (_tmp4_, DAEMON_APPLICATION_ID, G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_break_timer_settings_timer_break_timer_break_type_breakdaemon_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _break_timer_settings_timer_break_timer_break_type_breakdaemon_appeared_gbus_name_appeared_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((_break_timer_settings_timer_break_timer_break_type_breakdaemon_disappeared_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _break_timer_settings_timer_break_timer_break_type_breakdaemon_disappeared_gbus_name_vanished_callback, g_object_ref (self), (GClosureNotify) g_object_unref)));
	_tmp5_ = BREAK_TIMER_SETTINGS_BREAK_BREAK_TYPE_CLASS (break_timer_settings_timer_break_timer_break_type_parent_class)->init (G_TYPE_CHECK_INSTANCE_CAST (self, BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_TYPE, BreakTimerSettingsBreakBreakType), cancellable, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp6_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (_tmp0_);
		return _tmp6_;
	}
	result = _tmp5_;
	_g_object_unref0 (_tmp0_);
	return result;
}

void
break_timer_settings_timer_break_timer_break_type_update_status (BreakTimerSettingsTimerBreakTimerBreakType* self,
                                                                 BreakTimerCommonTimerBreakStatus* status)
{
	g_return_if_fail (self != NULL);
	if (status != NULL) {
		BreakTimerCommonBreakStatus _tmp0_ = {0};
		memset (&_tmp0_, 0, sizeof (BreakTimerCommonBreakStatus));
		_tmp0_.is_enabled = (*status).is_enabled;
		_tmp0_.is_focused = (*status).is_focused;
		_tmp0_.is_active = (*status).is_active;
		break_timer_settings_break_break_type_update_status (G_TYPE_CHECK_INSTANCE_CAST (self, BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_TYPE, BreakTimerSettingsBreakBreakType), &_tmp0_);
	} else {
		break_timer_settings_break_break_type_update_status (G_TYPE_CHECK_INSTANCE_CAST (self, BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_TYPE, BreakTimerSettingsBreakBreakType), NULL);
	}
	g_signal_emit (self, break_timer_settings_timer_break_timer_break_type_signals[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_TIMER_STATUS_CHANGED_SIGNAL], 0, status);
}

static gboolean
break_timer_settings_timer_break_timer_break_type_update_status_cb (BreakTimerSettingsTimerBreakTimerBreakType* self)
{
	BreakTimerCommonTimerBreakStatus* status = NULL;
	BreakTimerCommonTimerBreakStatus* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = break_timer_settings_timer_break_timer_break_type_get_status (self);
	status = _tmp0_;
	break_timer_settings_timer_break_timer_break_type_update_status (self, status);
	result = G_SOURCE_CONTINUE;
	_g_free0 (status);
	return result;
}

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

static gpointer
__break_timer_common_timer_break_status_dup0 (gpointer self)
{
	return self ? _break_timer_common_timer_break_status_dup (self) : NULL;
}

static BreakTimerCommonTimerBreakStatus*
break_timer_settings_timer_break_timer_break_type_get_status (BreakTimerSettingsTimerBreakTimerBreakType* self)
{
	BreakTimerCommonIBreakTimer_TimerBreak* _tmp0_;
	GError* _inner_error0_ = NULL;
	BreakTimerCommonTimerBreakStatus* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->break_server;
	if (_tmp0_ != NULL) {
		{
			BreakTimerCommonTimerBreakStatus _tmp1_ = {0};
			BreakTimerCommonIBreakTimer_TimerBreak* _tmp2_;
			BreakTimerCommonTimerBreakStatus _tmp3_ = {0};
			BreakTimerCommonTimerBreakStatus* _tmp4_;
			_tmp2_ = self->priv->break_server;
			break_timer_common_ibreaktimer_timerbreak_get_status (_tmp2_, &_tmp3_, &_inner_error0_);
			_tmp1_ = _tmp3_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == G_IO_ERROR) {
					goto __catch0_g_io_error;
				}
				if (_inner_error0_->domain == G_DBUS_ERROR) {
					goto __catch0_g_dbus_error;
				}
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return NULL;
			}
			_tmp4_ = __break_timer_common_timer_break_status_dup0 (&_tmp1_);
			result = _tmp4_;
			return result;
		}
		goto __finally0;
		__catch0_g_io_error:
		{
			GError* _error_ = NULL;
			GError* _tmp5_;
			const gchar* _tmp6_;
			_error_ = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp5_ = _error_;
			_tmp6_ = _tmp5_->message;
			g_warning ("TimerBreakType.vala:98: Error connecting to break daemon service: %s", _tmp6_);
			result = NULL;
			_g_error_free0 (_error_);
			return result;
		}
		goto __finally0;
		__catch0_g_dbus_error:
		{
			GError* _error_ = NULL;
			GError* _tmp7_;
			const gchar* _tmp8_;
			_error_ = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp7_ = _error_;
			_tmp8_ = _tmp7_->message;
			g_warning ("TimerBreakType.vala:105: Error getting break status: %s", _tmp8_);
			result = NULL;
			_g_error_free0 (_error_);
			return result;
		}
		__finally0:
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	} else {
		result = NULL;
		return result;
	}
}

static gboolean
_break_timer_settings_timer_break_timer_break_type_update_status_cb_gsource_func (gpointer self)
{
	gboolean result;
	result = break_timer_settings_timer_break_timer_break_type_update_status_cb ((BreakTimerSettingsTimerBreakTimerBreakType*) self);
	return result;
}

static void
break_timer_settings_timer_break_timer_break_type_breakdaemon_appeared (BreakTimerSettingsTimerBreakTimerBreakType* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		BreakTimerCommonIBreakTimer_TimerBreak* _tmp0_ = NULL;
		GDBusConnection* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		BreakTimerCommonIBreakTimer_TimerBreak* _tmp6_;
		BreakTimerCommonIBreakTimer_TimerBreak* _tmp7_;
		BreakTimerCommonIBreakTimer_TimerBreak* _tmp8_;
		_tmp1_ = self->priv->dbus_connection;
		_tmp2_ = break_timer_settings_break_break_type_get_id ((BreakTimerSettingsBreakBreakType*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strconcat (DAEMON_OBJECT_PATH "/", _tmp3_, NULL);
		_tmp5_ = _tmp4_;
		_tmp6_ = (BreakTimerCommonIBreakTimer_TimerBreak*) g_initable_new (BREAK_TIMER_COMMON_TYPE_IBREAKTIMER_TIMERBREAK_PROXY, NULL, &_inner_error0_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, "g-name", DAEMON_APPLICATION_ID, "g-connection", _tmp1_, "g-object-path", _tmp5_, "g-interface-name", "org.gnome.BreakTimer.TimerBreak", NULL);
		_tmp7_ = (BreakTimerCommonIBreakTimer_TimerBreak*) _tmp6_;
		_g_free0 (_tmp5_);
		_tmp0_ = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_IO_ERROR) {
				goto __catch0_g_io_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp8_ = _tmp0_;
		_tmp0_ = NULL;
		_g_object_unref0 (self->priv->break_server);
		self->priv->break_server = _tmp8_;
		self->priv->update_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 500, _break_timer_settings_timer_break_timer_break_type_update_status_cb_gsource_func, g_object_ref (self), g_object_unref);
		break_timer_settings_timer_break_timer_break_type_update_status_cb (self);
		_g_object_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		GError* _error_ = NULL;
		GError* _tmp9_;
		const gchar* _tmp10_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_g_object_unref0 (self->priv->break_server);
		self->priv->break_server = NULL;
		_tmp9_ = _error_;
		_tmp10_ = _tmp9_->message;
		g_warning ("TimerBreakType.vala:126: Error connecting to break daemon service: %s", _tmp10_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
break_timer_settings_timer_break_timer_break_type_breakdaemon_disappeared (BreakTimerSettingsTimerBreakTimerBreakType* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->update_timeout_id > ((guint) 0)) {
		g_source_remove (self->priv->update_timeout_id);
		self->priv->update_timeout_id = (guint) 0;
	}
	_g_object_unref0 (self->priv->break_server);
	self->priv->break_server = NULL;
	break_timer_settings_timer_break_timer_break_type_update_status_cb (self);
}

gint
break_timer_settings_timer_break_timer_break_type_get_interval (BreakTimerSettingsTimerBreakTimerBreakType* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_interval;
	return result;
}

void
break_timer_settings_timer_break_timer_break_type_set_interval (BreakTimerSettingsTimerBreakTimerBreakType* self,
                                                                gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = break_timer_settings_timer_break_timer_break_type_get_interval (self);
	if (old_value != value) {
		self->priv->_interval = value;
		g_object_notify_by_pspec ((GObject *) self, break_timer_settings_timer_break_timer_break_type_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_INTERVAL_PROPERTY]);
	}
}

gint
break_timer_settings_timer_break_timer_break_type_get_duration (BreakTimerSettingsTimerBreakTimerBreakType* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_duration;
	return result;
}

void
break_timer_settings_timer_break_timer_break_type_set_duration (BreakTimerSettingsTimerBreakTimerBreakType* self,
                                                                gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = break_timer_settings_timer_break_timer_break_type_get_duration (self);
	if (old_value != value) {
		self->priv->_duration = value;
		g_object_notify_by_pspec ((GObject *) self, break_timer_settings_timer_break_timer_break_type_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_DURATION_PROPERTY]);
	}
}

static void
break_timer_settings_timer_break_timer_break_type_class_init (BreakTimerSettingsTimerBreakTimerBreakTypeClass * klass,
                                                              gpointer klass_data)
{
	break_timer_settings_timer_break_timer_break_type_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BreakTimerSettingsTimerBreakTimerBreakType_private_offset);
	((BreakTimerSettingsBreakBreakTypeClass *) klass)->init = (gboolean (*) (BreakTimerSettingsBreakBreakType*, GCancellable*, GError**)) break_timer_settings_timer_break_timer_break_type_real_init;
	G_OBJECT_CLASS (klass)->get_property = _vala_break_timer_settings_timer_break_timer_break_type_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_break_timer_settings_timer_break_timer_break_type_set_property;
	G_OBJECT_CLASS (klass)->finalize = break_timer_settings_timer_break_timer_break_type_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_INTERVAL_PROPERTY, break_timer_settings_timer_break_timer_break_type_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_INTERVAL_PROPERTY] = g_param_spec_int ("interval", "interval", "interval", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_DURATION_PROPERTY, break_timer_settings_timer_break_timer_break_type_properties[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_DURATION_PROPERTY] = g_param_spec_int ("duration", "duration", "duration", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	break_timer_settings_timer_break_timer_break_type_signals[BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_TIMER_STATUS_CHANGED_SIGNAL] = g_signal_new ("timer-status-changed", BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_TIMER_BREAK_TYPE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
}

static void
break_timer_settings_timer_break_timer_break_type_instance_init (BreakTimerSettingsTimerBreakTimerBreakType * self,
                                                                 gpointer klass)
{
	self->priv = break_timer_settings_timer_break_timer_break_type_get_instance_private (self);
}

static void
break_timer_settings_timer_break_timer_break_type_finalize (GObject * obj)
{
	BreakTimerSettingsTimerBreakTimerBreakType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_TIMER_BREAK_TYPE, BreakTimerSettingsTimerBreakTimerBreakType);
	self->interval_options = (_vala_array_free (self->interval_options, self->interval_options_length1, (GDestroyNotify) g_object_unref), NULL);
	self->duration_options = (_vala_array_free (self->duration_options, self->duration_options_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (self->priv->dbus_connection);
	_g_object_unref0 (self->priv->break_server);
	G_OBJECT_CLASS (break_timer_settings_timer_break_timer_break_type_parent_class)->finalize (obj);
}

static GType
break_timer_settings_timer_break_timer_break_type_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BreakTimerSettingsTimerBreakTimerBreakTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) break_timer_settings_timer_break_timer_break_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BreakTimerSettingsTimerBreakTimerBreakType), 0, (GInstanceInitFunc) break_timer_settings_timer_break_timer_break_type_instance_init, NULL };
	GType break_timer_settings_timer_break_timer_break_type_type_id;
	break_timer_settings_timer_break_timer_break_type_type_id = g_type_register_static (BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_TYPE, "BreakTimerSettingsTimerBreakTimerBreakType", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	BreakTimerSettingsTimerBreakTimerBreakType_private_offset = g_type_add_instance_private (break_timer_settings_timer_break_timer_break_type_type_id, sizeof (BreakTimerSettingsTimerBreakTimerBreakTypePrivate));
	return break_timer_settings_timer_break_timer_break_type_type_id;
}

GType
break_timer_settings_timer_break_timer_break_type_get_type (void)
{
	static volatile gsize break_timer_settings_timer_break_timer_break_type_type_id__once = 0;
	if (g_once_init_enter (&break_timer_settings_timer_break_timer_break_type_type_id__once)) {
		GType break_timer_settings_timer_break_timer_break_type_type_id;
		break_timer_settings_timer_break_timer_break_type_type_id = break_timer_settings_timer_break_timer_break_type_get_type_once ();
		g_once_init_leave (&break_timer_settings_timer_break_timer_break_type_type_id__once, break_timer_settings_timer_break_timer_break_type_type_id);
	}
	return break_timer_settings_timer_break_timer_break_type_type_id__once;
}

static void
_vala_break_timer_settings_timer_break_timer_break_type_get_property (GObject * object,
                                                                      guint property_id,
                                                                      GValue * value,
                                                                      GParamSpec * pspec)
{
	BreakTimerSettingsTimerBreakTimerBreakType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_TIMER_BREAK_TYPE, BreakTimerSettingsTimerBreakTimerBreakType);
	switch (property_id) {
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_INTERVAL_PROPERTY:
		g_value_set_int (value, break_timer_settings_timer_break_timer_break_type_get_interval (self));
		break;
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_DURATION_PROPERTY:
		g_value_set_int (value, break_timer_settings_timer_break_timer_break_type_get_duration (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_break_timer_settings_timer_break_timer_break_type_set_property (GObject * object,
                                                                      guint property_id,
                                                                      const GValue * value,
                                                                      GParamSpec * pspec)
{
	BreakTimerSettingsTimerBreakTimerBreakType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BREAK_TIMER_SETTINGS_TIMER_BREAK_TYPE_TIMER_BREAK_TYPE, BreakTimerSettingsTimerBreakTimerBreakType);
	switch (property_id) {
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_INTERVAL_PROPERTY:
		break_timer_settings_timer_break_timer_break_type_set_interval (self, g_value_get_int (value));
		break;
		case BREAK_TIMER_SETTINGS_TIMER_BREAK_TIMER_BREAK_TYPE_DURATION_PROPERTY:
		break_timer_settings_timer_break_timer_break_type_set_duration (self, g_value_get_int (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);
}

