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

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

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


#define GAMES_TYPE_PLUGIN_REGISTRAR (games_plugin_registrar_get_type ())
#define GAMES_PLUGIN_REGISTRAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLUGIN_REGISTRAR, GamesPluginRegistrar))
#define GAMES_PLUGIN_REGISTRAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PLUGIN_REGISTRAR, GamesPluginRegistrarClass))
#define GAMES_IS_PLUGIN_REGISTRAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLUGIN_REGISTRAR))
#define GAMES_IS_PLUGIN_REGISTRAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PLUGIN_REGISTRAR))
#define GAMES_PLUGIN_REGISTRAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PLUGIN_REGISTRAR, GamesPluginRegistrarClass))

typedef struct _GamesPluginRegistrar GamesPluginRegistrar;
typedef struct _GamesPluginRegistrarClass GamesPluginRegistrarClass;
typedef struct _GamesPluginRegistrarPrivate GamesPluginRegistrarPrivate;

#define GAMES_TYPE_PLUGIN (games_plugin_get_type ())
#define GAMES_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLUGIN, GamesPlugin))
#define GAMES_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLUGIN))
#define GAMES_PLUGIN_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_PLUGIN, GamesPluginIface))

typedef struct _GamesPlugin GamesPlugin;
typedef struct _GamesPluginIface GamesPluginIface;

#define GAMES_TYPE_URI_SOURCE (games_uri_source_get_type ())
#define GAMES_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_URI_SOURCE, GamesUriSource))
#define GAMES_IS_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_URI_SOURCE))
#define GAMES_URI_SOURCE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_URI_SOURCE, GamesUriSourceIface))

typedef struct _GamesUriSource GamesUriSource;
typedef struct _GamesUriSourceIface GamesUriSourceIface;

#define GAMES_TYPE_URI_ITERATOR (games_uri_iterator_get_type ())
#define GAMES_URI_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_URI_ITERATOR, GamesUriIterator))
#define GAMES_IS_URI_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_URI_ITERATOR))
#define GAMES_URI_ITERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_URI_ITERATOR, GamesUriIteratorIface))

typedef struct _GamesUriIterator GamesUriIterator;
typedef struct _GamesUriIteratorIface GamesUriIteratorIface;

#define GAMES_TYPE_URI (games_uri_get_type ())
#define GAMES_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_URI, GamesUri))
#define GAMES_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_URI, GamesUriClass))
#define GAMES_IS_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_URI))
#define GAMES_IS_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_URI))
#define GAMES_URI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_URI, GamesUriClass))

typedef struct _GamesUri GamesUri;
typedef struct _GamesUriClass GamesUriClass;

#define GAMES_TYPE_URI_GAME_FACTORY (games_uri_game_factory_get_type ())
#define GAMES_URI_GAME_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_URI_GAME_FACTORY, GamesUriGameFactory))
#define GAMES_IS_URI_GAME_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_URI_GAME_FACTORY))
#define GAMES_URI_GAME_FACTORY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_URI_GAME_FACTORY, GamesUriGameFactoryIface))

typedef struct _GamesUriGameFactory GamesUriGameFactory;
typedef struct _GamesUriGameFactoryIface GamesUriGameFactoryIface;

#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 _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_module_close0(var) ((var == NULL) ? NULL : (var = (g_module_close (var), NULL)))
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GamesPluginRegistrar {
	GTypeModule parent_instance;
	GamesPluginRegistrarPrivate * priv;
};

struct _GamesPluginRegistrarClass {
	GTypeModuleClass parent_class;
};

struct _GamesUriIteratorIface {
	GTypeInterface parent_iface;
	GamesUri* (*get) (GamesUriIterator* self);
	gboolean (*next) (GamesUriIterator* self);
};

struct _GamesUriSourceIface {
	GTypeInterface parent_iface;
	GamesUriIterator* (*iterator) (GamesUriSource* self);
};

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);
};

typedef void (*GamesGameCallback) (GamesGame* game, void* user_data);
struct _GamesUriGameFactoryIface {
	GTypeInterface parent_iface;
	gchar** (*get_mime_types) (GamesUriGameFactory* self, int* result_length1);
	gchar** (*get_schemes) (GamesUriGameFactory* self, int* result_length1);
	void (*add_uri) (GamesUriGameFactory* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*add_uri_finish) (GamesUriGameFactory* self, GAsyncResult* _res_);
	void (*query_game_for_uri) (GamesUriGameFactory* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GamesGame* (*query_game_for_uri_finish) (GamesUriGameFactory* self, GAsyncResult* _res_);
	void (*foreach_game) (GamesUriGameFactory* self, GamesGameCallback game_callback, void* game_callback_target, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*foreach_game_finish) (GamesUriGameFactory* self, GAsyncResult* _res_);
};

struct _GamesPluginIface {
	GTypeInterface parent_iface;
	gchar** (*get_mime_types) (GamesPlugin* self, int* result_length1);
	GamesUriSource** (*get_uri_sources) (GamesPlugin* self, int* result_length1);
	GamesUriGameFactory** (*get_uri_game_factories) (GamesPlugin* self, int* result_length1);
};

struct _GamesPluginRegistrarPrivate {
	gchar* _name;
	gchar* _description;
	GamesPlugin* plugin;
	gchar* module_path;
	GType type;
	GModule* module;
	gboolean loaded;
};

typedef enum  {
	GAMES_PLUGIN_ERROR_INVALID_PLUGIN_DESCRIPTOR,
	GAMES_PLUGIN_ERROR_NOT_A_PLUGIN
} GamesPluginError;
#define GAMES_PLUGIN_ERROR games_plugin_error_quark ()
typedef GType (*GamesPluginRegistrarRegisterPluginFunc) (GTypeModule* module, void* user_data);

static gpointer games_plugin_registrar_parent_class = NULL;

GType games_plugin_registrar_get_type (void) G_GNUC_CONST;
gpointer games_uri_ref (gpointer instance);
void games_uri_unref (gpointer instance);
GParamSpec* games_param_spec_uri (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void games_value_set_uri (GValue* value, gpointer v_object);
void games_value_take_uri (GValue* value, gpointer v_object);
gpointer games_value_get_uri (const GValue* value);
GType games_uri_get_type (void) G_GNUC_CONST;
GType games_uri_iterator_get_type (void) G_GNUC_CONST;
GType games_uri_source_get_type (void) G_GNUC_CONST;
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_uri_game_factory_get_type (void) G_GNUC_CONST;
GType games_plugin_get_type (void) G_GNUC_CONST;
#define GAMES_PLUGIN_REGISTRAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_PLUGIN_REGISTRAR, GamesPluginRegistrarPrivate))
enum  {
	GAMES_PLUGIN_REGISTRAR_0_PROPERTY,
	GAMES_PLUGIN_REGISTRAR_NAME_PROPERTY,
	GAMES_PLUGIN_REGISTRAR_DESCRIPTION_PROPERTY
};
GQuark games_plugin_error_quark (void);
GamesPluginRegistrar* games_plugin_registrar_new (const gchar* plugin_filename, GError** error);
GamesPluginRegistrar* games_plugin_registrar_construct (GType object_type, const gchar* plugin_filename, GError** error);
static void games_plugin_registrar_set_name (GamesPluginRegistrar* self, const gchar* value);
static void games_plugin_registrar_set_description (GamesPluginRegistrar* self, const gchar* value);
GamesPlugin* games_plugin_registrar_get_plugin (GamesPluginRegistrar* self, GError** error);
static GamesPlugin* games_plugin_registrar_new_plugin (GamesPluginRegistrar* self, GError** error);
static gboolean games_plugin_registrar_real_load (GTypeModule* base);
const gchar* games_plugin_registrar_get_name (GamesPluginRegistrar* self);
const gchar* games_plugin_registrar_get_description (GamesPluginRegistrar* self);
static void games_plugin_registrar_finalize (GObject * obj);
static void _vala_games_plugin_registrar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_plugin_registrar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GamesPluginRegistrar* games_plugin_registrar_construct (GType object_type, const gchar* plugin_filename, GError** error) {
	GamesPluginRegistrar * self = NULL;
	gboolean _tmp0_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (plugin_filename != NULL, NULL);
	self = (GamesPluginRegistrar*) g_object_new (object_type, NULL);
	_tmp0_ = g_module_supported ();
	_vala_assert (_tmp0_, "Module.supported ()");
	{
		GKeyFile* keyfile = NULL;
		GKeyFile* _tmp1_;
		GKeyFile* _tmp2_;
		const gchar* _tmp3_;
		gchar* module_name = NULL;
		GKeyFile* _tmp4_;
		gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_ = NULL;
		GKeyFile* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_ = NULL;
		GKeyFile* _tmp12_;
		gchar* _tmp13_;
		_tmp1_ = g_key_file_new ();
		keyfile = _tmp1_;
		_tmp2_ = keyfile;
		_tmp3_ = plugin_filename;
		g_key_file_load_from_file (_tmp2_, _tmp3_, G_KEY_FILE_NONE, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_key_file_unref0 (keyfile);
			goto __catch4_g_error;
		}
		_tmp4_ = keyfile;
		_tmp5_ = g_key_file_get_string (_tmp4_, "Plugin", "Module", &_inner_error_);
		module_name = _tmp5_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_key_file_unref0 (keyfile);
			goto __catch4_g_error;
		}
		_tmp6_ = module_name;
		_tmp7_ = g_module_build_path (GAMES_PLUGINS_DIR, _tmp6_);
		_g_free0 (self->priv->module_path);
		self->priv->module_path = _tmp7_;
		_tmp9_ = keyfile;
		_tmp10_ = g_key_file_get_string (_tmp9_, "Plugin", "Name", &_inner_error_);
		_tmp8_ = _tmp10_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (module_name);
			_g_key_file_unref0 (keyfile);
			goto __catch4_g_error;
		}
		games_plugin_registrar_set_name (self, _tmp8_);
		_tmp12_ = keyfile;
		_tmp13_ = g_key_file_get_string (_tmp12_, "Plugin", "Description", &_inner_error_);
		_tmp11_ = _tmp13_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (_tmp8_);
			_g_free0 (module_name);
			_g_key_file_unref0 (keyfile);
			goto __catch4_g_error;
		}
		games_plugin_registrar_set_description (self, _tmp11_);
		_g_free0 (_tmp11_);
		_g_free0 (_tmp8_);
		_g_free0 (module_name);
		_g_key_file_unref0 (keyfile);
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError* e = NULL;
		GError* _tmp14_;
		const gchar* _tmp15_;
		GError* _tmp16_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp14_ = e;
		_tmp15_ = _tmp14_->message;
		_tmp16_ = g_error_new (GAMES_PLUGIN_ERROR, GAMES_PLUGIN_ERROR_INVALID_PLUGIN_DESCRIPTOR, _ ("Invalid plugin descriptor: %s"), _tmp15_);
		_inner_error_ = _tmp16_;
		_g_error_free0 (e);
		goto __finally4;
	}
	__finally4:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		if (_inner_error_->domain == GAMES_PLUGIN_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			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;
		}
	}
	self->priv->loaded = FALSE;
	return self;
}


GamesPluginRegistrar* games_plugin_registrar_new (const gchar* plugin_filename, GError** error) {
	return games_plugin_registrar_construct (GAMES_TYPE_PLUGIN_REGISTRAR, plugin_filename, error);
}


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


GamesPlugin* games_plugin_registrar_get_plugin (GamesPluginRegistrar* self, GError** error) {
	GamesPlugin* result = NULL;
	GamesPlugin* _tmp0_;
	GamesPlugin* _tmp3_ = NULL;
	GamesPlugin* _tmp4_;
	GamesPlugin* _tmp5_;
	GamesPlugin* _tmp6_;
	GamesPlugin* _tmp7_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->plugin;
	if (_tmp0_ != NULL) {
		GamesPlugin* _tmp1_;
		GamesPlugin* _tmp2_;
		_tmp1_ = self->priv->plugin;
		_tmp2_ = _g_object_ref0 (_tmp1_);
		result = _tmp2_;
		return result;
	}
	_tmp4_ = games_plugin_registrar_new_plugin (self, &_inner_error_);
	_tmp3_ = _tmp4_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		if (_inner_error_->domain == GAMES_PLUGIN_ERROR) {
			g_propagate_error (error, _inner_error_);
			return NULL;
		} else {
			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;
		}
	}
	_tmp5_ = _tmp3_;
	_tmp3_ = NULL;
	_g_object_unref0 (self->priv->plugin);
	self->priv->plugin = _tmp5_;
	_tmp6_ = self->priv->plugin;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	result = _tmp7_;
	_g_object_unref0 (_tmp3_);
	return result;
}


static GamesPlugin* games_plugin_registrar_new_plugin (GamesPluginRegistrar* self, GError** error) {
	GamesPlugin* result = NULL;
	gboolean _tmp0_;
	GObject* object = NULL;
	GType _tmp1_;
	GObject* _tmp2_;
	GObject* _tmp3_;
	GObject* _tmp4_;
	GamesPlugin* plugin = NULL;
	GObject* _tmp7_;
	GamesPlugin* _tmp8_;
	GamesPlugin* _tmp9_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->loaded;
	if (!_tmp0_) {
		G_TYPE_MODULE_GET_CLASS ((GTypeModule*) self)->load ((GTypeModule*) self);
	}
	_tmp1_ = self->priv->type;
	_tmp2_ = g_object_new (_tmp1_, NULL);
	_tmp3_ = G_IS_INITIALLY_UNOWNED (_tmp2_) ? g_object_ref_sink (_tmp2_) : _tmp2_;
	object = _tmp3_;
	_tmp4_ = object;
	if (_tmp4_ == NULL) {
		const gchar* _tmp5_;
		GError* _tmp6_;
		_tmp5_ = self->priv->module_path;
		_tmp6_ = g_error_new (GAMES_PLUGIN_ERROR, GAMES_PLUGIN_ERROR_NOT_A_PLUGIN, _ ("Couldn’t create a new instance of plugin in “%s”."), _tmp5_);
		_inner_error_ = _tmp6_;
		if (_inner_error_->domain == GAMES_PLUGIN_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_object_unref0 (object);
			return NULL;
		} else {
			_g_object_unref0 (object);
			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;
		}
	}
	_tmp7_ = object;
	_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, GAMES_TYPE_PLUGIN) ? ((GamesPlugin*) _tmp7_) : NULL);
	plugin = _tmp8_;
	_tmp9_ = plugin;
	if (_tmp9_ == NULL) {
		const gchar* _tmp10_;
		GError* _tmp11_;
		_tmp10_ = self->priv->module_path;
		_tmp11_ = g_error_new (GAMES_PLUGIN_ERROR, GAMES_PLUGIN_ERROR_NOT_A_PLUGIN, _ ("Couldn’t create a new instance of plugin in “%s”."), _tmp10_);
		_inner_error_ = _tmp11_;
		if (_inner_error_->domain == GAMES_PLUGIN_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_object_unref0 (plugin);
			_g_object_unref0 (object);
			return NULL;
		} else {
			_g_object_unref0 (plugin);
			_g_object_unref0 (object);
			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;
		}
	}
	result = plugin;
	_g_object_unref0 (object);
	return result;
}


static gboolean games_plugin_registrar_real_load (GTypeModule* base) {
	GamesPluginRegistrar * self;
	gboolean result = FALSE;
	gboolean _tmp0_;
	const gchar* _tmp1_;
	GModule* _tmp2_;
	GModule* _tmp3_;
	void* function = NULL;
	GModule* _tmp4_;
	void* _tmp5_ = NULL;
	void* _tmp6_;
	GamesPluginRegistrarRegisterPluginFunc register_plugin = NULL;
	void* _tmp7_;
	void* register_plugin_target;
	GamesPluginRegistrarRegisterPluginFunc _tmp8_;
	void* _tmp8__target;
	GType _tmp9_;
	self = (GamesPluginRegistrar*) base;
	_tmp0_ = self->priv->loaded;
	if (_tmp0_) {
		result = TRUE;
		return result;
	}
	_tmp1_ = self->priv->module_path;
	_tmp2_ = g_module_open (_tmp1_, G_MODULE_BIND_LAZY);
	_g_module_close0 (self->priv->module);
	self->priv->module = _tmp2_;
	_tmp3_ = self->priv->module;
	if (_tmp3_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp4_ = self->priv->module;
	g_module_symbol (_tmp4_, "register_games_plugin", &_tmp5_);
	function = _tmp5_;
	_tmp6_ = function;
	if (_tmp6_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp7_ = function;
	register_plugin = (GamesPluginRegistrarRegisterPluginFunc) _tmp7_;
	register_plugin_target = NULL;
	_tmp8_ = register_plugin;
	_tmp8__target = register_plugin_target;
	_tmp9_ = _tmp8_ ((GTypeModule*) self, _tmp8__target);
	self->priv->type = _tmp9_;
	self->priv->loaded = TRUE;
	result = TRUE;
	return result;
}


const gchar* games_plugin_registrar_get_name (GamesPluginRegistrar* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}


static void games_plugin_registrar_set_name (GamesPluginRegistrar* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, games_plugin_registrar_get_name (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp1_;
		g_object_notify ((GObject *) self, "name");
	}
}


const gchar* games_plugin_registrar_get_description (GamesPluginRegistrar* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_description;
	result = _tmp0_;
	return result;
}


static void games_plugin_registrar_set_description (GamesPluginRegistrar* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, games_plugin_registrar_get_description (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_description);
		self->priv->_description = _tmp1_;
		g_object_notify ((GObject *) self, "description");
	}
}


static void games_plugin_registrar_class_init (GamesPluginRegistrarClass * klass) {
	games_plugin_registrar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesPluginRegistrarPrivate));
	((GTypeModuleClass *) klass)->load = (gboolean (*) (GTypeModule *)) games_plugin_registrar_real_load;
	G_OBJECT_CLASS (klass)->get_property = _vala_games_plugin_registrar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_plugin_registrar_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_plugin_registrar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PLUGIN_REGISTRAR_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));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PLUGIN_REGISTRAR_DESCRIPTION_PROPERTY, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void games_plugin_registrar_instance_init (GamesPluginRegistrar * self) {
	self->priv = GAMES_PLUGIN_REGISTRAR_GET_PRIVATE (self);
}


static void games_plugin_registrar_finalize (GObject * obj) {
	GamesPluginRegistrar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PLUGIN_REGISTRAR, GamesPluginRegistrar);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_description);
	_g_object_unref0 (self->priv->plugin);
	_g_free0 (self->priv->module_path);
	_g_module_close0 (self->priv->module);
	G_OBJECT_CLASS (games_plugin_registrar_parent_class)->finalize (obj);
}


GType games_plugin_registrar_get_type (void) {
	static volatile gsize games_plugin_registrar_type_id__volatile = 0;
	if (g_once_init_enter (&games_plugin_registrar_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesPluginRegistrarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_plugin_registrar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPluginRegistrar), 0, (GInstanceInitFunc) games_plugin_registrar_instance_init, NULL };
		GType games_plugin_registrar_type_id;
		games_plugin_registrar_type_id = g_type_register_static (g_type_module_get_type (), "GamesPluginRegistrar", &g_define_type_info, 0);
		g_once_init_leave (&games_plugin_registrar_type_id__volatile, games_plugin_registrar_type_id);
	}
	return games_plugin_registrar_type_id__volatile;
}


static void _vala_games_plugin_registrar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesPluginRegistrar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PLUGIN_REGISTRAR, GamesPluginRegistrar);
	switch (property_id) {
		case GAMES_PLUGIN_REGISTRAR_NAME_PROPERTY:
		g_value_set_string (value, games_plugin_registrar_get_name (self));
		break;
		case GAMES_PLUGIN_REGISTRAR_DESCRIPTION_PROPERTY:
		g_value_set_string (value, games_plugin_registrar_get_description (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_plugin_registrar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesPluginRegistrar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PLUGIN_REGISTRAR, GamesPluginRegistrar);
	switch (property_id) {
		case GAMES_PLUGIN_REGISTRAR_NAME_PROPERTY:
		games_plugin_registrar_set_name (self, g_value_get_string (value));
		break;
		case GAMES_PLUGIN_REGISTRAR_DESCRIPTION_PROPERTY:
		games_plugin_registrar_set_description (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


GQuark games_plugin_error_quark (void) {
	return g_quark_from_static_string ("games_plugin_error-quark");
}



