/* generic-game.c generated by valac 0.36.12.13-3ae08, the Vala compiler
 * generated from generic-game.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>


#define GAMES_TYPE_GAME (games_game_get_type ())
#define GAMES_GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME, GamesGame))
#define GAMES_IS_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME))
#define GAMES_GAME_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_GAME, GamesGameIface))

typedef struct _GamesGame GamesGame;
typedef struct _GamesGameIface GamesGameIface;

#define GAMES_TYPE_ICON (games_icon_get_type ())
#define GAMES_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_ICON, GamesIcon))
#define GAMES_IS_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_ICON))
#define GAMES_ICON_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_ICON, GamesIconIface))

typedef struct _GamesIcon GamesIcon;
typedef struct _GamesIconIface GamesIconIface;

#define GAMES_TYPE_COVER (games_cover_get_type ())
#define GAMES_COVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COVER, GamesCover))
#define GAMES_IS_COVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COVER))
#define GAMES_COVER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_COVER, GamesCoverIface))

typedef struct _GamesCover GamesCover;
typedef struct _GamesCoverIface GamesCoverIface;

#define GAMES_TYPE_RUNNER (games_runner_get_type ())
#define GAMES_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_RUNNER, GamesRunner))
#define GAMES_IS_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_RUNNER))
#define GAMES_RUNNER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_RUNNER, GamesRunnerIface))

typedef struct _GamesRunner GamesRunner;
typedef struct _GamesRunnerIface GamesRunnerIface;

#define GAMES_TYPE_MEDIA_SET (games_media_set_get_type ())
#define GAMES_MEDIA_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MEDIA_SET, GamesMediaSet))
#define GAMES_MEDIA_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MEDIA_SET, GamesMediaSetClass))
#define GAMES_IS_MEDIA_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MEDIA_SET))
#define GAMES_IS_MEDIA_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MEDIA_SET))
#define GAMES_MEDIA_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MEDIA_SET, GamesMediaSetClass))

typedef struct _GamesMediaSet GamesMediaSet;
typedef struct _GamesMediaSetClass GamesMediaSetClass;

#define GAMES_TYPE_GENERIC_GAME (games_generic_game_get_type ())
#define GAMES_GENERIC_GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GENERIC_GAME, GamesGenericGame))
#define GAMES_GENERIC_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GENERIC_GAME, GamesGenericGameClass))
#define GAMES_IS_GENERIC_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GENERIC_GAME))
#define GAMES_IS_GENERIC_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GENERIC_GAME))
#define GAMES_GENERIC_GAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GENERIC_GAME, GamesGenericGameClass))

typedef struct _GamesGenericGame GamesGenericGame;
typedef struct _GamesGenericGameClass GamesGenericGameClass;
typedef struct _GamesGenericGamePrivate GamesGenericGamePrivate;

#define GAMES_TYPE_TITLE (games_title_get_type ())
#define GAMES_TITLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TITLE, GamesTitle))
#define GAMES_IS_TITLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TITLE))
#define GAMES_TITLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_TITLE, GamesTitleIface))

typedef struct _GamesTitle GamesTitle;
typedef struct _GamesTitleIface GamesTitleIface;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GamesIconIface {
	GTypeInterface parent_iface;
	GIcon* (*get_icon) (GamesIcon* self);
};

struct _GamesCoverIface {
	GTypeInterface parent_iface;
	GIcon* (*get_cover) (GamesCover* self);
};

struct _GamesRunnerIface {
	GTypeInterface parent_iface;
	gboolean (*check_is_valid) (GamesRunner* self, gchar* * error_message, GError** error);
	GtkWidget* (*get_display) (GamesRunner* self);
	void (*start) (GamesRunner* self, GError** error);
	void (*resume) (GamesRunner* self, GError** error);
	void (*pause) (GamesRunner* self);
	void (*stop) (GamesRunner* self);
	gboolean (*get_can_fullscreen) (GamesRunner* self);
	gboolean (*get_can_quit_safely) (GamesRunner* self);
	gboolean (*get_can_resume) (GamesRunner* self);
	GamesMediaSet* (*get_media_set) (GamesRunner* self);
};

struct _GamesGameIface {
	GTypeInterface parent_iface;
	GamesIcon* (*get_icon) (GamesGame* self);
	GamesCover* (*get_cover) (GamesGame* self);
	GamesRunner* (*get_runner) (GamesGame* self, GError** error);
	const gchar* (*get_name) (GamesGame* self);
};

struct _GamesGenericGame {
	GObject parent_instance;
	GamesGenericGamePrivate * priv;
};

struct _GamesGenericGameClass {
	GObjectClass parent_class;
};

struct _GamesTitleIface {
	GTypeInterface parent_iface;
	gchar* (*get_title) (GamesTitle* self, GError** error);
};

struct _GamesGenericGamePrivate {
	gchar* _name;
	GamesTitle* game_title;
	GamesIcon* game_icon;
	GamesCover* game_cover;
	GamesRunner* game_runner;
};


static gpointer games_generic_game_parent_class = NULL;
static GamesGameIface * games_generic_game_games_game_parent_iface = NULL;

GType games_icon_get_type (void) G_GNUC_CONST;
GType games_cover_get_type (void) G_GNUC_CONST;
GType games_media_set_get_type (void) G_GNUC_CONST;
GType games_runner_get_type (void) G_GNUC_CONST;
GType games_game_get_type (void) G_GNUC_CONST;
GType games_generic_game_get_type (void) G_GNUC_CONST;
GType games_title_get_type (void) G_GNUC_CONST;
#define GAMES_GENERIC_GAME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_GENERIC_GAME, GamesGenericGamePrivate))
enum  {
	GAMES_GENERIC_GAME_0_PROPERTY,
	GAMES_GENERIC_GAME_NAME_PROPERTY
};
GamesGenericGame* games_generic_game_new (GamesTitle* title, GamesIcon* icon, GamesCover* cover, GamesRunner* runner);
GamesGenericGame* games_generic_game_construct (GType object_type, GamesTitle* title, GamesIcon* icon, GamesCover* cover, GamesRunner* runner);
static GamesIcon* games_generic_game_real_get_icon (GamesGame* base);
static GamesCover* games_generic_game_real_get_cover (GamesGame* base);
static GamesRunner* games_generic_game_real_get_runner (GamesGame* base, GError** error);
gchar* games_title_get_title (GamesTitle* self, GError** error);
static void games_generic_game_finalize (GObject * obj);
const gchar* games_game_get_name (GamesGame* self);
static void _vala_games_generic_game_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);


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


GamesGenericGame* games_generic_game_construct (GType object_type, GamesTitle* title, GamesIcon* icon, GamesCover* cover, GamesRunner* runner) {
	GamesGenericGame * self = NULL;
	GamesTitle* _tmp0_;
	GamesTitle* _tmp1_;
	GamesIcon* _tmp2_;
	GamesIcon* _tmp3_;
	GamesCover* _tmp4_;
	GamesCover* _tmp5_;
	GamesRunner* _tmp6_;
	GamesRunner* _tmp7_;
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (icon != NULL, NULL);
	g_return_val_if_fail (cover != NULL, NULL);
	g_return_val_if_fail (runner != NULL, NULL);
	self = (GamesGenericGame*) g_object_new (object_type, NULL);
	_tmp0_ = title;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->game_title);
	self->priv->game_title = _tmp1_;
	_tmp2_ = icon;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->game_icon);
	self->priv->game_icon = _tmp3_;
	_tmp4_ = cover;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->priv->game_cover);
	self->priv->game_cover = _tmp5_;
	_tmp6_ = runner;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	_g_object_unref0 (self->priv->game_runner);
	self->priv->game_runner = _tmp7_;
	return self;
}


GamesGenericGame* games_generic_game_new (GamesTitle* title, GamesIcon* icon, GamesCover* cover, GamesRunner* runner) {
	return games_generic_game_construct (GAMES_TYPE_GENERIC_GAME, title, icon, cover, runner);
}


static GamesIcon* games_generic_game_real_get_icon (GamesGame* base) {
	GamesGenericGame * self;
	GamesIcon* result = NULL;
	GamesIcon* _tmp0_;
	GamesIcon* _tmp1_;
	self = (GamesGenericGame*) base;
	_tmp0_ = self->priv->game_icon;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


static GamesCover* games_generic_game_real_get_cover (GamesGame* base) {
	GamesGenericGame * self;
	GamesCover* result = NULL;
	GamesCover* _tmp0_;
	GamesCover* _tmp1_;
	self = (GamesGenericGame*) base;
	_tmp0_ = self->priv->game_cover;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


static GamesRunner* games_generic_game_real_get_runner (GamesGame* base, GError** error) {
	GamesGenericGame * self;
	GamesRunner* result = NULL;
	GamesRunner* _tmp0_;
	GamesRunner* _tmp1_;
	self = (GamesGenericGame*) base;
	_tmp0_ = self->priv->game_runner;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


static const gchar* games_generic_game_real_get_name (GamesGame* base) {
	const gchar* result;
	GamesGenericGame* self;
	const gchar* _tmp6_;
	const gchar* _tmp8_;
	GError * _inner_error_ = NULL;
	self = (GamesGenericGame*) base;
	{
		gchar* _tmp0_ = NULL;
		GamesTitle* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp1_ = self->priv->game_title;
		_tmp2_ = games_title_get_title (_tmp1_, &_inner_error_);
		_tmp0_ = _tmp2_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch7_g_error;
		}
		_tmp3_ = _tmp0_;
		_tmp0_ = NULL;
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp3_;
		_g_free0 (_tmp0_);
	}
	goto __finally7;
	__catch7_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_warning ("generic-game.vala:11: %s", _tmp5_);
		_g_error_free0 (e);
	}
	__finally7:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	_tmp6_ = self->priv->_name;
	if (_tmp6_ == NULL) {
		gchar* _tmp7_;
		_tmp7_ = g_strdup ("");
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp7_;
	}
	_tmp8_ = self->priv->_name;
	result = _tmp8_;
	return result;
}


static void games_generic_game_class_init (GamesGenericGameClass * klass) {
	games_generic_game_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesGenericGamePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_games_generic_game_get_property;
	G_OBJECT_CLASS (klass)->finalize = games_generic_game_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_GENERIC_GAME_NAME_PROPERTY, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void games_generic_game_games_game_interface_init (GamesGameIface * iface) {
	games_generic_game_games_game_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_icon = (GamesIcon* (*) (GamesGame *)) games_generic_game_real_get_icon;
	iface->get_cover = (GamesCover* (*) (GamesGame *)) games_generic_game_real_get_cover;
	iface->get_runner = (GamesRunner* (*) (GamesGame *, GError**)) games_generic_game_real_get_runner;
	iface->get_name = games_generic_game_real_get_name;
}


static void games_generic_game_instance_init (GamesGenericGame * self) {
	self->priv = GAMES_GENERIC_GAME_GET_PRIVATE (self);
}


static void games_generic_game_finalize (GObject * obj) {
	GamesGenericGame * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_GENERIC_GAME, GamesGenericGame);
	_g_free0 (self->priv->_name);
	_g_object_unref0 (self->priv->game_title);
	_g_object_unref0 (self->priv->game_icon);
	_g_object_unref0 (self->priv->game_cover);
	_g_object_unref0 (self->priv->game_runner);
	G_OBJECT_CLASS (games_generic_game_parent_class)->finalize (obj);
}


GType games_generic_game_get_type (void) {
	static volatile gsize games_generic_game_type_id__volatile = 0;
	if (g_once_init_enter (&games_generic_game_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesGenericGameClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_generic_game_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesGenericGame), 0, (GInstanceInitFunc) games_generic_game_instance_init, NULL };
		static const GInterfaceInfo games_game_info = { (GInterfaceInitFunc) games_generic_game_games_game_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType games_generic_game_type_id;
		games_generic_game_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesGenericGame", &g_define_type_info, 0);
		g_type_add_interface_static (games_generic_game_type_id, GAMES_TYPE_GAME, &games_game_info);
		g_once_init_leave (&games_generic_game_type_id__volatile, games_generic_game_type_id);
	}
	return games_generic_game_type_id__volatile;
}


static void _vala_games_generic_game_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesGenericGame * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_GENERIC_GAME, GamesGenericGame);
	switch (property_id) {
		case GAMES_GENERIC_GAME_NAME_PROPERTY:
		g_value_set_string (value, games_game_get_name ((GamesGame*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



