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

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

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib-unix.h>
#include <signal.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <libtracker-sparql/tracker-sparql.h>


#define GAMES_TYPE_APPLICATION (games_application_get_type ())
#define GAMES_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_APPLICATION, GamesApplication))
#define GAMES_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_APPLICATION, GamesApplicationClass))
#define GAMES_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_APPLICATION))
#define GAMES_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_APPLICATION))
#define GAMES_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_APPLICATION, GamesApplicationClass))

typedef struct _GamesApplication GamesApplication;
typedef struct _GamesApplicationClass GamesApplicationClass;
typedef struct _GamesApplicationPrivate GamesApplicationPrivate;

#define GAMES_TYPE_DATABASE (games_database_get_type ())
#define GAMES_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DATABASE, GamesDatabase))
#define GAMES_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DATABASE, GamesDatabaseClass))
#define GAMES_IS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DATABASE))
#define GAMES_IS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DATABASE))
#define GAMES_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DATABASE, GamesDatabaseClass))

typedef struct _GamesDatabase GamesDatabase;
typedef struct _GamesDatabaseClass GamesDatabaseClass;

#define GAMES_TYPE_APPLICATION_WINDOW (games_application_window_get_type ())
#define GAMES_APPLICATION_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindow))
#define GAMES_APPLICATION_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindowClass))
#define GAMES_IS_APPLICATION_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_APPLICATION_WINDOW))
#define GAMES_IS_APPLICATION_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_APPLICATION_WINDOW))
#define GAMES_APPLICATION_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindowClass))

typedef struct _GamesApplicationWindow GamesApplicationWindow;
typedef struct _GamesApplicationWindowClass GamesApplicationWindowClass;

#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;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_source_unref0(var) ((var == NULL) ? NULL : (var = (g_source_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#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_uri_unref0(var) ((var == NULL) ? NULL : (var = (games_uri_unref (var), NULL)))
#define __g_slist_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_free0_ (var), NULL)))
typedef struct _GamesApplicationAddGameFilesAsyncData GamesApplicationAddGameFilesAsyncData;

#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;
typedef struct _GamesApplicationOpenAsyncData GamesApplicationOpenAsyncData;

#define GAMES_TYPE_TRACKER_URI_SOURCE (games_tracker_uri_source_get_type ())
#define GAMES_TRACKER_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSource))
#define GAMES_TRACKER_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSourceClass))
#define GAMES_IS_TRACKER_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TRACKER_URI_SOURCE))
#define GAMES_IS_TRACKER_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_TRACKER_URI_SOURCE))
#define GAMES_TRACKER_URI_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_TRACKER_URI_SOURCE, GamesTrackerUriSourceClass))

typedef struct _GamesTrackerUriSource GamesTrackerUriSource;
typedef struct _GamesTrackerUriSourceClass GamesTrackerUriSourceClass;

#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_DATABASE_URI_SOURCE (games_database_uri_source_get_type ())
#define GAMES_DATABASE_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DATABASE_URI_SOURCE, GamesDatabaseUriSource))
#define GAMES_DATABASE_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DATABASE_URI_SOURCE, GamesDatabaseUriSourceClass))
#define GAMES_IS_DATABASE_URI_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DATABASE_URI_SOURCE))
#define GAMES_IS_DATABASE_URI_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DATABASE_URI_SOURCE))
#define GAMES_DATABASE_URI_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DATABASE_URI_SOURCE, GamesDatabaseUriSourceClass))

typedef struct _GamesDatabaseUriSource GamesDatabaseUriSource;
typedef struct _GamesDatabaseUriSourceClass GamesDatabaseUriSourceClass;

#define GAMES_TYPE_RETRO_SIMPLE_TYPE (games_retro_simple_type_get_type ())
typedef struct _GamesRetroSimpleType GamesRetroSimpleType;

#define GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY (games_mime_type_tracker_uri_query_get_type ())
#define GAMES_MIME_TYPE_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQuery))
#define GAMES_MIME_TYPE_TRACKER_URI_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQueryClass))
#define GAMES_IS_MIME_TYPE_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY))
#define GAMES_IS_MIME_TYPE_TRACKER_URI_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY))
#define GAMES_MIME_TYPE_TRACKER_URI_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MIME_TYPE_TRACKER_URI_QUERY, GamesMimeTypeTrackerUriQueryClass))

typedef struct _GamesMimeTypeTrackerUriQuery GamesMimeTypeTrackerUriQuery;
typedef struct _GamesMimeTypeTrackerUriQueryClass GamesMimeTypeTrackerUriQueryClass;

#define GAMES_TYPE_TRACKER_URI_QUERY (games_tracker_uri_query_get_type ())
#define GAMES_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TRACKER_URI_QUERY, GamesTrackerUriQuery))
#define GAMES_IS_TRACKER_URI_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TRACKER_URI_QUERY))
#define GAMES_TRACKER_URI_QUERY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_TRACKER_URI_QUERY, GamesTrackerUriQueryIface))

typedef struct _GamesTrackerUriQuery GamesTrackerUriQuery;
typedef struct _GamesTrackerUriQueryIface GamesTrackerUriQueryIface;

#define GAMES_TYPE_RETRO_SIMPLE_GAME_URI_ADAPTER (games_retro_simple_game_uri_adapter_get_type ())
#define GAMES_RETRO_SIMPLE_GAME_URI_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_RETRO_SIMPLE_GAME_URI_ADAPTER, GamesRetroSimpleGameUriAdapter))
#define GAMES_RETRO_SIMPLE_GAME_URI_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_RETRO_SIMPLE_GAME_URI_ADAPTER, GamesRetroSimpleGameUriAdapterClass))
#define GAMES_IS_RETRO_SIMPLE_GAME_URI_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_RETRO_SIMPLE_GAME_URI_ADAPTER))
#define GAMES_IS_RETRO_SIMPLE_GAME_URI_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_RETRO_SIMPLE_GAME_URI_ADAPTER))
#define GAMES_RETRO_SIMPLE_GAME_URI_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_RETRO_SIMPLE_GAME_URI_ADAPTER, GamesRetroSimpleGameUriAdapterClass))

typedef struct _GamesRetroSimpleGameUriAdapter GamesRetroSimpleGameUriAdapter;
typedef struct _GamesRetroSimpleGameUriAdapterClass GamesRetroSimpleGameUriAdapterClass;

#define GAMES_TYPE_GENERIC_URI_GAME_FACTORY (games_generic_uri_game_factory_get_type ())
#define GAMES_GENERIC_URI_GAME_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GENERIC_URI_GAME_FACTORY, GamesGenericUriGameFactory))
#define GAMES_GENERIC_URI_GAME_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GENERIC_URI_GAME_FACTORY, GamesGenericUriGameFactoryClass))
#define GAMES_IS_GENERIC_URI_GAME_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GENERIC_URI_GAME_FACTORY))
#define GAMES_IS_GENERIC_URI_GAME_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GENERIC_URI_GAME_FACTORY))
#define GAMES_GENERIC_URI_GAME_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GENERIC_URI_GAME_FACTORY, GamesGenericUriGameFactoryClass))

typedef struct _GamesGenericUriGameFactory GamesGenericUriGameFactory;
typedef struct _GamesGenericUriGameFactoryClass GamesGenericUriGameFactoryClass;

#define GAMES_TYPE_GAME_URI_ADAPTER (games_game_uri_adapter_get_type ())
#define GAMES_GAME_URI_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME_URI_ADAPTER, GamesGameUriAdapter))
#define GAMES_IS_GAME_URI_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME_URI_ADAPTER))
#define GAMES_GAME_URI_ADAPTER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_GAME_URI_ADAPTER, GamesGameUriAdapterIface))

typedef struct _GamesGameUriAdapter GamesGameUriAdapter;
typedef struct _GamesGameUriAdapterIface GamesGameUriAdapterIface;

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

typedef struct _GamesUriGameFactory GamesUriGameFactory;
typedef struct _GamesUriGameFactoryIface GamesUriGameFactoryIface;

#define GAMES_TYPE_PLUGIN_REGISTER (games_plugin_register_get_type ())
#define GAMES_PLUGIN_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLUGIN_REGISTER, GamesPluginRegister))
#define GAMES_PLUGIN_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PLUGIN_REGISTER, GamesPluginRegisterClass))
#define GAMES_IS_PLUGIN_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLUGIN_REGISTER))
#define GAMES_IS_PLUGIN_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PLUGIN_REGISTER))
#define GAMES_PLUGIN_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PLUGIN_REGISTER, GamesPluginRegisterClass))

typedef struct _GamesPluginRegister GamesPluginRegister;
typedef struct _GamesPluginRegisterClass GamesPluginRegisterClass;

#define GAMES_TYPE_PLUGIN_REGISTER_ITERATOR (games_plugin_register_iterator_get_type ())
#define GAMES_PLUGIN_REGISTER_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLUGIN_REGISTER_ITERATOR, GamesPluginRegisterIterator))
#define GAMES_PLUGIN_REGISTER_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PLUGIN_REGISTER_ITERATOR, GamesPluginRegisterIteratorClass))
#define GAMES_IS_PLUGIN_REGISTER_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLUGIN_REGISTER_ITERATOR))
#define GAMES_IS_PLUGIN_REGISTER_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PLUGIN_REGISTER_ITERATOR))
#define GAMES_PLUGIN_REGISTER_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PLUGIN_REGISTER_ITERATOR, GamesPluginRegisterIteratorClass))

typedef struct _GamesPluginRegisterIterator GamesPluginRegisterIterator;
typedef struct _GamesPluginRegisterIteratorClass GamesPluginRegisterIteratorClass;

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

typedef struct _GamesPluginRegistrar GamesPluginRegistrar;
typedef struct _GamesPluginRegistrarClass GamesPluginRegistrarClass;

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

typedef struct _GamesPlugin GamesPlugin;
typedef struct _GamesPluginIface GamesPluginIface;
#define _games_plugin_register_iterator_unref0(var) ((var == NULL) ? NULL : (var = (games_plugin_register_iterator_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _GamesApplicationGameForUrisData GamesApplicationGameForUrisData;
typedef struct _GamesApplicationAddCachedUriData GamesApplicationAddCachedUriData;
typedef struct _GamesApplicationLoadGameListData GamesApplicationLoadGameListData;

#define GAMES_TYPE_PREFERENCES_WINDOW (games_preferences_window_get_type ())
#define GAMES_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindow))
#define GAMES_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindowClass))
#define GAMES_IS_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_WINDOW))
#define GAMES_IS_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREFERENCES_WINDOW))
#define GAMES_PREFERENCES_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindowClass))

typedef struct _GamesPreferencesWindow GamesPreferencesWindow;
typedef struct _GamesPreferencesWindowClass GamesPreferencesWindowClass;
typedef struct _Block5Data Block5Data;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GamesApplication {
	GtkApplication parent_instance;
	GamesApplicationPrivate * priv;
};

struct _GamesApplicationClass {
	GtkApplicationClass parent_class;
};

struct _GamesApplicationPrivate {
	GamesDatabase* database;
	GamesApplicationWindow* window;
	gboolean game_list_loaded;
	GamesGameCollection* game_collection;
};

struct _GamesApplicationAddGameFilesAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesApplication* self;
	GtkFileChooserDialog* chooser;
	GamesApplicationWindow* _tmp0_;
	GtkFileChooserDialog* _tmp1_;
	GtkFileChooserDialog* _tmp2_;
	GtkFileFilter* filter;
	GtkFileFilter* _tmp3_;
	GtkFileChooserDialog* _tmp4_;
	GtkFileFilter* _tmp5_;
	GamesGameCollection* _tmp6_;
	gint _tmp7_;
	gchar** _tmp8_;
	gchar** mime_type_collection;
	gint mime_type_collection_length1;
	gint _mime_type_collection_size_;
	gint mime_type_it;
	gchar* _tmp9_;
	gchar* mime_type;
	GtkFileFilter* _tmp10_;
	const gchar* _tmp11_;
	GtkFileChooserDialog* _tmp12_;
	gint _tmp13_;
	GtkFileChooserDialog* _tmp14_;
	GSList* _tmp15_;
	GSList* uri_string_collection;
	GSList* uri_string_it;
	const gchar* uri_string;
	GamesUri* uri;
	const gchar* _tmp16_;
	GamesUri* _tmp17_;
	GamesUri* _tmp18_;
	GtkFileChooserDialog* _tmp19_;
};

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 _GamesApplicationOpenAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesApplication* self;
	GFile** files;
	gint files_length1;
	gchar* hint;
	GamesApplicationWindow* _tmp0_;
	GFile** _tmp1_;
	gint _tmp1__length1;
	GamesUri** uris;
	GamesUri** _tmp2_;
	gint uris_length1;
	gint _uris_size_;
	GFile** _tmp3_;
	gint _tmp3__length1;
	GFile** file_collection;
	gint file_collection_length1;
	gint _file_collection_size_;
	gint file_it;
	GFile* _tmp4_;
	GFile* file;
	GamesUri** _tmp5_;
	gint _tmp5__length1;
	GFile* _tmp6_;
	GamesUri* _tmp7_;
	GamesGame* game;
	GamesUri** _tmp8_;
	gint _tmp8__length1;
	GamesGame* _tmp9_;
	GamesGame* _tmp10_;
	GamesApplicationWindow* _tmp11_;
	GamesGame* _tmp12_;
};

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

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

struct _GamesRetroSimpleType {
	gchar* mime_type;
	gboolean search_mime_type;
	gchar* platform;
	gchar* prefix;
};

struct _GamesTrackerUriQueryIface {
	GTypeInterface parent_iface;
	gchar* (*get_query) (GamesTrackerUriQuery* self);
};

struct _GamesGameUriAdapterIface {
	GTypeInterface parent_iface;
	void (*game_for_uri) (GamesGameUriAdapter* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GamesGame* (*game_for_uri_finish) (GamesGameUriAdapter* self, GAsyncResult* _res_, GError** error);
};

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

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

typedef enum  {
	GAMES_PLUGIN_ERROR_INVALID_PLUGIN_DESCRIPTOR,
	GAMES_PLUGIN_ERROR_NOT_A_PLUGIN
} GamesPluginError;
#define GAMES_PLUGIN_ERROR games_plugin_error_quark ()
struct _GamesApplicationGameForUrisData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesApplication* self;
	GamesUri** uris;
	gint uris_length1;
	GamesGame* result;
	GamesUri** _tmp0_;
	gint _tmp0__length1;
	GamesUri** uri_collection;
	gint uri_collection_length1;
	gint _uri_collection_size_;
	gint uri_it;
	GamesUri* _tmp1_;
	GamesUri* uri;
	GamesUri* _tmp2_;
	GamesGameCollection* _tmp3_;
	GamesUri** _tmp4_;
	gint _tmp4__length1;
	GamesUri* _tmp5_;
	GamesGame* _tmp6_;
};

struct _GamesApplicationAddCachedUriData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesApplication* self;
	GamesUri* uri;
	GamesDatabase* _tmp0_;
	GamesDatabase* _tmp1_;
	GamesUri* _tmp2_;
	GError* e;
	GError* _tmp3_;
	const gchar* _tmp4_;
	GamesGameCollection* _tmp5_;
	GamesUri* _tmp6_;
	GError * _inner_error_;
};

struct _GamesApplicationLoadGameListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GamesApplication* self;
	GamesGameCollection* _tmp0_;
	GamesApplicationWindow* _tmp1_;
	GamesApplicationWindow* _tmp2_;
};

struct _Block5Data {
	int _ref_count_;
	GamesApplication* self;
	GtkAboutDialog* dialog;
};


static gpointer games_application_parent_class = NULL;

GType games_application_get_type (void) G_GNUC_CONST;
GType games_database_get_type (void) G_GNUC_CONST;
GType games_application_window_get_type (void) G_GNUC_CONST;
GType games_game_collection_get_type (void) G_GNUC_CONST;
#define GAMES_APPLICATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_APPLICATION, GamesApplicationPrivate))
enum  {
	GAMES_APPLICATION_0_PROPERTY
};
GamesApplication* games_application_new (void);
GamesApplication* games_application_construct (GType object_type);
static void games_application_add_actions (GamesApplication* self);
static void games_application_preferences (GamesApplication* self);
static void _games_application_preferences_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self);
static void games_application_about (GamesApplication* self);
static void _games_application_about_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self);
static void games_application_quit_application (GamesApplication* self);
static void _games_application_quit_application_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self);
void games_application_add_game_files (GamesApplication* self);
static void _games_application_add_game_files_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self);
static void games_application_add_signal_handlers (GamesApplication* self);
static gboolean __lambda15_ (GamesApplication* self);
static gboolean ___lambda15__gsource_func (gpointer self);
gchar* games_application_get_data_dir (void);
gchar* games_application_get_saves_dir (void);
gchar* games_application_get_snapshots_dir (void);
gchar* games_application_get_database_path (void);
gchar* games_application_get_cache_dir (void);
gchar* games_application_get_config_dir (void);
gchar* games_application_get_platforms_dir (void);
gchar* games_application_get_covers_dir (void);
void games_application_try_make_dir (const gchar* path);
gchar* games_application_get_medias_dir (void);
void games_application_add_game_files_async (GamesApplication* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void games_application_add_game_files_finish (GamesApplication* self, GAsyncResult* _res_);
static void games_application_add_game_files_async_data_free (gpointer _data);
static void games_application_add_game_files_async_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean games_application_add_game_files_async_co (GamesApplicationAddGameFilesAsyncData* _data_);
gchar** games_game_collection_get_accepted_mime_types (GamesGameCollection* self, int* result_length1);
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;
GamesUri* games_uri_new (const gchar* uri);
GamesUri* games_uri_construct (GType object_type, const gchar* uri);
static void games_application_add_cached_uri (GamesApplication* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void games_application_add_cached_uri_finish (GamesApplication* self, GAsyncResult* _res_);
static void games_application_add_game_files_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _g_free0_ (gpointer var);
static void _g_slist_free__g_free0_ (GSList* self);
static void games_application_real_open (GApplication* base, GFile** files, int files_length1, const gchar* hint);
static void games_application_open_async (GamesApplication* self, GFile** files, int files_length1, const gchar* hint, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void games_application_open_finish (GamesApplication* self, GAsyncResult* _res_);
static void games_application_open_async_data_free (gpointer _data);
static void games_application_open_async_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean games_application_open_async_co (GamesApplicationOpenAsyncData* _data_);
GamesUri* games_uri_new_from_file (GFile* file);
GamesUri* games_uri_construct_from_file (GType object_type, GFile* file);
static void _vala_array_add17 (GamesUri** * array, int* length, int* size, GamesUri* value);
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;
static void games_application_game_for_uris (GamesApplication* self, GamesUri** uris, int uris_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GamesGame* games_application_game_for_uris_finish (GamesApplication* self, GAsyncResult* _res_);
static void games_application_open_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void games_application_window_run_game (GamesApplicationWindow* self, GamesGame* game);
static void games_application_real_activate (GApplication* base);
static GtkCssProvider* games_application_load_css (const gchar* css);
void games_application_load_game_list (GamesApplication* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void games_application_load_game_list_finish (GamesApplication* self, GAsyncResult* _res_);
GListStore* games_game_collection_get_list_store (GamesGameCollection* self);
GamesApplicationWindow* games_application_window_new (GListModel* collection);
GamesApplicationWindow* games_application_window_construct (GType object_type, GListModel* collection);
static void __lambda21_ (GamesApplication* self);
static void ___lambda21__gtk_widget_destroy (GtkWidget* _sender, gpointer self);
static gboolean games_application_show_loading_notification (GamesApplication* self);
static gboolean _games_application_show_loading_notification_gsource_func (gpointer self);
void games_application_window_set_loading_notification (GamesApplicationWindow* self, gboolean value);
static void games_application_init_game_sources (GamesApplication* self);
GType games_tracker_uri_source_get_type (void) G_GNUC_CONST;
GamesTrackerUriSource* games_tracker_uri_source_new (TrackerSparqlConnection* connection);
GamesTrackerUriSource* games_tracker_uri_source_construct (GType object_type, TrackerSparqlConnection* connection);
GamesGameCollection* games_game_collection_new (void);
GamesGameCollection* games_game_collection_construct (GType object_type);
GType games_uri_iterator_get_type (void) G_GNUC_CONST;
GType games_uri_source_get_type (void) G_GNUC_CONST;
void games_game_collection_add_source (GamesGameCollection* self, GamesUriSource* source);
GType games_database_uri_source_get_type (void) G_GNUC_CONST;
GamesDatabaseUriSource* games_database_get_uri_source (GamesDatabase* self);
GType games_retro_simple_type_get_type (void) G_GNUC_CONST;
GamesRetroSimpleType* games_retro_simple_type_dup (const GamesRetroSimpleType* self);
void games_retro_simple_type_free (GamesRetroSimpleType* self);
void games_retro_simple_type_copy (const GamesRetroSimpleType* self, GamesRetroSimpleType* dest);
void games_retro_simple_type_destroy (GamesRetroSimpleType* self);
GType games_mime_type_tracker_uri_query_get_type (void) G_GNUC_CONST;
GamesMimeTypeTrackerUriQuery* games_mime_type_tracker_uri_query_new (const gchar* mime_type);
GamesMimeTypeTrackerUriQuery* games_mime_type_tracker_uri_query_construct (GType object_type, const gchar* mime_type);
GType games_tracker_uri_query_get_type (void) G_GNUC_CONST;
void games_tracker_uri_source_add_query (GamesTrackerUriSource* self, GamesTrackerUriQuery* query);
GType games_retro_simple_game_uri_adapter_get_type (void) G_GNUC_CONST;
GamesRetroSimpleGameUriAdapter* games_retro_simple_game_uri_adapter_new (GamesRetroSimpleType* simple_type);
GamesRetroSimpleGameUriAdapter* games_retro_simple_game_uri_adapter_construct (GType object_type, GamesRetroSimpleType* simple_type);
GType games_generic_uri_game_factory_get_type (void) G_GNUC_CONST;
GType games_game_uri_adapter_get_type (void) G_GNUC_CONST;
GamesGenericUriGameFactory* games_generic_uri_game_factory_new (GamesGameUriAdapter* game_uri_adapter);
GamesGenericUriGameFactory* games_generic_uri_game_factory_construct (GType object_type, GamesGameUriAdapter* game_uri_adapter);
void games_generic_uri_game_factory_add_mime_type (GamesGenericUriGameFactory* self, const gchar* mime_type);
GType games_uri_game_factory_get_type (void) G_GNUC_CONST;
void games_game_collection_add_factory (GamesGameCollection* self, GamesUriGameFactory* factory);
GType games_plugin_register_get_type (void) G_GNUC_CONST;
GamesPluginRegister* games_plugin_register_get_register (void);
gpointer games_plugin_register_iterator_ref (gpointer instance);
void games_plugin_register_iterator_unref (gpointer instance);
GParamSpec* games_param_spec_plugin_register_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void games_value_set_plugin_register_iterator (GValue* value, gpointer v_object);
void games_value_take_plugin_register_iterator (GValue* value, gpointer v_object);
gpointer games_value_get_plugin_register_iterator (const GValue* value);
GType games_plugin_register_iterator_get_type (void) G_GNUC_CONST;
GamesPluginRegisterIterator* games_plugin_register_iterator (GamesPluginRegister* self);
gboolean games_plugin_register_iterator_next (GamesPluginRegisterIterator* self);
GType games_plugin_registrar_get_type (void) G_GNUC_CONST;
GamesPluginRegistrar* games_plugin_register_iterator_get (GamesPluginRegisterIterator* self);
GType games_plugin_get_type (void) G_GNUC_CONST;
GQuark games_plugin_error_quark (void);
GamesPlugin* games_plugin_registrar_get_plugin (GamesPluginRegistrar* self, GError** error);
gchar** games_plugin_get_mime_types (GamesPlugin* self, int* result_length1);
GamesUriSource** games_plugin_get_uri_sources (GamesPlugin* self, int* result_length1);
GamesUriGameFactory** games_plugin_get_uri_game_factories (GamesPlugin* self, int* result_length1);
static void games_application_game_for_uris_data_free (gpointer _data);
static void games_application_game_for_uris_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean games_application_game_for_uris_co (GamesApplicationGameForUrisData* _data_);
static void games_application_game_for_uris_ready (GObject* source_object, GAsyncResult* _res_, gpointer _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 void games_application_add_cached_uri_data_free (gpointer _data);
static void games_application_add_cached_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean games_application_add_cached_uri_co (GamesApplicationAddCachedUriData* _data_);
void games_database_add_uri (GamesDatabase* self, GamesUri* uri, GError** error);
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 void games_application_add_cached_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void games_application_load_game_list_data_free (gpointer _data);
static void games_application_load_game_list_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean games_application_load_game_list_co (GamesApplicationLoadGameListData* _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 void games_application_load_game_list_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
GamesPreferencesWindow* games_preferences_window_new (void);
GamesPreferencesWindow* games_preferences_window_construct (GType object_type);
GType games_preferences_window_get_type (void) G_GNUC_CONST;
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
#define GAMES_CREDITS_DOCUMENTERS NULL
static void __lambda14_ (Block5Data* _data5_, gint response_id);
static void ___lambda14__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
gboolean games_application_window_quit_game (GamesApplicationWindow* self);
static GObject * games_application_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
GamesDatabase* games_database_new (const gchar* path, GError** error);
GamesDatabase* games_database_construct (GType object_type, const gchar* path, GError** error);
static void games_application_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);

extern const GamesRetroSimpleType GAMES_RETRO_SIMPLE_TYPES[24];
extern const gchar* GAMES_CREDITS_AUTHORS[2];
extern const gchar* GAMES_CREDITS_ARTISTS[1];

GamesApplication* games_application_construct (GType object_type) {
	GamesApplication * self = NULL;
	self = (GamesApplication*) g_object_new (object_type, "application-id", "org.gnome.Games", "flags", G_APPLICATION_HANDLES_OPEN, NULL);
	return self;
}


GamesApplication* games_application_new (void) {
	return games_application_construct (GAMES_TYPE_APPLICATION);
}


static void _games_application_preferences_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self) {
	games_application_preferences ((GamesApplication*) self);
}


static void _games_application_about_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self) {
	games_application_about ((GamesApplication*) self);
}


static void _games_application_quit_application_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self) {
	games_application_quit_application ((GamesApplication*) self);
}


static void _games_application_add_game_files_g_simple_action_activate (GSimpleAction* _sender, GVariant* parameter, gpointer self) {
	games_application_add_game_files ((GamesApplication*) self);
}


static void games_application_add_actions (GamesApplication* self) {
	GSimpleAction* preferences_action = NULL;
	GSimpleAction* _tmp0_;
	GSimpleAction* about_action = NULL;
	GSimpleAction* _tmp1_;
	GSimpleAction* quit_action = NULL;
	GSimpleAction* _tmp2_;
	GSimpleAction* add_game_files_action = NULL;
	GSimpleAction* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_simple_action_new ("preferences", NULL);
	preferences_action = _tmp0_;
	g_signal_connect_object (preferences_action, "activate", (GCallback) _games_application_preferences_g_simple_action_activate, self, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) preferences_action);
	_tmp1_ = g_simple_action_new ("about", NULL);
	about_action = _tmp1_;
	g_signal_connect_object (about_action, "activate", (GCallback) _games_application_about_g_simple_action_activate, self, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) about_action);
	_tmp2_ = g_simple_action_new ("quit", NULL);
	quit_action = _tmp2_;
	g_signal_connect_object (quit_action, "activate", (GCallback) _games_application_quit_application_g_simple_action_activate, self, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) quit_action);
	_tmp3_ = g_simple_action_new ("add-game-files", NULL);
	add_game_files_action = _tmp3_;
	g_signal_connect_object (add_game_files_action, "activate", (GCallback) _games_application_add_game_files_g_simple_action_activate, self, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) add_game_files_action);
	_g_object_unref0 (add_game_files_action);
	_g_object_unref0 (quit_action);
	_g_object_unref0 (about_action);
	_g_object_unref0 (preferences_action);
}


static gboolean __lambda15_ (GamesApplication* self) {
	gboolean result = FALSE;
	games_application_quit_application (self);
	result = G_SOURCE_CONTINUE;
	return result;
}


static gboolean ___lambda15__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda15_ ((GamesApplication*) self);
	return result;
}


static void games_application_add_signal_handlers (GamesApplication* self) {
	GSource* interrupt_source = NULL;
	GSource* _tmp0_;
	GMainContext* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_unix_signal_source_new ((gint) SIGINT);
	interrupt_source = _tmp0_;
	g_source_set_callback (interrupt_source, ___lambda15__gsource_func, g_object_ref (self), g_object_unref);
	_tmp1_ = g_main_context_default ();
	g_source_attach (interrupt_source, _tmp1_);
	_g_source_unref0 (interrupt_source);
}


static const gchar* string_to_string (const gchar* self) {
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}


gchar* games_application_get_data_dir (void) {
	gchar* result = NULL;
	gchar* data_dir = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = g_get_user_data_dir ();
	_tmp1_ = g_strdup (_tmp0_);
	data_dir = _tmp1_;
	_tmp2_ = string_to_string (data_dir);
	_tmp3_ = g_strconcat (_tmp2_, "/gnome-games", NULL);
	result = _tmp3_;
	_g_free0 (data_dir);
	return result;
}


gchar* games_application_get_saves_dir (void) {
	gchar* result = NULL;
	gchar* data_dir = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = games_application_get_data_dir ();
	data_dir = _tmp0_;
	_tmp1_ = string_to_string (data_dir);
	_tmp2_ = g_strconcat (_tmp1_, "/saves", NULL);
	result = _tmp2_;
	_g_free0 (data_dir);
	return result;
}


gchar* games_application_get_snapshots_dir (void) {
	gchar* result = NULL;
	gchar* data_dir = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = games_application_get_data_dir ();
	data_dir = _tmp0_;
	_tmp1_ = string_to_string (data_dir);
	_tmp2_ = g_strconcat (_tmp1_, "/snapshots", NULL);
	result = _tmp2_;
	_g_free0 (data_dir);
	return result;
}


gchar* games_application_get_database_path (void) {
	gchar* result = NULL;
	gchar* data_dir = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = games_application_get_data_dir ();
	data_dir = _tmp0_;
	_tmp1_ = string_to_string (data_dir);
	_tmp2_ = g_strconcat (_tmp1_, "/database.sqlite3", NULL);
	result = _tmp2_;
	_g_free0 (data_dir);
	return result;
}


gchar* games_application_get_cache_dir (void) {
	gchar* result = NULL;
	gchar* cache_dir = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = g_get_user_cache_dir ();
	_tmp1_ = g_strdup (_tmp0_);
	cache_dir = _tmp1_;
	_tmp2_ = string_to_string (cache_dir);
	_tmp3_ = g_strconcat (_tmp2_, "/gnome-games", NULL);
	result = _tmp3_;
	_g_free0 (cache_dir);
	return result;
}


gchar* games_application_get_config_dir (void) {
	gchar* result = NULL;
	gchar* config_dir = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = g_get_user_config_dir ();
	_tmp1_ = g_strdup (_tmp0_);
	config_dir = _tmp1_;
	_tmp2_ = string_to_string (config_dir);
	_tmp3_ = g_strconcat (_tmp2_, "/gnome-games", NULL);
	result = _tmp3_;
	_g_free0 (config_dir);
	return result;
}


gchar* games_application_get_platforms_dir (void) {
	gchar* result = NULL;
	gchar* config_dir = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = games_application_get_config_dir ();
	config_dir = _tmp0_;
	_tmp1_ = string_to_string (config_dir);
	_tmp2_ = g_strconcat (_tmp1_, "/platforms", NULL);
	result = _tmp2_;
	_g_free0 (config_dir);
	return result;
}


gchar* games_application_get_covers_dir (void) {
	gchar* result = NULL;
	gchar* cache_dir = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = games_application_get_cache_dir ();
	cache_dir = _tmp0_;
	_tmp1_ = string_to_string (cache_dir);
	_tmp2_ = g_strconcat (_tmp1_, "/covers", NULL);
	result = _tmp2_;
	_g_free0 (cache_dir);
	return result;
}


void games_application_try_make_dir (const gchar* path) {
	GFile* file = NULL;
	const gchar* _tmp0_;
	GFile* _tmp1_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (path != NULL);
	_tmp0_ = path;
	_tmp1_ = g_file_new_for_path (_tmp0_);
	file = _tmp1_;
	{
		GFile* _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = file;
		_tmp3_ = g_file_query_exists (_tmp2_, NULL);
		if (!_tmp3_) {
			GFile* _tmp4_;
			_tmp4_ = file;
			g_file_make_directory_with_parents (_tmp4_, NULL, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch23_g_error;
			}
		}
	}
	goto __finally23;
	__catch23_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		_tmp7_ = string_to_string (_tmp6_);
		_tmp8_ = g_strconcat (_tmp7_, "\n", NULL);
		_tmp9_ = _tmp8_;
		g_warning ("application.vala:120: %s", _tmp9_);
		_g_free0 (_tmp9_);
		_g_error_free0 (e);
	}
	__finally23:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (file);
		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;
	}
	_g_object_unref0 (file);
}


gchar* games_application_get_medias_dir (void) {
	gchar* result = NULL;
	gchar* data_dir = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = games_application_get_data_dir ();
	data_dir = _tmp0_;
	_tmp1_ = string_to_string (data_dir);
	_tmp2_ = g_strconcat (_tmp1_, "/medias", NULL);
	result = _tmp2_;
	_g_free0 (data_dir);
	return result;
}


void games_application_add_game_files (GamesApplication* self) {
	g_return_if_fail (self != NULL);
	games_application_add_game_files_async (self, NULL, NULL);
}


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


static void games_application_add_game_files_async_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesApplicationAddGameFilesAsyncData* _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 _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


void games_application_add_game_files_async (GamesApplication* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesApplicationAddGameFilesAsyncData* _data_;
	GamesApplication* _tmp0_;
	_data_ = g_slice_new0 (GamesApplicationAddGameFilesAsyncData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_application_add_game_files_async_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_application_add_game_files_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	games_application_add_game_files_async_co (_data_);
}


void games_application_add_game_files_finish (GamesApplication* self, GAsyncResult* _res_) {
	GamesApplicationAddGameFilesAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void games_application_add_game_files_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesApplicationAddGameFilesAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_application_add_game_files_async_co (_data_);
}


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


static void _g_slist_free__g_free0_ (GSList* self) {
	g_slist_foreach (self, (GFunc) _g_free0_, NULL);
	g_slist_free (self);
}


static gboolean games_application_add_game_files_async_co (GamesApplicationAddGameFilesAsyncData* _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->window;
	_data_->_tmp1_ = (GtkFileChooserDialog*) gtk_file_chooser_dialog_new (_ ("Select game files"), (GtkWindow*) _data_->_tmp0_, GTK_FILE_CHOOSER_ACTION_OPEN, _ ("_Cancel"), GTK_RESPONSE_CANCEL, _ ("_Add"), GTK_RESPONSE_ACCEPT, NULL);
	g_object_ref_sink (_data_->_tmp1_);
	_data_->chooser = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->chooser;
	gtk_file_chooser_set_select_multiple ((GtkFileChooser*) _data_->_tmp2_, TRUE);
	_data_->_tmp3_ = gtk_file_filter_new ();
	g_object_ref_sink (_data_->_tmp3_);
	_data_->filter = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->chooser;
	_data_->_tmp5_ = _data_->filter;
	gtk_file_chooser_set_filter ((GtkFileChooser*) _data_->_tmp4_, _data_->_tmp5_);
	_data_->_tmp6_ = _data_->self->priv->game_collection;
	_data_->_tmp8_ = games_game_collection_get_accepted_mime_types (_data_->_tmp6_, &_data_->_tmp7_);
	{
		_data_->mime_type_collection_length1 = 0;
		_data_->_mime_type_collection_size_ = 0;
		_data_->mime_type_collection = _data_->_tmp8_;
		_data_->mime_type_collection_length1 = _data_->_tmp7_;
		for (_data_->mime_type_it = 0; _data_->mime_type_it < _data_->_tmp7_; _data_->mime_type_it = _data_->mime_type_it + 1) {
			_data_->_tmp9_ = g_strdup (_data_->mime_type_collection[_data_->mime_type_it]);
			_data_->mime_type = _data_->_tmp9_;
			{
				_data_->_tmp10_ = _data_->filter;
				_data_->_tmp11_ = _data_->mime_type;
				gtk_file_filter_add_mime_type (_data_->_tmp10_, _data_->_tmp11_);
				_g_free0 (_data_->mime_type);
			}
		}
		_data_->mime_type_collection = (_vala_array_free (_data_->mime_type_collection, _data_->mime_type_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_data_->_tmp12_ = _data_->chooser;
	_data_->_tmp13_ = gtk_dialog_run ((GtkDialog*) _data_->_tmp12_);
	if (_data_->_tmp13_ == ((gint) GTK_RESPONSE_ACCEPT)) {
		_data_->_tmp14_ = _data_->chooser;
		_data_->_tmp15_ = gtk_file_chooser_get_uris ((GtkFileChooser*) _data_->_tmp14_);
		{
			_data_->uri_string_collection = _data_->_tmp15_;
			for (_data_->uri_string_it = _data_->uri_string_collection; _data_->uri_string_it != NULL; _data_->uri_string_it = _data_->uri_string_it->next) {
				_data_->uri_string = (const gchar*) _data_->uri_string_it->data;
				{
					_data_->_tmp16_ = _data_->uri_string;
					_data_->_tmp17_ = games_uri_new (_data_->_tmp16_);
					_data_->uri = _data_->_tmp17_;
					_data_->_tmp18_ = _data_->uri;
					_data_->_state_ = 1;
					games_application_add_cached_uri (_data_->self, _data_->_tmp18_, games_application_add_game_files_async_ready, _data_);
					return FALSE;
					_state_1:
					games_application_add_cached_uri_finish (_data_->self, _data_->_res_);
					_games_uri_unref0 (_data_->uri);
				}
			}
			__g_slist_free__g_free0_0 (_data_->uri_string_collection);
		}
	}
	_data_->_tmp19_ = _data_->chooser;
	g_signal_emit_by_name ((GtkDialog*) _data_->_tmp19_, "close");
	_g_object_unref0 (_data_->filter);
	_g_object_unref0 (_data_->chooser);
	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_application_real_open (GApplication* base, GFile** files, int files_length1, const gchar* hint) {
	GamesApplication * self;
	GFile** _tmp0_;
	gint _tmp0__length1;
	const gchar* _tmp1_;
	self = (GamesApplication*) base;
	g_return_if_fail (hint != NULL);
	_tmp0_ = files;
	_tmp0__length1 = files_length1;
	_tmp1_ = hint;
	games_application_open_async (self, _tmp0_, _tmp0__length1, _tmp1_, NULL, NULL);
}


static void games_application_open_async_data_free (gpointer _data) {
	GamesApplicationOpenAsyncData* _data_;
	_data_ = _data;
	_g_free0 (_data_->hint);
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesApplicationOpenAsyncData, _data_);
}


static void games_application_open_async_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesApplicationOpenAsyncData* _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_application_open_async (GamesApplication* self, GFile** files, int files_length1, const gchar* hint, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesApplicationOpenAsyncData* _data_;
	GamesApplication* _tmp0_;
	GFile** _tmp1_;
	gint _tmp1__length1;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	_data_ = g_slice_new0 (GamesApplicationOpenAsyncData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_application_open_async_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_application_open_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = files;
	_tmp1__length1 = files_length1;
	_data_->files = _tmp1_;
	_data_->files_length1 = _tmp1__length1;
	_tmp2_ = hint;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (_data_->hint);
	_data_->hint = _tmp3_;
	games_application_open_async_co (_data_);
}


static void games_application_open_finish (GamesApplication* self, GAsyncResult* _res_) {
	GamesApplicationOpenAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


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


static void games_application_open_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesApplicationOpenAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_application_open_async_co (_data_);
}


static gboolean games_application_open_async_co (GamesApplicationOpenAsyncData* _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->window;
	if (_data_->_tmp0_ == NULL) {
		g_application_activate ((GApplication*) _data_->self);
	}
	_data_->_tmp1_ = _data_->files;
	_data_->_tmp1__length1 = _data_->files_length1;
	if (_data_->_tmp1__length1 == 0) {
		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_->_tmp2_ = g_new0 (GamesUri*, 0 + 1);
	_data_->uris = _data_->_tmp2_;
	_data_->uris_length1 = 0;
	_data_->_uris_size_ = _data_->uris_length1;
	_data_->_tmp3_ = _data_->files;
	_data_->_tmp3__length1 = _data_->files_length1;
	{
		_data_->file_collection_length1 = 0;
		_data_->_file_collection_size_ = 0;
		_data_->file_collection = _data_->_tmp3_;
		_data_->file_collection_length1 = _data_->_tmp3__length1;
		for (_data_->file_it = 0; _data_->file_it < _data_->_tmp3__length1; _data_->file_it = _data_->file_it + 1) {
			_data_->_tmp4_ = _g_object_ref0 (_data_->file_collection[_data_->file_it]);
			_data_->file = _data_->_tmp4_;
			{
				_data_->_tmp5_ = _data_->uris;
				_data_->_tmp5__length1 = _data_->uris_length1;
				_data_->_tmp6_ = _data_->file;
				_data_->_tmp7_ = games_uri_new_from_file (_data_->_tmp6_);
				_vala_array_add17 (&_data_->uris, &_data_->uris_length1, &_data_->_uris_size_, _data_->_tmp7_);
				_g_object_unref0 (_data_->file);
			}
		}
	}
	_data_->_tmp8_ = _data_->uris;
	_data_->_tmp8__length1 = _data_->uris_length1;
	_data_->_state_ = 1;
	games_application_game_for_uris (_data_->self, _data_->_tmp8_, _data_->_tmp8__length1, games_application_open_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = games_application_game_for_uris_finish (_data_->self, _data_->_res_);
	_data_->game = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->game;
	if (_data_->_tmp10_ != NULL) {
		_data_->_tmp11_ = _data_->self->priv->window;
		_data_->_tmp12_ = _data_->game;
		games_application_window_run_game (_data_->_tmp11_, _data_->_tmp12_);
	}
	_g_object_unref0 (_data_->game);
	_data_->uris = (_vala_array_free (_data_->uris, _data_->uris_length1, (GDestroyNotify) games_uri_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 __lambda21_ (GamesApplication* self) {
	games_application_quit_application (self);
}


static void ___lambda21__gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
	__lambda21_ ((GamesApplication*) self);
}


static gboolean _games_application_show_loading_notification_gsource_func (gpointer self) {
	gboolean result;
	result = games_application_show_loading_notification ((GamesApplication*) self);
	return result;
}


static void games_application_real_activate (GApplication* base) {
	GamesApplication * self;
	GtkSettings* _tmp0_;
	GdkScreen* screen = NULL;
	GdkScreen* _tmp1_;
	GdkScreen* _tmp2_;
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp3_;
	GamesGameCollection* _tmp4_;
	GListStore* _tmp5_;
	GListStore* _tmp6_;
	GamesApplicationWindow* _tmp7_;
	GamesApplicationWindow* _tmp8_;
	GamesApplicationWindow* _tmp9_;
	GamesApplicationWindow* _tmp10_;
	self = (GamesApplication*) base;
	_tmp0_ = gtk_settings_get_default ();
	g_object_set (_tmp0_, "gtk-application-prefer-dark-theme", TRUE, NULL);
	_tmp1_ = gdk_screen_get_default ();
	_tmp2_ = _g_object_ref0 (_tmp1_);
	screen = _tmp2_;
	_tmp3_ = games_application_load_css ("gtk-style.css");
	provider = _tmp3_;
	gtk_style_context_add_provider_for_screen (screen, (GtkStyleProvider*) provider, (guint) 600);
	games_application_load_game_list (self, NULL, NULL);
	_tmp4_ = self->priv->game_collection;
	_tmp5_ = games_game_collection_get_list_store (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = games_application_window_new ((GListModel*) _tmp6_);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp7_;
	_g_object_unref0 (_tmp6_);
	_tmp8_ = self->priv->window;
	gtk_application_add_window ((GtkApplication*) self, (GtkWindow*) _tmp8_);
	_tmp9_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp9_, "destroy", (GCallback) ___lambda21__gtk_widget_destroy, self, 0);
	_tmp10_ = self->priv->window;
	gtk_widget_show ((GtkWidget*) _tmp10_);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 500, _games_application_show_loading_notification_gsource_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (provider);
	_g_object_unref0 (screen);
}


static gboolean games_application_show_loading_notification (GamesApplication* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->game_list_loaded;
	if (!_tmp0_) {
		GamesApplicationWindow* _tmp1_;
		_tmp1_ = self->priv->window;
		games_application_window_set_loading_notification (_tmp1_, TRUE);
	}
	result = FALSE;
	return result;
}


static void games_application_init_game_sources (GamesApplication* self) {
	GamesGameCollection* _tmp0_;
	GamesTrackerUriSource* tracker_uri_source = NULL;
	GamesGameCollection* _tmp6_;
	GamesDatabase* _tmp7_;
	GamesTrackerUriSource* _tmp12_;
	GHashTable* mime_types = NULL;
	GHashFunc _tmp15_;
	GEqualFunc _tmp16_;
	GHashTable* _tmp17_;
	GamesPluginRegister* _register_ = NULL;
	GamesPluginRegister* _tmp44_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game_collection;
	if (_tmp0_ != NULL) {
		return;
	}
	tracker_uri_source = NULL;
	{
		TrackerSparqlConnection* connection = NULL;
		TrackerSparqlConnection* _tmp1_;
		TrackerSparqlConnection* _tmp2_;
		GamesTrackerUriSource* _tmp3_;
		_tmp1_ = tracker_sparql_connection_get (NULL, &_inner_error_);
		connection = _tmp1_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch24_g_error;
		}
		_tmp2_ = connection;
		_tmp3_ = games_tracker_uri_source_new (_tmp2_);
		_g_object_unref0 (tracker_uri_source);
		tracker_uri_source = _tmp3_;
		_g_object_unref0 (connection);
	}
	goto __finally24;
	__catch24_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_debug ("application.vala:215: %s", _tmp5_);
		_g_error_free0 (e);
	}
	__finally24:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (tracker_uri_source);
		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;
	}
	_tmp6_ = games_game_collection_new ();
	_g_object_unref0 (self->priv->game_collection);
	self->priv->game_collection = _tmp6_;
	_tmp7_ = self->priv->database;
	if (_tmp7_ != NULL) {
		GamesGameCollection* _tmp8_;
		GamesDatabase* _tmp9_;
		GamesDatabaseUriSource* _tmp10_;
		GamesDatabaseUriSource* _tmp11_;
		_tmp8_ = self->priv->game_collection;
		_tmp9_ = self->priv->database;
		_tmp10_ = games_database_get_uri_source (_tmp9_);
		_tmp11_ = _tmp10_;
		games_game_collection_add_source (_tmp8_, (GamesUriSource*) _tmp11_);
		_g_object_unref0 (_tmp11_);
	}
	_tmp12_ = tracker_uri_source;
	if (_tmp12_ != NULL) {
		GamesGameCollection* _tmp13_;
		GamesTrackerUriSource* _tmp14_;
		_tmp13_ = self->priv->game_collection;
		_tmp14_ = tracker_uri_source;
		games_game_collection_add_source (_tmp13_, (GamesUriSource*) _tmp14_);
	}
	_tmp15_ = g_str_hash;
	_tmp16_ = g_str_equal;
	_tmp17_ = g_hash_table_new_full (_tmp15_, _tmp16_, NULL, _g_free0_);
	mime_types = _tmp17_;
	{
		GamesRetroSimpleType* simple_type_collection = NULL;
		gint simple_type_collection_length1 = 0;
		gint _simple_type_collection_size_ = 0;
		gint simple_type_it = 0;
		simple_type_collection = GAMES_RETRO_SIMPLE_TYPES;
		simple_type_collection_length1 = G_N_ELEMENTS (GAMES_RETRO_SIMPLE_TYPES);
		for (simple_type_it = 0; simple_type_it < G_N_ELEMENTS (GAMES_RETRO_SIMPLE_TYPES); simple_type_it = simple_type_it + 1) {
			GamesRetroSimpleType simple_type = {0};
			simple_type = simple_type_collection[simple_type_it];
			{
				GHashTable* _tmp18_;
				GamesRetroSimpleType _tmp19_;
				const gchar* _tmp20_;
				gboolean _tmp21_;
				gboolean _tmp22_ = FALSE;
				GamesRetroSimpleType _tmp23_;
				gboolean _tmp24_;
				GamesRetroSimpleGameUriAdapter* game_uri_adapter = NULL;
				GamesRetroSimpleType _tmp35_;
				GamesRetroSimpleGameUriAdapter* _tmp36_;
				GamesGenericUriGameFactory* factory = NULL;
				GamesRetroSimpleGameUriAdapter* _tmp37_;
				GamesGenericUriGameFactory* _tmp38_;
				GamesGenericUriGameFactory* _tmp39_;
				GamesRetroSimpleType _tmp40_;
				const gchar* _tmp41_;
				GamesGameCollection* _tmp42_;
				GamesGenericUriGameFactory* _tmp43_;
				_tmp18_ = mime_types;
				_tmp19_ = simple_type;
				_tmp20_ = _tmp19_.mime_type;
				_tmp21_ = g_hash_table_contains (_tmp18_, _tmp20_);
				_vala_assert (!_tmp21_, "!mime_types.contains (simple_type.mime_type)");
				_tmp23_ = simple_type;
				_tmp24_ = _tmp23_.search_mime_type;
				if (_tmp24_) {
					GamesTrackerUriSource* _tmp25_;
					_tmp25_ = tracker_uri_source;
					_tmp22_ = _tmp25_ != NULL;
				} else {
					_tmp22_ = FALSE;
				}
				if (_tmp22_) {
					GHashTable* _tmp26_;
					GamesRetroSimpleType _tmp27_;
					const gchar* _tmp28_;
					gchar* _tmp29_;
					GamesMimeTypeTrackerUriQuery* query = NULL;
					GamesRetroSimpleType _tmp30_;
					const gchar* _tmp31_;
					GamesMimeTypeTrackerUriQuery* _tmp32_;
					GamesTrackerUriSource* _tmp33_;
					GamesMimeTypeTrackerUriQuery* _tmp34_;
					_tmp26_ = mime_types;
					_tmp27_ = simple_type;
					_tmp28_ = _tmp27_.mime_type;
					_tmp29_ = g_strdup (_tmp28_);
					g_hash_table_add (_tmp26_, _tmp29_);
					_tmp30_ = simple_type;
					_tmp31_ = _tmp30_.mime_type;
					_tmp32_ = games_mime_type_tracker_uri_query_new (_tmp31_);
					query = _tmp32_;
					_tmp33_ = tracker_uri_source;
					_tmp34_ = query;
					games_tracker_uri_source_add_query (_tmp33_, (GamesTrackerUriQuery*) _tmp34_);
					_g_object_unref0 (query);
				}
				_tmp35_ = simple_type;
				_tmp36_ = games_retro_simple_game_uri_adapter_new (&_tmp35_);
				game_uri_adapter = _tmp36_;
				_tmp37_ = game_uri_adapter;
				_tmp38_ = games_generic_uri_game_factory_new ((GamesGameUriAdapter*) _tmp37_);
				factory = _tmp38_;
				_tmp39_ = factory;
				_tmp40_ = simple_type;
				_tmp41_ = _tmp40_.mime_type;
				games_generic_uri_game_factory_add_mime_type (_tmp39_, _tmp41_);
				_tmp42_ = self->priv->game_collection;
				_tmp43_ = factory;
				games_game_collection_add_factory (_tmp42_, (GamesUriGameFactory*) _tmp43_);
				_g_object_unref0 (factory);
				_g_object_unref0 (game_uri_adapter);
			}
		}
	}
	_tmp44_ = games_plugin_register_get_register ();
	_register_ = _tmp44_;
	{
		GamesPluginRegisterIterator* _plugin_registrar_it = NULL;
		GamesPluginRegister* _tmp45_;
		GamesPluginRegisterIterator* _tmp46_;
		_tmp45_ = _register_;
		_tmp46_ = games_plugin_register_iterator (_tmp45_);
		_plugin_registrar_it = _tmp46_;
		while (TRUE) {
			GamesPluginRegisterIterator* _tmp47_;
			gboolean _tmp48_;
			GamesPluginRegistrar* plugin_registrar = NULL;
			GamesPluginRegisterIterator* _tmp49_;
			GamesPluginRegistrar* _tmp50_;
			_tmp47_ = _plugin_registrar_it;
			_tmp48_ = games_plugin_register_iterator_next (_tmp47_);
			if (!_tmp48_) {
				break;
			}
			_tmp49_ = _plugin_registrar_it;
			_tmp50_ = games_plugin_register_iterator_get (_tmp49_);
			plugin_registrar = _tmp50_;
			{
				GamesPlugin* plugin = NULL;
				GamesPluginRegistrar* _tmp51_;
				GamesPlugin* _tmp52_;
				GamesTrackerUriSource* _tmp53_;
				GamesPlugin* _tmp68_;
				gint _tmp69_;
				GamesUriSource** _tmp70_;
				GamesPlugin* _tmp74_;
				gint _tmp75_;
				GamesUriGameFactory** _tmp76_;
				_tmp51_ = plugin_registrar;
				_tmp52_ = games_plugin_registrar_get_plugin (_tmp51_, &_inner_error_);
				plugin = _tmp52_;
				if (G_UNLIKELY (_inner_error_ != NULL)) {
					goto __catch25_g_error;
				}
				_tmp53_ = tracker_uri_source;
				if (_tmp53_ != NULL) {
					GamesPlugin* _tmp54_;
					gint _tmp55_;
					gchar** _tmp56_;
					_tmp54_ = plugin;
					_tmp56_ = games_plugin_get_mime_types (_tmp54_, &_tmp55_);
					{
						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 = _tmp56_;
						mime_type_collection_length1 = _tmp55_;
						for (mime_type_it = 0; mime_type_it < _tmp55_; mime_type_it = mime_type_it + 1) {
							gchar* _tmp57_;
							gchar* mime_type = NULL;
							_tmp57_ = g_strdup (mime_type_collection[mime_type_it]);
							mime_type = _tmp57_;
							{
								GHashTable* _tmp58_;
								const gchar* _tmp59_;
								gboolean _tmp60_;
								GHashTable* _tmp61_;
								const gchar* _tmp62_;
								gchar* _tmp63_;
								GamesMimeTypeTrackerUriQuery* query = NULL;
								const gchar* _tmp64_;
								GamesMimeTypeTrackerUriQuery* _tmp65_;
								GamesTrackerUriSource* _tmp66_;
								GamesMimeTypeTrackerUriQuery* _tmp67_;
								_tmp58_ = mime_types;
								_tmp59_ = mime_type;
								_tmp60_ = g_hash_table_contains (_tmp58_, _tmp59_);
								if (_tmp60_) {
									_g_free0 (mime_type);
									continue;
								}
								_tmp61_ = mime_types;
								_tmp62_ = mime_type;
								_tmp63_ = g_strdup (_tmp62_);
								g_hash_table_add (_tmp61_, _tmp63_);
								_tmp64_ = mime_type;
								_tmp65_ = games_mime_type_tracker_uri_query_new (_tmp64_);
								query = _tmp65_;
								_tmp66_ = tracker_uri_source;
								_tmp67_ = query;
								games_tracker_uri_source_add_query (_tmp66_, (GamesTrackerUriQuery*) _tmp67_);
								_g_object_unref0 (query);
								_g_free0 (mime_type);
							}
						}
						mime_type_collection = (_vala_array_free (mime_type_collection, mime_type_collection_length1, (GDestroyNotify) g_free), NULL);
					}
				}
				_tmp68_ = plugin;
				_tmp70_ = games_plugin_get_uri_sources (_tmp68_, &_tmp69_);
				{
					GamesUriSource** uri_source_collection = NULL;
					gint uri_source_collection_length1 = 0;
					gint _uri_source_collection_size_ = 0;
					gint uri_source_it = 0;
					uri_source_collection = _tmp70_;
					uri_source_collection_length1 = _tmp69_;
					for (uri_source_it = 0; uri_source_it < _tmp69_; uri_source_it = uri_source_it + 1) {
						GamesUriSource* _tmp71_;
						GamesUriSource* uri_source = NULL;
						_tmp71_ = _g_object_ref0 (uri_source_collection[uri_source_it]);
						uri_source = _tmp71_;
						{
							GamesGameCollection* _tmp72_;
							GamesUriSource* _tmp73_;
							_tmp72_ = self->priv->game_collection;
							_tmp73_ = uri_source;
							games_game_collection_add_source (_tmp72_, _tmp73_);
							_g_object_unref0 (uri_source);
						}
					}
					uri_source_collection = (_vala_array_free (uri_source_collection, uri_source_collection_length1, (GDestroyNotify) g_object_unref), NULL);
				}
				_tmp74_ = plugin;
				_tmp76_ = games_plugin_get_uri_game_factories (_tmp74_, &_tmp75_);
				{
					GamesUriGameFactory** factory_collection = NULL;
					gint factory_collection_length1 = 0;
					gint _factory_collection_size_ = 0;
					gint factory_it = 0;
					factory_collection = _tmp76_;
					factory_collection_length1 = _tmp75_;
					for (factory_it = 0; factory_it < _tmp75_; factory_it = factory_it + 1) {
						GamesUriGameFactory* _tmp77_;
						GamesUriGameFactory* factory = NULL;
						_tmp77_ = _g_object_ref0 (factory_collection[factory_it]);
						factory = _tmp77_;
						{
							GamesGameCollection* _tmp78_;
							GamesUriGameFactory* _tmp79_;
							_tmp78_ = self->priv->game_collection;
							_tmp79_ = factory;
							games_game_collection_add_factory (_tmp78_, _tmp79_);
							_g_object_unref0 (factory);
						}
					}
					factory_collection = (_vala_array_free (factory_collection, factory_collection_length1, (GDestroyNotify) g_object_unref), NULL);
				}
				_g_object_unref0 (plugin);
			}
			goto __finally25;
			__catch25_g_error:
			{
				GError* e = NULL;
				GError* _tmp80_;
				const gchar* _tmp81_;
				e = _inner_error_;
				_inner_error_ = NULL;
				_tmp80_ = e;
				_tmp81_ = _tmp80_->message;
				g_debug ("application.vala:267: Error: %s", _tmp81_);
				_g_error_free0 (e);
			}
			__finally25:
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				_g_object_unref0 (plugin_registrar);
				_games_plugin_register_iterator_unref0 (_plugin_registrar_it);
				_g_object_unref0 (_register_);
				_g_hash_table_unref0 (mime_types);
				_g_object_unref0 (tracker_uri_source);
				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;
			}
			_g_object_unref0 (plugin_registrar);
		}
		_games_plugin_register_iterator_unref0 (_plugin_registrar_it);
	}
	_g_object_unref0 (_register_);
	_g_hash_table_unref0 (mime_types);
	_g_object_unref0 (tracker_uri_source);
}


static void games_application_game_for_uris_data_free (gpointer _data) {
	GamesApplicationGameForUrisData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesApplicationGameForUrisData, _data_);
}


static void games_application_game_for_uris_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesApplicationGameForUrisData* _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_application_game_for_uris (GamesApplication* self, GamesUri** uris, int uris_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesApplicationGameForUrisData* _data_;
	GamesApplication* _tmp0_;
	GamesUri** _tmp1_;
	gint _tmp1__length1;
	_data_ = g_slice_new0 (GamesApplicationGameForUrisData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_application_game_for_uris_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_application_game_for_uris_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = uris;
	_tmp1__length1 = uris_length1;
	_data_->uris = _tmp1_;
	_data_->uris_length1 = _tmp1__length1;
	games_application_game_for_uris_co (_data_);
}


static GamesGame* games_application_game_for_uris_finish (GamesApplication* self, GAsyncResult* _res_) {
	GamesGame* result;
	GamesApplicationGameForUrisData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


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


static void games_application_game_for_uris_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesApplicationGameForUrisData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_application_game_for_uris_co (_data_);
}


static gboolean games_application_game_for_uris_co (GamesApplicationGameForUrisData* _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:
	games_application_init_game_sources (_data_->self);
	_data_->_tmp0_ = _data_->uris;
	_data_->_tmp0__length1 = _data_->uris_length1;
	{
		_data_->uri_collection_length1 = 0;
		_data_->_uri_collection_size_ = 0;
		_data_->uri_collection = _data_->_tmp0_;
		_data_->uri_collection_length1 = _data_->_tmp0__length1;
		for (_data_->uri_it = 0; _data_->uri_it < _data_->_tmp0__length1; _data_->uri_it = _data_->uri_it + 1) {
			_data_->_tmp1_ = _games_uri_ref0 (_data_->uri_collection[_data_->uri_it]);
			_data_->uri = _data_->_tmp1_;
			{
				_data_->_tmp2_ = _data_->uri;
				_data_->_state_ = 1;
				games_application_add_cached_uri (_data_->self, _data_->_tmp2_, games_application_game_for_uris_ready, _data_);
				return FALSE;
				_state_1:
				games_application_add_cached_uri_finish (_data_->self, _data_->_res_);
				_games_uri_unref0 (_data_->uri);
			}
		}
	}
	_data_->_tmp3_ = _data_->self->priv->game_collection;
	_data_->_tmp4_ = _data_->uris;
	_data_->_tmp4__length1 = _data_->uris_length1;
	_data_->_tmp5_ = _data_->_tmp4_[0];
	_data_->_state_ = 2;
	games_game_collection_query_game_for_uri (_data_->_tmp3_, _data_->_tmp5_, games_application_game_for_uris_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp6_ = games_game_collection_query_game_for_uri_finish (_data_->_tmp3_, _data_->_res_);
	_data_->result = _data_->_tmp6_;
	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_application_add_cached_uri_data_free (gpointer _data) {
	GamesApplicationAddCachedUriData* _data_;
	_data_ = _data;
	_games_uri_unref0 (_data_->uri);
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesApplicationAddCachedUriData, _data_);
}


static void games_application_add_cached_uri_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesApplicationAddCachedUriData* _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_application_add_cached_uri (GamesApplication* self, GamesUri* uri, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesApplicationAddCachedUriData* _data_;
	GamesApplication* _tmp0_;
	GamesUri* _tmp1_;
	GamesUri* _tmp2_;
	_data_ = g_slice_new0 (GamesApplicationAddCachedUriData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_application_add_cached_uri_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_application_add_cached_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_application_add_cached_uri_co (_data_);
}


static void games_application_add_cached_uri_finish (GamesApplication* self, GAsyncResult* _res_) {
	GamesApplicationAddCachedUriData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void games_application_add_cached_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesApplicationAddCachedUriData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_application_add_cached_uri_co (_data_);
}


static gboolean games_application_add_cached_uri_co (GamesApplicationAddCachedUriData* _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->database;
		if (_data_->_tmp0_ != NULL) {
			_data_->_tmp1_ = _data_->self->priv->database;
			_data_->_tmp2_ = _data_->uri;
			games_database_add_uri (_data_->_tmp1_, _data_->_tmp2_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				goto __catch26_g_error;
			}
		}
	}
	goto __finally26;
	__catch26_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp3_ = _data_->e;
		_data_->_tmp4_ = _data_->_tmp3_->message;
		g_debug ("application.vala:287: %s", _data_->_tmp4_);
		_g_error_free0 (_data_->e);
	}
	__finally26:
	if (G_UNLIKELY (_data_->_inner_error_ != 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_->_tmp5_ = _data_->self->priv->game_collection;
	_data_->_tmp6_ = _data_->uri;
	_data_->_state_ = 1;
	games_game_collection_add_uri (_data_->_tmp5_, _data_->_tmp6_, games_application_add_cached_uri_ready, _data_);
	return FALSE;
	_state_1:
	games_game_collection_add_uri_finish (_data_->_tmp5_, _data_->_res_);
	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_application_load_game_list_data_free (gpointer _data) {
	GamesApplicationLoadGameListData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GamesApplicationLoadGameListData, _data_);
}


static void games_application_load_game_list_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	GamesApplicationLoadGameListData* _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_application_load_game_list (GamesApplication* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesApplicationLoadGameListData* _data_;
	GamesApplication* _tmp0_;
	_data_ = g_slice_new0 (GamesApplicationLoadGameListData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, games_application_load_game_list_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_application_load_game_list_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	games_application_load_game_list_co (_data_);
}


void games_application_load_game_list_finish (GamesApplication* self, GAsyncResult* _res_) {
	GamesApplicationLoadGameListData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void games_application_load_game_list_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GamesApplicationLoadGameListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	games_application_load_game_list_co (_data_);
}


static gboolean games_application_load_game_list_co (GamesApplicationLoadGameListData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	games_application_init_game_sources (_data_->self);
	_data_->_tmp0_ = _data_->self->priv->game_collection;
	_data_->_state_ = 1;
	games_game_collection_search_games (_data_->_tmp0_, games_application_load_game_list_ready, _data_);
	return FALSE;
	_state_1:
	games_game_collection_search_games_finish (_data_->_tmp0_, _data_->_res_);
	_data_->self->priv->game_list_loaded = TRUE;
	_data_->_tmp1_ = _data_->self->priv->window;
	if (_data_->_tmp1_ != NULL) {
		_data_->_tmp2_ = _data_->self->priv->window;
		games_application_window_set_loading_notification (_data_->_tmp2_, FALSE);
	}
	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_application_preferences (GamesApplication* self) {
	GamesPreferencesWindow* _tmp0_;
	GamesPreferencesWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = games_preferences_window_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (_tmp1_);
}


static Block5Data* block5_data_ref (Block5Data* _data5_) {
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}


static void block5_data_unref (void * _userdata_) {
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		GamesApplication* self;
		self = _data5_->self;
		_g_object_unref0 (_data5_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}


static void __lambda14_ (Block5Data* _data5_, gint response_id) {
	GamesApplication* self;
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	self = _data5_->self;
	_tmp1_ = response_id;
	if (_tmp1_ == ((gint) GTK_RESPONSE_CANCEL)) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp2_;
		_tmp2_ = response_id;
		_tmp0_ = _tmp2_ == ((gint) GTK_RESPONSE_DELETE_EVENT);
	}
	if (_tmp0_) {
		gtk_widget_hide_on_delete ((GtkWidget*) _data5_->dialog);
	}
}


static void ___lambda14__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	__lambda14_ (self, response_id);
}


static void games_application_about (GamesApplication* self) {
	Block5Data* _data5_;
	GtkAboutDialog* _tmp0_;
	GamesApplicationWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	_tmp0_ = (GtkAboutDialog*) gtk_about_dialog_new ();
	g_object_ref_sink (_tmp0_);
	_data5_->dialog = _tmp0_;
	gtk_window_set_destroy_with_parent ((GtkWindow*) _data5_->dialog, TRUE);
	_tmp1_ = self->priv->window;
	gtk_window_set_transient_for ((GtkWindow*) _data5_->dialog, (GtkWindow*) _tmp1_);
	gtk_window_set_modal ((GtkWindow*) _data5_->dialog, TRUE);
	gtk_about_dialog_set_program_name (_data5_->dialog, _ ("GNOME Games"));
	gtk_about_dialog_set_logo_icon_name (_data5_->dialog, "org.gnome.Games");
	gtk_about_dialog_set_comments (_data5_->dialog, _ ("A video game player for GNOME"));
	gtk_about_dialog_set_version (_data5_->dialog, VERSION);
	gtk_about_dialog_set_website (_data5_->dialog, "https://wiki.gnome.org/Apps/Games");
	gtk_about_dialog_set_website_label (_data5_->dialog, _ ("Learn more about GNOME Games"));
	gtk_about_dialog_set_license_type (_data5_->dialog, GTK_LICENSE_GPL_3_0);
	gtk_about_dialog_set_authors (_data5_->dialog, GAMES_CREDITS_AUTHORS);
	gtk_about_dialog_set_artists (_data5_->dialog, GAMES_CREDITS_ARTISTS);
	gtk_about_dialog_set_documenters (_data5_->dialog, GAMES_CREDITS_DOCUMENTERS);
	gtk_about_dialog_set_translator_credits (_data5_->dialog, _ ("translator-credits"));
	g_signal_connect_data ((GtkDialog*) _data5_->dialog, "response", (GCallback) ___lambda14__gtk_dialog_response, block5_data_ref (_data5_), (GClosureNotify) block5_data_unref, 0);
	gtk_window_present ((GtkWindow*) _data5_->dialog);
	block5_data_unref (_data5_);
	_data5_ = NULL;
}


static void games_application_quit_application (GamesApplication* self) {
	gboolean _tmp0_ = FALSE;
	GamesApplicationWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->window;
	if (_tmp1_ != NULL) {
		GamesApplicationWindow* _tmp2_;
		gboolean _tmp3_;
		_tmp2_ = self->priv->window;
		_tmp3_ = games_application_window_quit_game (_tmp2_);
		_tmp0_ = !_tmp3_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	g_application_quit ((GApplication*) self);
}


static GtkCssProvider* games_application_load_css (const gchar* css) {
	GtkCssProvider* result = NULL;
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp0_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (css != NULL, NULL);
	_tmp0_ = gtk_css_provider_new ();
	provider = _tmp0_;
	{
		GFile* file = NULL;
		const gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		GFile* _tmp4_;
		GFile* _tmp5_;
		_tmp1_ = css;
		_tmp2_ = g_strconcat ("resource:///org/gnome/Games/", _tmp1_, NULL);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_file_new_for_uri (_tmp3_);
		_tmp5_ = _tmp4_;
		_g_free0 (_tmp3_);
		file = _tmp5_;
		gtk_css_provider_load_from_file (provider, file, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_object_unref0 (file);
			goto __catch27_g_error;
		}
		_g_object_unref0 (file);
	}
	goto __finally27;
	__catch27_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = css;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		g_warning ("application.vala:349: Loading CSS file “%s” failed: %s", _tmp6_, _tmp8_);
		_g_error_free0 (e);
	}
	__finally27:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (provider);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	result = provider;
	return result;
}


static GObject * games_application_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GamesApplication * self;
	gchar* database_path = NULL;
	gchar* _tmp0_;
	GError * _inner_error_ = NULL;
	parent_class = G_OBJECT_CLASS (games_application_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_APPLICATION, GamesApplication);
	g_set_prgname ("gnome-games");
	g_set_application_name (_ ("Games"));
	gtk_window_set_default_icon_name ("org.gnome.Games");
	g_setenv ("PULSE_PROP_media.role", "game", TRUE);
	g_setenv ("PULSE_PROP_application.icon_name", "org.gnome.Games", TRUE);
	games_application_add_actions (self);
	games_application_add_signal_handlers (self);
	_tmp0_ = games_application_get_database_path ();
	database_path = _tmp0_;
	{
		GamesDatabase* _tmp1_ = NULL;
		const gchar* _tmp2_;
		GamesDatabase* _tmp3_;
		GamesDatabase* _tmp4_;
		_tmp2_ = database_path;
		_tmp3_ = games_database_new (_tmp2_, &_inner_error_);
		_tmp1_ = _tmp3_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch28_g_error;
		}
		_tmp4_ = _tmp1_;
		_tmp1_ = NULL;
		_g_object_unref0 (self->priv->database);
		self->priv->database = _tmp4_;
		_g_object_unref0 (_tmp1_);
	}
	goto __finally28;
	__catch28_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		g_debug ("application.vala:33: %s", _tmp6_);
		_g_error_free0 (e);
	}
	__finally28:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (database_path);
		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_);
	}
	_g_free0 (database_path);
	return obj;
}


static void games_application_class_init (GamesApplicationClass * klass) {
	games_application_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesApplicationPrivate));
	((GApplicationClass *) klass)->open = (void (*) (GApplication *, GFile**, int, const gchar*)) games_application_real_open;
	((GApplicationClass *) klass)->activate = (void (*) (GApplication *)) games_application_real_activate;
	G_OBJECT_CLASS (klass)->constructor = games_application_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_application_finalize;
}


static void games_application_instance_init (GamesApplication * self) {
	self->priv = GAMES_APPLICATION_GET_PRIVATE (self);
}


static void games_application_finalize (GObject * obj) {
	GamesApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_APPLICATION, GamesApplication);
	_g_object_unref0 (self->priv->database);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->game_collection);
	G_OBJECT_CLASS (games_application_parent_class)->finalize (obj);
}


GType games_application_get_type (void) {
	static volatile gsize games_application_type_id__volatile = 0;
	if (g_once_init_enter (&games_application_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesApplication), 0, (GInstanceInitFunc) games_application_instance_init, NULL };
		GType games_application_type_id;
		games_application_type_id = g_type_register_static (gtk_application_get_type (), "GamesApplication", &g_define_type_info, 0);
		g_once_init_leave (&games_application_type_id__volatile, games_application_type_id);
	}
	return games_application_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);
}



