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

/* This file is part of GNOME Games. License: GPLv3*/

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


#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;
typedef struct _GamesApplicationWindowPrivate GamesApplicationWindowPrivate;

#define GAMES_TYPE_UI_STATE (games_ui_state_get_type ())

#define GAMES_TYPE_COLLECTION_BOX (games_collection_box_get_type ())
#define GAMES_COLLECTION_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COLLECTION_BOX, GamesCollectionBox))
#define GAMES_COLLECTION_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_COLLECTION_BOX, GamesCollectionBoxClass))
#define GAMES_IS_COLLECTION_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COLLECTION_BOX))
#define GAMES_IS_COLLECTION_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_COLLECTION_BOX))
#define GAMES_COLLECTION_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_COLLECTION_BOX, GamesCollectionBoxClass))

typedef struct _GamesCollectionBox GamesCollectionBox;
typedef struct _GamesCollectionBoxClass GamesCollectionBoxClass;

#define GAMES_TYPE_DISPLAY_BOX (games_display_box_get_type ())
#define GAMES_DISPLAY_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DISPLAY_BOX, GamesDisplayBox))
#define GAMES_DISPLAY_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DISPLAY_BOX, GamesDisplayBoxClass))
#define GAMES_IS_DISPLAY_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DISPLAY_BOX))
#define GAMES_IS_DISPLAY_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DISPLAY_BOX))
#define GAMES_DISPLAY_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DISPLAY_BOX, GamesDisplayBoxClass))

typedef struct _GamesDisplayBox GamesDisplayBox;
typedef struct _GamesDisplayBoxClass GamesDisplayBoxClass;

#define GAMES_TYPE_COLLECTION_HEADER_BAR (games_collection_header_bar_get_type ())
#define GAMES_COLLECTION_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBar))
#define GAMES_COLLECTION_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBarClass))
#define GAMES_IS_COLLECTION_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COLLECTION_HEADER_BAR))
#define GAMES_IS_COLLECTION_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_COLLECTION_HEADER_BAR))
#define GAMES_COLLECTION_HEADER_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBarClass))

typedef struct _GamesCollectionHeaderBar GamesCollectionHeaderBar;
typedef struct _GamesCollectionHeaderBarClass GamesCollectionHeaderBarClass;

#define GAMES_TYPE_DISPLAY_HEADER_BAR (games_display_header_bar_get_type ())
#define GAMES_DISPLAY_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DISPLAY_HEADER_BAR, GamesDisplayHeaderBar))
#define GAMES_DISPLAY_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DISPLAY_HEADER_BAR, GamesDisplayHeaderBarClass))
#define GAMES_IS_DISPLAY_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DISPLAY_HEADER_BAR))
#define GAMES_IS_DISPLAY_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DISPLAY_HEADER_BAR))
#define GAMES_DISPLAY_HEADER_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DISPLAY_HEADER_BAR, GamesDisplayHeaderBarClass))

typedef struct _GamesDisplayHeaderBar GamesDisplayHeaderBar;
typedef struct _GamesDisplayHeaderBarClass GamesDisplayHeaderBarClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_GAME (games_game_get_type ())
#define GAMES_GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME, GamesGame))
#define GAMES_IS_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME))
#define GAMES_GAME_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_GAME, GamesGameIface))

typedef struct _GamesGame GamesGame;
typedef struct _GamesGameIface GamesGameIface;

#define GAMES_TYPE_ICON (games_icon_get_type ())
#define GAMES_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_ICON, GamesIcon))
#define GAMES_IS_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_ICON))
#define GAMES_ICON_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_ICON, GamesIconIface))

typedef struct _GamesIcon GamesIcon;
typedef struct _GamesIconIface GamesIconIface;

#define GAMES_TYPE_COVER (games_cover_get_type ())
#define GAMES_COVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COVER, GamesCover))
#define GAMES_IS_COVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COVER))
#define GAMES_COVER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_COVER, GamesCoverIface))

typedef struct _GamesCover GamesCover;
typedef struct _GamesCoverIface GamesCoverIface;

#define GAMES_TYPE_RUNNER (games_runner_get_type ())
#define GAMES_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_RUNNER, GamesRunner))
#define GAMES_IS_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_RUNNER))
#define GAMES_RUNNER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_RUNNER, GamesRunnerIface))

typedef struct _GamesRunner GamesRunner;
typedef struct _GamesRunnerIface GamesRunnerIface;

#define GAMES_TYPE_MEDIA_SET (games_media_set_get_type ())
#define GAMES_MEDIA_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MEDIA_SET, GamesMediaSet))
#define GAMES_MEDIA_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MEDIA_SET, GamesMediaSetClass))
#define GAMES_IS_MEDIA_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MEDIA_SET))
#define GAMES_IS_MEDIA_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MEDIA_SET))
#define GAMES_MEDIA_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MEDIA_SET, GamesMediaSetClass))

typedef struct _GamesMediaSet GamesMediaSet;
typedef struct _GamesMediaSetClass GamesMediaSetClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define GAMES_TYPE_RESUME_DIALOG (games_resume_dialog_get_type ())
#define GAMES_RESUME_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_RESUME_DIALOG, GamesResumeDialog))
#define GAMES_RESUME_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_RESUME_DIALOG, GamesResumeDialogClass))
#define GAMES_IS_RESUME_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_RESUME_DIALOG))
#define GAMES_IS_RESUME_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_RESUME_DIALOG))
#define GAMES_RESUME_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_RESUME_DIALOG, GamesResumeDialogClass))

typedef struct _GamesResumeDialog GamesResumeDialog;
typedef struct _GamesResumeDialogClass GamesResumeDialogClass;
typedef struct _Block7Data Block7Data;

#define GAMES_TYPE_RESUME_FAILED_DIALOG (games_resume_failed_dialog_get_type ())
#define GAMES_RESUME_FAILED_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_RESUME_FAILED_DIALOG, GamesResumeFailedDialog))
#define GAMES_RESUME_FAILED_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_RESUME_FAILED_DIALOG, GamesResumeFailedDialogClass))
#define GAMES_IS_RESUME_FAILED_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_RESUME_FAILED_DIALOG))
#define GAMES_IS_RESUME_FAILED_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_RESUME_FAILED_DIALOG))
#define GAMES_RESUME_FAILED_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_RESUME_FAILED_DIALOG, GamesResumeFailedDialogClass))

typedef struct _GamesResumeFailedDialog GamesResumeFailedDialog;
typedef struct _GamesResumeFailedDialogClass GamesResumeFailedDialogClass;
typedef struct _Block8Data Block8Data;

#define GAMES_TYPE_QUIT_DIALOG (games_quit_dialog_get_type ())
#define GAMES_QUIT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_QUIT_DIALOG, GamesQuitDialog))
#define GAMES_QUIT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_QUIT_DIALOG, GamesQuitDialogClass))
#define GAMES_IS_QUIT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_QUIT_DIALOG))
#define GAMES_IS_QUIT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_QUIT_DIALOG))
#define GAMES_QUIT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_QUIT_DIALOG, GamesQuitDialogClass))

typedef struct _GamesQuitDialog GamesQuitDialog;
typedef struct _GamesQuitDialogClass GamesQuitDialogClass;
typedef struct _Block9Data Block9Data;

struct _GamesApplicationWindow {
	GtkApplicationWindow parent_instance;
	GamesApplicationWindowPrivate * priv;
};

struct _GamesApplicationWindowClass {
	GtkApplicationWindowClass parent_class;
};

typedef enum  {
	GAMES_UI_STATE_COLLECTION,
	GAMES_UI_STATE_DISPLAY
} GamesUiState;

struct _GamesApplicationWindowPrivate {
	GamesUiState _ui_state;
	gboolean _is_fullscreen;
	gboolean _search_mode;
	gboolean _loading_notification;
	GtkStack* content_box;
	GamesCollectionBox* collection_box;
	GamesDisplayBox* display_box;
	GtkStack* header_bar;
	GamesCollectionHeaderBar* collection_header_bar;
	GamesDisplayHeaderBar* display_header_bar;
	GSettings* settings;
	GBinding* box_search_binding;
	GBinding* box_fullscreen_binding;
	GBinding* header_bar_search_binding;
	GBinding* header_bar_fullscreen_binding;
	GBinding* loading_notification_binding;
	GCancellable* run_game_cancellable;
	GCancellable* quit_game_cancellable;
	glong window_size_update_timeout;
	glong focus_out_timeout_id;
	guint inhibit_cookie;
	GtkApplicationInhibitFlags inhibit_flags;
};

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 _Block7Data {
	int _ref_count_;
	GamesApplicationWindow* self;
	GamesResumeDialog* dialog;
};

struct _Block8Data {
	int _ref_count_;
	GamesApplicationWindow* self;
	GamesResumeFailedDialog* dialog;
};

struct _Block9Data {
	int _ref_count_;
	GamesApplicationWindow* self;
	GamesQuitDialog* dialog;
};


static gpointer games_application_window_parent_class = NULL;

GType games_application_window_get_type (void) G_GNUC_CONST;
GType games_ui_state_get_type (void) G_GNUC_CONST;
GType games_collection_box_get_type (void) G_GNUC_CONST;
GType games_display_box_get_type (void) G_GNUC_CONST;
GType games_collection_header_bar_get_type (void) G_GNUC_CONST;
GType games_display_header_bar_get_type (void) G_GNUC_CONST;
#define GAMES_APPLICATION_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindowPrivate))
enum  {
	GAMES_APPLICATION_WINDOW_DUMMY_PROPERTY,
	GAMES_APPLICATION_WINDOW_UI_STATE,
	GAMES_APPLICATION_WINDOW_IS_FULLSCREEN,
	GAMES_APPLICATION_WINDOW_SEARCH_MODE,
	GAMES_APPLICATION_WINDOW_LOADING_NOTIFICATION
};
#define GAMES_APPLICATION_WINDOW_WINDOW_SIZE_UPDATE_DELAY_MILLISECONDS ((guint) 500)
#define GAMES_APPLICATION_WINDOW_FOCUS_OUT_DELAY_MILLISECONDS ((guint) 500)
GamesApplicationWindow* games_application_window_new (GListModel* collection);
GamesApplicationWindow* games_application_window_construct (GType object_type, GListModel* collection);
void games_collection_box_set_collection (GamesCollectionBox* self, GListModel* 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;
void games_application_window_run_game (GamesApplicationWindow* self, GamesGame* game);
static void games_application_window_run_game_with_cancellable (GamesApplicationWindow* self, GamesGame* game, GCancellable* cancellable);
static void games_application_window_inhibit (GamesApplicationWindow* self, GtkApplicationInhibitFlags flags);
gboolean games_application_window_quit_game (GamesApplicationWindow* self);
gboolean games_application_window_quit_game_with_cancellable (GamesApplicationWindow* self, GCancellable* cancellable);
static void games_application_window_real_size_allocate (GtkWidget* base, GtkAllocation* allocation);
static gboolean games_application_window_store_window_size (GamesApplicationWindow* self);
static gboolean _games_application_window_store_window_size_gsource_func (gpointer self);
gboolean games_application_window_on_delete_event (GamesApplicationWindow* self);
static gboolean _games_application_window_on_delete_event_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self);
gboolean games_application_window_on_key_pressed (GamesApplicationWindow* self, GdkEventKey* event);
static gboolean games_application_window_handle_collection_key_event (GamesApplicationWindow* self, GdkEventKey* event);
static gboolean games_application_window_handle_display_key_event (GamesApplicationWindow* self, GdkEventKey* event);
static gboolean _games_application_window_on_key_pressed_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
gboolean games_application_window_on_window_state_event (GamesApplicationWindow* self, GdkEventWindowState* event);
void games_application_window_set_is_fullscreen (GamesApplicationWindow* self, gboolean value);
static void games_application_window_update_pause (GamesApplicationWindow* self, gboolean with_delay);
GamesUiState games_application_window_get_ui_state (GamesApplicationWindow* self);
static void games_application_window_uninhibit (GamesApplicationWindow* self, GtkApplicationInhibitFlags flags);
static gboolean _games_application_window_on_window_state_event_gtk_widget_window_state_event (GtkWidget* _sender, GdkEventWindowState* event, gpointer self);
static void games_application_window_on_game_activated (GamesApplicationWindow* self, GamesGame* game);
static void _games_application_window_on_game_activated_games_collection_box_game_activated (GamesCollectionBox* _sender, GamesGame* game, gpointer self);
static void games_application_window_on_display_back (GamesApplicationWindow* self);
void games_application_window_set_ui_state (GamesApplicationWindow* self, GamesUiState value);
static void _games_application_window_on_display_back_games_display_header_bar_back (GamesDisplayHeaderBar* _sender, gpointer self);
const gchar* games_game_get_name (GamesGame* self);
void games_display_header_bar_set_game_title (GamesDisplayHeaderBar* self, const gchar* value);
GamesDisplayHeaderBar* games_display_box_get_header_bar (GamesDisplayBox* self);
static void games_application_window_reset_display_page (GamesApplicationWindow* self);
static GamesRunner* games_application_window_try_get_runner (GamesApplicationWindow* self, GamesGame* game);
gboolean games_runner_get_can_fullscreen (GamesRunner* self);
void games_display_header_bar_set_can_fullscreen (GamesDisplayHeaderBar* self, gboolean value);
void games_display_box_set_runner (GamesDisplayBox* self, GamesRunner* value);
GamesMediaSet* games_runner_get_media_set (GamesRunner* self);
void games_display_header_bar_set_media_set (GamesDisplayHeaderBar* self, GamesMediaSet* value);
gboolean games_runner_get_can_resume (GamesRunner* self);
static gboolean games_application_window_prompt_resume_with_cancellable (GamesApplicationWindow* self, GCancellable* cancellable);
static gboolean games_application_window_try_run_with_cancellable (GamesApplicationWindow* self, GamesRunner* runner, gboolean resume, GCancellable* cancellable);
static void games_application_window_prompt_resume_fail_with_cancellable (GamesApplicationWindow* self, GamesRunner* runner, GCancellable* cancellable);
GamesRunner* games_game_get_runner (GamesGame* self, GError** error);
gboolean games_runner_check_is_valid (GamesRunner* self, gchar* * error_message, GError** error);
void games_display_box_display_running_game_failed (GamesDisplayBox* self, GamesGame* game, const gchar* error_message);
GType games_resume_dialog_get_type (void) G_GNUC_CONST;
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
GamesResumeDialog* games_resume_dialog_new (void);
GamesResumeDialog* games_resume_dialog_construct (GType object_type);
static void __lambda9_ (Block7Data* _data7_);
static void ___lambda9__g_cancellable_cancelled (GCancellable* _sender, gpointer self);
GamesRunner* games_display_box_get_runner (GamesDisplayBox* self);
void games_runner_resume (GamesRunner* self, GError** error);
void games_runner_start (GamesRunner* self, GError** error);
GType games_resume_failed_dialog_get_type (void) G_GNUC_CONST;
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
GamesResumeFailedDialog* games_resume_failed_dialog_new (void);
GamesResumeFailedDialog* games_resume_failed_dialog_construct (GType object_type);
static void __lambda10_ (Block8Data* _data8_);
static void ___lambda10__g_cancellable_cancelled (GCancellable* _sender, gpointer self);
GType games_quit_dialog_get_type (void) G_GNUC_CONST;
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
void games_runner_pause (GamesRunner* self);
gboolean games_runner_get_can_quit_safely (GamesRunner* self);
GamesQuitDialog* games_quit_dialog_new (void);
GamesQuitDialog* games_quit_dialog_construct (GType object_type);
static void __lambda11_ (Block9Data* _data9_);
static void ___lambda11__g_cancellable_cancelled (GCancellable* _sender, gpointer self);
static gboolean games_application_window_cancel_quitting_game (GamesApplicationWindow* self);
static void games_application_window_on_toplevel_focus (GamesApplicationWindow* self);
static void _games_application_window_on_toplevel_focus_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static gboolean games_application_window_can_update_pause (GamesApplicationWindow* self);
static gboolean games_application_window_on_focus_out_delay_elapsed (GamesApplicationWindow* self);
static gboolean _games_application_window_on_focus_out_delay_elapsed_gsource_func (gpointer self);
gboolean games_application_window_get_search_mode (GamesApplicationWindow* self);
void games_application_window_set_search_mode (GamesApplicationWindow* self, gboolean value);
gboolean games_collection_box_search_bar_handle_event (GamesCollectionBox* self, GdkEvent* event);
gboolean games_display_header_bar_get_can_fullscreen (GamesDisplayHeaderBar* self);
gboolean games_application_window_get_is_fullscreen (GamesApplicationWindow* self);
void games_runner_stop (GamesRunner* self);
gboolean games_application_window_get_loading_notification (GamesApplicationWindow* self);
void games_application_window_set_loading_notification (GamesApplicationWindow* self, gboolean value);
static GObject * games_application_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void games_application_window_finalize (GObject * obj);
static void _vala_games_application_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_application_window_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GamesApplicationWindow* games_application_window_construct (GType object_type, GListModel* collection) {
	GamesApplicationWindow * self = NULL;
	GamesCollectionBox* _tmp0_;
	GListModel* _tmp1_;
	g_return_val_if_fail (collection != NULL, NULL);
	self = (GamesApplicationWindow*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->collection_box;
	_tmp1_ = collection;
	games_collection_box_set_collection (_tmp0_, _tmp1_);
	return self;
}


GamesApplicationWindow* games_application_window_new (GListModel* collection) {
	return games_application_window_construct (GAMES_TYPE_APPLICATION_WINDOW, collection);
}


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


void games_application_window_run_game (GamesApplicationWindow* self, GamesGame* game) {
	GCancellable* _tmp0_;
	GCancellable* _tmp2_;
	GCancellable* cancellable;
	GCancellable* _tmp3_;
	GCancellable* _tmp4_;
	GCancellable* _tmp5_;
	GamesGame* _tmp6_;
	GCancellable* _tmp7_;
	GCancellable* _tmp8_;
	GCancellable* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (game != NULL);
	_tmp0_ = self->priv->run_game_cancellable;
	if (_tmp0_ != NULL) {
		GCancellable* _tmp1_;
		_tmp1_ = self->priv->run_game_cancellable;
		g_cancellable_cancel (_tmp1_);
	}
	_tmp2_ = g_cancellable_new ();
	_g_object_unref0 (self->priv->run_game_cancellable);
	self->priv->run_game_cancellable = _tmp2_;
	_tmp3_ = g_cancellable_new ();
	cancellable = _tmp3_;
	_tmp4_ = cancellable;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->priv->run_game_cancellable);
	self->priv->run_game_cancellable = _tmp5_;
	_tmp6_ = game;
	_tmp7_ = cancellable;
	games_application_window_run_game_with_cancellable (self, _tmp6_, _tmp7_);
	_tmp8_ = self->priv->run_game_cancellable;
	_tmp9_ = cancellable;
	if (_tmp8_ == _tmp9_) {
		_g_object_unref0 (self->priv->run_game_cancellable);
		self->priv->run_game_cancellable = NULL;
	}
	games_application_window_inhibit (self, GTK_APPLICATION_INHIBIT_IDLE | GTK_APPLICATION_INHIBIT_LOGOUT);
	_g_object_unref0 (cancellable);
}


gboolean games_application_window_quit_game (GamesApplicationWindow* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp4_;
	GCancellable* cancellable;
	GCancellable* _tmp6_;
	GCancellable* _tmp7_;
	GCancellable* _tmp8_;
	gboolean _result_;
	GCancellable* _tmp9_;
	gboolean _tmp10_;
	GCancellable* _tmp11_;
	GCancellable* _tmp12_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_widget_get_visible ((GtkWidget*) self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = TRUE;
		return result;
	}
	_tmp2_ = self->priv->run_game_cancellable;
	if (_tmp2_ != NULL) {
		GCancellable* _tmp3_;
		_tmp3_ = self->priv->run_game_cancellable;
		g_cancellable_cancel (_tmp3_);
	}
	_tmp4_ = self->priv->quit_game_cancellable;
	if (_tmp4_ != NULL) {
		GCancellable* _tmp5_;
		_tmp5_ = self->priv->quit_game_cancellable;
		g_cancellable_cancel (_tmp5_);
	}
	_tmp6_ = g_cancellable_new ();
	cancellable = _tmp6_;
	_tmp7_ = cancellable;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_g_object_unref0 (self->priv->quit_game_cancellable);
	self->priv->quit_game_cancellable = _tmp8_;
	_tmp9_ = cancellable;
	_tmp10_ = games_application_window_quit_game_with_cancellable (self, _tmp9_);
	_result_ = _tmp10_;
	_tmp11_ = self->priv->quit_game_cancellable;
	_tmp12_ = cancellable;
	if (_tmp11_ == _tmp12_) {
		_g_object_unref0 (self->priv->quit_game_cancellable);
		self->priv->quit_game_cancellable = NULL;
	}
	result = _result_;
	_g_object_unref0 (cancellable);
	return result;
}


static gboolean _games_application_window_store_window_size_gsource_func (gpointer self) {
	gboolean result;
	result = games_application_window_store_window_size ((GamesApplicationWindow*) self);
	return result;
}


static void games_application_window_real_size_allocate (GtkWidget* base, GtkAllocation* allocation) {
	GamesApplicationWindow * self;
	GtkAllocation _tmp0_;
	gboolean _tmp1_ = FALSE;
	glong _tmp2_;
	self = (GamesApplicationWindow*) base;
	g_return_if_fail (allocation != NULL);
	_tmp0_ = *allocation;
	GTK_WIDGET_CLASS (games_application_window_parent_class)->size_allocate ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_application_window_get_type (), GtkApplicationWindow), &_tmp0_);
	_tmp2_ = self->priv->window_size_update_timeout;
	if (_tmp2_ == ((glong) -1)) {
		gboolean _tmp3_;
		gboolean _tmp4_;
		g_object_get ((GtkWindow*) self, "is-maximized", &_tmp3_, NULL);
		_tmp4_ = _tmp3_;
		_tmp1_ = !_tmp4_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		guint _tmp5_;
		_tmp5_ = g_timeout_add_full (G_PRIORITY_DEFAULT, GAMES_APPLICATION_WINDOW_WINDOW_SIZE_UPDATE_DELAY_MILLISECONDS, _games_application_window_store_window_size_gsource_func, g_object_ref (self), g_object_unref);
		self->priv->window_size_update_timeout = (glong) _tmp5_;
	}
}


gboolean games_application_window_on_delete_event (GamesApplicationWindow* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = games_application_window_quit_game (self);
	result = !_tmp0_;
	return result;
}


static gboolean _games_application_window_on_delete_event_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self) {
	gboolean result;
	result = games_application_window_on_delete_event ((GamesApplicationWindow*) self);
	return result;
}


gboolean games_application_window_on_key_pressed (GamesApplicationWindow* self, GdkEventKey* event) {
	gboolean result = FALSE;
	GdkModifierType default_modifiers;
	GdkModifierType _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GdkEventKey* _tmp3_;
	guint _tmp4_;
	gboolean _tmp11_ = FALSE;
	GdkEventKey* _tmp12_;
	gboolean _tmp13_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = gtk_accelerator_get_default_mod_mask ();
	default_modifiers = _tmp0_;
	_tmp3_ = event;
	_tmp4_ = _tmp3_->keyval;
	if (_tmp4_ == ((guint) GDK_KEY_q)) {
		_tmp2_ = TRUE;
	} else {
		GdkEventKey* _tmp5_;
		guint _tmp6_;
		_tmp5_ = event;
		_tmp6_ = _tmp5_->keyval;
		_tmp2_ = _tmp6_ == ((guint) GDK_KEY_Q);
	}
	if (_tmp2_) {
		GdkEventKey* _tmp7_;
		GdkModifierType _tmp8_;
		GdkModifierType _tmp9_;
		_tmp7_ = event;
		_tmp8_ = _tmp7_->state;
		_tmp9_ = default_modifiers;
		_tmp1_ = (_tmp8_ & _tmp9_) == GDK_CONTROL_MASK;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gboolean _tmp10_;
		_tmp10_ = games_application_window_quit_game (self);
		if (!_tmp10_) {
			result = FALSE;
			return result;
		}
		gtk_widget_destroy ((GtkWidget*) self);
		result = TRUE;
		return result;
	}
	_tmp12_ = event;
	_tmp13_ = games_application_window_handle_collection_key_event (self, _tmp12_);
	if (_tmp13_) {
		_tmp11_ = TRUE;
	} else {
		GdkEventKey* _tmp14_;
		gboolean _tmp15_;
		_tmp14_ = event;
		_tmp15_ = games_application_window_handle_display_key_event (self, _tmp14_);
		_tmp11_ = _tmp15_;
	}
	result = _tmp11_;
	return result;
}


static gboolean _games_application_window_on_key_pressed_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = games_application_window_on_key_pressed ((GamesApplicationWindow*) self, event);
	return result;
}


gboolean games_application_window_on_window_state_event (GamesApplicationWindow* self, GdkEventWindowState* event) {
	gboolean result = FALSE;
	gboolean is_maximized;
	GdkEventWindowState* _tmp0_;
	GdkWindowState _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	GdkEventWindowState* _tmp4_;
	GdkWindowState _tmp5_;
	GdkEventWindowState* _tmp6_;
	GdkWindowState _tmp7_;
	gboolean focused;
	GdkEventWindowState* _tmp8_;
	GdkWindowState _tmp9_;
	gboolean playing;
	GamesUiState _tmp10_;
	GamesUiState _tmp11_;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_;
	gboolean _tmp15_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = event;
	_tmp1_ = _tmp0_->new_window_state;
	is_maximized = (gboolean) (_tmp1_ & GDK_WINDOW_STATE_MAXIMIZED);
	_tmp2_ = self->priv->settings;
	_tmp3_ = is_maximized;
	g_settings_set_boolean (_tmp2_, "window-maximized", _tmp3_);
	_tmp4_ = event;
	_tmp5_ = _tmp4_->new_window_state;
	games_application_window_set_is_fullscreen (self, (gboolean) (_tmp5_ & GDK_WINDOW_STATE_FULLSCREEN));
	games_application_window_update_pause (self, FALSE);
	_tmp6_ = event;
	_tmp7_ = _tmp6_->changed_mask;
	if (!((gboolean) (_tmp7_ & GDK_WINDOW_STATE_FOCUSED))) {
		result = FALSE;
		return result;
	}
	_tmp8_ = event;
	_tmp9_ = _tmp8_->new_window_state;
	focused = (gboolean) (_tmp9_ & GDK_WINDOW_STATE_FOCUSED);
	_tmp10_ = games_application_window_get_ui_state (self);
	_tmp11_ = _tmp10_;
	playing = _tmp11_ == GAMES_UI_STATE_DISPLAY;
	_tmp13_ = focused;
	if (_tmp13_) {
		gboolean _tmp14_;
		_tmp14_ = playing;
		_tmp12_ = _tmp14_;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		games_application_window_inhibit (self, GTK_APPLICATION_INHIBIT_IDLE);
	}
	_tmp15_ = focused;
	if (!_tmp15_) {
		games_application_window_uninhibit (self, GTK_APPLICATION_INHIBIT_IDLE);
	}
	result = FALSE;
	return result;
}


static gboolean _games_application_window_on_window_state_event_gtk_widget_window_state_event (GtkWidget* _sender, GdkEventWindowState* event, gpointer self) {
	gboolean result;
	result = games_application_window_on_window_state_event ((GamesApplicationWindow*) self, event);
	return result;
}


static void games_application_window_on_game_activated (GamesApplicationWindow* self, GamesGame* game) {
	GamesGame* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (game != NULL);
	_tmp0_ = game;
	games_application_window_run_game (self, _tmp0_);
}


static void _games_application_window_on_game_activated_games_collection_box_game_activated (GamesCollectionBox* _sender, GamesGame* game, gpointer self) {
	games_application_window_on_game_activated ((GamesApplicationWindow*) self, game);
}


static void games_application_window_on_display_back (GamesApplicationWindow* self) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = games_application_window_quit_game (self);
	if (_tmp0_) {
		games_application_window_set_ui_state (self, GAMES_UI_STATE_COLLECTION);
	}
	games_application_window_uninhibit (self, GTK_APPLICATION_INHIBIT_IDLE | GTK_APPLICATION_INHIBIT_LOGOUT);
}


static void _games_application_window_on_display_back_games_display_header_bar_back (GamesDisplayHeaderBar* _sender, gpointer self) {
	games_application_window_on_display_back ((GamesApplicationWindow*) self);
}


static void games_application_window_run_game_with_cancellable (GamesApplicationWindow* self, GamesGame* game, GCancellable* cancellable) {
	GamesDisplayHeaderBar* _tmp0_;
	GamesGame* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GamesDisplayBox* _tmp4_;
	GamesDisplayHeaderBar* _tmp5_;
	GamesDisplayHeaderBar* _tmp6_;
	GamesGame* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	GamesRunner* runner;
	GamesGame* _tmp10_;
	GamesRunner* _tmp11_;
	GamesRunner* _tmp12_;
	GamesDisplayHeaderBar* _tmp13_;
	GamesRunner* _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	GamesDisplayBox* _tmp17_;
	GamesDisplayHeaderBar* _tmp18_;
	GamesDisplayHeaderBar* _tmp19_;
	GamesRunner* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	GamesDisplayBox* _tmp23_;
	GamesRunner* _tmp24_;
	GamesDisplayHeaderBar* _tmp25_;
	GamesRunner* _tmp26_;
	GamesMediaSet* _tmp27_;
	GamesMediaSet* _tmp28_;
	GamesDisplayBox* _tmp29_;
	GamesDisplayHeaderBar* _tmp30_;
	GamesDisplayHeaderBar* _tmp31_;
	GamesRunner* _tmp32_;
	GamesMediaSet* _tmp33_;
	GamesMediaSet* _tmp34_;
	gboolean _tmp35_ = FALSE;
	GSettings* _tmp36_;
	gboolean _tmp37_;
	gboolean resume;
	GamesRunner* _tmp41_;
	gboolean _tmp42_;
	gboolean _tmp43_;
	GamesRunner* _tmp46_;
	gboolean _tmp47_;
	GCancellable* _tmp48_;
	gboolean _tmp49_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (game != NULL);
	g_return_if_fail (cancellable != NULL);
	_tmp0_ = self->priv->display_header_bar;
	_tmp1_ = game;
	_tmp2_ = games_game_get_name (_tmp1_);
	_tmp3_ = _tmp2_;
	games_display_header_bar_set_game_title (_tmp0_, _tmp3_);
	_tmp4_ = self->priv->display_box;
	_tmp5_ = games_display_box_get_header_bar (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = game;
	_tmp8_ = games_game_get_name (_tmp7_);
	_tmp9_ = _tmp8_;
	games_display_header_bar_set_game_title (_tmp6_, _tmp9_);
	games_application_window_set_ui_state (self, GAMES_UI_STATE_DISPLAY);
	games_application_window_reset_display_page (self);
	_tmp10_ = game;
	_tmp11_ = games_application_window_try_get_runner (self, _tmp10_);
	runner = _tmp11_;
	_tmp12_ = runner;
	if (_tmp12_ == NULL) {
		_g_object_unref0 (runner);
		return;
	}
	_tmp13_ = self->priv->display_header_bar;
	_tmp14_ = runner;
	_tmp15_ = games_runner_get_can_fullscreen (_tmp14_);
	_tmp16_ = _tmp15_;
	games_display_header_bar_set_can_fullscreen (_tmp13_, _tmp16_);
	_tmp17_ = self->priv->display_box;
	_tmp18_ = games_display_box_get_header_bar (_tmp17_);
	_tmp19_ = _tmp18_;
	_tmp20_ = runner;
	_tmp21_ = games_runner_get_can_fullscreen (_tmp20_);
	_tmp22_ = _tmp21_;
	games_display_header_bar_set_can_fullscreen (_tmp19_, _tmp22_);
	_tmp23_ = self->priv->display_box;
	_tmp24_ = runner;
	games_display_box_set_runner (_tmp23_, _tmp24_);
	_tmp25_ = self->priv->display_header_bar;
	_tmp26_ = runner;
	_tmp27_ = games_runner_get_media_set (_tmp26_);
	_tmp28_ = _tmp27_;
	games_display_header_bar_set_media_set (_tmp25_, _tmp28_);
	_tmp29_ = self->priv->display_box;
	_tmp30_ = games_display_box_get_header_bar (_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = runner;
	_tmp33_ = games_runner_get_media_set (_tmp32_);
	_tmp34_ = _tmp33_;
	games_display_header_bar_set_media_set (_tmp31_, _tmp34_);
	_tmp36_ = self->priv->settings;
	_tmp37_ = g_settings_get_boolean (_tmp36_, "fullscreen");
	if (_tmp37_) {
		GamesRunner* _tmp38_;
		gboolean _tmp39_;
		gboolean _tmp40_;
		_tmp38_ = runner;
		_tmp39_ = games_runner_get_can_fullscreen (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp35_ = _tmp40_;
	} else {
		_tmp35_ = FALSE;
	}
	games_application_window_set_is_fullscreen (self, _tmp35_);
	resume = FALSE;
	_tmp41_ = runner;
	_tmp42_ = games_runner_get_can_resume (_tmp41_);
	_tmp43_ = _tmp42_;
	if (_tmp43_) {
		GCancellable* _tmp44_;
		gboolean _tmp45_;
		_tmp44_ = cancellable;
		_tmp45_ = games_application_window_prompt_resume_with_cancellable (self, _tmp44_);
		resume = _tmp45_;
	}
	_tmp46_ = runner;
	_tmp47_ = resume;
	_tmp48_ = cancellable;
	_tmp49_ = games_application_window_try_run_with_cancellable (self, _tmp46_, _tmp47_, _tmp48_);
	if (!_tmp49_) {
		GamesRunner* _tmp50_;
		GCancellable* _tmp51_;
		_tmp50_ = runner;
		_tmp51_ = cancellable;
		games_application_window_prompt_resume_fail_with_cancellable (self, _tmp50_, _tmp51_);
	}
	_g_object_unref0 (runner);
}


static GamesRunner* games_application_window_try_get_runner (GamesApplicationWindow* self, GamesGame* game) {
	GamesRunner* result = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (game != NULL, NULL);
	{
		GamesRunner* runner;
		GamesGame* _tmp0_;
		GamesRunner* _tmp1_;
		gchar* error_message = NULL;
		gboolean _tmp2_;
		GamesRunner* _tmp3_;
		gchar* _tmp4_ = NULL;
		gboolean _tmp5_;
		GamesDisplayBox* _tmp6_;
		GamesGame* _tmp7_;
		const gchar* _tmp8_;
		_tmp0_ = game;
		_tmp1_ = games_game_get_runner (_tmp0_, &_inner_error_);
		runner = _tmp1_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch29_g_error;
		}
		_tmp3_ = runner;
		_tmp5_ = games_runner_check_is_valid (_tmp3_, &_tmp4_, &_inner_error_);
		_g_free0 (error_message);
		error_message = _tmp4_;
		_tmp2_ = _tmp5_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (error_message);
			_g_object_unref0 (runner);
			goto __catch29_g_error;
		}
		if (_tmp2_) {
			result = runner;
			_g_free0 (error_message);
			return result;
		}
		games_application_window_reset_display_page (self);
		_tmp6_ = self->priv->display_box;
		_tmp7_ = game;
		_tmp8_ = error_message;
		games_display_box_display_running_game_failed (_tmp6_, _tmp7_, _tmp8_);
		result = NULL;
		_g_free0 (error_message);
		_g_object_unref0 (runner);
		return result;
	}
	goto __finally29;
	__catch29_g_error:
	{
		GError* e = NULL;
		GError* _tmp9_;
		const gchar* _tmp10_;
		GamesDisplayBox* _tmp11_;
		GamesGame* _tmp12_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp9_ = e;
		_tmp10_ = _tmp9_->message;
		g_warning ("application-window.vala:281: %s", _tmp10_);
		games_application_window_reset_display_page (self);
		_tmp11_ = self->priv->display_box;
		_tmp12_ = game;
		games_display_box_display_running_game_failed (_tmp11_, _tmp12_, _ ("An unexpected error occurred."));
		result = NULL;
		_g_error_free0 (e);
		return result;
	}
	__finally29:
	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;
}


static Block7Data* block7_data_ref (Block7Data* _data7_) {
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}


static void block7_data_unref (void * _userdata_) {
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		GamesApplicationWindow* self;
		self = _data7_->self;
		_g_object_unref0 (_data7_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}


static void __lambda9_ (Block7Data* _data7_) {
	GamesApplicationWindow* self;
	GamesResumeDialog* _tmp0_;
	self = _data7_->self;
	_tmp0_ = _data7_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}


static void ___lambda9__g_cancellable_cancelled (GCancellable* _sender, gpointer self) {
	__lambda9_ (self);
}


static gboolean games_application_window_prompt_resume_with_cancellable (GamesApplicationWindow* self, GCancellable* cancellable) {
	gboolean result = FALSE;
	Block7Data* _data7_;
	GamesResumeDialog* _tmp0_;
	GamesResumeDialog* _tmp1_;
	GCancellable* _tmp2_;
	gint response;
	GamesResumeDialog* _tmp3_;
	gint _tmp4_;
	GamesResumeDialog* _tmp5_;
	GCancellable* _tmp6_;
	gboolean _tmp7_;
	gint _tmp8_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (cancellable != NULL, FALSE);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_tmp0_ = games_resume_dialog_new ();
	g_object_ref_sink (_tmp0_);
	_data7_->dialog = _tmp0_;
	_tmp1_ = _data7_->dialog;
	gtk_window_set_transient_for ((GtkWindow*) _tmp1_, (GtkWindow*) self);
	_tmp2_ = cancellable;
	g_signal_connect_data (_tmp2_, "cancelled", (GCallback) ___lambda9__g_cancellable_cancelled, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_tmp3_ = _data7_->dialog;
	_tmp4_ = gtk_dialog_run ((GtkDialog*) _tmp3_);
	response = _tmp4_;
	_tmp5_ = _data7_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp5_);
	_tmp6_ = cancellable;
	_tmp7_ = g_cancellable_is_cancelled (_tmp6_);
	if (_tmp7_) {
		response = (gint) GTK_RESPONSE_CANCEL;
	}
	_tmp8_ = response;
	if (_tmp8_ == ((gint) GTK_RESPONSE_CANCEL)) {
		result = FALSE;
		block7_data_unref (_data7_);
		_data7_ = NULL;
		return result;
	}
	result = TRUE;
	block7_data_unref (_data7_);
	_data7_ = NULL;
	return result;
}


static gboolean games_application_window_try_run_with_cancellable (GamesApplicationWindow* self, GamesRunner* runner, gboolean resume, GCancellable* cancellable) {
	gboolean result = FALSE;
	gboolean _tmp7_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (runner != NULL, FALSE);
	g_return_val_if_fail (cancellable != NULL, FALSE);
	{
		gboolean _tmp0_;
		_tmp0_ = resume;
		if (_tmp0_) {
			GamesDisplayBox* _tmp1_;
			GamesRunner* _tmp2_;
			GamesRunner* _tmp3_;
			_tmp1_ = self->priv->display_box;
			_tmp2_ = games_display_box_get_runner (_tmp1_);
			_tmp3_ = _tmp2_;
			games_runner_resume (_tmp3_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch30_g_error;
			}
		} else {
			GamesRunner* _tmp4_;
			_tmp4_ = runner;
			games_runner_start (_tmp4_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch30_g_error;
			}
		}
		result = TRUE;
		return result;
	}
	goto __finally30;
	__catch30_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		g_warning ("application-window.vala:319: %s", _tmp6_);
		result = FALSE;
		_g_error_free0 (e);
		return result;
	}
	__finally30:
	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 _tmp7_;
}


static Block8Data* block8_data_ref (Block8Data* _data8_) {
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}


static void block8_data_unref (void * _userdata_) {
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		GamesApplicationWindow* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}


static void __lambda10_ (Block8Data* _data8_) {
	GamesApplicationWindow* self;
	GamesResumeFailedDialog* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}


static void ___lambda10__g_cancellable_cancelled (GCancellable* _sender, gpointer self) {
	__lambda10_ (self);
}


static void games_application_window_prompt_resume_fail_with_cancellable (GamesApplicationWindow* self, GamesRunner* runner, GCancellable* cancellable) {
	Block8Data* _data8_;
	GamesResumeFailedDialog* _tmp0_;
	GamesResumeFailedDialog* _tmp1_;
	GCancellable* _tmp2_;
	gint response;
	GamesResumeFailedDialog* _tmp3_;
	gint _tmp4_;
	GamesResumeFailedDialog* _tmp5_;
	GCancellable* _tmp6_;
	gboolean _tmp7_;
	gint _tmp8_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (runner != NULL);
	g_return_if_fail (cancellable != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_tmp0_ = games_resume_failed_dialog_new ();
	g_object_ref_sink (_tmp0_);
	_data8_->dialog = _tmp0_;
	_tmp1_ = _data8_->dialog;
	gtk_window_set_transient_for ((GtkWindow*) _tmp1_, (GtkWindow*) self);
	_tmp2_ = cancellable;
	g_signal_connect_data (_tmp2_, "cancelled", (GCallback) ___lambda10__g_cancellable_cancelled, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp3_ = _data8_->dialog;
	_tmp4_ = gtk_dialog_run ((GtkDialog*) _tmp3_);
	response = _tmp4_;
	_tmp5_ = _data8_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp5_);
	_tmp6_ = cancellable;
	_tmp7_ = g_cancellable_is_cancelled (_tmp6_);
	if (_tmp7_) {
		response = (gint) GTK_RESPONSE_CANCEL;
	}
	_tmp8_ = response;
	if (_tmp8_ == ((gint) GTK_RESPONSE_CANCEL)) {
		GamesDisplayBox* _tmp9_;
		_tmp9_ = self->priv->display_box;
		games_display_box_set_runner (_tmp9_, NULL);
		games_application_window_set_ui_state (self, GAMES_UI_STATE_COLLECTION);
		block8_data_unref (_data8_);
		_data8_ = NULL;
		return;
	}
	{
		GamesRunner* _tmp10_;
		_tmp10_ = runner;
		games_runner_start (_tmp10_, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch31_g_error;
		}
	}
	goto __finally31;
	__catch31_g_error:
	{
		GError* e = NULL;
		GError* _tmp11_;
		const gchar* _tmp12_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp11_ = e;
		_tmp12_ = _tmp11_->message;
		g_warning ("application-window.vala:350: %s", _tmp12_);
		_g_error_free0 (e);
	}
	__finally31:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		block8_data_unref (_data8_);
		_data8_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	block8_data_unref (_data8_);
	_data8_ = NULL;
}


static Block9Data* block9_data_ref (Block9Data* _data9_) {
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}


static void block9_data_unref (void * _userdata_) {
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		GamesApplicationWindow* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}


static void __lambda11_ (Block9Data* _data9_) {
	GamesApplicationWindow* self;
	GamesQuitDialog* _tmp0_;
	self = _data9_->self;
	_tmp0_ = _data9_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}


static void ___lambda11__g_cancellable_cancelled (GCancellable* _sender, gpointer self) {
	__lambda11_ (self);
}


gboolean games_application_window_quit_game_with_cancellable (GamesApplicationWindow* self, GCancellable* cancellable) {
	gboolean result = FALSE;
	Block9Data* _data9_;
	GamesDisplayBox* _tmp0_;
	GamesRunner* _tmp1_;
	GamesRunner* _tmp2_;
	GamesDisplayBox* _tmp3_;
	GamesRunner* _tmp4_;
	GamesRunner* _tmp5_;
	GamesDisplayBox* _tmp6_;
	GamesRunner* _tmp7_;
	GamesRunner* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	GamesQuitDialog* _tmp11_;
	GamesQuitDialog* _tmp12_;
	GCancellable* _tmp13_;
	gint response;
	GamesQuitDialog* _tmp14_;
	gint _tmp15_;
	GamesQuitDialog* _tmp16_;
	GCancellable* _tmp17_;
	gboolean _tmp18_;
	gint _tmp20_;
	gboolean _tmp21_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (cancellable != NULL, FALSE);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_tmp0_ = self->priv->display_box;
	_tmp1_ = games_display_box_get_runner (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		result = TRUE;
		block9_data_unref (_data9_);
		_data9_ = NULL;
		return result;
	}
	_tmp3_ = self->priv->display_box;
	_tmp4_ = games_display_box_get_runner (_tmp3_);
	_tmp5_ = _tmp4_;
	games_runner_pause (_tmp5_);
	_tmp6_ = self->priv->display_box;
	_tmp7_ = games_display_box_get_runner (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = games_runner_get_can_quit_safely (_tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_) {
		result = TRUE;
		block9_data_unref (_data9_);
		_data9_ = NULL;
		return result;
	}
	_tmp11_ = games_quit_dialog_new ();
	g_object_ref_sink (_tmp11_);
	_data9_->dialog = _tmp11_;
	_tmp12_ = _data9_->dialog;
	gtk_window_set_transient_for ((GtkWindow*) _tmp12_, (GtkWindow*) self);
	_tmp13_ = cancellable;
	g_signal_connect_data (_tmp13_, "cancelled", (GCallback) ___lambda11__g_cancellable_cancelled, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
	_tmp14_ = _data9_->dialog;
	_tmp15_ = gtk_dialog_run ((GtkDialog*) _tmp14_);
	response = _tmp15_;
	_tmp16_ = _data9_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp16_);
	_tmp17_ = cancellable;
	_tmp18_ = g_cancellable_is_cancelled (_tmp17_);
	if (_tmp18_) {
		gboolean _tmp19_;
		_tmp19_ = games_application_window_cancel_quitting_game (self);
		result = _tmp19_;
		block9_data_unref (_data9_);
		_data9_ = NULL;
		return result;
	}
	_tmp20_ = response;
	if (_tmp20_ == ((gint) GTK_RESPONSE_ACCEPT)) {
		result = TRUE;
		block9_data_unref (_data9_);
		_data9_ = NULL;
		return result;
	}
	_tmp21_ = games_application_window_cancel_quitting_game (self);
	result = _tmp21_;
	block9_data_unref (_data9_);
	_data9_ = NULL;
	return result;
}


static gboolean games_application_window_cancel_quitting_game (GamesApplicationWindow* self) {
	gboolean result = FALSE;
	GamesDisplayBox* _tmp0_;
	GamesRunner* _tmp1_;
	GamesRunner* _tmp2_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->display_box;
	_tmp1_ = games_display_box_get_runner (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		{
			GamesDisplayBox* _tmp3_;
			GamesRunner* _tmp4_;
			GamesRunner* _tmp5_;
			_tmp3_ = self->priv->display_box;
			_tmp4_ = games_display_box_get_runner (_tmp3_);
			_tmp5_ = _tmp4_;
			games_runner_resume (_tmp5_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch32_g_error;
			}
		}
		goto __finally32;
		__catch32_g_error:
		{
			GError* e = NULL;
			GError* _tmp6_;
			const gchar* _tmp7_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp6_ = e;
			_tmp7_ = _tmp6_->message;
			g_warning ("application-window.vala:388: %s", _tmp7_);
			_g_error_free0 (e);
		}
		__finally32:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			gboolean _tmp8_ = FALSE;
			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 _tmp8_;
		}
	}
	result = FALSE;
	return result;
}


static void games_application_window_on_toplevel_focus (GamesApplicationWindow* self) {
	g_return_if_fail (self != NULL);
	games_application_window_update_pause (self, TRUE);
}


static void _games_application_window_on_toplevel_focus_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	games_application_window_on_toplevel_focus ((GamesApplicationWindow*) self);
}


static gboolean games_application_window_store_window_size (GamesApplicationWindow* self) {
	gboolean result = FALSE;
	GdkScreen* screen;
	GdkScreen* _tmp0_;
	GdkScreen* _tmp1_;
	GdkScreen* _tmp2_;
	gint width;
	gint height;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	gint _tmp5_;
	GdkScreen* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	GdkScreen* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	GSettings* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	glong _tmp16_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = gtk_window_get_screen ((GtkWindow*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	screen = _tmp1_;
	_tmp2_ = screen;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_object_unref0 (screen);
		return result;
	}
	width = 0;
	height = 0;
	gtk_window_get_size ((GtkWindow*) self, &_tmp3_, &_tmp4_);
	width = _tmp3_;
	height = _tmp4_;
	_tmp5_ = width;
	_tmp6_ = screen;
	_tmp7_ = gdk_screen_get_width (_tmp6_);
	_tmp8_ = MIN (_tmp5_, _tmp7_);
	width = _tmp8_;
	_tmp9_ = height;
	_tmp10_ = screen;
	_tmp11_ = gdk_screen_get_height (_tmp10_);
	_tmp12_ = MIN (_tmp9_, _tmp11_);
	height = _tmp12_;
	_tmp13_ = self->priv->settings;
	_tmp14_ = width;
	_tmp15_ = height;
	g_settings_set (_tmp13_, "window-size", "(ii)", _tmp14_, _tmp15_);
	_tmp16_ = self->priv->window_size_update_timeout;
	g_source_remove ((guint) _tmp16_);
	self->priv->window_size_update_timeout = (glong) -1;
	result = FALSE;
	_g_object_unref0 (screen);
	return result;
}


static gboolean _games_application_window_on_focus_out_delay_elapsed_gsource_func (gpointer self) {
	gboolean result;
	result = games_application_window_on_focus_out_delay_elapsed ((GamesApplicationWindow*) self);
	return result;
}


static void games_application_window_update_pause (GamesApplicationWindow* self, gboolean with_delay) {
	glong _tmp0_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->focus_out_timeout_id;
	if (_tmp0_ != ((glong) -1)) {
		glong _tmp1_;
		_tmp1_ = self->priv->focus_out_timeout_id;
		g_source_remove ((guint) _tmp1_);
		self->priv->focus_out_timeout_id = (glong) -1;
	}
	_tmp2_ = games_application_window_can_update_pause (self);
	if (!_tmp2_) {
		return;
	}
	g_object_get ((GtkWindow*) self, "has-toplevel-focus", &_tmp3_, NULL);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		{
			GamesDisplayBox* _tmp5_;
			GamesRunner* _tmp6_;
			GamesRunner* _tmp7_;
			_tmp5_ = self->priv->display_box;
			_tmp6_ = games_display_box_get_runner (_tmp5_);
			_tmp7_ = _tmp6_;
			games_runner_resume (_tmp7_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch33_g_error;
			}
		}
		goto __finally33;
		__catch33_g_error:
		{
			GError* e = NULL;
			GError* _tmp8_;
			const gchar* _tmp9_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp8_ = e;
			_tmp9_ = _tmp8_->message;
			g_warning ("application-window.vala:434: %s", _tmp9_);
			_g_error_free0 (e);
		}
		__finally33:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	} else {
		gboolean _tmp10_;
		_tmp10_ = with_delay;
		if (_tmp10_) {
			guint _tmp11_;
			_tmp11_ = g_timeout_add_full (G_PRIORITY_DEFAULT, GAMES_APPLICATION_WINDOW_FOCUS_OUT_DELAY_MILLISECONDS, _games_application_window_on_focus_out_delay_elapsed_gsource_func, g_object_ref (self), g_object_unref);
			self->priv->focus_out_timeout_id = (glong) _tmp11_;
		} else {
			GamesDisplayBox* _tmp12_;
			GamesRunner* _tmp13_;
			GamesRunner* _tmp14_;
			_tmp12_ = self->priv->display_box;
			_tmp13_ = games_display_box_get_runner (_tmp12_);
			_tmp14_ = _tmp13_;
			games_runner_pause (_tmp14_);
		}
	}
}


static gboolean games_application_window_on_focus_out_delay_elapsed (GamesApplicationWindow* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->focus_out_timeout_id = (glong) -1;
	_tmp0_ = games_application_window_can_update_pause (self);
	if (!_tmp0_) {
		result = FALSE;
		return result;
	}
	g_object_get ((GtkWindow*) self, "has-toplevel-focus", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		GamesDisplayBox* _tmp3_;
		GamesRunner* _tmp4_;
		GamesRunner* _tmp5_;
		_tmp3_ = self->priv->display_box;
		_tmp4_ = games_display_box_get_runner (_tmp3_);
		_tmp5_ = _tmp4_;
		games_runner_pause (_tmp5_);
	}
	result = FALSE;
	return result;
}


static gboolean games_application_window_can_update_pause (GamesApplicationWindow* self) {
	gboolean result = FALSE;
	GamesUiState _tmp0_;
	GamesUiState _tmp1_;
	GamesDisplayBox* _tmp2_;
	GamesRunner* _tmp3_;
	GamesRunner* _tmp4_;
	GCancellable* _tmp5_;
	GCancellable* _tmp6_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = games_application_window_get_ui_state (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != GAMES_UI_STATE_DISPLAY) {
		result = FALSE;
		return result;
	}
	_tmp2_ = self->priv->display_box;
	_tmp3_ = games_display_box_get_runner (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp5_ = self->priv->run_game_cancellable;
	if (_tmp5_ != NULL) {
		result = FALSE;
		return result;
	}
	_tmp6_ = self->priv->quit_game_cancellable;
	if (_tmp6_ != NULL) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}


static gboolean games_application_window_handle_collection_key_event (GamesApplicationWindow* self, GdkEventKey* event) {
	gboolean result = FALSE;
	GamesUiState _tmp0_;
	GamesUiState _tmp1_;
	GdkModifierType default_modifiers;
	GdkModifierType _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	GdkEventKey* _tmp5_;
	guint _tmp6_;
	GamesCollectionBox* _tmp14_;
	GdkEventKey* _tmp15_;
	gboolean _tmp16_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = games_application_window_get_ui_state (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != GAMES_UI_STATE_COLLECTION) {
		result = FALSE;
		return result;
	}
	_tmp2_ = gtk_accelerator_get_default_mod_mask ();
	default_modifiers = _tmp2_;
	_tmp5_ = event;
	_tmp6_ = _tmp5_->keyval;
	if (_tmp6_ == ((guint) GDK_KEY_f)) {
		_tmp4_ = TRUE;
	} else {
		GdkEventKey* _tmp7_;
		guint _tmp8_;
		_tmp7_ = event;
		_tmp8_ = _tmp7_->keyval;
		_tmp4_ = _tmp8_ == ((guint) GDK_KEY_F);
	}
	if (_tmp4_) {
		GdkEventKey* _tmp9_;
		GdkModifierType _tmp10_;
		GdkModifierType _tmp11_;
		_tmp9_ = event;
		_tmp10_ = _tmp9_->state;
		_tmp11_ = default_modifiers;
		_tmp3_ = (_tmp10_ & _tmp11_) == GDK_CONTROL_MASK;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gboolean _tmp12_;
		gboolean _tmp13_;
		_tmp12_ = games_application_window_get_search_mode (self);
		_tmp13_ = _tmp12_;
		if (!_tmp13_) {
			games_application_window_set_search_mode (self, TRUE);
		}
		result = TRUE;
		return result;
	}
	_tmp14_ = self->priv->collection_box;
	_tmp15_ = event;
	_tmp16_ = games_collection_box_search_bar_handle_event (_tmp14_, (GdkEvent*) _tmp15_);
	result = _tmp16_;
	return result;
}


static gboolean games_application_window_handle_display_key_event (GamesApplicationWindow* self, GdkEventKey* event) {
	gboolean result = FALSE;
	GamesUiState _tmp0_;
	GamesUiState _tmp1_;
	GdkModifierType default_modifiers;
	GdkModifierType _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	GdkEventKey* _tmp6_;
	guint _tmp7_;
	gboolean _tmp21_ = FALSE;
	GdkEventKey* _tmp22_;
	guint _tmp23_;
	gboolean _tmp32_ = FALSE;
	GdkEventKey* _tmp33_;
	guint _tmp34_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = games_application_window_get_ui_state (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != GAMES_UI_STATE_DISPLAY) {
		result = FALSE;
		return result;
	}
	_tmp2_ = gtk_accelerator_get_default_mod_mask ();
	default_modifiers = _tmp2_;
	_tmp6_ = event;
	_tmp7_ = _tmp6_->keyval;
	if (_tmp7_ == ((guint) GDK_KEY_f)) {
		_tmp5_ = TRUE;
	} else {
		GdkEventKey* _tmp8_;
		guint _tmp9_;
		_tmp8_ = event;
		_tmp9_ = _tmp8_->keyval;
		_tmp5_ = _tmp9_ == ((guint) GDK_KEY_F);
	}
	if (_tmp5_) {
		GdkEventKey* _tmp10_;
		GdkModifierType _tmp11_;
		GdkModifierType _tmp12_;
		_tmp10_ = event;
		_tmp11_ = _tmp10_->state;
		_tmp12_ = default_modifiers;
		_tmp4_ = (_tmp11_ & _tmp12_) == GDK_CONTROL_MASK;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		GamesDisplayHeaderBar* _tmp13_;
		gboolean _tmp14_;
		gboolean _tmp15_;
		_tmp13_ = self->priv->display_header_bar;
		_tmp14_ = games_display_header_bar_get_can_fullscreen (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp3_ = _tmp15_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gboolean _tmp16_;
		gboolean _tmp17_;
		GSettings* _tmp18_;
		gboolean _tmp19_;
		gboolean _tmp20_;
		_tmp16_ = games_application_window_get_is_fullscreen (self);
		_tmp17_ = _tmp16_;
		games_application_window_set_is_fullscreen (self, !_tmp17_);
		_tmp18_ = self->priv->settings;
		_tmp19_ = games_application_window_get_is_fullscreen (self);
		_tmp20_ = _tmp19_;
		g_settings_set_boolean (_tmp18_, "fullscreen", _tmp20_);
		result = TRUE;
		return result;
	}
	_tmp22_ = event;
	_tmp23_ = _tmp22_->keyval;
	if (_tmp23_ == ((guint) GDK_KEY_F11)) {
		GamesDisplayHeaderBar* _tmp24_;
		gboolean _tmp25_;
		gboolean _tmp26_;
		_tmp24_ = self->priv->display_header_bar;
		_tmp25_ = games_display_header_bar_get_can_fullscreen (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp21_ = _tmp26_;
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		gboolean _tmp27_;
		gboolean _tmp28_;
		GSettings* _tmp29_;
		gboolean _tmp30_;
		gboolean _tmp31_;
		_tmp27_ = games_application_window_get_is_fullscreen (self);
		_tmp28_ = _tmp27_;
		games_application_window_set_is_fullscreen (self, !_tmp28_);
		_tmp29_ = self->priv->settings;
		_tmp30_ = games_application_window_get_is_fullscreen (self);
		_tmp31_ = _tmp30_;
		g_settings_set_boolean (_tmp29_, "fullscreen", _tmp31_);
		result = TRUE;
		return result;
	}
	_tmp33_ = event;
	_tmp34_ = _tmp33_->keyval;
	if (_tmp34_ == ((guint) GDK_KEY_Escape)) {
		GamesDisplayHeaderBar* _tmp35_;
		gboolean _tmp36_;
		gboolean _tmp37_;
		_tmp35_ = self->priv->display_header_bar;
		_tmp36_ = games_display_header_bar_get_can_fullscreen (_tmp35_);
		_tmp37_ = _tmp36_;
		_tmp32_ = _tmp37_;
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		GSettings* _tmp38_;
		games_application_window_set_is_fullscreen (self, FALSE);
		_tmp38_ = self->priv->settings;
		g_settings_set_boolean (_tmp38_, "fullscreen", FALSE);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static void games_application_window_inhibit (GamesApplicationWindow* self, GtkApplicationInhibitFlags flags) {
	GtkApplicationInhibitFlags _tmp0_;
	GtkApplicationInhibitFlags _tmp1_;
	GtkApplicationInhibitFlags _tmp2_;
	GtkApplicationInhibitFlags new_flags;
	GtkApplicationInhibitFlags _tmp3_;
	GtkApplicationInhibitFlags _tmp4_;
	guint new_cookie;
	GtkApplication* _tmp5_;
	GtkApplication* _tmp6_;
	GtkApplicationInhibitFlags _tmp7_;
	guint _tmp8_;
	guint _tmp9_;
	guint _tmp13_;
	GtkApplicationInhibitFlags _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->inhibit_flags;
	_tmp1_ = flags;
	_tmp2_ = flags;
	if ((_tmp0_ & _tmp1_) == _tmp2_) {
		return;
	}
	_tmp3_ = self->priv->inhibit_flags;
	_tmp4_ = flags;
	new_flags = _tmp3_ | _tmp4_;
	_tmp5_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp6_ = _tmp5_;
	_tmp7_ = new_flags;
	_tmp8_ = gtk_application_inhibit (_tmp6_, (GtkWindow*) self, _tmp7_, _ ("Playing a game"));
	new_cookie = _tmp8_;
	_tmp9_ = self->priv->inhibit_cookie;
	if (_tmp9_ != ((guint) 0)) {
		GtkApplication* _tmp10_;
		GtkApplication* _tmp11_;
		guint _tmp12_;
		_tmp10_ = gtk_window_get_application ((GtkWindow*) self);
		_tmp11_ = _tmp10_;
		_tmp12_ = self->priv->inhibit_cookie;
		gtk_application_uninhibit (_tmp11_, _tmp12_);
	}
	_tmp13_ = new_cookie;
	self->priv->inhibit_cookie = _tmp13_;
	_tmp14_ = new_flags;
	self->priv->inhibit_flags = _tmp14_;
}


static void games_application_window_uninhibit (GamesApplicationWindow* self, GtkApplicationInhibitFlags flags) {
	GtkApplicationInhibitFlags _tmp0_;
	GtkApplicationInhibitFlags _tmp1_;
	GtkApplicationInhibitFlags new_flags;
	GtkApplicationInhibitFlags _tmp2_;
	GtkApplicationInhibitFlags _tmp3_;
	guint new_cookie;
	GtkApplicationInhibitFlags _tmp4_;
	GtkApplication* _tmp9_;
	GtkApplication* _tmp10_;
	guint _tmp11_;
	guint _tmp12_;
	GtkApplicationInhibitFlags _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->inhibit_flags;
	_tmp1_ = flags;
	if ((_tmp0_ & _tmp1_) == 0) {
		return;
	}
	_tmp2_ = self->priv->inhibit_flags;
	_tmp3_ = flags;
	new_flags = _tmp2_ & (~_tmp3_);
	new_cookie = (guint) 0;
	_tmp4_ = new_flags;
	if ((gboolean) _tmp4_) {
		GtkApplication* _tmp5_;
		GtkApplication* _tmp6_;
		GtkApplicationInhibitFlags _tmp7_;
		guint _tmp8_;
		_tmp5_ = gtk_window_get_application ((GtkWindow*) self);
		_tmp6_ = _tmp5_;
		_tmp7_ = new_flags;
		_tmp8_ = gtk_application_inhibit (_tmp6_, (GtkWindow*) self, _tmp7_, _ ("Playing a game"));
		new_cookie = _tmp8_;
	}
	_tmp9_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->inhibit_cookie;
	gtk_application_uninhibit (_tmp10_, _tmp11_);
	_tmp12_ = new_cookie;
	self->priv->inhibit_cookie = _tmp12_;
	_tmp13_ = new_flags;
	self->priv->inhibit_flags = _tmp13_;
}


static void games_application_window_reset_display_page (GamesApplicationWindow* self) {
	GamesDisplayHeaderBar* _tmp0_;
	GamesDisplayBox* _tmp1_;
	GamesDisplayHeaderBar* _tmp2_;
	GamesDisplayHeaderBar* _tmp3_;
	GamesDisplayBox* _tmp4_;
	GamesDisplayHeaderBar* _tmp5_;
	GamesDisplayBox* _tmp6_;
	GamesDisplayHeaderBar* _tmp7_;
	GamesDisplayHeaderBar* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->display_header_bar;
	games_display_header_bar_set_can_fullscreen (_tmp0_, FALSE);
	_tmp1_ = self->priv->display_box;
	_tmp2_ = games_display_box_get_header_bar (_tmp1_);
	_tmp3_ = _tmp2_;
	games_display_header_bar_set_can_fullscreen (_tmp3_, FALSE);
	_tmp4_ = self->priv->display_box;
	games_display_box_set_runner (_tmp4_, NULL);
	_tmp5_ = self->priv->display_header_bar;
	games_display_header_bar_set_media_set (_tmp5_, NULL);
	_tmp6_ = self->priv->display_box;
	_tmp7_ = games_display_box_get_header_bar (_tmp6_);
	_tmp8_ = _tmp7_;
	games_display_header_bar_set_media_set (_tmp8_, NULL);
}


GamesUiState games_application_window_get_ui_state (GamesApplicationWindow* self) {
	GamesUiState result;
	GamesUiState _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_ui_state;
	result = _tmp0_;
	return result;
}


void games_application_window_set_ui_state (GamesApplicationWindow* self, GamesUiState value) {
	g_return_if_fail (self != NULL);
	if (games_application_window_get_ui_state (self) != value) {
		GamesUiState _tmp0_;
		GamesUiState _tmp1_;
		GamesUiState _tmp2_;
		GamesUiState _tmp3_;
		GamesUiState _tmp4_;
		GamesUiState _tmp5_;
		_tmp0_ = value;
		_tmp1_ = games_application_window_get_ui_state (self);
		_tmp2_ = _tmp1_;
		if (_tmp0_ == _tmp2_) {
			return;
		}
		_tmp3_ = value;
		self->priv->_ui_state = _tmp3_;
		_tmp4_ = games_application_window_get_ui_state (self);
		_tmp5_ = _tmp4_;
		switch (_tmp5_) {
			case GAMES_UI_STATE_COLLECTION:
			{
				GtkStack* _tmp6_;
				GamesCollectionBox* _tmp7_;
				GtkStack* _tmp8_;
				GamesCollectionHeaderBar* _tmp9_;
				GamesDisplayBox* _tmp10_;
				GamesRunner* _tmp11_;
				GamesRunner* _tmp12_;
				_tmp6_ = self->priv->content_box;
				_tmp7_ = self->priv->collection_box;
				gtk_stack_set_visible_child (_tmp6_, (GtkWidget*) _tmp7_);
				_tmp8_ = self->priv->header_bar;
				_tmp9_ = self->priv->collection_header_bar;
				gtk_stack_set_visible_child (_tmp8_, (GtkWidget*) _tmp9_);
				games_application_window_set_is_fullscreen (self, FALSE);
				_tmp10_ = self->priv->display_box;
				_tmp11_ = games_display_box_get_runner (_tmp10_);
				_tmp12_ = _tmp11_;
				if (_tmp12_ != NULL) {
					GamesDisplayBox* _tmp13_;
					GamesRunner* _tmp14_;
					GamesRunner* _tmp15_;
					GamesDisplayBox* _tmp16_;
					_tmp13_ = self->priv->display_box;
					_tmp14_ = games_display_box_get_runner (_tmp13_);
					_tmp15_ = _tmp14_;
					games_runner_stop (_tmp15_);
					_tmp16_ = self->priv->display_box;
					games_display_box_set_runner (_tmp16_, NULL);
				}
				break;
			}
			case GAMES_UI_STATE_DISPLAY:
			{
				GtkStack* _tmp17_;
				GamesDisplayBox* _tmp18_;
				GtkStack* _tmp19_;
				GamesDisplayHeaderBar* _tmp20_;
				_tmp17_ = self->priv->content_box;
				_tmp18_ = self->priv->display_box;
				gtk_stack_set_visible_child (_tmp17_, (GtkWidget*) _tmp18_);
				_tmp19_ = self->priv->header_bar;
				_tmp20_ = self->priv->display_header_bar;
				gtk_stack_set_visible_child (_tmp19_, (GtkWidget*) _tmp20_);
				games_application_window_set_search_mode (self, FALSE);
				break;
			}
			default:
			break;
		}
		g_object_notify ((GObject *) self, "ui-state");
	}
}


gboolean games_application_window_get_is_fullscreen (GamesApplicationWindow* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_is_fullscreen;
	result = _tmp0_;
	return result;
}


void games_application_window_set_is_fullscreen (GamesApplicationWindow* self, gboolean value) {
	g_return_if_fail (self != NULL);
	if (games_application_window_get_is_fullscreen (self) != value) {
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_;
		gboolean _tmp4_;
		_tmp1_ = value;
		if (_tmp1_) {
			GamesUiState _tmp2_;
			GamesUiState _tmp3_;
			_tmp2_ = games_application_window_get_ui_state (self);
			_tmp3_ = _tmp2_;
			_tmp0_ = _tmp3_ == GAMES_UI_STATE_DISPLAY;
		} else {
			_tmp0_ = FALSE;
		}
		self->priv->_is_fullscreen = _tmp0_;
		_tmp4_ = self->priv->_is_fullscreen;
		if (_tmp4_) {
			gtk_window_fullscreen ((GtkWindow*) self);
		} else {
			gtk_window_unfullscreen ((GtkWindow*) self);
		}
		g_object_notify ((GObject *) self, "is-fullscreen");
	}
}


gboolean games_application_window_get_search_mode (GamesApplicationWindow* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_search_mode;
	result = _tmp0_;
	return result;
}


void games_application_window_set_search_mode (GamesApplicationWindow* self, gboolean value) {
	g_return_if_fail (self != NULL);
	if (games_application_window_get_search_mode (self) != value) {
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_;
		_tmp1_ = value;
		if (_tmp1_) {
			GamesUiState _tmp2_;
			GamesUiState _tmp3_;
			_tmp2_ = games_application_window_get_ui_state (self);
			_tmp3_ = _tmp2_;
			_tmp0_ = _tmp3_ == GAMES_UI_STATE_COLLECTION;
		} else {
			_tmp0_ = FALSE;
		}
		self->priv->_search_mode = _tmp0_;
		g_object_notify ((GObject *) self, "search-mode");
	}
}


gboolean games_application_window_get_loading_notification (GamesApplicationWindow* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_loading_notification;
	result = _tmp0_;
	return result;
}


void games_application_window_set_loading_notification (GamesApplicationWindow* self, gboolean value) {
	g_return_if_fail (self != NULL);
	if (games_application_window_get_loading_notification (self) != value) {
		gboolean _tmp0_;
		_tmp0_ = value;
		self->priv->_loading_notification = _tmp0_;
		g_object_notify ((GObject *) self, "loading-notification");
	}
}


static GObject * games_application_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GamesApplicationWindow * self;
	GSettings* _tmp0_;
	gint width = 0;
	gint height = 0;
	GSettings* _tmp1_;
	GdkScreen* screen;
	GdkScreen* _tmp2_;
	GdkScreen* _tmp3_;
	GdkScreen* _tmp4_;
	gint _tmp13_;
	gint _tmp14_;
	GSettings* _tmp15_;
	gboolean _tmp16_;
	GamesCollectionBox* _tmp17_;
	GBinding* _tmp18_;
	GBinding* _tmp19_;
	GamesCollectionBox* _tmp20_;
	GBinding* _tmp21_;
	GBinding* _tmp22_;
	GamesCollectionHeaderBar* _tmp23_;
	GBinding* _tmp24_;
	GBinding* _tmp25_;
	GamesDisplayBox* _tmp26_;
	GBinding* _tmp27_;
	GBinding* _tmp28_;
	GamesDisplayHeaderBar* _tmp29_;
	GBinding* _tmp30_;
	GBinding* _tmp31_;
	parent_class = G_OBJECT_CLASS (games_application_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindow);
	_tmp0_ = g_settings_new ("org.gnome.Games");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp0_;
	_tmp1_ = self->priv->settings;
	g_settings_get (_tmp1_, "window-size", "(ii)", &width, &height);
	_tmp2_ = gtk_window_get_screen ((GtkWindow*) self);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	screen = _tmp3_;
	_tmp4_ = screen;
	if (_tmp4_ != NULL) {
		gint _tmp5_;
		GdkScreen* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		GdkScreen* _tmp10_;
		gint _tmp11_;
		gint _tmp12_;
		_tmp5_ = width;
		_tmp6_ = screen;
		_tmp7_ = gdk_screen_get_width (_tmp6_);
		_tmp8_ = MIN (_tmp5_, _tmp7_);
		width = _tmp8_;
		_tmp9_ = height;
		_tmp10_ = screen;
		_tmp11_ = gdk_screen_get_height (_tmp10_);
		_tmp12_ = MIN (_tmp9_, _tmp11_);
		height = _tmp12_;
	}
	_tmp13_ = width;
	_tmp14_ = height;
	gtk_window_resize ((GtkWindow*) self, _tmp13_, _tmp14_);
	_tmp15_ = self->priv->settings;
	_tmp16_ = g_settings_get_boolean (_tmp15_, "window-maximized");
	if (_tmp16_) {
		gtk_window_maximize ((GtkWindow*) self);
	}
	_tmp17_ = self->priv->collection_box;
	_tmp18_ = g_object_bind_property_with_closures ((GObject*) self, "search-mode", (GObject*) _tmp17_, "search-mode", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
	_tmp19_ = _g_object_ref0 (_tmp18_);
	_g_object_unref0 (self->priv->box_search_binding);
	self->priv->box_search_binding = _tmp19_;
	_tmp20_ = self->priv->collection_box;
	_tmp21_ = g_object_bind_property_with_closures ((GObject*) self, "loading-notification", (GObject*) _tmp20_, "loading-notification", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
	_tmp22_ = _g_object_ref0 (_tmp21_);
	_g_object_unref0 (self->priv->loading_notification_binding);
	self->priv->loading_notification_binding = _tmp22_;
	_tmp23_ = self->priv->collection_header_bar;
	_tmp24_ = g_object_bind_property_with_closures ((GObject*) self, "search-mode", (GObject*) _tmp23_, "search-mode", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
	_tmp25_ = _g_object_ref0 (_tmp24_);
	_g_object_unref0 (self->priv->header_bar_search_binding);
	self->priv->header_bar_search_binding = _tmp25_;
	_tmp26_ = self->priv->display_box;
	_tmp27_ = g_object_bind_property_with_closures ((GObject*) self, "is-fullscreen", (GObject*) _tmp26_, "is-fullscreen", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
	_tmp28_ = _g_object_ref0 (_tmp27_);
	_g_object_unref0 (self->priv->box_fullscreen_binding);
	self->priv->box_fullscreen_binding = _tmp28_;
	_tmp29_ = self->priv->display_header_bar;
	_tmp30_ = g_object_bind_property_with_closures ((GObject*) self, "is-fullscreen", (GObject*) _tmp29_, "is-fullscreen", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
	_tmp31_ = _g_object_ref0 (_tmp30_);
	_g_object_unref0 (self->priv->header_bar_fullscreen_binding);
	self->priv->header_bar_fullscreen_binding = _tmp31_;
	self->priv->window_size_update_timeout = (glong) -1;
	self->priv->focus_out_timeout_id = (glong) -1;
	self->priv->inhibit_cookie = (guint) 0;
	self->priv->inhibit_flags = 0;
	gtk_application_window_set_show_menubar ((GtkApplicationWindow*) self, FALSE);
	_g_object_unref0 (screen);
	return obj;
}


static void games_application_window_class_init (GamesApplicationWindowClass * klass) {
	gint GamesApplicationWindow_private_offset;
	games_application_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesApplicationWindowPrivate));
	((GtkWidgetClass *) klass)->size_allocate = games_application_window_real_size_allocate;
	G_OBJECT_CLASS (klass)->get_property = _vala_games_application_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_application_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_application_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_application_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_APPLICATION_WINDOW_UI_STATE, g_param_spec_enum ("ui-state", "ui-state", "ui-state", GAMES_TYPE_UI_STATE, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_APPLICATION_WINDOW_IS_FULLSCREEN, g_param_spec_boolean ("is-fullscreen", "is-fullscreen", "is-fullscreen", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_APPLICATION_WINDOW_SEARCH_MODE, g_param_spec_boolean ("search-mode", "search-mode", "search-mode", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_APPLICATION_WINDOW_LOADING_NOTIFICATION, g_param_spec_boolean ("loading-notification", "loading-notification", "loading-notification", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	GamesApplicationWindow_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/ui/application-window.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "content_box", FALSE, GamesApplicationWindow_private_offset + G_STRUCT_OFFSET (GamesApplicationWindowPrivate, content_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "collection_box", FALSE, GamesApplicationWindow_private_offset + G_STRUCT_OFFSET (GamesApplicationWindowPrivate, collection_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "display_box", FALSE, GamesApplicationWindow_private_offset + G_STRUCT_OFFSET (GamesApplicationWindowPrivate, display_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "header_bar", FALSE, GamesApplicationWindow_private_offset + G_STRUCT_OFFSET (GamesApplicationWindowPrivate, header_bar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "collection_header_bar", FALSE, GamesApplicationWindow_private_offset + G_STRUCT_OFFSET (GamesApplicationWindowPrivate, collection_header_bar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "display_header_bar", FALSE, GamesApplicationWindow_private_offset + G_STRUCT_OFFSET (GamesApplicationWindowPrivate, display_header_bar));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_delete_event", G_CALLBACK(_games_application_window_on_delete_event_gtk_widget_delete_event));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_key_pressed", G_CALLBACK(_games_application_window_on_key_pressed_gtk_widget_key_press_event));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_window_state_event", G_CALLBACK(_games_application_window_on_window_state_event_gtk_widget_window_state_event));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_game_activated", G_CALLBACK(_games_application_window_on_game_activated_games_collection_box_game_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_display_back", G_CALLBACK(_games_application_window_on_display_back_games_display_header_bar_back));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_toplevel_focus", G_CALLBACK(_games_application_window_on_toplevel_focus_g_object_notify));
}


static void games_application_window_instance_init (GamesApplicationWindow * self) {
	self->priv = GAMES_APPLICATION_WINDOW_GET_PRIVATE (self);
	g_type_ensure (GAMES_TYPE_COLLECTION_BOX);
	g_type_ensure (GAMES_TYPE_DISPLAY_HEADER_BAR);
	g_type_ensure (GAMES_TYPE_DISPLAY_BOX);
	g_type_ensure (GAMES_TYPE_COLLECTION_HEADER_BAR);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void games_application_window_finalize (GObject * obj) {
	GamesApplicationWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindow);
	_g_object_unref0 (self->priv->content_box);
	_g_object_unref0 (self->priv->collection_box);
	_g_object_unref0 (self->priv->display_box);
	_g_object_unref0 (self->priv->header_bar);
	_g_object_unref0 (self->priv->collection_header_bar);
	_g_object_unref0 (self->priv->display_header_bar);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->box_search_binding);
	_g_object_unref0 (self->priv->box_fullscreen_binding);
	_g_object_unref0 (self->priv->header_bar_search_binding);
	_g_object_unref0 (self->priv->header_bar_fullscreen_binding);
	_g_object_unref0 (self->priv->loading_notification_binding);
	_g_object_unref0 (self->priv->run_game_cancellable);
	_g_object_unref0 (self->priv->quit_game_cancellable);
	G_OBJECT_CLASS (games_application_window_parent_class)->finalize (obj);
}


GType games_application_window_get_type (void) {
	static volatile gsize games_application_window_type_id__volatile = 0;
	if (g_once_init_enter (&games_application_window_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesApplicationWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_application_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesApplicationWindow), 0, (GInstanceInitFunc) games_application_window_instance_init, NULL };
		GType games_application_window_type_id;
		games_application_window_type_id = g_type_register_static (gtk_application_window_get_type (), "GamesApplicationWindow", &g_define_type_info, 0);
		g_once_init_leave (&games_application_window_type_id__volatile, games_application_window_type_id);
	}
	return games_application_window_type_id__volatile;
}


static void _vala_games_application_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesApplicationWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindow);
	switch (property_id) {
		case GAMES_APPLICATION_WINDOW_UI_STATE:
		g_value_set_enum (value, games_application_window_get_ui_state (self));
		break;
		case GAMES_APPLICATION_WINDOW_IS_FULLSCREEN:
		g_value_set_boolean (value, games_application_window_get_is_fullscreen (self));
		break;
		case GAMES_APPLICATION_WINDOW_SEARCH_MODE:
		g_value_set_boolean (value, games_application_window_get_search_mode (self));
		break;
		case GAMES_APPLICATION_WINDOW_LOADING_NOTIFICATION:
		g_value_set_boolean (value, games_application_window_get_loading_notification (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_application_window_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesApplicationWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_APPLICATION_WINDOW, GamesApplicationWindow);
	switch (property_id) {
		case GAMES_APPLICATION_WINDOW_UI_STATE:
		games_application_window_set_ui_state (self, g_value_get_enum (value));
		break;
		case GAMES_APPLICATION_WINDOW_IS_FULLSCREEN:
		games_application_window_set_is_fullscreen (self, g_value_get_boolean (value));
		break;
		case GAMES_APPLICATION_WINDOW_SEARCH_MODE:
		games_application_window_set_search_mode (self, g_value_get_boolean (value));
		break;
		case GAMES_APPLICATION_WINDOW_LOADING_NOTIFICATION:
		games_application_window_set_loading_notification (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



