/* master-system-plugin.c generated by valac 0.35.5, the Vala compiler
 * generated from master-system-plugin.vala, do not modify */

/* This file is part of GNOME Games. License: GPLv3*/

#include <glib.h>
#include <glib-object.h>
#include <libgnome-games.h>
#include <stdlib.h>
#include <string.h>
#include <libtracker-sparql/tracker-sparql.h>
#include <gio/gio.h>


#define GAMES_TYPE_MASTER_SYSTEM_PLUGIN (games_master_system_plugin_get_type ())
#define GAMES_MASTER_SYSTEM_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MASTER_SYSTEM_PLUGIN, GamesMasterSystemPlugin))
#define GAMES_MASTER_SYSTEM_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MASTER_SYSTEM_PLUGIN, GamesMasterSystemPluginClass))
#define GAMES_IS_MASTER_SYSTEM_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MASTER_SYSTEM_PLUGIN))
#define GAMES_IS_MASTER_SYSTEM_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MASTER_SYSTEM_PLUGIN))
#define GAMES_MASTER_SYSTEM_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MASTER_SYSTEM_PLUGIN, GamesMasterSystemPluginClass))

typedef struct _GamesMasterSystemPlugin GamesMasterSystemPlugin;
typedef struct _GamesMasterSystemPluginClass GamesMasterSystemPluginClass;
typedef struct _GamesMasterSystemPluginPrivate GamesMasterSystemPluginPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_MASTER_SYSTEM_HEADER (games_master_system_header_get_type ())
#define GAMES_MASTER_SYSTEM_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MASTER_SYSTEM_HEADER, GamesMasterSystemHeader))
#define GAMES_MASTER_SYSTEM_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MASTER_SYSTEM_HEADER, GamesMasterSystemHeaderClass))
#define GAMES_IS_MASTER_SYSTEM_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MASTER_SYSTEM_HEADER))
#define GAMES_IS_MASTER_SYSTEM_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MASTER_SYSTEM_HEADER))
#define GAMES_MASTER_SYSTEM_HEADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MASTER_SYSTEM_HEADER, GamesMasterSystemHeaderClass))

typedef struct _GamesMasterSystemHeader GamesMasterSystemHeader;
typedef struct _GamesMasterSystemHeaderClass GamesMasterSystemHeaderClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesMasterSystemPlugin {
	GObject parent_instance;
	GamesMasterSystemPluginPrivate * priv;
};

struct _GamesMasterSystemPluginClass {
	GObjectClass parent_class;
};


static gpointer games_master_system_plugin_parent_class = NULL;
static GamesPluginIface * games_master_system_plugin_games_plugin_parent_iface = NULL;
static GType games_master_system_plugin_type_id = 0;

GType games_master_system_plugin_get_type (void) G_GNUC_CONST;
enum  {
	GAMES_MASTER_SYSTEM_PLUGIN_DUMMY_PROPERTY
};
#define GAMES_MASTER_SYSTEM_PLUGIN_MASTER_SYSTEM_PREFIX "master-system"
#define GAMES_MASTER_SYSTEM_PLUGIN_MASTER_SYSTEM_MIME_TYPE "application/x-sms-rom"
#define GAMES_MASTER_SYSTEM_PLUGIN_MASTER_SYSTEM_PLATFORM "MasterSystem"
#define GAMES_MASTER_SYSTEM_PLUGIN_GAME_GEAR_PREFIX "game-gear"
#define GAMES_MASTER_SYSTEM_PLUGIN_GAME_GEAR_MIME_TYPE "application/x-gamegear-rom"
#define GAMES_MASTER_SYSTEM_PLUGIN_GAME_GEAR_PLATFORM "GameGear"
#define GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_PREFIX "sg-1000"
#define GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_MIME_TYPE "application/x-sg1000-rom"
#define GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_PLATFORM "SG1000"
static GamesGameSource* games_master_system_plugin_real_get_game_source (GamesPlugin* base, GError** error);
static GamesGame* games_master_system_plugin_game_for_uri (const gchar* uri, GError** error);
static GamesGame* _games_master_system_plugin_game_for_uri_games_generic_sync_game_uri_adapter_game_for_uri (const gchar* uri, gpointer self, GError** error);
static GamesGame* games_master_system_plugin_sg_1000_game_for_uri (const gchar* uri, GError** error);
static GamesGame* _games_master_system_plugin_sg_1000_game_for_uri_games_generic_sync_game_uri_adapter_game_for_uri (const gchar* uri, gpointer self, GError** error);
GType games_master_system_header_get_type (void) G_GNUC_CONST;
GamesMasterSystemHeader* games_master_system_header_new (GFile* file);
GamesMasterSystemHeader* games_master_system_header_construct (GType object_type, GFile* file);
void games_master_system_header_check_validity (GamesMasterSystemHeader* self, GError** error);
gboolean games_master_system_header_is_master_system (GamesMasterSystemHeader* self);
gboolean games_master_system_header_is_game_gear (GamesMasterSystemHeader* self);
GamesMasterSystemPlugin* games_master_system_plugin_new (void);
GamesMasterSystemPlugin* games_master_system_plugin_construct (GType object_type);
GType register_games_plugin (GTypeModule* module);
GType games_master_system_header_register_type (GTypeModule * module);
GType games_master_system_plugin_register_type (GTypeModule * module);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static GamesGame* _games_master_system_plugin_game_for_uri_games_generic_sync_game_uri_adapter_game_for_uri (const gchar* uri, gpointer self, GError** error) {
	GamesGame* result;
	result = games_master_system_plugin_game_for_uri (uri, error);
	return result;
}


static GamesGame* _games_master_system_plugin_sg_1000_game_for_uri_games_generic_sync_game_uri_adapter_game_for_uri (const gchar* uri, gpointer self, GError** error) {
	GamesGame* result;
	result = games_master_system_plugin_sg_1000_game_for_uri (uri, error);
	return result;
}


static GamesGameSource* games_master_system_plugin_real_get_game_source (GamesPlugin* base, GError** error) {
	GamesMasterSystemPlugin * self;
	GamesGameSource* result = NULL;
	GamesGenericSyncGameUriAdapter* game_uri_adapter;
	GamesGenericSyncGameUriAdapter* _tmp0_;
	GamesGenericSyncGameUriAdapter* sg_1000_game_uri_adapter;
	GamesGenericSyncGameUriAdapter* _tmp1_;
	GamesGenericUriGameFactory* master_system_factory;
	GamesGenericUriGameFactory* _tmp2_;
	GamesGenericUriGameFactory* game_gear_factory;
	GamesGenericUriGameFactory* _tmp3_;
	GamesGenericUriGameFactory* sg_1000_factory;
	GamesGenericUriGameFactory* _tmp4_;
	GamesMimeTypeTrackerQuery* master_system_query;
	GamesMimeTypeTrackerQuery* _tmp5_;
	GamesMimeTypeTrackerQuery* game_gear_query;
	GamesMimeTypeTrackerQuery* _tmp6_;
	GamesMimeTypeTrackerQuery* sg_1000_query;
	GamesMimeTypeTrackerQuery* _tmp7_;
	TrackerSparqlConnection* connection;
	TrackerSparqlConnection* _tmp8_;
	GamesTrackerGameSource* source;
	GamesTrackerGameSource* _tmp9_;
	GamesTrackerGameSource* _tmp10_;
	GamesTrackerGameSource* _tmp11_;
	GamesTrackerGameSource* _tmp12_;
	GError * _inner_error_ = NULL;
	self = (GamesMasterSystemPlugin*) base;
	_tmp0_ = games_generic_sync_game_uri_adapter_new (_games_master_system_plugin_game_for_uri_games_generic_sync_game_uri_adapter_game_for_uri, NULL, NULL);
	game_uri_adapter = _tmp0_;
	_tmp1_ = games_generic_sync_game_uri_adapter_new (_games_master_system_plugin_sg_1000_game_for_uri_games_generic_sync_game_uri_adapter_game_for_uri, NULL, NULL);
	sg_1000_game_uri_adapter = _tmp1_;
	_tmp2_ = games_generic_uri_game_factory_new ((GamesGameUriAdapter*) game_uri_adapter, NULL, NULL, NULL);
	master_system_factory = _tmp2_;
	_tmp3_ = games_generic_uri_game_factory_new ((GamesGameUriAdapter*) game_uri_adapter, NULL, NULL, NULL);
	game_gear_factory = _tmp3_;
	_tmp4_ = games_generic_uri_game_factory_new ((GamesGameUriAdapter*) sg_1000_game_uri_adapter, NULL, NULL, NULL);
	sg_1000_factory = _tmp4_;
	_tmp5_ = games_mime_type_tracker_query_new (GAMES_MASTER_SYSTEM_PLUGIN_MASTER_SYSTEM_MIME_TYPE, (GamesUriGameFactory*) master_system_factory);
	master_system_query = _tmp5_;
	_tmp6_ = games_mime_type_tracker_query_new (GAMES_MASTER_SYSTEM_PLUGIN_GAME_GEAR_MIME_TYPE, (GamesUriGameFactory*) game_gear_factory);
	game_gear_query = _tmp6_;
	_tmp7_ = games_mime_type_tracker_query_new (GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_MIME_TYPE, (GamesUriGameFactory*) sg_1000_factory);
	sg_1000_query = _tmp7_;
	_tmp8_ = tracker_sparql_connection_get (NULL, &_inner_error_);
	connection = _tmp8_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (sg_1000_query);
		_g_object_unref0 (game_gear_query);
		_g_object_unref0 (master_system_query);
		_g_object_unref0 (sg_1000_factory);
		_g_object_unref0 (game_gear_factory);
		_g_object_unref0 (master_system_factory);
		_g_object_unref0 (sg_1000_game_uri_adapter);
		_g_object_unref0 (game_uri_adapter);
		return NULL;
	}
	_tmp9_ = games_tracker_game_source_new (connection);
	source = _tmp9_;
	_tmp10_ = source;
	games_tracker_game_source_add_query (_tmp10_, (GamesTrackerQuery*) master_system_query);
	_tmp11_ = source;
	games_tracker_game_source_add_query (_tmp11_, (GamesTrackerQuery*) game_gear_query);
	_tmp12_ = source;
	games_tracker_game_source_add_query (_tmp12_, (GamesTrackerQuery*) sg_1000_query);
	result = (GamesGameSource*) source;
	_g_object_unref0 (connection);
	_g_object_unref0 (sg_1000_query);
	_g_object_unref0 (game_gear_query);
	_g_object_unref0 (master_system_query);
	_g_object_unref0 (sg_1000_factory);
	_g_object_unref0 (game_gear_factory);
	_g_object_unref0 (master_system_factory);
	_g_object_unref0 (sg_1000_game_uri_adapter);
	_g_object_unref0 (game_uri_adapter);
	return result;
}


static GamesGame* games_master_system_plugin_game_for_uri (const gchar* uri, GError** error) {
	GamesGame* result = NULL;
	GFile* file;
	const gchar* _tmp0_;
	GFile* _tmp1_;
	GamesMasterSystemHeader* header;
	GamesMasterSystemHeader* _tmp2_;
	gchar* prefix = NULL;
	gchar* mime_type = NULL;
	gchar* platform = NULL;
	gboolean _tmp3_;
	GamesFingerprintUid* uid;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	GamesFingerprintUid* _tmp13_;
	GamesFilenameTitle* title;
	const gchar* _tmp14_;
	GamesFilenameTitle* _tmp15_;
	GamesDummyIcon* icon;
	GamesDummyIcon* _tmp16_;
	GamesGriloMedia* media;
	GamesFilenameTitle* _tmp17_;
	const gchar* _tmp18_;
	GamesGriloMedia* _tmp19_;
	GamesCompositeCover* cover;
	const gchar* _tmp20_;
	GamesLocalCover* _tmp21_;
	GamesGriloMedia* _tmp22_;
	GamesFingerprintUid* _tmp23_;
	GamesGriloCover* _tmp24_;
	GamesCover** _tmp25_;
	GamesCover** _tmp26_;
	gint _tmp26__length1;
	GamesCompositeCover* _tmp27_;
	GamesCompositeCover* _tmp28_;
	GamesRetroCoreSource* core_source;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	gchar** _tmp32_;
	gchar** _tmp33_;
	gint _tmp33__length1;
	GamesRetroCoreSource* _tmp34_;
	GamesRetroCoreSource* _tmp35_;
	GamesRetroRunner* runner;
	GamesRetroCoreSource* _tmp36_;
	const gchar* _tmp37_;
	GamesFingerprintUid* _tmp38_;
	GamesFilenameTitle* _tmp39_;
	GamesRetroRunner* _tmp40_;
	GamesFilenameTitle* _tmp41_;
	GamesDummyIcon* _tmp42_;
	GamesCompositeCover* _tmp43_;
	GamesRetroRunner* _tmp44_;
	GamesGenericGame* _tmp45_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (uri != NULL, NULL);
	_tmp0_ = uri;
	_tmp1_ = g_file_new_for_uri (_tmp0_);
	file = _tmp1_;
	_tmp2_ = games_master_system_header_new (file);
	header = _tmp2_;
	games_master_system_header_check_validity (header, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (header);
		_g_object_unref0 (file);
		return NULL;
	}
	_tmp3_ = games_master_system_header_is_master_system (header);
	if (_tmp3_) {
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = g_strdup (GAMES_MASTER_SYSTEM_PLUGIN_MASTER_SYSTEM_PREFIX);
		_g_free0 (prefix);
		prefix = _tmp4_;
		_tmp5_ = g_strdup (GAMES_MASTER_SYSTEM_PLUGIN_MASTER_SYSTEM_MIME_TYPE);
		_g_free0 (mime_type);
		mime_type = _tmp5_;
		_tmp6_ = g_strdup (GAMES_MASTER_SYSTEM_PLUGIN_MASTER_SYSTEM_PLATFORM);
		_g_free0 (platform);
		platform = _tmp6_;
	} else {
		gboolean _tmp7_;
		_tmp7_ = games_master_system_header_is_game_gear (header);
		if (_tmp7_) {
			gchar* _tmp8_;
			gchar* _tmp9_;
			gchar* _tmp10_;
			_tmp8_ = g_strdup (GAMES_MASTER_SYSTEM_PLUGIN_GAME_GEAR_PREFIX);
			_g_free0 (prefix);
			prefix = _tmp8_;
			_tmp9_ = g_strdup (GAMES_MASTER_SYSTEM_PLUGIN_GAME_GEAR_MIME_TYPE);
			_g_free0 (mime_type);
			mime_type = _tmp9_;
			_tmp10_ = g_strdup (GAMES_MASTER_SYSTEM_PLUGIN_GAME_GEAR_PLATFORM);
			_g_free0 (platform);
			platform = _tmp10_;
		} else {
			g_assert_not_reached ();
		}
	}
	_tmp11_ = uri;
	_tmp12_ = prefix;
	_tmp13_ = games_fingerprint_uid_new (_tmp11_, _tmp12_);
	uid = _tmp13_;
	_tmp14_ = uri;
	_tmp15_ = games_filename_title_new (_tmp14_);
	title = _tmp15_;
	_tmp16_ = games_dummy_icon_new ();
	icon = _tmp16_;
	_tmp17_ = title;
	_tmp18_ = mime_type;
	_tmp19_ = games_grilo_media_new ((GamesTitle*) _tmp17_, _tmp18_);
	media = _tmp19_;
	_tmp20_ = uri;
	_tmp21_ = games_local_cover_new (_tmp20_);
	_tmp22_ = media;
	_tmp23_ = uid;
	_tmp24_ = games_grilo_cover_new (_tmp22_, (GamesUid*) _tmp23_);
	_tmp25_ = g_new0 (GamesCover*, 2 + 1);
	_tmp25_[0] = (GamesCover*) _tmp21_;
	_tmp25_[1] = (GamesCover*) _tmp24_;
	_tmp26_ = _tmp25_;
	_tmp26__length1 = 2;
	_tmp27_ = games_composite_cover_new (_tmp26_, 2);
	_tmp28_ = _tmp27_;
	_tmp26_ = (_vala_array_free (_tmp26_, _tmp26__length1, (GDestroyNotify) g_object_unref), NULL);
	cover = _tmp28_;
	_tmp29_ = platform;
	_tmp30_ = mime_type;
	_tmp31_ = g_strdup (_tmp30_);
	_tmp32_ = g_new0 (gchar*, 1 + 1);
	_tmp32_[0] = _tmp31_;
	_tmp33_ = _tmp32_;
	_tmp33__length1 = 1;
	_tmp34_ = games_retro_core_source_new (_tmp29_, _tmp33_, 1);
	_tmp35_ = _tmp34_;
	_tmp33_ = (_vala_array_free (_tmp33_, _tmp33__length1, (GDestroyNotify) g_free), NULL);
	core_source = _tmp35_;
	_tmp36_ = core_source;
	_tmp37_ = uri;
	_tmp38_ = uid;
	_tmp39_ = title;
	_tmp40_ = games_retro_runner_new (_tmp36_, _tmp37_, (GamesUid*) _tmp38_, (GamesTitle*) _tmp39_);
	runner = _tmp40_;
	_tmp41_ = title;
	_tmp42_ = icon;
	_tmp43_ = cover;
	_tmp44_ = runner;
	_tmp45_ = games_generic_game_new ((GamesTitle*) _tmp41_, (GamesIcon*) _tmp42_, (GamesCover*) _tmp43_, (GamesRunner*) _tmp44_);
	result = (GamesGame*) _tmp45_;
	_g_object_unref0 (runner);
	_g_object_unref0 (core_source);
	_g_object_unref0 (cover);
	_g_object_unref0 (media);
	_g_object_unref0 (icon);
	_g_object_unref0 (title);
	_g_object_unref0 (uid);
	_g_free0 (platform);
	_g_free0 (mime_type);
	_g_free0 (prefix);
	_g_object_unref0 (header);
	_g_object_unref0 (file);
	return result;
}


static GamesGame* games_master_system_plugin_sg_1000_game_for_uri (const gchar* uri, GError** error) {
	GamesGame* result = NULL;
	GamesFingerprintUid* uid;
	const gchar* _tmp0_;
	GamesFingerprintUid* _tmp1_;
	GamesFilenameTitle* title;
	const gchar* _tmp2_;
	GamesFilenameTitle* _tmp3_;
	GamesDummyIcon* icon;
	GamesDummyIcon* _tmp4_;
	GamesGriloMedia* media;
	GamesGriloMedia* _tmp5_;
	GamesCompositeCover* cover;
	const gchar* _tmp6_;
	GamesLocalCover* _tmp7_;
	GamesGriloCover* _tmp8_;
	GamesCover** _tmp9_;
	GamesCover** _tmp10_;
	gint _tmp10__length1;
	GamesCompositeCover* _tmp11_;
	GamesCompositeCover* _tmp12_;
	GamesRetroCoreSource* core_source;
	gchar* _tmp13_;
	gchar** _tmp14_;
	gchar** _tmp15_;
	gint _tmp15__length1;
	GamesRetroCoreSource* _tmp16_;
	GamesRetroCoreSource* _tmp17_;
	GamesRetroRunner* runner;
	const gchar* _tmp18_;
	GamesRetroRunner* _tmp19_;
	GamesGenericGame* _tmp20_;
	g_return_val_if_fail (uri != NULL, NULL);
	_tmp0_ = uri;
	_tmp1_ = games_fingerprint_uid_new (_tmp0_, GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_PREFIX);
	uid = _tmp1_;
	_tmp2_ = uri;
	_tmp3_ = games_filename_title_new (_tmp2_);
	title = _tmp3_;
	_tmp4_ = games_dummy_icon_new ();
	icon = _tmp4_;
	_tmp5_ = games_grilo_media_new ((GamesTitle*) title, GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_MIME_TYPE);
	media = _tmp5_;
	_tmp6_ = uri;
	_tmp7_ = games_local_cover_new (_tmp6_);
	_tmp8_ = games_grilo_cover_new (media, (GamesUid*) uid);
	_tmp9_ = g_new0 (GamesCover*, 2 + 1);
	_tmp9_[0] = (GamesCover*) _tmp7_;
	_tmp9_[1] = (GamesCover*) _tmp8_;
	_tmp10_ = _tmp9_;
	_tmp10__length1 = 2;
	_tmp11_ = games_composite_cover_new (_tmp10_, 2);
	_tmp12_ = _tmp11_;
	_tmp10_ = (_vala_array_free (_tmp10_, _tmp10__length1, (GDestroyNotify) g_object_unref), NULL);
	cover = _tmp12_;
	_tmp13_ = g_strdup (GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_MIME_TYPE);
	_tmp14_ = g_new0 (gchar*, 1 + 1);
	_tmp14_[0] = _tmp13_;
	_tmp15_ = _tmp14_;
	_tmp15__length1 = 1;
	_tmp16_ = games_retro_core_source_new (GAMES_MASTER_SYSTEM_PLUGIN_SG_1000_PLATFORM, _tmp15_, 1);
	_tmp17_ = _tmp16_;
	_tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_free), NULL);
	core_source = _tmp17_;
	_tmp18_ = uri;
	_tmp19_ = games_retro_runner_new (core_source, _tmp18_, (GamesUid*) uid, (GamesTitle*) title);
	runner = _tmp19_;
	_tmp20_ = games_generic_game_new ((GamesTitle*) title, (GamesIcon*) icon, (GamesCover*) cover, (GamesRunner*) runner);
	result = (GamesGame*) _tmp20_;
	_g_object_unref0 (runner);
	_g_object_unref0 (core_source);
	_g_object_unref0 (cover);
	_g_object_unref0 (media);
	_g_object_unref0 (icon);
	_g_object_unref0 (title);
	_g_object_unref0 (uid);
	return result;
}


GamesMasterSystemPlugin* games_master_system_plugin_construct (GType object_type) {
	GamesMasterSystemPlugin * self = NULL;
	self = (GamesMasterSystemPlugin*) g_object_new (object_type, NULL);
	return self;
}


GamesMasterSystemPlugin* games_master_system_plugin_new (void) {
	return games_master_system_plugin_construct (GAMES_TYPE_MASTER_SYSTEM_PLUGIN);
}


static void games_master_system_plugin_class_init (GamesMasterSystemPluginClass * klass) {
	games_master_system_plugin_parent_class = g_type_class_peek_parent (klass);
}


static void games_master_system_plugin_games_plugin_interface_init (GamesPluginIface * iface) {
	games_master_system_plugin_games_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_game_source = (GamesGameSource* (*) (GamesPlugin *, GError**)) games_master_system_plugin_real_get_game_source;
}


static void games_master_system_plugin_instance_init (GamesMasterSystemPlugin * self) {
}


GType games_master_system_plugin_get_type (void) {
	return games_master_system_plugin_type_id;
}


GType games_master_system_plugin_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GamesMasterSystemPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_master_system_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesMasterSystemPlugin), 0, (GInstanceInitFunc) games_master_system_plugin_instance_init, NULL };
	static const GInterfaceInfo games_plugin_info = { (GInterfaceInitFunc) games_master_system_plugin_games_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_master_system_plugin_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesMasterSystemPlugin", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_master_system_plugin_type_id, GAMES_TYPE_PLUGIN, &games_plugin_info);
	return games_master_system_plugin_type_id;
}


GType register_games_plugin (GTypeModule* module) {
	GType result = 0UL;
	g_return_val_if_fail (module != NULL, 0UL);
	games_master_system_header_register_type (module);
	games_master_system_plugin_register_type (module);
	result = GAMES_TYPE_MASTER_SYSTEM_PLUGIN;
	return result;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



