/* cue-sheet-file-node.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from cue-sheet-file-node.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include "gnome-games.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.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  {
	GAMES_CUE_SHEET_FILE_NODE_0_PROPERTY,
	GAMES_CUE_SHEET_FILE_NODE_FILE_NAME_PROPERTY,
	GAMES_CUE_SHEET_FILE_NODE_FILE_FORMAT_PROPERTY,
	GAMES_CUE_SHEET_FILE_NODE_FILE_PROPERTY,
	GAMES_CUE_SHEET_FILE_NODE_NUM_PROPERTIES
};
static GParamSpec* games_cue_sheet_file_node_properties[GAMES_CUE_SHEET_FILE_NODE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesCueSheetFileNodePrivate {
	gchar* _file_name;
	GamesCueSheetFileFormat _file_format;
	GFile* _file;
};

static gint GamesCueSheetFileNode_private_offset;
static gpointer games_cue_sheet_file_node_parent_class = NULL;

static void games_cue_sheet_file_node_finalize (GObject * obj);
static GType games_cue_sheet_file_node_get_type_once (void);
static void _vala_games_cue_sheet_file_node_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_games_cue_sheet_file_node_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_cue_sheet_file_node_get_instance_private (GamesCueSheetFileNode* self)
{
	return G_STRUCT_MEMBER_P (self, GamesCueSheetFileNode_private_offset);
}

GamesCueSheetFileNode*
games_cue_sheet_file_node_construct (GType object_type,
                                     GFile* file,
                                     GamesCueSheetFileFormat file_format)
{
	GamesCueSheetFileNode * self = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	self = (GamesCueSheetFileNode*) g_object_new (object_type, "file", file, "file-format", file_format, NULL);
	return self;
}

GamesCueSheetFileNode*
games_cue_sheet_file_node_new (GFile* file,
                               GamesCueSheetFileFormat file_format)
{
	return games_cue_sheet_file_node_construct (GAMES_TYPE_CUE_SHEET_FILE_NODE, file, file_format);
}

const gchar*
games_cue_sheet_file_node_get_file_name (GamesCueSheetFileNode* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file_name;
	result = _tmp0_;
	return result;
}

static void
games_cue_sheet_file_node_set_file_name (GamesCueSheetFileNode* self,
                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_cue_sheet_file_node_get_file_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_file_name);
		self->priv->_file_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, games_cue_sheet_file_node_properties[GAMES_CUE_SHEET_FILE_NODE_FILE_NAME_PROPERTY]);
	}
}

GamesCueSheetFileFormat
games_cue_sheet_file_node_get_file_format (GamesCueSheetFileNode* self)
{
	GamesCueSheetFileFormat result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_file_format;
	return result;
}

static void
games_cue_sheet_file_node_set_file_format (GamesCueSheetFileNode* self,
                                           GamesCueSheetFileFormat value)
{
	GamesCueSheetFileFormat old_value;
	g_return_if_fail (self != NULL);
	old_value = games_cue_sheet_file_node_get_file_format (self);
	if (old_value != value) {
		self->priv->_file_format = value;
		g_object_notify_by_pspec ((GObject *) self, games_cue_sheet_file_node_properties[GAMES_CUE_SHEET_FILE_NODE_FILE_FORMAT_PROPERTY]);
	}
}

GFile*
games_cue_sheet_file_node_get_file (GamesCueSheetFileNode* 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
games_cue_sheet_file_node_set_file (GamesCueSheetFileNode* self,
                                    GFile* value)
{
	GFile* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_cue_sheet_file_node_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, games_cue_sheet_file_node_properties[GAMES_CUE_SHEET_FILE_NODE_FILE_PROPERTY]);
	}
}

static void
games_cue_sheet_file_node_class_init (GamesCueSheetFileNodeClass * klass,
                                      gpointer klass_data)
{
	games_cue_sheet_file_node_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesCueSheetFileNode_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_cue_sheet_file_node_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_cue_sheet_file_node_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_cue_sheet_file_node_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_CUE_SHEET_FILE_NODE_FILE_NAME_PROPERTY, games_cue_sheet_file_node_properties[GAMES_CUE_SHEET_FILE_NODE_FILE_NAME_PROPERTY] = g_param_spec_string ("file-name", "file-name", "file-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_CUE_SHEET_FILE_NODE_FILE_FORMAT_PROPERTY, games_cue_sheet_file_node_properties[GAMES_CUE_SHEET_FILE_NODE_FILE_FORMAT_PROPERTY] = g_param_spec_enum ("file-format", "file-format", "file-format", GAMES_TYPE_CUE_SHEET_FILE_FORMAT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_CUE_SHEET_FILE_NODE_FILE_PROPERTY, games_cue_sheet_file_node_properties[GAMES_CUE_SHEET_FILE_NODE_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));
}

static void
games_cue_sheet_file_node_instance_init (GamesCueSheetFileNode * self,
                                         gpointer klass)
{
	self->priv = games_cue_sheet_file_node_get_instance_private (self);
}

static void
games_cue_sheet_file_node_finalize (GObject * obj)
{
	GamesCueSheetFileNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_CUE_SHEET_FILE_NODE, GamesCueSheetFileNode);
	_g_free0 (self->priv->_file_name);
	_g_object_unref0 (self->priv->_file);
	G_OBJECT_CLASS (games_cue_sheet_file_node_parent_class)->finalize (obj);
}

static GType
games_cue_sheet_file_node_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesCueSheetFileNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_cue_sheet_file_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesCueSheetFileNode), 0, (GInstanceInitFunc) games_cue_sheet_file_node_instance_init, NULL };
	GType games_cue_sheet_file_node_type_id;
	games_cue_sheet_file_node_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesCueSheetFileNode", &g_define_type_info, 0);
	GamesCueSheetFileNode_private_offset = g_type_add_instance_private (games_cue_sheet_file_node_type_id, sizeof (GamesCueSheetFileNodePrivate));
	return games_cue_sheet_file_node_type_id;
}

GType
games_cue_sheet_file_node_get_type (void)
{
	static volatile gsize games_cue_sheet_file_node_type_id__once = 0;
	if (g_once_init_enter (&games_cue_sheet_file_node_type_id__once)) {
		GType games_cue_sheet_file_node_type_id;
		games_cue_sheet_file_node_type_id = games_cue_sheet_file_node_get_type_once ();
		g_once_init_leave (&games_cue_sheet_file_node_type_id__once, games_cue_sheet_file_node_type_id);
	}
	return games_cue_sheet_file_node_type_id__once;
}

static void
_vala_games_cue_sheet_file_node_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	GamesCueSheetFileNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_CUE_SHEET_FILE_NODE, GamesCueSheetFileNode);
	switch (property_id) {
		case GAMES_CUE_SHEET_FILE_NODE_FILE_NAME_PROPERTY:
		g_value_set_string (value, games_cue_sheet_file_node_get_file_name (self));
		break;
		case GAMES_CUE_SHEET_FILE_NODE_FILE_FORMAT_PROPERTY:
		g_value_set_enum (value, games_cue_sheet_file_node_get_file_format (self));
		break;
		case GAMES_CUE_SHEET_FILE_NODE_FILE_PROPERTY:
		g_value_set_object (value, games_cue_sheet_file_node_get_file (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_cue_sheet_file_node_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	GamesCueSheetFileNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_CUE_SHEET_FILE_NODE, GamesCueSheetFileNode);
	switch (property_id) {
		case GAMES_CUE_SHEET_FILE_NODE_FILE_NAME_PROPERTY:
		games_cue_sheet_file_node_set_file_name (self, g_value_get_string (value));
		break;
		case GAMES_CUE_SHEET_FILE_NODE_FILE_FORMAT_PROPERTY:
		games_cue_sheet_file_node_set_file_format (self, g_value_get_enum (value));
		break;
		case GAMES_CUE_SHEET_FILE_NODE_FILE_PROPERTY:
		games_cue_sheet_file_node_set_file (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

