/* steam-plugin.c generated by valac 0.36.9, the Vala compiler
 * generated from steam-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>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>


#define GAMES_TYPE_STEAM_PLUGIN (games_steam_plugin_get_type ())
#define GAMES_STEAM_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_STEAM_PLUGIN, GamesSteamPlugin))
#define GAMES_STEAM_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_STEAM_PLUGIN, GamesSteamPluginClass))
#define GAMES_IS_STEAM_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_STEAM_PLUGIN))
#define GAMES_IS_STEAM_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_STEAM_PLUGIN))
#define GAMES_STEAM_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_STEAM_PLUGIN, GamesSteamPluginClass))

typedef struct _GamesSteamPlugin GamesSteamPlugin;
typedef struct _GamesSteamPluginClass GamesSteamPluginClass;
typedef struct _GamesSteamPluginPrivate GamesSteamPluginPrivate;

#define GAMES_TYPE_STEAM_URI_SOURCE (games_steam_uri_source_get_type ())
#define GAMES_STEAM_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_STEAM_URI_SOURCE, GamesSteamUriSource))
#define GAMES_STEAM_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_STEAM_URI_SOURCE, GamesSteamUriSourceClass))
#define GAMES_IS_STEAM_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_STEAM_URI_SOURCE))
#define GAMES_IS_STEAM_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_STEAM_URI_SOURCE))
#define GAMES_STEAM_URI_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_STEAM_URI_SOURCE, GamesSteamUriSourceClass))

typedef struct _GamesSteamUriSource GamesSteamUriSource;
typedef struct _GamesSteamUriSourceClass GamesSteamUriSourceClass;
#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)))

#define GAMES_TYPE_STEAM_REGISTRY (games_steam_registry_get_type ())
#define GAMES_STEAM_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_STEAM_REGISTRY, GamesSteamRegistry))
#define GAMES_STEAM_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_STEAM_REGISTRY, GamesSteamRegistryClass))
#define GAMES_IS_STEAM_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_STEAM_REGISTRY))
#define GAMES_IS_STEAM_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_STEAM_REGISTRY))
#define GAMES_STEAM_REGISTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_STEAM_REGISTRY, GamesSteamRegistryClass))

typedef struct _GamesSteamRegistry GamesSteamRegistry;
typedef struct _GamesSteamRegistryClass GamesSteamRegistryClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _games_uri_unref0(var) ((var == NULL) ? NULL : (var = (games_uri_unref (var), NULL)))
#define _games_steam_registry_unref0(var) ((var == NULL) ? NULL : (var = (games_steam_registry_unref (var), NULL)))

#define GAMES_TYPE_STEAM_TITLE (games_steam_title_get_type ())
#define GAMES_STEAM_TITLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_STEAM_TITLE, GamesSteamTitle))
#define GAMES_STEAM_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_STEAM_TITLE, GamesSteamTitleClass))
#define GAMES_IS_STEAM_TITLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_STEAM_TITLE))
#define GAMES_IS_STEAM_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_STEAM_TITLE))
#define GAMES_STEAM_TITLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_STEAM_TITLE, GamesSteamTitleClass))

typedef struct _GamesSteamTitle GamesSteamTitle;
typedef struct _GamesSteamTitleClass GamesSteamTitleClass;

#define GAMES_TYPE_STEAM_ICON (games_steam_icon_get_type ())
#define GAMES_STEAM_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_STEAM_ICON, GamesSteamIcon))
#define GAMES_STEAM_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_STEAM_ICON, GamesSteamIconClass))
#define GAMES_IS_STEAM_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_STEAM_ICON))
#define GAMES_IS_STEAM_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_STEAM_ICON))
#define GAMES_STEAM_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_STEAM_ICON, GamesSteamIconClass))

typedef struct _GamesSteamIcon GamesSteamIcon;
typedef struct _GamesSteamIconClass GamesSteamIconClass;

#define GAMES_TYPE_STEAM_COVER (games_steam_cover_get_type ())
#define GAMES_STEAM_COVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_STEAM_COVER, GamesSteamCover))
#define GAMES_STEAM_COVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_STEAM_COVER, GamesSteamCoverClass))
#define GAMES_IS_STEAM_COVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_STEAM_COVER))
#define GAMES_IS_STEAM_COVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_STEAM_COVER))
#define GAMES_STEAM_COVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_STEAM_COVER, GamesSteamCoverClass))

typedef struct _GamesSteamCover GamesSteamCover;
typedef struct _GamesSteamCoverClass GamesSteamCoverClass;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

struct _GamesSteamPlugin {
	GObject parent_instance;
	GamesSteamPluginPrivate * priv;
};

struct _GamesSteamPluginClass {
	GObjectClass parent_class;
};

typedef enum  {
	GAMES_STEAM_ERROR_NO_APPID,
	GAMES_STEAM_ERROR_NO_NAME
} GamesSteamError;
#define GAMES_STEAM_ERROR games_steam_error_quark ()

static gpointer games_steam_plugin_parent_class = NULL;
static GHashTable* games_steam_plugin_game_for_id;
static GHashTable* games_steam_plugin_game_for_id = NULL;
static GamesPluginIface * games_steam_plugin_games_plugin_parent_iface = NULL;
static GType games_steam_plugin_type_id = 0;

GType games_steam_plugin_get_type (void) G_GNUC_CONST;
enum  {
	GAMES_STEAM_PLUGIN_0_PROPERTY
};
#define GAMES_STEAM_PLUGIN_STEAM_FILE_SCHEME "steam+file"
static GamesUriSource** games_steam_plugin_real_get_uri_sources (GamesPlugin* base, int* result_length1);
GType games_steam_uri_source_get_type (void) G_GNUC_CONST;
GamesSteamUriSource* games_steam_uri_source_new (GError** error);
GamesSteamUriSource* games_steam_uri_source_construct (GType object_type, GError** error);
static GamesUriGameFactory** games_steam_plugin_real_get_uri_game_factories (GamesPlugin* base, int* result_length1);
static GamesGame* games_steam_plugin_game_for_uri (GamesUri* uri, GError** error);
static GamesGame* _games_steam_plugin_game_for_uri_games_generic_game_uri_adapter_game_for_uri (GamesUri* uri, gpointer self, GError** error);
gpointer games_steam_registry_ref (gpointer instance);
void games_steam_registry_unref (gpointer instance);
GParamSpec* games_param_spec_steam_registry (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void games_value_set_steam_registry (GValue* value, gpointer v_object);
void games_value_take_steam_registry (GValue* value, gpointer v_object);
gpointer games_value_get_steam_registry (const GValue* value);
GType games_steam_registry_get_type (void) G_GNUC_CONST;
GamesSteamRegistry* games_steam_registry_new (const gchar* appmanifest_path, GError** error);
GamesSteamRegistry* games_steam_registry_construct (GType object_type, const gchar* appmanifest_path, GError** error);
gchar* games_steam_registry_get_data (GamesSteamRegistry* self, gchar** path, int path_length1);
GQuark games_steam_error_quark (void);
GType games_steam_title_get_type (void) G_GNUC_CONST;
GamesSteamTitle* games_steam_title_new (GamesSteamRegistry* registry);
GamesSteamTitle* games_steam_title_construct (GType object_type, GamesSteamRegistry* registry);
GType games_steam_icon_get_type (void) G_GNUC_CONST;
GamesSteamIcon* games_steam_icon_new (const gchar* game_id);
GamesSteamIcon* games_steam_icon_construct (GType object_type, const gchar* game_id);
GType games_steam_cover_get_type (void) G_GNUC_CONST;
GamesSteamCover* games_steam_cover_new (const gchar* game_id);
GamesSteamCover* games_steam_cover_construct (GType object_type, const gchar* game_id);
GamesSteamPlugin* games_steam_plugin_new (void);
GamesSteamPlugin* games_steam_plugin_construct (GType object_type);
static void _g_free0_ (gpointer var);
static void _g_object_unref0_ (gpointer var);
static void games_steam_plugin_finalize (GObject * obj);
GType register_games_plugin (GTypeModule* module);
GType games_steam_cover_register_type (GTypeModule * module);
GType games_steam_icon_register_type (GTypeModule * module);
GType games_steam_plugin_register_type (GTypeModule * module);
GType games_steam_registry_register_type (GTypeModule * module);
GType games_steam_registry_value_register_type (GTypeModule * module);
GType games_steam_registry_node_register_type (GTypeModule * module);
GType games_steam_registry_data_register_type (GTypeModule * module);
GType games_steam_title_register_type (GTypeModule * module);
GType games_steam_uri_iterator_register_type (GTypeModule * module);
GType games_steam_uri_source_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 gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static GamesUriSource** games_steam_plugin_real_get_uri_sources (GamesPlugin* base, int* result_length1) {
	GamesSteamPlugin * self;
	GamesUriSource** result = NULL;
	GamesUriSource** _tmp6_;
	GamesUriSource** _tmp7_;
	gint _tmp7__length1;
	GError * _inner_error_ = NULL;
	self = (GamesSteamPlugin*) base;
	{
		GamesSteamUriSource* source = NULL;
		GamesSteamUriSource* _tmp0_;
		GamesUriSource* _tmp1_;
		GamesUriSource** _tmp2_;
		GamesUriSource** _tmp3_;
		gint _tmp3__length1;
		_tmp0_ = games_steam_uri_source_new (&_inner_error_);
		source = _tmp0_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch3_g_error;
		}
		_tmp1_ = _g_object_ref0 ((GamesUriSource*) source);
		_tmp2_ = g_new0 (GamesUriSource*, 1 + 1);
		_tmp2_[0] = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp3__length1 = 1;
		if (result_length1) {
			*result_length1 = _tmp3__length1;
		}
		result = _tmp3_;
		_g_object_unref0 (source);
		return result;
	}
	goto __finally3;
	__catch3_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_debug ("steam-plugin.vala:19: %s", _tmp5_);
		_g_error_free0 (e);
	}
	__finally3:
	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_ = g_new0 (GamesUriSource*, 0 + 1);
	_tmp7_ = _tmp6_;
	_tmp7__length1 = 0;
	if (result_length1) {
		*result_length1 = _tmp7__length1;
	}
	result = _tmp7_;
	return result;
}


static GamesGame* _games_steam_plugin_game_for_uri_games_generic_game_uri_adapter_game_for_uri (GamesUri* uri, gpointer self, GError** error) {
	GamesGame* result;
	result = games_steam_plugin_game_for_uri (uri, error);
	return result;
}


static GamesUriGameFactory** games_steam_plugin_real_get_uri_game_factories (GamesPlugin* base, int* result_length1) {
	GamesSteamPlugin * self;
	GamesUriGameFactory** result = NULL;
	GamesGenericGameUriAdapter* game_uri_adapter = NULL;
	GamesGenericGameUriAdapter* _tmp0_;
	GamesGenericUriGameFactory* factory = NULL;
	GamesGenericUriGameFactory* _tmp1_;
	GamesUriGameFactory* _tmp2_;
	GamesUriGameFactory** _tmp3_;
	GamesUriGameFactory** _tmp4_;
	gint _tmp4__length1;
	self = (GamesSteamPlugin*) base;
	_tmp0_ = games_generic_game_uri_adapter_new (_games_steam_plugin_game_for_uri_games_generic_game_uri_adapter_game_for_uri, NULL, NULL);
	game_uri_adapter = _tmp0_;
	_tmp1_ = games_generic_uri_game_factory_new ((GamesGameUriAdapter*) game_uri_adapter);
	factory = _tmp1_;
	games_generic_uri_game_factory_add_scheme (factory, GAMES_STEAM_PLUGIN_STEAM_FILE_SCHEME);
	_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;
}


static GamesGame* games_steam_plugin_game_for_uri (GamesUri* uri, GError** error) {
	GamesGame* result = NULL;
	GamesUri* file_uri = NULL;
	GamesUri* _tmp0_;
	GamesUri* _tmp1_;
	GFile* file = NULL;
	GamesUri* _tmp2_;
	GFile* _tmp3_;
	gchar* appmanifest_path = NULL;
	GFile* _tmp4_;
	gchar* _tmp5_;
	GamesSteamRegistry* registry = NULL;
	const gchar* _tmp6_;
	GamesSteamRegistry* _tmp7_;
	gchar* game_id = NULL;
	GamesSteamRegistry* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar** _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp22_;
	GHashTable* _tmp25_;
	const gchar* _tmp26_;
	gboolean _tmp27_;
	GamesSteamTitle* title = NULL;
	GamesSteamRegistry* _tmp32_;
	GamesSteamTitle* _tmp33_;
	GamesSteamIcon* icon = NULL;
	const gchar* _tmp34_;
	GamesSteamIcon* _tmp35_;
	GamesSteamCover* cover = NULL;
	const gchar* _tmp36_;
	GamesSteamCover* _tmp37_;
	gchar** args = NULL;
	gchar* _tmp38_;
	const gchar* _tmp39_;
	gchar* _tmp40_;
	gchar** _tmp41_;
	gint args_length1;
	gint _args_size_;
	GamesCommandRunner* runner = NULL;
	gchar** _tmp42_;
	gint _tmp42__length1;
	GamesCommandRunner* _tmp43_;
	GamesGenericGame* game = NULL;
	GamesSteamTitle* _tmp44_;
	GamesSteamIcon* _tmp45_;
	GamesSteamCover* _tmp46_;
	GamesCommandRunner* _tmp47_;
	GamesGenericGame* _tmp48_;
	GHashTable* _tmp49_;
	const gchar* _tmp50_;
	gchar* _tmp51_;
	GamesGenericGame* _tmp52_;
	GamesGame* _tmp53_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (uri != NULL, NULL);
	_tmp0_ = uri;
	_tmp1_ = games_uri_new_from_uri_and_scheme (_tmp0_, "file", &_inner_error_);
	file_uri = _tmp1_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp2_ = file_uri;
	_tmp3_ = games_uri_to_file (_tmp2_);
	file = _tmp3_;
	_tmp4_ = file;
	_tmp5_ = g_file_get_path (_tmp4_);
	appmanifest_path = _tmp5_;
	_tmp6_ = appmanifest_path;
	_tmp7_ = games_steam_registry_new (_tmp6_, &_inner_error_);
	registry = _tmp7_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_free0 (appmanifest_path);
		_g_object_unref0 (file);
		_games_uri_unref0 (file_uri);
		return NULL;
	}
	_tmp8_ = registry;
	_tmp9_ = g_strdup ("AppState");
	_tmp10_ = g_strdup ("appid");
	_tmp11_ = g_new0 (gchar*, 2 + 1);
	_tmp11_[0] = _tmp9_;
	_tmp11_[1] = _tmp10_;
	_tmp12_ = _tmp11_;
	_tmp12__length1 = 2;
	_tmp13_ = games_steam_registry_get_data (_tmp8_, _tmp12_, 2);
	_tmp14_ = _tmp13_;
	_tmp12_ = (_vala_array_free (_tmp12_, _tmp12__length1, (GDestroyNotify) g_free), NULL);
	game_id = _tmp14_;
	_tmp15_ = game_id;
	if (_tmp15_ == NULL) {
		GamesSteamRegistry* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar** _tmp19_;
		gchar** _tmp20_;
		gint _tmp20__length1;
		gchar* _tmp21_;
		_tmp16_ = registry;
		_tmp17_ = g_strdup ("AppState");
		_tmp18_ = g_strdup ("appID");
		_tmp19_ = g_new0 (gchar*, 2 + 1);
		_tmp19_[0] = _tmp17_;
		_tmp19_[1] = _tmp18_;
		_tmp20_ = _tmp19_;
		_tmp20__length1 = 2;
		_tmp21_ = games_steam_registry_get_data (_tmp16_, _tmp20_, 2);
		_g_free0 (game_id);
		game_id = _tmp21_;
		_tmp20_ = (_vala_array_free (_tmp20_, _tmp20__length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp22_ = game_id;
	if (_tmp22_ == NULL) {
		const gchar* _tmp23_;
		GError* _tmp24_;
		_tmp23_ = appmanifest_path;
		_tmp24_ = g_error_new (GAMES_STEAM_ERROR, GAMES_STEAM_ERROR_NO_APPID, _ ("Couldn’t get Steam appid from manifest “%s”."), _tmp23_);
		_inner_error_ = _tmp24_;
		g_propagate_error (error, _inner_error_);
		_g_free0 (game_id);
		_games_steam_registry_unref0 (registry);
		_g_free0 (appmanifest_path);
		_g_object_unref0 (file);
		_games_uri_unref0 (file_uri);
		return NULL;
	}
	_tmp25_ = games_steam_plugin_game_for_id;
	_tmp26_ = game_id;
	_tmp27_ = g_hash_table_contains (_tmp25_, _tmp26_);
	if (_tmp27_) {
		GamesGame* game = NULL;
		GHashTable* _tmp28_;
		const gchar* _tmp29_;
		gconstpointer _tmp30_;
		GamesGame* _tmp31_;
		_tmp28_ = games_steam_plugin_game_for_id;
		_tmp29_ = game_id;
		_tmp30_ = g_hash_table_lookup (_tmp28_, _tmp29_);
		_tmp31_ = _g_object_ref0 ((GamesGame*) _tmp30_);
		game = _tmp31_;
		result = game;
		_g_free0 (game_id);
		_games_steam_registry_unref0 (registry);
		_g_free0 (appmanifest_path);
		_g_object_unref0 (file);
		_games_uri_unref0 (file_uri);
		return result;
	}
	_tmp32_ = registry;
	_tmp33_ = games_steam_title_new (_tmp32_);
	title = _tmp33_;
	_tmp34_ = game_id;
	_tmp35_ = games_steam_icon_new (_tmp34_);
	icon = _tmp35_;
	_tmp36_ = game_id;
	_tmp37_ = games_steam_cover_new (_tmp36_);
	cover = _tmp37_;
	_tmp38_ = g_strdup ("steam");
	_tmp39_ = game_id;
	_tmp40_ = g_strconcat ("steam://rungameid/", _tmp39_, NULL);
	_tmp41_ = g_new0 (gchar*, 2 + 1);
	_tmp41_[0] = _tmp38_;
	_tmp41_[1] = _tmp40_;
	args = _tmp41_;
	args_length1 = 2;
	_args_size_ = args_length1;
	_tmp42_ = args;
	_tmp42__length1 = args_length1;
	_tmp43_ = games_command_runner_new (_tmp42_, _tmp42__length1, FALSE);
	runner = _tmp43_;
	_tmp44_ = title;
	_tmp45_ = icon;
	_tmp46_ = cover;
	_tmp47_ = runner;
	_tmp48_ = games_generic_game_new ((GamesTitle*) _tmp44_, (GamesIcon*) _tmp45_, (GamesCover*) _tmp46_, (GamesRunner*) _tmp47_);
	game = _tmp48_;
	_tmp49_ = games_steam_plugin_game_for_id;
	_tmp50_ = game_id;
	_tmp51_ = g_strdup (_tmp50_);
	_tmp52_ = game;
	_tmp53_ = _g_object_ref0 ((GamesGame*) _tmp52_);
	g_hash_table_insert (_tmp49_, _tmp51_, _tmp53_);
	result = (GamesGame*) game;
	_g_object_unref0 (runner);
	args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (cover);
	_g_object_unref0 (icon);
	_g_object_unref0 (title);
	_g_free0 (game_id);
	_games_steam_registry_unref0 (registry);
	_g_free0 (appmanifest_path);
	_g_object_unref0 (file);
	_games_uri_unref0 (file_uri);
	return result;
}


GamesSteamPlugin* games_steam_plugin_construct (GType object_type) {
	GamesSteamPlugin * self = NULL;
	self = (GamesSteamPlugin*) g_object_new (object_type, NULL);
	return self;
}


GamesSteamPlugin* games_steam_plugin_new (void) {
	return games_steam_plugin_construct (GAMES_TYPE_STEAM_PLUGIN);
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static void games_steam_plugin_class_init (GamesSteamPluginClass * klass) {
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	games_steam_plugin_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = games_steam_plugin_finalize;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (games_steam_plugin_game_for_id);
	games_steam_plugin_game_for_id = _tmp2_;
}


static void games_steam_plugin_games_plugin_interface_init (GamesPluginIface * iface) {
	games_steam_plugin_games_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_uri_sources = (GamesUriSource** (*) (GamesPlugin *, int*)) games_steam_plugin_real_get_uri_sources;
	iface->get_uri_game_factories = (GamesUriGameFactory** (*) (GamesPlugin *, int*)) games_steam_plugin_real_get_uri_game_factories;
}


static void games_steam_plugin_instance_init (GamesSteamPlugin * self) {
}


static void games_steam_plugin_finalize (GObject * obj) {
	GamesSteamPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_STEAM_PLUGIN, GamesSteamPlugin);
	G_OBJECT_CLASS (games_steam_plugin_parent_class)->finalize (obj);
}


GType games_steam_plugin_get_type (void) {
	return games_steam_plugin_type_id;
}


GType games_steam_plugin_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GamesSteamPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_steam_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesSteamPlugin), 0, (GInstanceInitFunc) games_steam_plugin_instance_init, NULL };
	static const GInterfaceInfo games_plugin_info = { (GInterfaceInitFunc) games_steam_plugin_games_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_steam_plugin_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesSteamPlugin", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_steam_plugin_type_id, GAMES_TYPE_PLUGIN, &games_plugin_info);
	return games_steam_plugin_type_id;
}


GType register_games_plugin (GTypeModule* module) {
	GType result = 0UL;
	g_return_val_if_fail (module != NULL, 0UL);
	games_steam_cover_register_type (module);
	games_steam_icon_register_type (module);
	games_steam_plugin_register_type (module);
	games_steam_registry_register_type (module);
	games_steam_registry_value_register_type (module);
	games_steam_registry_node_register_type (module);
	games_steam_registry_data_register_type (module);
	games_steam_title_register_type (module);
	games_steam_uri_iterator_register_type (module);
	games_steam_uri_source_register_type (module);
	result = GAMES_TYPE_STEAM_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);
}



