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

/* TimerBreakView.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 "daemon.h"
#include <glib-object.h>
#include <glib.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_DAEMON_TIMER_BREAK_TIMER_BREAK_VIEW_0_PROPERTY,
	BREAK_TIMER_DAEMON_TIMER_BREAK_TIMER_BREAK_VIEW_TIMER_BREAK_PROPERTY,
	BREAK_TIMER_DAEMON_TIMER_BREAK_TIMER_BREAK_VIEW_NUM_PROPERTIES
};
static GParamSpec* break_timer_daemon_timer_break_timer_break_view_properties[BREAK_TIMER_DAEMON_TIMER_BREAK_TIMER_BREAK_VIEW_NUM_PROPERTIES];

static gpointer break_timer_daemon_timer_break_timer_break_view_parent_class = NULL;

static GType break_timer_daemon_timer_break_timer_break_view_get_type_once (void);
static void _vala_break_timer_daemon_timer_break_timer_break_view_get_property (GObject * object,
                                                                         guint property_id,
                                                                         GValue * value,
                                                                         GParamSpec * pspec);

BreakTimerDaemonTimerBreakTimerBreakView*
break_timer_daemon_timer_break_timer_break_view_construct (GType object_type,
                                                           BreakTimerDaemonTimerBreakTimerBreakController* timer_break,
                                                           BreakTimerDaemonUIManager* ui_manager)
{
	BreakTimerDaemonTimerBreakTimerBreakView * self = NULL;
	g_return_val_if_fail (timer_break != NULL, NULL);
	g_return_val_if_fail (ui_manager != NULL, NULL);
	self = (BreakTimerDaemonTimerBreakTimerBreakView*) break_timer_daemon_break_break_view_construct (object_type, (BreakTimerDaemonBreakBreakController*) timer_break, ui_manager);
	return self;
}

gint
break_timer_daemon_timer_break_timer_break_view_get_lead_in_seconds (BreakTimerDaemonTimerBreakTimerBreakView* self)
{
	gint lead_in = 0;
	BreakTimerDaemonTimerBreakTimerBreakController* _tmp0_;
	BreakTimerDaemonTimerBreakTimerBreakController* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = break_timer_daemon_timer_break_timer_break_view_get_timer_break (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = break_timer_daemon_timer_break_timer_break_controller_get_duration (_tmp1_);
	_tmp3_ = _tmp2_;
	lead_in = _tmp3_ + 3;
	if (lead_in > 40) {
		lead_in = 40;
	} else {
		if (lead_in < 15) {
			lead_in = 15;
		}
	}
	result = lead_in;
	return result;
}

BreakTimerDaemonTimerBreakTimerBreakController*
break_timer_daemon_timer_break_timer_break_view_get_timer_break (BreakTimerDaemonTimerBreakTimerBreakView* self)
{
	BreakTimerDaemonTimerBreakTimerBreakController* result;
	BreakTimerDaemonBreakBreakController* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = ((BreakTimerDaemonBreakBreakView*) self)->break_controller;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, BREAK_TIMER_DAEMON_TIMER_BREAK_TYPE_TIMER_BREAK_CONTROLLER, BreakTimerDaemonTimerBreakTimerBreakController);
	return result;
}

static void
break_timer_daemon_timer_break_timer_break_view_class_init (BreakTimerDaemonTimerBreakTimerBreakViewClass * klass,
                                                            gpointer klass_data)
{
	break_timer_daemon_timer_break_timer_break_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_break_timer_daemon_timer_break_timer_break_view_get_property;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_DAEMON_TIMER_BREAK_TIMER_BREAK_VIEW_TIMER_BREAK_PROPERTY, break_timer_daemon_timer_break_timer_break_view_properties[BREAK_TIMER_DAEMON_TIMER_BREAK_TIMER_BREAK_VIEW_TIMER_BREAK_PROPERTY] = g_param_spec_object ("timer-break", "timer-break", "timer-break", BREAK_TIMER_DAEMON_TIMER_BREAK_TYPE_TIMER_BREAK_CONTROLLER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
break_timer_daemon_timer_break_timer_break_view_instance_init (BreakTimerDaemonTimerBreakTimerBreakView * self,
                                                               gpointer klass)
{
}

static GType
break_timer_daemon_timer_break_timer_break_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BreakTimerDaemonTimerBreakTimerBreakViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) break_timer_daemon_timer_break_timer_break_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BreakTimerDaemonTimerBreakTimerBreakView), 0, (GInstanceInitFunc) break_timer_daemon_timer_break_timer_break_view_instance_init, NULL };
	GType break_timer_daemon_timer_break_timer_break_view_type_id;
	break_timer_daemon_timer_break_timer_break_view_type_id = g_type_register_static (BREAK_TIMER_DAEMON_BREAK_TYPE_BREAK_VIEW, "BreakTimerDaemonTimerBreakTimerBreakView", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	return break_timer_daemon_timer_break_timer_break_view_type_id;
}

GType
break_timer_daemon_timer_break_timer_break_view_get_type (void)
{
	static volatile gsize break_timer_daemon_timer_break_timer_break_view_type_id__once = 0;
	if (g_once_init_enter (&break_timer_daemon_timer_break_timer_break_view_type_id__once)) {
		GType break_timer_daemon_timer_break_timer_break_view_type_id;
		break_timer_daemon_timer_break_timer_break_view_type_id = break_timer_daemon_timer_break_timer_break_view_get_type_once ();
		g_once_init_leave (&break_timer_daemon_timer_break_timer_break_view_type_id__once, break_timer_daemon_timer_break_timer_break_view_type_id);
	}
	return break_timer_daemon_timer_break_timer_break_view_type_id__once;
}

static void
_vala_break_timer_daemon_timer_break_timer_break_view_get_property (GObject * object,
                                                                    guint property_id,
                                                                    GValue * value,
                                                                    GParamSpec * pspec)
{
	BreakTimerDaemonTimerBreakTimerBreakView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BREAK_TIMER_DAEMON_TIMER_BREAK_TYPE_TIMER_BREAK_VIEW, BreakTimerDaemonTimerBreakTimerBreakView);
	switch (property_id) {
		case BREAK_TIMER_DAEMON_TIMER_BREAK_TIMER_BREAK_VIEW_TIMER_BREAK_PROPERTY:
		g_value_set_object (value, break_timer_daemon_timer_break_timer_break_view_get_timer_break (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

