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

/* BreakInfoWidget.vala
 *
 * Copyright 2020-2021 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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <adwaita.h>
#include <gtk/gtk.h>
#include <glib-object.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_BREAK_BREAK_INFO_WIDGET_0_PROPERTY,
	BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_BREAK_TYPE_PROPERTY,
	BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_TITLE_PROPERTY,
	BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_NUM_PROPERTIES
};
static GParamSpec* break_timer_settings_break_break_info_widget_properties[BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _BreakTimerSettingsBreakBreakInfoWidgetPrivate {
	BreakTimerSettingsBreakBreakType* _break_type;
	gchar* _title;
	AdwStatusPage* status_page;
	GtkLabel* detail_label;
};

static gint BreakTimerSettingsBreakBreakInfoWidget_private_offset;
static gpointer break_timer_settings_break_break_info_widget_parent_class = NULL;

static void break_timer_settings_break_break_info_widget_set_break_type (BreakTimerSettingsBreakBreakInfoWidget* self,
                                                                  BreakTimerSettingsBreakBreakType* value);
static void break_timer_settings_break_break_info_widget_set_title (BreakTimerSettingsBreakBreakInfoWidget* self,
                                                             const gchar* value);
static void break_timer_settings_break_break_info_widget_finalize (GObject * obj);
static GType break_timer_settings_break_break_info_widget_get_type_once (void);
static void _vala_break_timer_settings_break_break_info_widget_get_property (GObject * object,
                                                                      guint property_id,
                                                                      GValue * value,
                                                                      GParamSpec * pspec);
static void _vala_break_timer_settings_break_break_info_widget_set_property (GObject * object,
                                                                      guint property_id,
                                                                      const GValue * value,
                                                                      GParamSpec * pspec);

static inline gpointer
break_timer_settings_break_break_info_widget_get_instance_private (BreakTimerSettingsBreakBreakInfoWidget* self)
{
	return G_STRUCT_MEMBER_P (self, BreakTimerSettingsBreakBreakInfoWidget_private_offset);
}

BreakTimerSettingsBreakBreakInfoWidget*
break_timer_settings_break_break_info_widget_construct (GType object_type,
                                                        BreakTimerSettingsBreakBreakType* break_type,
                                                        const gchar* title)
{
	BreakTimerSettingsBreakBreakInfoWidget * self = NULL;
	AdwStatusPage* _tmp0_;
	AdwStatusPage* _tmp1_;
	AdwStatusPage* _tmp2_;
	AdwStatusPage* _tmp3_;
	GtkLabel* _tmp4_;
	AdwStatusPage* _tmp5_;
	GtkLabel* _tmp6_;
	g_return_val_if_fail (break_type != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	self = (BreakTimerSettingsBreakBreakInfoWidget*) g_object_new (object_type, NULL);
	break_timer_settings_break_break_info_widget_set_break_type (self, break_type);
	break_timer_settings_break_break_info_widget_set_title (self, title);
	_tmp0_ = (AdwStatusPage*) adw_status_page_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->status_page);
	self->priv->status_page = _tmp0_;
	_tmp1_ = self->priv->status_page;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp1_);
	_tmp2_ = self->priv->status_page;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	_tmp3_ = self->priv->status_page;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->detail_label);
	self->priv->detail_label = _tmp4_;
	_tmp5_ = self->priv->status_page;
	_tmp6_ = self->priv->detail_label;
	adw_status_page_set_child (_tmp5_, (GtkWidget*) _tmp6_);
	gtk_widget_show ((GtkWidget*) self);
	return self;
}

void
break_timer_settings_break_break_info_widget_set_heading (BreakTimerSettingsBreakBreakInfoWidget* self,
                                                          const gchar* heading)
{
	AdwStatusPage* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (heading != NULL);
	_tmp0_ = self->priv->status_page;
	adw_status_page_set_title (_tmp0_, heading);
}

void
break_timer_settings_break_break_info_widget_set_description (BreakTimerSettingsBreakBreakInfoWidget* self,
                                                              const gchar* description)
{
	AdwStatusPage* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (description != NULL);
	_tmp0_ = self->priv->status_page;
	adw_status_page_set_description (_tmp0_, description);
}

void
break_timer_settings_break_break_info_widget_set_detail (BreakTimerSettingsBreakBreakInfoWidget* self,
                                                         const gchar* detail)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (detail != NULL);
	_tmp0_ = self->priv->detail_label;
	gtk_label_set_label (_tmp0_, detail);
}

BreakTimerSettingsBreakBreakType*
break_timer_settings_break_break_info_widget_get_break_type (BreakTimerSettingsBreakBreakInfoWidget* self)
{
	BreakTimerSettingsBreakBreakType* result;
	BreakTimerSettingsBreakBreakType* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_break_type;
	result = _tmp0_;
	return result;
}

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

static void
break_timer_settings_break_break_info_widget_set_break_type (BreakTimerSettingsBreakBreakInfoWidget* self,
                                                             BreakTimerSettingsBreakBreakType* value)
{
	BreakTimerSettingsBreakBreakType* old_value;
	g_return_if_fail (self != NULL);
	old_value = break_timer_settings_break_break_info_widget_get_break_type (self);
	if (old_value != value) {
		BreakTimerSettingsBreakBreakType* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_break_type);
		self->priv->_break_type = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, break_timer_settings_break_break_info_widget_properties[BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_BREAK_TYPE_PROPERTY]);
	}
}

const gchar*
break_timer_settings_break_break_info_widget_get_title (BreakTimerSettingsBreakBreakInfoWidget* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}

static void
break_timer_settings_break_break_info_widget_set_title (BreakTimerSettingsBreakBreakInfoWidget* self,
                                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = break_timer_settings_break_break_info_widget_get_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_title);
		self->priv->_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, break_timer_settings_break_break_info_widget_properties[BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_TITLE_PROPERTY]);
	}
}

static void
break_timer_settings_break_break_info_widget_class_init (BreakTimerSettingsBreakBreakInfoWidgetClass * klass,
                                                         gpointer klass_data)
{
	break_timer_settings_break_break_info_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BreakTimerSettingsBreakBreakInfoWidget_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_break_timer_settings_break_break_info_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_break_timer_settings_break_break_info_widget_set_property;
	G_OBJECT_CLASS (klass)->finalize = break_timer_settings_break_break_info_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_BREAK_TYPE_PROPERTY, break_timer_settings_break_break_info_widget_properties[BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_BREAK_TYPE_PROPERTY] = g_param_spec_object ("break-type", "break-type", "break-type", BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_TYPE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_TITLE_PROPERTY, break_timer_settings_break_break_info_widget_properties[BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
break_timer_settings_break_break_info_widget_instance_init (BreakTimerSettingsBreakBreakInfoWidget * self,
                                                            gpointer klass)
{
	self->priv = break_timer_settings_break_break_info_widget_get_instance_private (self);
}

static void
break_timer_settings_break_break_info_widget_finalize (GObject * obj)
{
	BreakTimerSettingsBreakBreakInfoWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_INFO_WIDGET, BreakTimerSettingsBreakBreakInfoWidget);
	_g_object_unref0 (self->priv->_break_type);
	_g_free0 (self->priv->_title);
	_g_object_unref0 (self->priv->status_page);
	_g_object_unref0 (self->priv->detail_label);
	G_OBJECT_CLASS (break_timer_settings_break_break_info_widget_parent_class)->finalize (obj);
}

static GType
break_timer_settings_break_break_info_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BreakTimerSettingsBreakBreakInfoWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) break_timer_settings_break_break_info_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BreakTimerSettingsBreakBreakInfoWidget), 0, (GInstanceInitFunc) break_timer_settings_break_break_info_widget_instance_init, NULL };
	GType break_timer_settings_break_break_info_widget_type_id;
	break_timer_settings_break_break_info_widget_type_id = g_type_register_static (gtk_box_get_type (), "BreakTimerSettingsBreakBreakInfoWidget", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	BreakTimerSettingsBreakBreakInfoWidget_private_offset = g_type_add_instance_private (break_timer_settings_break_break_info_widget_type_id, sizeof (BreakTimerSettingsBreakBreakInfoWidgetPrivate));
	return break_timer_settings_break_break_info_widget_type_id;
}

GType
break_timer_settings_break_break_info_widget_get_type (void)
{
	static volatile gsize break_timer_settings_break_break_info_widget_type_id__once = 0;
	if (g_once_init_enter (&break_timer_settings_break_break_info_widget_type_id__once)) {
		GType break_timer_settings_break_break_info_widget_type_id;
		break_timer_settings_break_break_info_widget_type_id = break_timer_settings_break_break_info_widget_get_type_once ();
		g_once_init_leave (&break_timer_settings_break_break_info_widget_type_id__once, break_timer_settings_break_break_info_widget_type_id);
	}
	return break_timer_settings_break_break_info_widget_type_id__once;
}

static void
_vala_break_timer_settings_break_break_info_widget_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec)
{
	BreakTimerSettingsBreakBreakInfoWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_INFO_WIDGET, BreakTimerSettingsBreakBreakInfoWidget);
	switch (property_id) {
		case BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_BREAK_TYPE_PROPERTY:
		g_value_set_object (value, break_timer_settings_break_break_info_widget_get_break_type (self));
		break;
		case BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_TITLE_PROPERTY:
		g_value_set_string (value, break_timer_settings_break_break_info_widget_get_title (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_break_timer_settings_break_break_info_widget_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec)
{
	BreakTimerSettingsBreakBreakInfoWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BREAK_TIMER_SETTINGS_BREAK_TYPE_BREAK_INFO_WIDGET, BreakTimerSettingsBreakBreakInfoWidget);
	switch (property_id) {
		case BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_BREAK_TYPE_PROPERTY:
		break_timer_settings_break_break_info_widget_set_break_type (self, g_value_get_object (value));
		break;
		case BREAK_TIMER_SETTINGS_BREAK_BREAK_INFO_WIDGET_TITLE_PROPERTY:
		break_timer_settings_break_break_info_widget_set_title (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

