/* mame-plugin.c generated by valac 0.36.9, the Vala compiler
 * generated from mame-plugin.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 <stdlib.h>
#include <string.h>


#define GAMES_TYPE_MAME_PLUGIN (games_mame_plugin_get_type ())
#define GAMES_MAME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MAME_PLUGIN, GamesMamePlugin))
#define GAMES_MAME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MAME_PLUGIN, GamesMamePluginClass))
#define GAMES_IS_MAME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MAME_PLUGIN))
#define GAMES_IS_MAME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MAME_PLUGIN))
#define GAMES_MAME_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MAME_PLUGIN, GamesMamePluginClass))

typedef struct _GamesMamePlugin GamesMamePlugin;
typedef struct _GamesMamePluginClass GamesMamePluginClass;
typedef struct _GamesMamePluginPrivate GamesMamePluginPrivate;

#define GAMES_TYPE_MAME_GAME_URI_ADAPTER (games_mame_game_uri_adapter_get_type ())
#define GAMES_MAME_GAME_URI_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MAME_GAME_URI_ADAPTER, GamesMameGameUriAdapter))
#define GAMES_MAME_GAME_URI_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MAME_GAME_URI_ADAPTER, GamesMameGameUriAdapterClass))
#define GAMES_IS_MAME_GAME_URI_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MAME_GAME_URI_ADAPTER))
#define GAMES_IS_MAME_GAME_URI_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MAME_GAME_URI_ADAPTER))
#define GAMES_MAME_GAME_URI_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MAME_GAME_URI_ADAPTER, GamesMameGameUriAdapterClass))

typedef struct _GamesMameGameUriAdapter GamesMameGameUriAdapter;
typedef struct _GamesMameGameUriAdapterClass GamesMameGameUriAdapterClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesMamePlugin {
	GObject parent_instance;
	GamesMamePluginPrivate * priv;
};

struct _GamesMamePluginClass {
	GObjectClass parent_class;
};


static gpointer games_mame_plugin_parent_class = NULL;
static GamesPluginIface * games_mame_plugin_games_plugin_parent_iface = NULL;
static GType games_mame_plugin_type_id = 0;

GType games_mame_plugin_get_type (void) G_GNUC_CONST;
enum  {
	GAMES_MAME_PLUGIN_0_PROPERTY
};
#define GAMES_MAME_PLUGIN_MIME_TYPE "application/zip"
static gchar** games_mame_plugin_real_get_mime_types (GamesPlugin* base, int* result_length1);
static GamesUriGameFactory** games_mame_plugin_real_get_uri_game_factories (GamesPlugin* base, int* result_length1);
GType games_mame_game_uri_adapter_get_type (void) G_GNUC_CONST;
GamesMameGameUriAdapter* games_mame_game_uri_adapter_new (void);
GamesMameGameUriAdapter* games_mame_game_uri_adapter_construct (GType object_type);
GamesMamePlugin* games_mame_plugin_new (void);
GamesMamePlugin* games_mame_plugin_construct (GType object_type);
GType register_games_plugin (GTypeModule* module);
GType games_mame_game_uri_adapter_register_type (GTypeModule * module);
GType games_mame_plugin_register_type (GTypeModule * module);


static gchar** games_mame_plugin_real_get_mime_types (GamesPlugin* base, int* result_length1) {
	GamesMamePlugin * self;
	gchar** result = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	self = (GamesMamePlugin*) base;
	_tmp0_ = g_strdup (GAMES_MAME_PLUGIN_MIME_TYPE);
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = 1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}


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


static GamesUriGameFactory** games_mame_plugin_real_get_uri_game_factories (GamesPlugin* base, int* result_length1) {
	GamesMamePlugin * self;
	GamesUriGameFactory** result = NULL;
	GamesMameGameUriAdapter* game_uri_adapter = NULL;
	GamesMameGameUriAdapter* _tmp0_;
	GamesGenericUriGameFactory* factory = NULL;
	GamesGenericUriGameFactory* _tmp1_;
	GamesUriGameFactory* _tmp2_;
	GamesUriGameFactory** _tmp3_;
	GamesUriGameFactory** _tmp4_;
	gint _tmp4__length1;
	self = (GamesMamePlugin*) base;
	_tmp0_ = games_mame_game_uri_adapter_new ();
	game_uri_adapter = _tmp0_;
	_tmp1_ = games_generic_uri_game_factory_new ((GamesGameUriAdapter*) game_uri_adapter);
	factory = _tmp1_;
	games_generic_uri_game_factory_add_mime_type (factory, GAMES_MAME_PLUGIN_MIME_TYPE);
	_tmp2_ = _g_object_ref0 ((GamesUriGameFactory*) factory);
	_tmp3_ = g_new0 (GamesUriGameFactory*, 1 + 1);
	_tmp3_[0] = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = 1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	_g_object_unref0 (factory);
	_g_object_unref0 (game_uri_adapter);
	return result;
}


GamesMamePlugin* games_mame_plugin_construct (GType object_type) {
	GamesMamePlugin * self = NULL;
	self = (GamesMamePlugin*) g_object_new (object_type, NULL);
	return self;
}


GamesMamePlugin* games_mame_plugin_new (void) {
	return games_mame_plugin_construct (GAMES_TYPE_MAME_PLUGIN);
}


static void games_mame_plugin_class_init (GamesMamePluginClass * klass) {
	games_mame_plugin_parent_class = g_type_class_peek_parent (klass);
}


static void games_mame_plugin_games_plugin_interface_init (GamesPluginIface * iface) {
	games_mame_plugin_games_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_mime_types = (gchar** (*) (GamesPlugin *, int*)) games_mame_plugin_real_get_mime_types;
	iface->get_uri_game_factories = (GamesUriGameFactory** (*) (GamesPlugin *, int*)) games_mame_plugin_real_get_uri_game_factories;
}


static void games_mame_plugin_instance_init (GamesMamePlugin * self) {
}


GType games_mame_plugin_get_type (void) {
	return games_mame_plugin_type_id;
}


GType games_mame_plugin_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GamesMamePluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_mame_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesMamePlugin), 0, (GInstanceInitFunc) games_mame_plugin_instance_init, NULL };
	static const GInterfaceInfo games_plugin_info = { (GInterfaceInitFunc) games_mame_plugin_games_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_mame_plugin_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesMamePlugin", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_mame_plugin_type_id, GAMES_TYPE_PLUGIN, &games_plugin_info);
	return games_mame_plugin_type_id;
}


GType register_games_plugin (GTypeModule* module) {
	GType result = 0UL;
	g_return_val_if_fail (module != NULL, 0UL);
	games_mame_game_uri_adapter_register_type (module);
	games_mame_plugin_register_type (module);
	result = GAMES_TYPE_MAME_PLUGIN;
	return result;
}



