/* sound.c generated by valac 0.56.19, the Vala compiler
 * generated from sound.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 <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.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
#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 (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 struct _ClocksSoundPrivate ClocksSoundPrivate;
enum  {
	CLOCKS_SOUND_0_PROPERTY,
	CLOCKS_SOUND_FILE_PROPERTY,
	CLOCKS_SOUND_URI_PROPERTY,
	CLOCKS_SOUND_LABEL_PROPERTY,
	CLOCKS_SOUND_NUM_PROPERTIES
};
static GParamSpec* clocks_sound_properties[CLOCKS_SOUND_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))
#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 _ClocksSound {
	GObject parent_instance;
	ClocksSoundPrivate * priv;
};

struct _ClocksSoundClass {
	GObjectClass parent_class;
};

struct _ClocksSoundPrivate {
	GFile* _file;
	gchar* _uri;
	gchar* _label;
};

static gint ClocksSound_private_offset;
static gpointer clocks_sound_parent_class = NULL;

VALA_EXTERN GType clocks_sound_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksSound, g_object_unref)
VALA_EXTERN ClocksSound* clocks_sound_new (GFile* file,
                               const gchar* label);
VALA_EXTERN ClocksSound* clocks_sound_construct (GType object_type,
                                     GFile* file,
                                     const gchar* label);
VALA_EXTERN GFile* clocks_sound_get_file (ClocksSound* self);
static void clocks_sound_set_file (ClocksSound* self,
                            GFile* value);
VALA_EXTERN const gchar* clocks_sound_get_uri (ClocksSound* self);
static void clocks_sound_set_uri (ClocksSound* self,
                           const gchar* value);
VALA_EXTERN const gchar* clocks_sound_get_label (ClocksSound* self);
static void clocks_sound_set_label (ClocksSound* self,
                             const gchar* value);
static GObject * clocks_sound_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void clocks_sound_finalize (GObject * obj);
static GType clocks_sound_get_type_once (void);
static void _vala_clocks_sound_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_clocks_sound_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);

static inline gpointer
clocks_sound_get_instance_private (ClocksSound* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksSound_private_offset);
}

ClocksSound*
clocks_sound_construct (GType object_type,
                        GFile* file,
                        const gchar* label)
{
	ClocksSound * self = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (ClocksSound*) g_object_new (object_type, "file", file, "label", label, NULL);
	return self;
}

ClocksSound*
clocks_sound_new (GFile* file,
                  const gchar* label)
{
	return clocks_sound_construct (CLOCKS_TYPE_SOUND, file, label);
}

GFile*
clocks_sound_get_file (ClocksSound* self)
{
	GFile* result;
	GFile* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file;
	result = _tmp0_;
	return result;
}

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

static void
clocks_sound_set_file (ClocksSound* self,
                       GFile* value)
{
	GFile* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_get_file (self);
	if (old_value != value) {
		GFile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_file);
		self->priv->_file = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_sound_properties[CLOCKS_SOUND_FILE_PROPERTY]);
	}
}

const gchar*
clocks_sound_get_uri (ClocksSound* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_uri;
	result = _tmp0_;
	return result;
}

static void
clocks_sound_set_uri (ClocksSound* self,
                      const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_get_uri (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_uri);
		self->priv->_uri = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_sound_properties[CLOCKS_SOUND_URI_PROPERTY]);
	}
}

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

static void
clocks_sound_set_label (ClocksSound* self,
                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_sound_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_sound_properties[CLOCKS_SOUND_LABEL_PROPERTY]);
	}
}

static GObject *
clocks_sound_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ClocksSound * self;
	GFile* _tmp0_;
	const gchar* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp9_;
	parent_class = G_OBJECT_CLASS (clocks_sound_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_SOUND, ClocksSound);
	_tmp0_ = self->priv->_file;
	_tmp1_ = self->priv->_uri;
	_vala_assert ((_tmp0_ != NULL) ^ (_tmp1_ != NULL), "(file != null) ^ (uri != null)");
	_tmp2_ = self->priv->_file;
	if (_tmp2_ != NULL) {
		GFile* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = self->priv->_file;
		_tmp4_ = g_file_get_uri (_tmp3_);
		_tmp5_ = _tmp4_;
		clocks_sound_set_uri (self, _tmp5_);
		_g_free0 (_tmp5_);
	} else {
		const gchar* _tmp6_;
		GFile* _tmp7_;
		GFile* _tmp8_;
		_tmp6_ = self->priv->_uri;
		_tmp7_ = g_file_new_for_uri (_tmp6_);
		_tmp8_ = _tmp7_;
		clocks_sound_set_file (self, _tmp8_);
		_g_object_unref0 (_tmp8_);
	}
	_tmp9_ = self->priv->_file;
	if (!g_file_query_exists (_tmp9_, NULL)) {
		const gchar* _tmp10_;
		_tmp10_ = self->priv->_uri;
		g_critical ("sound.vala:36: Sound file '%s' not found.", _tmp10_);
	}
	return obj;
}

static void
clocks_sound_class_init (ClocksSoundClass * klass,
                         gpointer klass_data)
{
	clocks_sound_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksSound_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_sound_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_sound_set_property;
	G_OBJECT_CLASS (klass)->constructor = clocks_sound_constructor;
	G_OBJECT_CLASS (klass)->finalize = clocks_sound_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_SOUND_FILE_PROPERTY, clocks_sound_properties[CLOCKS_SOUND_FILE_PROPERTY] = g_param_spec_object ("file", "file", "file", g_file_get_type (), 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_URI_PROPERTY, clocks_sound_properties[CLOCKS_SOUND_URI_PROPERTY] = g_param_spec_string ("uri", "uri", "uri", NULL, 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_LABEL_PROPERTY, clocks_sound_properties[CLOCKS_SOUND_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
clocks_sound_instance_init (ClocksSound * self,
                            gpointer klass)
{
	gchar* _tmp0_;
	self->priv = clocks_sound_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_label = _tmp0_;
}

static void
clocks_sound_finalize (GObject * obj)
{
	ClocksSound * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_SOUND, ClocksSound);
	_g_object_unref0 (self->priv->_file);
	_g_free0 (self->priv->_uri);
	_g_free0 (self->priv->_label);
	G_OBJECT_CLASS (clocks_sound_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_sound_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksSoundClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_sound_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksSound), 0, (GInstanceInitFunc) clocks_sound_instance_init, NULL };
	GType clocks_sound_type_id;
	clocks_sound_type_id = g_type_register_static (G_TYPE_OBJECT, "ClocksSound", &g_define_type_info, 0);
	ClocksSound_private_offset = g_type_add_instance_private (clocks_sound_type_id, sizeof (ClocksSoundPrivate));
	return clocks_sound_type_id;
}

GType
clocks_sound_get_type (void)
{
	static gsize clocks_sound_type_id__once = 0;
	if (g_once_init_enter (&clocks_sound_type_id__once)) {
		GType clocks_sound_type_id;
		clocks_sound_type_id = clocks_sound_get_type_once ();
		g_once_init_leave (&clocks_sound_type_id__once, clocks_sound_type_id);
	}
	return clocks_sound_type_id__once;
}

static void
_vala_clocks_sound_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	ClocksSound * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_SOUND, ClocksSound);
	switch (property_id) {
		case CLOCKS_SOUND_FILE_PROPERTY:
		g_value_set_object (value, clocks_sound_get_file (self));
		break;
		case CLOCKS_SOUND_URI_PROPERTY:
		g_value_set_string (value, clocks_sound_get_uri (self));
		break;
		case CLOCKS_SOUND_LABEL_PROPERTY:
		g_value_set_string (value, clocks_sound_get_label (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_sound_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	ClocksSound * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_TYPE_SOUND, ClocksSound);
	switch (property_id) {
		case CLOCKS_SOUND_FILE_PROPERTY:
		clocks_sound_set_file (self, g_value_get_object (value));
		break;
		case CLOCKS_SOUND_URI_PROPERTY:
		clocks_sound_set_uri (self, g_value_get_string (value));
		break;
		case CLOCKS_SOUND_LABEL_PROPERTY:
		clocks_sound_set_label (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

