/* libretro-title.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from libretro-title.vala, do not modify */

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

#include "games-libretro-plugin.h"
#include <retro-gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "gnome-games.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_LIBRETRO_TITLE_0_PROPERTY,
	GAMES_LIBRETRO_TITLE_NUM_PROPERTIES
};
static GParamSpec* games_libretro_title_properties[GAMES_LIBRETRO_TITLE_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 _GamesLibretroTitlePrivate {
	RetroCoreDescriptor* core_descriptor;
};

static gint GamesLibretroTitle_private_offset;
static gpointer games_libretro_title_parent_class = NULL;
static GamesTitleIface * games_libretro_title_games_title_parent_iface = NULL;
static GType games_libretro_title_type_id = 0;

static gchar* games_libretro_title_real_get_title (GamesTitle* base,
                                            GError** error);
static void games_libretro_title_finalize (GObject * obj);

static inline gpointer
games_libretro_title_get_instance_private (GamesLibretroTitle* self)
{
	return G_STRUCT_MEMBER_P (self, GamesLibretroTitle_private_offset);
}

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

GamesLibretroTitle*
games_libretro_title_construct (GType object_type,
                                RetroCoreDescriptor* core_descriptor)
{
	GamesLibretroTitle * self = NULL;
	RetroCoreDescriptor* _tmp0_;
	g_return_val_if_fail (core_descriptor != NULL, NULL);
	self = (GamesLibretroTitle*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (core_descriptor);
	_g_object_unref0 (self->priv->core_descriptor);
	self->priv->core_descriptor = _tmp0_;
	return self;
}

GamesLibretroTitle*
games_libretro_title_new (RetroCoreDescriptor* core_descriptor)
{
	return games_libretro_title_construct (GAMES_TYPE_LIBRETRO_TITLE, core_descriptor);
}

static gchar*
games_libretro_title_real_get_title (GamesTitle* base,
                                     GError** error)
{
	GamesLibretroTitle * self;
	gchar* _tmp0_ = NULL;
	RetroCoreDescriptor* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	self = (GamesLibretroTitle*) base;
	_tmp1_ = self->priv->core_descriptor;
	_tmp2_ = retro_core_descriptor_get_name (_tmp1_, &_inner_error0_);
	_tmp0_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp3_;
	_g_free0 (_tmp0_);
	return result;
}

static void
games_libretro_title_class_init (GamesLibretroTitleClass * klass,
                                 gpointer klass_data)
{
	games_libretro_title_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesLibretroTitle_private_offset);
	G_OBJECT_CLASS (klass)->finalize = games_libretro_title_finalize;
}

static void
games_libretro_title_games_title_interface_init (GamesTitleIface * iface,
                                                 gpointer iface_data)
{
	games_libretro_title_games_title_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_title = (gchar* (*) (GamesTitle*, GError**)) games_libretro_title_real_get_title;
}

static void
games_libretro_title_instance_init (GamesLibretroTitle * self,
                                    gpointer klass)
{
	self->priv = games_libretro_title_get_instance_private (self);
}

static void
games_libretro_title_finalize (GObject * obj)
{
	GamesLibretroTitle * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_LIBRETRO_TITLE, GamesLibretroTitle);
	_g_object_unref0 (self->priv->core_descriptor);
	G_OBJECT_CLASS (games_libretro_title_parent_class)->finalize (obj);
}

GType
games_libretro_title_get_type (void)
{
	return games_libretro_title_type_id;
}

GType
games_libretro_title_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesLibretroTitleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_libretro_title_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesLibretroTitle), 0, (GInstanceInitFunc) games_libretro_title_instance_init, NULL };
	static const GInterfaceInfo games_title_info = { (GInterfaceInitFunc) games_libretro_title_games_title_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_libretro_title_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesLibretroTitle", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_libretro_title_type_id, GAMES_TYPE_TITLE, &games_title_info);
	GamesLibretroTitle_private_offset = sizeof (GamesLibretroTitlePrivate);
	return games_libretro_title_type_id;
}

