/* sound-chooser-row.c generated by valac 0.56.19, the Vala compiler
 * generated from sound-chooser-row.vala, do not modify */

/*
 * Copyright (C) 2025  Adrien Plazas <aplazas@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 <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.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
#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_TYPE_SOUND_CHOOSER_ROW (clocks_sound_chooser_row_get_type ())
#define CLOCKS_SOUND_CHOOSER_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRow))
#define CLOCKS_SOUND_CHOOSER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRowClass))
#define CLOCKS_IS_SOUND_CHOOSER_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_SOUND_CHOOSER_ROW))
#define CLOCKS_IS_SOUND_CHOOSER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_SOUND_CHOOSER_ROW))
#define CLOCKS_SOUND_CHOOSER_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRowClass))

typedef struct _ClocksSoundChooserRow ClocksSoundChooserRow;
typedef struct _ClocksSoundChooserRowClass ClocksSoundChooserRowClass;
typedef struct _ClocksSoundChooserRowPrivate ClocksSoundChooserRowPrivate;

#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;
enum  {
	CLOCKS_SOUND_CHOOSER_ROW_0_PROPERTY,
	CLOCKS_SOUND_CHOOSER_ROW_SOUND_PROPERTY,
	CLOCKS_SOUND_CHOOSER_ROW_RINGING_PROPERTY,
	CLOCKS_SOUND_CHOOSER_ROW_SELECTED_PROPERTY,
	CLOCKS_SOUND_CHOOSER_ROW_NUM_PROPERTIES
};
static GParamSpec* clocks_sound_chooser_row_properties[CLOCKS_SOUND_CHOOSER_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ClocksSoundChooserRow {
	AdwActionRow parent_instance;
	ClocksSoundChooserRowPrivate * priv;
};

struct _ClocksSoundChooserRowClass {
	AdwActionRowClass parent_class;
};

struct _ClocksSoundChooserRowPrivate {
	ClocksSound* _sound;
	gboolean _ringing;
	gboolean _selected;
};

static gint ClocksSoundChooserRow_private_offset;
static gpointer clocks_sound_chooser_row_parent_class = NULL;

VALA_EXTERN GType clocks_sound_chooser_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksSoundChooserRow, 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 ClocksSoundChooserRow* clocks_sound_chooser_row_new (ClocksSound* sound);
VALA_EXTERN ClocksSoundChooserRow* clocks_sound_chooser_row_construct (GType object_type,
                                                           ClocksSound* sound);
static void clocks_sound_chooser_row_update_accessibility (ClocksSoundChooserRow* self);
VALA_EXTERN gboolean clocks_sound_chooser_row_get_selected (ClocksSoundChooserRow* self);
VALA_EXTERN gboolean clocks_sound_chooser_row_get_ringing (ClocksSoundChooserRow* self);
VALA_EXTERN ClocksSound* clocks_sound_chooser_row_get_sound (ClocksSoundChooserRow* self);
static void clocks_sound_chooser_row_set_sound (ClocksSoundChooserRow* self,
                                         ClocksSound* value);
VALA_EXTERN void clocks_sound_chooser_row_set_ringing (ClocksSoundChooserRow* self,
                                           gboolean value);
VALA_EXTERN void clocks_sound_chooser_row_set_selected (ClocksSoundChooserRow* self,
                                            gboolean value);
static GObject * clocks_sound_chooser_row_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _clocks_sound_chooser_row___lambda72_ (ClocksSoundChooserRow* self);
static void __clocks_sound_chooser_row___lambda72__g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self);
static void _clocks_sound_chooser_row___lambda73_ (ClocksSoundChooserRow* self);
static void __clocks_sound_chooser_row___lambda73__g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self);
static void clocks_sound_chooser_row_finalize (GObject * obj);
static GType clocks_sound_chooser_row_get_type_once (void);
static void _vala_clocks_sound_chooser_row_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_clocks_sound_chooser_row_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);

static inline gpointer
clocks_sound_chooser_row_get_instance_private (ClocksSoundChooserRow* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksSoundChooserRow_private_offset);
}

ClocksSoundChooserRow*
clocks_sound_chooser_row_construct (GType object_type,
                                    ClocksSound* sound)
{
	ClocksSoundChooserRow * self = NULL;
	g_return_val_if_fail (sound != NULL, NULL);
	self = (ClocksSoundChooserRow*) g_object_new (object_type, "sound", sound, NULL);
	return self;
}

ClocksSoundChooserRow*
clocks_sound_chooser_row_new (ClocksSound* sound)
{
	return clocks_sound_chooser_row_construct (CLOCKS_TYPE_SOUND_CHOOSER_ROW, sound);
}

static void
clocks_sound_chooser_row_update_accessibility (ClocksSoundChooserRow* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_selected;
	if (_tmp0_) {
		gboolean _tmp1_;
		gboolean _tmp2_;
		_tmp1_ = self->priv->_ringing;
		_tmp2_ = self->priv->_selected;
		gtk_accessible_update_state ((GtkAccessible*) self, GTK_ACCESSIBLE_STATE_CHECKED, _tmp1_, GTK_ACCESSIBLE_STATE_SELECTED, _tmp2_, -1);
	} else {
		gboolean _tmp3_;
		gtk_accessible_reset_state ((GtkAccessible*) self, GTK_ACCESSIBLE_STATE_CHECKED);
		_tmp3_ = self->priv->_selected;
		gtk_accessible_update_state ((GtkAccessible*) self, GTK_ACCESSIBLE_STATE_SELECTED, _tmp3_, -1);
	}
}

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

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

static void
clocks_sound_chooser_row_set_sound (ClocksSoundChooserRow* self,
                                    ClocksSound* value)
{
	ClocksSound* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_chooser_row_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_sound_chooser_row_properties[CLOCKS_SOUND_CHOOSER_ROW_SOUND_PROPERTY]);
	}
}

gboolean
clocks_sound_chooser_row_get_ringing (ClocksSoundChooserRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_ringing;
	return result;
}

void
clocks_sound_chooser_row_set_ringing (ClocksSoundChooserRow* self,
                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_chooser_row_get_ringing (self);
	if (old_value != value) {
		self->priv->_ringing = value;
		g_object_notify_by_pspec ((GObject *) self, clocks_sound_chooser_row_properties[CLOCKS_SOUND_CHOOSER_ROW_RINGING_PROPERTY]);
	}
}

gboolean
clocks_sound_chooser_row_get_selected (ClocksSoundChooserRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_selected;
	return result;
}

void
clocks_sound_chooser_row_set_selected (ClocksSoundChooserRow* self,
                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_chooser_row_get_selected (self);
	if (old_value != value) {
		self->priv->_selected = value;
		g_object_notify_by_pspec ((GObject *) self, clocks_sound_chooser_row_properties[CLOCKS_SOUND_CHOOSER_ROW_SELECTED_PROPERTY]);
	}
}

static void
_clocks_sound_chooser_row___lambda72_ (ClocksSoundChooserRow* self)
{
	clocks_sound_chooser_row_update_accessibility (self);
}

static void
__clocks_sound_chooser_row___lambda72__g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self)
{
	_clocks_sound_chooser_row___lambda72_ ((ClocksSoundChooserRow*) self);
}

static void
_clocks_sound_chooser_row___lambda73_ (ClocksSoundChooserRow* self)
{
	clocks_sound_chooser_row_update_accessibility (self);
}

static void
__clocks_sound_chooser_row___lambda73__g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self)
{
	_clocks_sound_chooser_row___lambda73_ ((ClocksSoundChooserRow*) self);
}

static GObject *
clocks_sound_chooser_row_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ClocksSoundChooserRow * self;
	parent_class = G_OBJECT_CLASS (clocks_sound_chooser_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRow);
	g_signal_connect_object ((GObject*) self, "notify::ringing", (GCallback) __clocks_sound_chooser_row___lambda72__g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::selected", (GCallback) __clocks_sound_chooser_row___lambda73__g_object_notify, self, 0);
	clocks_sound_chooser_row_update_accessibility (self);
	return obj;
}

static void
clocks_sound_chooser_row_class_init (ClocksSoundChooserRowClass * klass,
                                     gpointer klass_data)
{
	clocks_sound_chooser_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksSoundChooserRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_sound_chooser_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_sound_chooser_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = clocks_sound_chooser_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = clocks_sound_chooser_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_SOUND_CHOOSER_ROW_SOUND_PROPERTY, clocks_sound_chooser_row_properties[CLOCKS_SOUND_CHOOSER_ROW_SOUND_PROPERTY] = g_param_spec_object ("sound", "sound", "sound", CLOCKS_TYPE_SOUND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_SOUND_CHOOSER_ROW_RINGING_PROPERTY, clocks_sound_chooser_row_properties[CLOCKS_SOUND_CHOOSER_ROW_RINGING_PROPERTY] = g_param_spec_boolean ("ringing", "ringing", "ringing", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_SOUND_CHOOSER_ROW_SELECTED_PROPERTY, clocks_sound_chooser_row_properties[CLOCKS_SOUND_CHOOSER_ROW_SELECTED_PROPERTY] = g_param_spec_boolean ("selected", "selected", "selected", FALSE, 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/sound-chooser-row.ui");
}

static void
clocks_sound_chooser_row_instance_init (ClocksSoundChooserRow * self,
                                        gpointer klass)
{
	self->priv = clocks_sound_chooser_row_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
clocks_sound_chooser_row_finalize (GObject * obj)
{
	ClocksSoundChooserRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRow);
	_g_object_unref0 (self->priv->_sound);
	G_OBJECT_CLASS (clocks_sound_chooser_row_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_sound_chooser_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksSoundChooserRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_sound_chooser_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksSoundChooserRow), 0, (GInstanceInitFunc) clocks_sound_chooser_row_instance_init, NULL };
	GType clocks_sound_chooser_row_type_id;
	clocks_sound_chooser_row_type_id = g_type_register_static (adw_action_row_get_type (), "ClocksSoundChooserRow", &g_define_type_info, 0);
	ClocksSoundChooserRow_private_offset = g_type_add_instance_private (clocks_sound_chooser_row_type_id, sizeof (ClocksSoundChooserRowPrivate));
	return clocks_sound_chooser_row_type_id;
}

GType
clocks_sound_chooser_row_get_type (void)
{
	static gsize clocks_sound_chooser_row_type_id__once = 0;
	if (g_once_init_enter (&clocks_sound_chooser_row_type_id__once)) {
		GType clocks_sound_chooser_row_type_id;
		clocks_sound_chooser_row_type_id = clocks_sound_chooser_row_get_type_once ();
		g_once_init_leave (&clocks_sound_chooser_row_type_id__once, clocks_sound_chooser_row_type_id);
	}
	return clocks_sound_chooser_row_type_id__once;
}

static void
_vala_clocks_sound_chooser_row_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	ClocksSoundChooserRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRow);
	switch (property_id) {
		case CLOCKS_SOUND_CHOOSER_ROW_SOUND_PROPERTY:
		g_value_set_object (value, clocks_sound_chooser_row_get_sound (self));
		break;
		case CLOCKS_SOUND_CHOOSER_ROW_RINGING_PROPERTY:
		g_value_set_boolean (value, clocks_sound_chooser_row_get_ringing (self));
		break;
		case CLOCKS_SOUND_CHOOSER_ROW_SELECTED_PROPERTY:
		g_value_set_boolean (value, clocks_sound_chooser_row_get_selected (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_sound_chooser_row_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	ClocksSoundChooserRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_SOUND_CHOOSER_ROW, ClocksSoundChooserRow);
	switch (property_id) {
		case CLOCKS_SOUND_CHOOSER_ROW_SOUND_PROPERTY:
		clocks_sound_chooser_row_set_sound (self, g_value_get_object (value));
		break;
		case CLOCKS_SOUND_CHOOSER_ROW_RINGING_PROPERTY:
		clocks_sound_chooser_row_set_ringing (self, g_value_get_boolean (value));
		break;
		case CLOCKS_SOUND_CHOOSER_ROW_SELECTED_PROPERTY:
		clocks_sound_chooser_row_set_selected (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

