/* game-collection.c generated by valac 0.36.6.6-c7bee, the Vala compiler
 * generated from game-collection.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_COLLECTION (games_game_collection_get_type ())
#define GAMES_GAME_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME_COLLECTION, GamesGameCollection))
#define GAMES_GAME_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GAME_COLLECTION, GamesGameCollectionClass))
#define GAMES_IS_GAME_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME_COLLECTION))
#define GAMES_IS_GAME_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GAME_COLLECTION))
#define GAMES_GAME_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GAME_COLLECTION, GamesGameCollectionClass))

typedef struct _GamesGameCollection GamesGameCollection;
typedef struct _GamesGameCollectionClass GamesGameCollectionClass;
typedef struct _GamesGameCollectionPrivate GamesGameCollectionPrivate;

#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_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 _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _games_uri_unref0(var) ((var == NULL) ? NULL : (var = (games_uri_unref (var), NULL)))
typedef struct _GamesGameCollectionAddUriData GamesGameCollectionAddUriData;
typedef struct _GamesGameCollectionQueryGameForUriData GamesGameCollectionQueryGameForUriData;
typedef struct _GamesGameCollectionSearchGamesData GamesGameCollectionSearchGamesData;
typedef struct _GamesGameCollectionEachGameData GamesGameCollectionEachGameData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _GamesGameCollectionGetFactoriesForUriData GamesGameCollectionGetFactoriesForUriData;
typedef struct _GamesGameCollectionGetFactoriesForFileData GamesGameCollectionGetFactoriesForFileData;

struct _GamesGameCollection {
	GObject parent_instance;
	GamesGameCollectionPrivate * priv;
};

struct _GamesGameCollectionClass {
	GObjectClass parent_class;
};

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 _GamesUriIteratorIface {
	GTypeInterface parent_iface;
	GamesUri* (*get) (GamesUriIterator* self);
	gboolean (*next) (GamesUriIterator* self);
};

struct _GamesUriSourceIface {
	GTypeInterface parent_iface;
	GamesUriIterator* (*iterator) (GamesUriSource* 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 _GamesGameCollectionPrivate {
	GHashTable* games;
	GListStore* list_store;
	GamesUriSource** sources;
	gint sources_length1;
	gint _sources_size_;
	GamesUriGameFactory** factories;
	gint factories_length1;
	gint _factories_size_;
	GHashTable* factories_for_mime_type;
	GHashTable* factories_for_scheme;
};

struct _GamesGameCollectionAddUriData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesGameCollection* self;
	GamesUri* uri;
	GamesUri* _tmp0_;
	gint _tmp1_;
	GamesUriGameFactory** _tmp2_;
	GamesUriGameFactory** factory_collection;
	gint factory_collection_length1;
	gint _factory_collection_size_;
	gint factory_it;
	GamesUriGameFactory* _tmp3_;
	GamesUriGameFactory* factory;
	GamesUriGameFactory* _tmp4_;
	GamesUri* _tmp5_;
};

struct _GamesGameCollectionQueryGameForUriData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesGameCollection* self;
	GamesUri* uri;
	GamesGame* result;
	GamesGame** games;
	GamesGame** _tmp0_;
	gint games_length1;
	gint _games_size_;
	GamesUri* _tmp1_;
	gint _tmp2_;
	GamesUriGameFactory** _tmp3_;
	GamesUriGameFactory** factory_collection;
	gint factory_collection_length1;
	gint _factory_collection_size_;
	gint factory_it;
	GamesUriGameFactory* _tmp4_;
	GamesUriGameFactory* factory;
	GamesGame* game;
	GamesUriGameFactory* _tmp5_;
	GamesUri* _tmp6_;
	GamesGame* _tmp7_;
	GamesGame* _tmp8_;
	GamesGame** _tmp9_;
	gint _tmp9__length1;
	GamesGame* _tmp10_;
	GamesGame* _tmp11_;
	GamesGame** _tmp12_;
	gint _tmp12__length1;
	GamesGame** _tmp13_;
	gint _tmp13__length1;
	GamesGame* _tmp14_;
	GamesGame* _tmp15_;
};

struct _GamesGameCollectionSearchGamesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesGameCollection* self;
	GamesUriSource** _tmp0_;
	gint _tmp0__length1;
	GamesUriSource** source_collection;
	gint source_collection_length1;
	gint _source_collection_size_;
	gint source_it;
	GamesUriSource* _tmp1_;
	GamesUriSource* source;
	GamesUriIterator* _uri_it;
	GamesUriSource* _tmp2_;
	GamesUriIterator* _tmp3_;
	GamesUriIterator* _tmp4_;
	gboolean _tmp5_;
	GamesUri* uri;
	GamesUriIterator* _tmp6_;
	GamesUri* _tmp7_;
	GamesUri* _tmp8_;
};

struct _GamesGameCollectionEachGameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesGameCollection* self;
	GamesGameCallback callback;
	gpointer callback_target;
	GamesUriSource** _tmp0_;
	gint _tmp0__length1;
	GamesUriSource** source_collection;
	gint source_collection_length1;
	gint _source_collection_size_;
	gint source_it;
	GamesUriSource* _tmp1_;
	GamesUriSource* source;
	GamesUriIterator* _uri_it;
	GamesUriSource* _tmp2_;
	GamesUriIterator* _tmp3_;
	GamesUriIterator* _tmp4_;
	gboolean _tmp5_;
	GamesUri* uri;
	GamesUriIterator* _tmp6_;
	GamesUri* _tmp7_;
	GamesUri* _tmp8_;
	GamesUriGameFactory** _tmp9_;
	gint _tmp9__length1;
	GamesUriGameFactory** factory_collection;
	gint factory_collection_length1;
	gint _factory_collection_size_;
	gint factory_it;
	GamesUriGameFactory* _tmp10_;
	GamesUriGameFactory* factory;
	GamesUriGameFactory* _tmp11_;
	GamesGameCallback _tmp12_;
	void* _tmp12__target;
};

struct _GamesGameCollectionGetFactoriesForUriData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesGameCollection* self;
	GamesUri* uri;
	GamesUriGameFactory** result;
	gint result_length1;
	GamesUriGameFactory** factories;
	GamesUriGameFactory** _tmp0_;
	gint factories_length1;
	gint _factories_size_;
	gchar* scheme;
	gchar* _tmp1_;
	GamesUri* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GError* e;
	GError* _tmp5_;
	const gchar* _tmp6_;
	GamesUriGameFactory** _tmp7_;
	gint _tmp7__length1;
	const gchar* _tmp8_;
	GFile* file;
	GamesUri* _tmp9_;
	GFile* _tmp10_;
	GamesUriGameFactory** _tmp11_;
	GFile* _tmp12_;
	gint _tmp13_;
	GamesUriGameFactory** _tmp14_;
	gint _tmp11__length1;
	gint __tmp11__size_;
	GamesUriGameFactory** factory_collection;
	gint factory_collection_length1;
	gint _factory_collection_size_;
	gint factory_it;
	GamesUriGameFactory* _tmp15_;
	GamesUriGameFactory* factory;
	GamesUriGameFactory** _tmp16_;
	gint _tmp16__length1;
	GamesUriGameFactory* _tmp17_;
	GamesUriGameFactory* _tmp18_;
	GError* _vala1_e;
	GError* _tmp19_;
	const gchar* _tmp20_;
	GHashTable* _tmp21_;
	const gchar* _tmp22_;
	gboolean _tmp23_;
	GHashTable* _tmp24_;
	const gchar* _tmp25_;
	gconstpointer _tmp26_;
	gpointer* _tmp27_;
	gint _tmp27__length1;
	GamesUriGameFactory** _vala1_factory_collection;
	gint _vala1_factory_collection_length1;
	gint __vala1_factory_collection_size_;
	gint _vala1_factory_it;
	GamesUriGameFactory* _tmp28_;
	GamesUriGameFactory* _vala1_factory;
	GamesUriGameFactory** _tmp29_;
	gint _tmp29__length1;
	GamesUriGameFactory* _tmp30_;
	GamesUriGameFactory* _tmp31_;
	GamesUriGameFactory** _tmp32_;
	gint _tmp32__length1;
	GError * _inner_error_;
};

struct _GamesGameCollectionGetFactoriesForFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesGameCollection* self;
	GFile* file;
	GamesUriGameFactory** result;
	gint result_length1;
	GFile* _tmp0_;
	gboolean _tmp1_;
	GamesUriGameFactory** _tmp2_;
	GamesUriGameFactory** _tmp3_;
	gint _tmp3__length1;
	GFileInfo* file_info;
	GFile* _tmp4_;
	GFileInfo* _tmp5_;
	gchar* mime_type;
	GFileInfo* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	GHashTable* _tmp9_;
	const gchar* _tmp10_;
	gboolean _tmp11_;
	GamesUriGameFactory** _tmp12_;
	GamesUriGameFactory** _tmp13_;
	gint _tmp13__length1;
	GHashTable* _tmp14_;
	const gchar* _tmp15_;
	gconstpointer _tmp16_;
	gpointer* _tmp17_;
	gint _tmp17__length1;
	GamesUriGameFactory** _tmp18_;
	gint _tmp18__length1;
	GamesUriGameFactory** _tmp19_;
	gint _tmp19__length1;
	GError * _inner_error_;
};


static gpointer games_game_collection_parent_class = NULL;

GType games_game_collection_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;
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_uri_game_factory_get_type (void) G_GNUC_CONST;
#define GAMES_GAME_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_GAME_COLLECTION, GamesGameCollectionPrivate))
enum  {
	GAMES_GAME_COLLECTION_0_PROPERTY
};
GListStore* games_game_collection_get_list_store (GamesGameCollection* self);
void games_game_collection_add_source (GamesGameCollection* self, GamesUriSource* source);
static void _vala_array_add1 (GamesUriSource** * array, int* length, int* size, GamesUriSource* value);
void games_game_collection_add_factory (GamesGameCollection* self, GamesUriGameFactory* factory);
static void _vala_array_add2 (GamesUriGameFactory** * array, int* length, int* size, GamesUriGameFactory* value);
gchar** games_uri_game_factory_get_mime_types (GamesUriGameFactory* self, int* result_length1);
gchar** games_uri_game_factory_get_schemes (GamesUriGameFactory* self, int* result_length1);
static void __lambda5_ (GamesGameCollection* self, GamesGame* game);
static void games_game_collection_store_game (GamesGameCollection* self, GamesGame* game);
static void ___lambda5__games_uri_game_factory_game_added (GamesUriGameFactory* _sender, GamesGame* game, gpointer self);
gchar** games_game_collection_get_accepted_mime_types (GamesGameCollection* self, int* result_length1);
static gchar** _vala_array_dup2 (gchar** self, int length);
static void games_game_collection_add_uri_data_free (gpointer _data);
static void games_game_collection_add_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void games_game_collection_add_uri (GamesGameCollection* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
void games_game_collection_add_uri_finish (GamesGameCollection* self, GAsyncResult* _res_);
static gboolean games_game_collection_add_uri_co (GamesGameCollectionAddUriData* _data_);
static void games_game_collection_get_factories_for_uri (GamesGameCollection* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GamesUriGameFactory** games_game_collection_get_factories_for_uri_finish (GamesGameCollection* self, GAsyncResult* _res_, int* result_length1);
static void games_game_collection_add_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void games_uri_game_factory_add_uri (GamesUriGameFactory* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
void games_uri_game_factory_add_uri_finish (GamesUriGameFactory* self, GAsyncResult* _res_);
static void games_game_collection_query_game_for_uri_data_free (gpointer _data);
static void games_game_collection_query_game_for_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void games_game_collection_query_game_for_uri (GamesGameCollection* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
GamesGame* games_game_collection_query_game_for_uri_finish (GamesGameCollection* self, GAsyncResult* _res_);
static gboolean games_game_collection_query_game_for_uri_co (GamesGameCollectionQueryGameForUriData* _data_);
static void games_game_collection_query_game_for_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void games_uri_game_factory_query_game_for_uri (GamesUriGameFactory* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
GamesGame* games_uri_game_factory_query_game_for_uri_finish (GamesUriGameFactory* self, GAsyncResult* _res_);
static void _vala_array_add3 (GamesGame** * array, int* length, int* size, GamesGame* value);
static void games_game_collection_search_games_data_free (gpointer _data);
static void games_game_collection_search_games_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void games_game_collection_search_games (GamesGameCollection* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void games_game_collection_search_games_finish (GamesGameCollection* self, GAsyncResult* _res_);
static gboolean games_game_collection_search_games_co (GamesGameCollectionSearchGamesData* _data_);
GamesUriIterator* games_uri_source_iterator (GamesUriSource* self);
gboolean games_uri_iterator_next (GamesUriIterator* self);
GamesUri* games_uri_iterator_get (GamesUriIterator* self);
static void games_game_collection_search_games_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void games_game_collection_each_game_data_free (gpointer _data);
static void games_game_collection_each_game_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void games_game_collection_each_game (GamesGameCollection* self, GamesGameCallback callback, void* callback_target, GAsyncReadyCallback _callback_, gpointer _user_data_);
void games_game_collection_each_game_finish (GamesGameCollection* self, GAsyncResult* _res_);
static gboolean games_game_collection_each_game_co (GamesGameCollectionEachGameData* _data_);
static void games_game_collection_each_game_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void games_uri_game_factory_foreach_game (GamesUriGameFactory* self, GamesGameCallback game_callback, void* game_callback_target, GAsyncReadyCallback _callback_, gpointer _user_data_);
void games_uri_game_factory_foreach_game_finish (GamesUriGameFactory* self, GAsyncResult* _res_);
static void games_game_collection_get_factories_for_uri_data_free (gpointer _data);
static void games_game_collection_get_factories_for_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean games_game_collection_get_factories_for_uri_co (GamesGameCollectionGetFactoriesForUriData* _data_);
static gboolean _games_game_collection_get_factories_for_uri_co_gsource_func (gpointer self);
gchar* games_uri_get_scheme (GamesUri* self, GError** error);
GFile* games_uri_to_file (GamesUri* self);
static void games_game_collection_get_factories_for_file (GamesGameCollection* self, GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GamesUriGameFactory** games_game_collection_get_factories_for_file_finish (GamesGameCollection* self, GAsyncResult* _res_, int* result_length1, GError** error);
static void games_game_collection_get_factories_for_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _vala_array_add4 (GamesUriGameFactory** * array, int* length, int* size, GamesUriGameFactory* value);
static void _vala_array_add5 (GamesUriGameFactory** * array, int* length, int* size, GamesUriGameFactory* value);
static void games_game_collection_get_factories_for_file_data_free (gpointer _data);
static void games_game_collection_get_factories_for_file_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean games_game_collection_get_factories_for_file_co (GamesGameCollectionGetFactoriesForFileData* _data_);
static GamesUriGameFactory** _vala_array_dup3 (GamesUriGameFactory** self, int length);
GamesGameCollection* games_game_collection_new (void);
GamesGameCollection* games_game_collection_construct (GType object_type);
static GObject * games_game_collection_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _g_object_unref0_ (gpointer var);
static void _g_free0_ (gpointer var);
static void _g_array_unref0_ (gpointer var);
static void games_game_collection_finalize (GObject * obj);
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;
}


GListStore* games_game_collection_get_list_store (GamesGameCollection* self) {
	GListStore* result = NULL;
	GListStore* _tmp0_;
	GListStore* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->list_store;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


static void _vala_array_add1 (GamesUriSource** * array, int* length, int* size, GamesUriSource* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesUriSource*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


void games_game_collection_add_source (GamesGameCollection* self, GamesUriSource* source) {
	GamesUriSource** _tmp0_;
	gint _tmp0__length1;
	GamesUriSource* _tmp1_;
	GamesUriSource* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	_tmp0_ = self->priv->sources;
	_tmp0__length1 = self->priv->sources_length1;
	_tmp1_ = source;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_vala_array_add1 (&self->priv->sources, &self->priv->sources_length1, &self->priv->_sources_size_, _tmp2_);
}


static void _vala_array_add2 (GamesUriGameFactory** * array, int* length, int* size, GamesUriGameFactory* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesUriGameFactory*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static void __lambda5_ (GamesGameCollection* self, GamesGame* game) {
	GamesGame* _tmp0_;
	g_return_if_fail (game != NULL);
	_tmp0_ = game;
	games_game_collection_store_game (self, _tmp0_);
}


static void ___lambda5__games_uri_game_factory_game_added (GamesUriGameFactory* _sender, GamesGame* game, gpointer self) {
	__lambda5_ ((GamesGameCollection*) self, game);
}


void games_game_collection_add_factory (GamesGameCollection* self, GamesUriGameFactory* factory) {
	GamesUriGameFactory** _tmp0_;
	gint _tmp0__length1;
	GamesUriGameFactory* _tmp1_;
	GamesUriGameFactory* _tmp2_;
	GamesUriGameFactory* _tmp3_;
	gint _tmp4_;
	gchar** _tmp5_;
	GamesUriGameFactory* _tmp19_;
	gint _tmp20_;
	gchar** _tmp21_;
	GamesUriGameFactory* _tmp35_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (factory != NULL);
	_tmp0_ = self->priv->factories;
	_tmp0__length1 = self->priv->factories_length1;
	_tmp1_ = factory;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_vala_array_add2 (&self->priv->factories, &self->priv->factories_length1, &self->priv->_factories_size_, _tmp2_);
	_tmp3_ = factory;
	_tmp5_ = games_uri_game_factory_get_mime_types (_tmp3_, &_tmp4_);
	{
		gchar** mime_type_collection = NULL;
		gint mime_type_collection_length1 = 0;
		gint _mime_type_collection_size_ = 0;
		gint mime_type_it = 0;
		mime_type_collection = _tmp5_;
		mime_type_collection_length1 = _tmp4_;
		for (mime_type_it = 0; mime_type_it < _tmp4_; mime_type_it = mime_type_it + 1) {
			gchar* _tmp6_;
			gchar* mime_type = NULL;
			_tmp6_ = g_strdup (mime_type_collection[mime_type_it]);
			mime_type = _tmp6_;
			{
				GHashTable* _tmp7_;
				const gchar* _tmp8_;
				gboolean _tmp9_;
				GHashTable* _tmp14_;
				const gchar* _tmp15_;
				gconstpointer _tmp16_;
				GamesUriGameFactory* _tmp17_;
				GamesUriGameFactory* _tmp18_;
				_tmp7_ = self->priv->factories_for_mime_type;
				_tmp8_ = mime_type;
				_tmp9_ = g_hash_table_contains (_tmp7_, _tmp8_);
				if (!_tmp9_) {
					GHashTable* _tmp10_;
					const gchar* _tmp11_;
					gchar* _tmp12_;
					GArray* _tmp13_;
					_tmp10_ = self->priv->factories_for_mime_type;
					_tmp11_ = mime_type;
					_tmp12_ = g_strdup (_tmp11_);
					_tmp13_ = g_array_new (TRUE, TRUE, sizeof (GamesUriGameFactory*));
					g_hash_table_insert (_tmp10_, _tmp12_, _tmp13_);
				}
				_tmp14_ = self->priv->factories_for_mime_type;
				_tmp15_ = mime_type;
				_tmp16_ = g_hash_table_lookup (_tmp14_, _tmp15_);
				_tmp17_ = factory;
				_tmp18_ = _g_object_ref0 (_tmp17_);
				g_array_append_val ((GArray*) _tmp16_, _tmp18_);
				_g_free0 (mime_type);
			}
		}
		mime_type_collection = (_vala_array_free (mime_type_collection, mime_type_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp19_ = factory;
	_tmp21_ = games_uri_game_factory_get_schemes (_tmp19_, &_tmp20_);
	{
		gchar** scheme_collection = NULL;
		gint scheme_collection_length1 = 0;
		gint _scheme_collection_size_ = 0;
		gint scheme_it = 0;
		scheme_collection = _tmp21_;
		scheme_collection_length1 = _tmp20_;
		for (scheme_it = 0; scheme_it < _tmp20_; scheme_it = scheme_it + 1) {
			gchar* _tmp22_;
			gchar* scheme = NULL;
			_tmp22_ = g_strdup (scheme_collection[scheme_it]);
			scheme = _tmp22_;
			{
				GHashTable* _tmp23_;
				const gchar* _tmp24_;
				gboolean _tmp25_;
				GHashTable* _tmp30_;
				const gchar* _tmp31_;
				gconstpointer _tmp32_;
				GamesUriGameFactory* _tmp33_;
				GamesUriGameFactory* _tmp34_;
				_tmp23_ = self->priv->factories_for_scheme;
				_tmp24_ = scheme;
				_tmp25_ = g_hash_table_contains (_tmp23_, _tmp24_);
				if (!_tmp25_) {
					GHashTable* _tmp26_;
					const gchar* _tmp27_;
					gchar* _tmp28_;
					GArray* _tmp29_;
					_tmp26_ = self->priv->factories_for_scheme;
					_tmp27_ = scheme;
					_tmp28_ = g_strdup (_tmp27_);
					_tmp29_ = g_array_new (TRUE, TRUE, sizeof (GamesUriGameFactory*));
					g_hash_table_insert (_tmp26_, _tmp28_, _tmp29_);
				}
				_tmp30_ = self->priv->factories_for_scheme;
				_tmp31_ = scheme;
				_tmp32_ = g_hash_table_lookup (_tmp30_, _tmp31_);
				_tmp33_ = factory;
				_tmp34_ = _g_object_ref0 (_tmp33_);
				g_array_append_val ((GArray*) _tmp32_, _tmp34_);
				_g_free0 (scheme);
			}
		}
		scheme_collection = (_vala_array_free (scheme_collection, scheme_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp35_ = factory;
	g_signal_connect_object (_tmp35_, "game-added", (GCallback) ___lambda5__games_uri_game_factory_game_added, self, 0);
}


static gchar** _vala_array_dup2 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


gchar** games_game_collection_get_accepted_mime_types (GamesGameCollection* self, int* result_length1) {
	gchar** result = NULL;
	GHashTable* _tmp0_;
	gint _tmp1_;
	gconstpointer* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar** _tmp4_;
	gint _tmp4__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->factories_for_mime_type;
	_tmp2_ = g_hash_table_get_keys_as_array (_tmp0_, &_tmp1_);
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup2 (_tmp2_, _tmp1_) : ((gpointer) _tmp2_);
	_tmp3__length1 = _tmp1_;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}


static void games_game_collection_add_uri_data_free (gpointer _data) {
	GamesGameCollectionAddUriData* _data_;
	_data_ = _data;
	_games_uri_unref0 (_data_->uri);
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesGameCollectionAddUriData, _data_);
}


static void games_game_collection_add_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesGameCollectionAddUriData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static gpointer _games_uri_ref0 (gpointer self) {
	return self ? games_uri_ref (self) : NULL;
}


void games_game_collection_add_uri (GamesGameCollection* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesGameCollectionAddUriData* _data_;
	GamesGameCollection* _tmp0_;
	GamesUri* _tmp1_;
	GamesUri* _tmp2_;
	_data_ = g_slice_new0 (GamesGameCollectionAddUriData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_game_collection_add_uri_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_game_collection_add_uri_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = uri;
	_tmp2_ = _games_uri_ref0 (_tmp1_);
	_games_uri_unref0 (_data_->uri);
	_data_->uri = _tmp2_;
	games_game_collection_add_uri_co (_data_);
}


void games_game_collection_add_uri_finish (GamesGameCollection* self, GAsyncResult* _res_) {
	GamesGameCollectionAddUriData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void games_game_collection_add_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesGameCollectionAddUriData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_game_collection_add_uri_co (_data_);
}


static gboolean games_game_collection_add_uri_co (GamesGameCollectionAddUriData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->uri;
	_data_->_state_ = 1;
	games_game_collection_get_factories_for_uri (_data_->self, _data_->_tmp0_, games_game_collection_add_uri_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = games_game_collection_get_factories_for_uri_finish (_data_->self, _data_->_res_, &_data_->_tmp1_);
	{
		_data_->factory_collection_length1 = 0;
		_data_->_factory_collection_size_ = 0;
		_data_->factory_collection = _data_->_tmp2_;
		_data_->factory_collection_length1 = _data_->_tmp1_;
		for (_data_->factory_it = 0; _data_->factory_it < _data_->_tmp1_; _data_->factory_it = _data_->factory_it + 1) {
			_data_->_tmp3_ = _g_object_ref0 (_data_->factory_collection[_data_->factory_it]);
			_data_->factory = _data_->_tmp3_;
			{
				_data_->_tmp4_ = _data_->factory;
				_data_->_tmp5_ = _data_->uri;
				_data_->_state_ = 2;
				games_uri_game_factory_add_uri (_data_->_tmp4_, _data_->_tmp5_, games_game_collection_add_uri_ready, _data_);
				return FALSE;
				_state_2:
				games_uri_game_factory_add_uri_finish (_data_->_tmp4_, _data_->_res_);
				_g_object_unref0 (_data_->factory);
			}
		}
		_data_->factory_collection = (_vala_array_free (_data_->factory_collection, _data_->factory_collection_length1, (GDestroyNotify) g_object_unref), NULL);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void games_game_collection_query_game_for_uri_data_free (gpointer _data) {
	GamesGameCollectionQueryGameForUriData* _data_;
	_data_ = _data;
	_games_uri_unref0 (_data_->uri);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesGameCollectionQueryGameForUriData, _data_);
}


static void games_game_collection_query_game_for_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesGameCollectionQueryGameForUriData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void games_game_collection_query_game_for_uri (GamesGameCollection* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesGameCollectionQueryGameForUriData* _data_;
	GamesGameCollection* _tmp0_;
	GamesUri* _tmp1_;
	GamesUri* _tmp2_;
	_data_ = g_slice_new0 (GamesGameCollectionQueryGameForUriData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_game_collection_query_game_for_uri_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_game_collection_query_game_for_uri_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = uri;
	_tmp2_ = _games_uri_ref0 (_tmp1_);
	_games_uri_unref0 (_data_->uri);
	_data_->uri = _tmp2_;
	games_game_collection_query_game_for_uri_co (_data_);
}


GamesGame* games_game_collection_query_game_for_uri_finish (GamesGameCollection* self, GAsyncResult* _res_) {
	GamesGame* result;
	GamesGameCollectionQueryGameForUriData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void games_game_collection_query_game_for_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesGameCollectionQueryGameForUriData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_game_collection_query_game_for_uri_co (_data_);
}


static void _vala_array_add3 (GamesGame** * array, int* length, int* size, GamesGame* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesGame*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static gboolean games_game_collection_query_game_for_uri_co (GamesGameCollectionQueryGameForUriData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_new0 (GamesGame*, 0 + 1);
	_data_->games = _data_->_tmp0_;
	_data_->games_length1 = 0;
	_data_->_games_size_ = _data_->games_length1;
	_data_->_tmp1_ = _data_->uri;
	_data_->_state_ = 1;
	games_game_collection_get_factories_for_uri (_data_->self, _data_->_tmp1_, games_game_collection_query_game_for_uri_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = games_game_collection_get_factories_for_uri_finish (_data_->self, _data_->_res_, &_data_->_tmp2_);
	{
		_data_->factory_collection_length1 = 0;
		_data_->_factory_collection_size_ = 0;
		_data_->factory_collection = _data_->_tmp3_;
		_data_->factory_collection_length1 = _data_->_tmp2_;
		for (_data_->factory_it = 0; _data_->factory_it < _data_->_tmp2_; _data_->factory_it = _data_->factory_it + 1) {
			_data_->_tmp4_ = _g_object_ref0 (_data_->factory_collection[_data_->factory_it]);
			_data_->factory = _data_->_tmp4_;
			{
				_data_->_tmp5_ = _data_->factory;
				_data_->_tmp6_ = _data_->uri;
				_data_->_state_ = 2;
				games_uri_game_factory_query_game_for_uri (_data_->_tmp5_, _data_->_tmp6_, games_game_collection_query_game_for_uri_ready, _data_);
				return FALSE;
				_state_2:
				_data_->_tmp7_ = games_uri_game_factory_query_game_for_uri_finish (_data_->_tmp5_, _data_->_res_);
				_data_->game = _data_->_tmp7_;
				_data_->_tmp8_ = _data_->game;
				if (_data_->_tmp8_ != NULL) {
					_data_->_tmp9_ = _data_->games;
					_data_->_tmp9__length1 = _data_->games_length1;
					_data_->_tmp10_ = _data_->game;
					_data_->_tmp11_ = _g_object_ref0 (_data_->_tmp10_);
					_vala_array_add3 (&_data_->games, &_data_->games_length1, &_data_->_games_size_, _data_->_tmp11_);
				}
				_g_object_unref0 (_data_->game);
				_g_object_unref0 (_data_->factory);
			}
		}
		_data_->factory_collection = (_vala_array_free (_data_->factory_collection, _data_->factory_collection_length1, (GDestroyNotify) g_object_unref), NULL);
	}
	_data_->_tmp12_ = _data_->games;
	_data_->_tmp12__length1 = _data_->games_length1;
	if (_data_->_tmp12__length1 != 1) {
		_data_->result = NULL;
		_data_->games = (_vala_array_free (_data_->games, _data_->games_length1, (GDestroyNotify) g_object_unref), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp13_ = _data_->games;
	_data_->_tmp13__length1 = _data_->games_length1;
	_data_->_tmp14_ = _data_->_tmp13_[0];
	_data_->_tmp15_ = _g_object_ref0 (_data_->_tmp14_);
	_data_->result = _data_->_tmp15_;
	_data_->games = (_vala_array_free (_data_->games, _data_->games_length1, (GDestroyNotify) g_object_unref), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void games_game_collection_search_games_data_free (gpointer _data) {
	GamesGameCollectionSearchGamesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesGameCollectionSearchGamesData, _data_);
}


static void games_game_collection_search_games_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesGameCollectionSearchGamesData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void games_game_collection_search_games (GamesGameCollection* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesGameCollectionSearchGamesData* _data_;
	GamesGameCollection* _tmp0_;
	_data_ = g_slice_new0 (GamesGameCollectionSearchGamesData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_game_collection_search_games_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_game_collection_search_games_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	games_game_collection_search_games_co (_data_);
}


void games_game_collection_search_games_finish (GamesGameCollection* self, GAsyncResult* _res_) {
	GamesGameCollectionSearchGamesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void games_game_collection_search_games_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesGameCollectionSearchGamesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_game_collection_search_games_co (_data_);
}


static gboolean games_game_collection_search_games_co (GamesGameCollectionSearchGamesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->sources;
	_data_->_tmp0__length1 = _data_->self->priv->sources_length1;
	{
		_data_->source_collection_length1 = 0;
		_data_->_source_collection_size_ = 0;
		_data_->source_collection = _data_->_tmp0_;
		_data_->source_collection_length1 = _data_->_tmp0__length1;
		for (_data_->source_it = 0; _data_->source_it < _data_->_tmp0__length1; _data_->source_it = _data_->source_it + 1) {
			_data_->_tmp1_ = _g_object_ref0 (_data_->source_collection[_data_->source_it]);
			_data_->source = _data_->_tmp1_;
			{
				{
					_data_->_tmp2_ = _data_->source;
					_data_->_tmp3_ = games_uri_source_iterator (_data_->_tmp2_);
					_data_->_uri_it = _data_->_tmp3_;
					while (TRUE) {
						_data_->_tmp4_ = _data_->_uri_it;
						_data_->_tmp5_ = games_uri_iterator_next (_data_->_tmp4_);
						if (!_data_->_tmp5_) {
							break;
						}
						_data_->_tmp6_ = _data_->_uri_it;
						_data_->_tmp7_ = games_uri_iterator_get (_data_->_tmp6_);
						_data_->uri = _data_->_tmp7_;
						_data_->_tmp8_ = _data_->uri;
						_data_->_state_ = 1;
						games_game_collection_add_uri (_data_->self, _data_->_tmp8_, games_game_collection_search_games_ready, _data_);
						return FALSE;
						_state_1:
						games_game_collection_add_uri_finish (_data_->self, _data_->_res_);
						_games_uri_unref0 (_data_->uri);
					}
					_g_object_unref0 (_data_->_uri_it);
				}
				_g_object_unref0 (_data_->source);
			}
		}
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void games_game_collection_each_game_data_free (gpointer _data) {
	GamesGameCollectionEachGameData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesGameCollectionEachGameData, _data_);
}


static void games_game_collection_each_game_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesGameCollectionEachGameData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void games_game_collection_each_game (GamesGameCollection* self, GamesGameCallback callback, void* callback_target, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesGameCollectionEachGameData* _data_;
	GamesGameCollection* _tmp0_;
	GamesGameCallback _tmp1_;
	void* _tmp1__target;
	_data_ = g_slice_new0 (GamesGameCollectionEachGameData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_game_collection_each_game_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_game_collection_each_game_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = callback;
	_tmp1__target = callback_target;
	_data_->callback = _tmp1_;
	_data_->callback_target = _tmp1__target;
	games_game_collection_each_game_co (_data_);
}


void games_game_collection_each_game_finish (GamesGameCollection* self, GAsyncResult* _res_) {
	GamesGameCollectionEachGameData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void games_game_collection_each_game_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesGameCollectionEachGameData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_game_collection_each_game_co (_data_);
}


static gboolean games_game_collection_each_game_co (GamesGameCollectionEachGameData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->sources;
	_data_->_tmp0__length1 = _data_->self->priv->sources_length1;
	{
		_data_->source_collection_length1 = 0;
		_data_->_source_collection_size_ = 0;
		_data_->source_collection = _data_->_tmp0_;
		_data_->source_collection_length1 = _data_->_tmp0__length1;
		for (_data_->source_it = 0; _data_->source_it < _data_->_tmp0__length1; _data_->source_it = _data_->source_it + 1) {
			_data_->_tmp1_ = _g_object_ref0 (_data_->source_collection[_data_->source_it]);
			_data_->source = _data_->_tmp1_;
			{
				{
					_data_->_tmp2_ = _data_->source;
					_data_->_tmp3_ = games_uri_source_iterator (_data_->_tmp2_);
					_data_->_uri_it = _data_->_tmp3_;
					while (TRUE) {
						_data_->_tmp4_ = _data_->_uri_it;
						_data_->_tmp5_ = games_uri_iterator_next (_data_->_tmp4_);
						if (!_data_->_tmp5_) {
							break;
						}
						_data_->_tmp6_ = _data_->_uri_it;
						_data_->_tmp7_ = games_uri_iterator_get (_data_->_tmp6_);
						_data_->uri = _data_->_tmp7_;
						_data_->_tmp8_ = _data_->uri;
						_data_->_state_ = 1;
						games_game_collection_add_uri (_data_->self, _data_->_tmp8_, games_game_collection_each_game_ready, _data_);
						return FALSE;
						_state_1:
						games_game_collection_add_uri_finish (_data_->self, _data_->_res_);
						_games_uri_unref0 (_data_->uri);
					}
					_g_object_unref0 (_data_->_uri_it);
				}
				_g_object_unref0 (_data_->source);
			}
		}
	}
	_data_->_tmp9_ = _data_->self->priv->factories;
	_data_->_tmp9__length1 = _data_->self->priv->factories_length1;
	{
		_data_->factory_collection_length1 = 0;
		_data_->_factory_collection_size_ = 0;
		_data_->factory_collection = _data_->_tmp9_;
		_data_->factory_collection_length1 = _data_->_tmp9__length1;
		for (_data_->factory_it = 0; _data_->factory_it < _data_->_tmp9__length1; _data_->factory_it = _data_->factory_it + 1) {
			_data_->_tmp10_ = _g_object_ref0 (_data_->factory_collection[_data_->factory_it]);
			_data_->factory = _data_->_tmp10_;
			{
				_data_->_tmp11_ = _data_->factory;
				_data_->_tmp12_ = _data_->callback;
				_data_->_tmp12__target = _data_->callback_target;
				_data_->_state_ = 2;
				games_uri_game_factory_foreach_game (_data_->_tmp11_, _data_->_tmp12_, _data_->_tmp12__target, games_game_collection_each_game_ready, _data_);
				return FALSE;
				_state_2:
				games_uri_game_factory_foreach_game_finish (_data_->_tmp11_, _data_->_res_);
				_g_object_unref0 (_data_->factory);
			}
		}
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void games_game_collection_get_factories_for_uri_data_free (gpointer _data) {
	GamesGameCollectionGetFactoriesForUriData* _data_;
	_data_ = _data;
	_games_uri_unref0 (_data_->uri);
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesGameCollectionGetFactoriesForUriData, _data_);
}


static void games_game_collection_get_factories_for_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesGameCollectionGetFactoriesForUriData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void games_game_collection_get_factories_for_uri (GamesGameCollection* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesGameCollectionGetFactoriesForUriData* _data_;
	GamesGameCollection* _tmp0_;
	GamesUri* _tmp1_;
	GamesUri* _tmp2_;
	_data_ = g_slice_new0 (GamesGameCollectionGetFactoriesForUriData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_game_collection_get_factories_for_uri_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_game_collection_get_factories_for_uri_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = uri;
	_tmp2_ = _games_uri_ref0 (_tmp1_);
	_games_uri_unref0 (_data_->uri);
	_data_->uri = _tmp2_;
	games_game_collection_get_factories_for_uri_co (_data_);
}


static GamesUriGameFactory** games_game_collection_get_factories_for_uri_finish (GamesGameCollection* self, GAsyncResult* _res_, int* result_length1) {
	GamesUriGameFactory** result;
	GamesGameCollectionGetFactoriesForUriData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static gboolean _games_game_collection_get_factories_for_uri_co_gsource_func (gpointer self) {
	gboolean result;
	result = games_game_collection_get_factories_for_uri_co (self);
	return result;
}


static void games_game_collection_get_factories_for_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesGameCollectionGetFactoriesForUriData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_game_collection_get_factories_for_uri_co (_data_);
}


static void _vala_array_add4 (GamesUriGameFactory** * array, int* length, int* size, GamesUriGameFactory* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesUriGameFactory*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static void _vala_array_add5 (GamesUriGameFactory** * array, int* length, int* size, GamesUriGameFactory* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GamesUriGameFactory*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static gboolean games_game_collection_get_factories_for_uri_co (GamesGameCollectionGetFactoriesForUriData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _games_game_collection_get_factories_for_uri_co_gsource_func, _data_, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp0_ = g_new0 (GamesUriGameFactory*, 0 + 1);
	_data_->factories = _data_->_tmp0_;
	_data_->factories_length1 = 0;
	_data_->_factories_size_ = _data_->factories_length1;
	{
		_data_->_tmp2_ = _data_->uri;
		_data_->_tmp3_ = games_uri_get_scheme (_data_->_tmp2_, &_data_->_inner_error_);
		_data_->_tmp1_ = _data_->_tmp3_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_tmp4_ = _data_->_tmp1_;
		_data_->_tmp1_ = NULL;
		_g_free0 (_data_->scheme);
		_data_->scheme = _data_->_tmp4_;
		_g_free0 (_data_->_tmp1_);
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp5_ = _data_->e;
		_data_->_tmp6_ = _data_->_tmp5_->message;
		g_debug ("game-collection.vala:95: %s", _data_->_tmp6_);
		_data_->_tmp7_ = _data_->factories;
		_data_->_tmp7__length1 = _data_->factories_length1;
		_data_->result_length1 = _data_->_tmp7__length1;
		_data_->result = _data_->_tmp7_;
		_g_error_free0 (_data_->e);
		_g_free0 (_data_->scheme);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_free0 (_data_->scheme);
		_data_->factories = (_vala_array_free (_data_->factories, _data_->factories_length1, (GDestroyNotify) g_object_unref), NULL);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = _data_->scheme;
	if (g_strcmp0 (_data_->_tmp8_, "file") == 0) {
		{
			_data_->_tmp9_ = _data_->uri;
			_data_->_tmp10_ = games_uri_to_file (_data_->_tmp9_);
			_data_->file = _data_->_tmp10_;
			_data_->_tmp12_ = _data_->file;
			_data_->_state_ = 2;
			games_game_collection_get_factories_for_file (_data_->self, _data_->_tmp12_, games_game_collection_get_factories_for_uri_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp14_ = games_game_collection_get_factories_for_file_finish (_data_->self, _data_->_res_, &_data_->_tmp13_, &_data_->_inner_error_);
			_data_->_tmp11_ = _data_->_tmp14_;
			_data_->_tmp11__length1 = _data_->_tmp13_;
			_data_->__tmp11__size_ = _data_->_tmp11__length1;
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->file);
				goto __catch2_g_error;
			}
			{
				_data_->factory_collection_length1 = 0;
				_data_->_factory_collection_size_ = 0;
				_data_->factory_collection = _data_->_tmp11_;
				_data_->factory_collection_length1 = _data_->_tmp11__length1;
				for (_data_->factory_it = 0; _data_->factory_it < _data_->_tmp11__length1; _data_->factory_it = _data_->factory_it + 1) {
					_data_->_tmp15_ = _g_object_ref0 (_data_->factory_collection[_data_->factory_it]);
					_data_->factory = _data_->_tmp15_;
					{
						_data_->_tmp16_ = _data_->factories;
						_data_->_tmp16__length1 = _data_->factories_length1;
						_data_->_tmp17_ = _data_->factory;
						_data_->_tmp18_ = _g_object_ref0 (_data_->_tmp17_);
						_vala_array_add4 (&_data_->factories, &_data_->factories_length1, &_data_->_factories_size_, _data_->_tmp18_);
						_g_object_unref0 (_data_->factory);
					}
				}
			}
			_data_->_tmp11_ = (_vala_array_free (_data_->_tmp11_, _data_->_tmp11__length1, (GDestroyNotify) g_object_unref), NULL);
			_g_object_unref0 (_data_->file);
		}
		goto __finally2;
		__catch2_g_error:
		{
			_data_->_vala1_e = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp19_ = _data_->_vala1_e;
			_data_->_tmp20_ = _data_->_tmp19_->message;
			g_debug ("game-collection.vala:107: %s", _data_->_tmp20_);
			_g_error_free0 (_data_->_vala1_e);
		}
		__finally2:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_free0 (_data_->scheme);
			_data_->factories = (_vala_array_free (_data_->factories, _data_->factories_length1, (GDestroyNotify) g_object_unref), NULL);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp21_ = _data_->self->priv->factories_for_scheme;
	_data_->_tmp22_ = _data_->scheme;
	_data_->_tmp23_ = g_hash_table_contains (_data_->_tmp21_, _data_->_tmp22_);
	if (_data_->_tmp23_) {
		_data_->_tmp24_ = _data_->self->priv->factories_for_scheme;
		_data_->_tmp25_ = _data_->scheme;
		_data_->_tmp26_ = g_hash_table_lookup (_data_->_tmp24_, _data_->_tmp25_);
		_data_->_tmp27_ = ((GArray*) _data_->_tmp26_)->data;
		_data_->_tmp27__length1 = (gint) ((GArray*) _data_->_tmp26_)->len;
		{
			_data_->_vala1_factory_collection_length1 = 0;
			_data_->__vala1_factory_collection_size_ = 0;
			_data_->_vala1_factory_collection = _data_->_tmp27_;
			_data_->_vala1_factory_collection_length1 = _data_->_tmp27__length1;
			for (_data_->_vala1_factory_it = 0; _data_->_vala1_factory_it < _data_->_tmp27__length1; _data_->_vala1_factory_it = _data_->_vala1_factory_it + 1) {
				_data_->_tmp28_ = _g_object_ref0 (_data_->_vala1_factory_collection[_data_->_vala1_factory_it]);
				_data_->_vala1_factory = _data_->_tmp28_;
				{
					_data_->_tmp29_ = _data_->factories;
					_data_->_tmp29__length1 = _data_->factories_length1;
					_data_->_tmp30_ = _data_->_vala1_factory;
					_data_->_tmp31_ = _g_object_ref0 (_data_->_tmp30_);
					_vala_array_add5 (&_data_->factories, &_data_->factories_length1, &_data_->_factories_size_, _data_->_tmp31_);
					_g_object_unref0 (_data_->_vala1_factory);
				}
			}
		}
	}
	_data_->_tmp32_ = _data_->factories;
	_data_->_tmp32__length1 = _data_->factories_length1;
	_data_->result_length1 = _data_->_tmp32__length1;
	_data_->result = _data_->_tmp32_;
	_g_free0 (_data_->scheme);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void games_game_collection_get_factories_for_file_data_free (gpointer _data) {
	GamesGameCollectionGetFactoriesForFileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesGameCollectionGetFactoriesForFileData, _data_);
}


static void games_game_collection_get_factories_for_file_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesGameCollectionGetFactoriesForFileData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void games_game_collection_get_factories_for_file (GamesGameCollection* self, GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesGameCollectionGetFactoriesForFileData* _data_;
	GamesGameCollection* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	_data_ = g_slice_new0 (GamesGameCollectionGetFactoriesForFileData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_game_collection_get_factories_for_file_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_game_collection_get_factories_for_file_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = file;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp2_;
	games_game_collection_get_factories_for_file_co (_data_);
}


static GamesUriGameFactory** games_game_collection_get_factories_for_file_finish (GamesGameCollection* self, GAsyncResult* _res_, int* result_length1, GError** error) {
	GamesUriGameFactory** result;
	GamesGameCollectionGetFactoriesForFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static GamesUriGameFactory** _vala_array_dup3 (GamesUriGameFactory** self, int length) {
	GamesUriGameFactory** result;
	int i;
	result = g_new0 (GamesUriGameFactory*, length + 1);
	for (i = 0; i < length; i++) {
		GamesUriGameFactory* _tmp0_;
		_tmp0_ = _g_object_ref0 (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gboolean games_game_collection_get_factories_for_file_co (GamesGameCollectionGetFactoriesForFileData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->file;
	_data_->_tmp1_ = g_file_query_exists (_data_->_tmp0_, NULL);
	if (!_data_->_tmp1_) {
		_data_->_tmp2_ = g_new0 (GamesUriGameFactory*, 0 + 1);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp3__length1 = 0;
		_data_->result_length1 = _data_->_tmp3__length1;
		_data_->result = _data_->_tmp3_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->file;
	_data_->_tmp5_ = g_file_query_info (_data_->_tmp4_, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, &_data_->_inner_error_);
	_data_->file_info = _data_->_tmp5_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = _data_->file_info;
	_data_->_tmp7_ = g_file_info_get_content_type (_data_->_tmp6_);
	_data_->_tmp8_ = g_strdup (_data_->_tmp7_);
	_data_->mime_type = _data_->_tmp8_;
	_data_->_tmp9_ = _data_->self->priv->factories_for_mime_type;
	_data_->_tmp10_ = _data_->mime_type;
	_data_->_tmp11_ = g_hash_table_contains (_data_->_tmp9_, _data_->_tmp10_);
	if (!_data_->_tmp11_) {
		_data_->_tmp12_ = g_new0 (GamesUriGameFactory*, 0 + 1);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp13__length1 = 0;
		_data_->result_length1 = _data_->_tmp13__length1;
		_data_->result = _data_->_tmp13_;
		_g_free0 (_data_->mime_type);
		_g_object_unref0 (_data_->file_info);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp14_ = _data_->self->priv->factories_for_mime_type;
	_data_->_tmp15_ = _data_->mime_type;
	_data_->_tmp16_ = g_hash_table_lookup (_data_->_tmp14_, _data_->_tmp15_);
	_data_->_tmp17_ = ((GArray*) _data_->_tmp16_)->data;
	_data_->_tmp17__length1 = (gint) ((GArray*) _data_->_tmp16_)->len;
	_data_->_tmp18_ = (_data_->_tmp17_ != NULL) ? _vala_array_dup3 (_data_->_tmp17_, _data_->_tmp17__length1) : ((gpointer) _data_->_tmp17_);
	_data_->_tmp18__length1 = _data_->_tmp17__length1;
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_tmp19__length1 = _data_->_tmp18__length1;
	_data_->result_length1 = _data_->_tmp19__length1;
	_data_->result = _data_->_tmp19_;
	_g_free0 (_data_->mime_type);
	_g_object_unref0 (_data_->file_info);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void games_game_collection_store_game (GamesGameCollection* self, GamesGame* game) {
	GHashTable* _tmp0_;
	GamesGame* _tmp1_;
	gboolean _tmp2_;
	GListStore* _tmp3_;
	GamesGame* _tmp4_;
	GHashTable* _tmp5_;
	GamesGame* _tmp6_;
	GamesGame* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (game != NULL);
	_tmp0_ = self->priv->games;
	_tmp1_ = game;
	_tmp2_ = g_hash_table_contains (_tmp0_, _tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = self->priv->list_store;
	_tmp4_ = game;
	g_list_store_append (_tmp3_, (GObject*) _tmp4_);
	_tmp5_ = self->priv->games;
	_tmp6_ = game;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	g_hash_table_add (_tmp5_, _tmp7_);
}


GamesGameCollection* games_game_collection_construct (GType object_type) {
	GamesGameCollection * self = NULL;
	self = (GamesGameCollection*) g_object_new (object_type, NULL);
	return self;
}


GamesGameCollection* games_game_collection_new (void) {
	return games_game_collection_construct (GAMES_TYPE_GAME_COLLECTION);
}


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


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


static void _g_array_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_array_unref (var), NULL));
}


static GObject * games_game_collection_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GamesGameCollection * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GListStore* _tmp3_;
	GHashFunc _tmp4_;
	GEqualFunc _tmp5_;
	GHashTable* _tmp6_;
	GHashFunc _tmp7_;
	GEqualFunc _tmp8_;
	GHashTable* _tmp9_;
	parent_class = G_OBJECT_CLASS (games_game_collection_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_GAME_COLLECTION, GamesGameCollection);
	_tmp0_ = g_direct_hash;
	_tmp1_ = g_direct_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->games);
	self->priv->games = _tmp2_;
	_tmp3_ = g_list_store_new (GAMES_TYPE_GAME);
	_g_object_unref0 (self->priv->list_store);
	self->priv->list_store = _tmp3_;
	_tmp4_ = g_str_hash;
	_tmp5_ = g_str_equal;
	_tmp6_ = g_hash_table_new_full (_tmp4_, _tmp5_, _g_free0_, _g_array_unref0_);
	_g_hash_table_unref0 (self->priv->factories_for_mime_type);
	self->priv->factories_for_mime_type = _tmp6_;
	_tmp7_ = g_str_hash;
	_tmp8_ = g_str_equal;
	_tmp9_ = g_hash_table_new_full (_tmp7_, _tmp8_, _g_free0_, _g_array_unref0_);
	_g_hash_table_unref0 (self->priv->factories_for_scheme);
	self->priv->factories_for_scheme = _tmp9_;
	return obj;
}


static void games_game_collection_class_init (GamesGameCollectionClass * klass) {
	games_game_collection_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesGameCollectionPrivate));
	G_OBJECT_CLASS (klass)->constructor = games_game_collection_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_game_collection_finalize;
}


static void games_game_collection_instance_init (GamesGameCollection * self) {
	self->priv = GAMES_GAME_COLLECTION_GET_PRIVATE (self);
}


static void games_game_collection_finalize (GObject * obj) {
	GamesGameCollection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_GAME_COLLECTION, GamesGameCollection);
	_g_hash_table_unref0 (self->priv->games);
	_g_object_unref0 (self->priv->list_store);
	self->priv->sources = (_vala_array_free (self->priv->sources, self->priv->sources_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->factories = (_vala_array_free (self->priv->factories, self->priv->factories_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_hash_table_unref0 (self->priv->factories_for_mime_type);
	_g_hash_table_unref0 (self->priv->factories_for_scheme);
	G_OBJECT_CLASS (games_game_collection_parent_class)->finalize (obj);
}


GType games_game_collection_get_type (void) {
	static volatile gsize games_game_collection_type_id__volatile = 0;
	if (g_once_init_enter (&games_game_collection_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesGameCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_game_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesGameCollection), 0, (GInstanceInitFunc) games_game_collection_instance_init, NULL };
		GType games_game_collection_type_id;
		games_game_collection_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesGameCollection", &g_define_type_info, 0);
		g_once_init_leave (&games_game_collection_type_id__volatile, games_game_collection_type_id);
	}
	return games_game_collection_type_id__volatile;
}


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



