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

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

#include <glib.h>
#include <glib-object.h>
#include <libgnome-games.h>
#include <retro-gtk.h>
#include <stdlib.h>
#include <string.h>


#define GAMES_TYPE_LIBRETRO_TITLE (games_libretro_title_get_type ())
#define GAMES_LIBRETRO_TITLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_LIBRETRO_TITLE, GamesLibretroTitle))
#define GAMES_LIBRETRO_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_LIBRETRO_TITLE, GamesLibretroTitleClass))
#define GAMES_IS_LIBRETRO_TITLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_LIBRETRO_TITLE))
#define GAMES_IS_LIBRETRO_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_LIBRETRO_TITLE))
#define GAMES_LIBRETRO_TITLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_LIBRETRO_TITLE, GamesLibretroTitleClass))

typedef struct _GamesLibretroTitle GamesLibretroTitle;
typedef struct _GamesLibretroTitleClass GamesLibretroTitleClass;
typedef struct _GamesLibretroTitlePrivate GamesLibretroTitlePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesLibretroTitle {
	GObject parent_instance;
	GamesLibretroTitlePrivate * priv;
};

struct _GamesLibretroTitleClass {
	GObjectClass parent_class;
};

struct _GamesLibretroTitlePrivate {
	RetroCoreDescriptor* core_descriptor;
};


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;

GType games_libretro_title_get_type (void) G_GNUC_CONST;
#define GAMES_LIBRETRO_TITLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_LIBRETRO_TITLE, GamesLibretroTitlePrivate))
enum  {
	GAMES_LIBRETRO_TITLE_0_PROPERTY
};
GamesLibretroTitle* games_libretro_title_new (RetroCoreDescriptor* core_descriptor);
GamesLibretroTitle* games_libretro_title_construct (GType object_type, RetroCoreDescriptor* core_descriptor);
static gchar* games_libretro_title_real_get_title (GamesTitle* base, GError** error);
static void games_libretro_title_finalize (GObject * obj);


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_;
	RetroCoreDescriptor* _tmp1_;
	g_return_val_if_fail (core_descriptor != NULL, NULL);
	self = (GamesLibretroTitle*) g_object_new (object_type, NULL);
	_tmp0_ = core_descriptor;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->core_descriptor);
	self->priv->core_descriptor = _tmp1_;
	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* result = NULL;
	gchar* _tmp0_ = NULL;
	RetroCoreDescriptor* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError * _inner_error_ = NULL;
	self = (GamesLibretroTitle*) base;
	_tmp1_ = self->priv->core_descriptor;
	_tmp2_ = retro_core_descriptor_get_name (_tmp1_, &_inner_error_);
	_tmp0_ = _tmp2_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp3_;
	_g_free0 (_tmp0_);
	return result;
}


static void games_libretro_title_class_init (GamesLibretroTitleClass * klass) {
	games_libretro_title_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesLibretroTitlePrivate));
	G_OBJECT_CLASS (klass)->finalize = games_libretro_title_finalize;
}


static void games_libretro_title_games_title_interface_init (GamesTitleIface * iface) {
	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) {
	self->priv = GAMES_LIBRETRO_TITLE_GET_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);
	return games_libretro_title_type_id;
}



