/* display-box.c generated by valac 0.35.5, the Vala compiler
 * generated from display-box.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 <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gdk/gdk.h>


#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;
typedef struct _GamesDisplayBoxPrivate GamesDisplayBoxPrivate;

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

typedef struct _GamesRunner GamesRunner;
typedef struct _GamesRunnerIface GamesRunnerIface;

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

typedef struct _GamesMediaSet GamesMediaSet;
typedef struct _GamesMediaSetClass GamesMediaSetClass;

#define GAMES_TYPE_ERROR_DISPLAY (games_error_display_get_type ())
#define GAMES_ERROR_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_ERROR_DISPLAY, GamesErrorDisplay))
#define GAMES_ERROR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_ERROR_DISPLAY, GamesErrorDisplayClass))
#define GAMES_IS_ERROR_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_ERROR_DISPLAY))
#define GAMES_IS_ERROR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_ERROR_DISPLAY))
#define GAMES_ERROR_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_ERROR_DISPLAY, GamesErrorDisplayClass))

typedef struct _GamesErrorDisplay GamesErrorDisplay;
typedef struct _GamesErrorDisplayClass GamesErrorDisplayClass;

#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;
enum  {
	GAMES_DISPLAY_BOX_BACK_SIGNAL,
	GAMES_DISPLAY_BOX_LAST_SIGNAL
};
static guint games_display_box_signals[GAMES_DISPLAY_BOX_LAST_SIGNAL] = {0};

struct _GamesDisplayBox {
	GtkEventBox parent_instance;
	GamesDisplayBoxPrivate * priv;
};

struct _GamesDisplayBoxClass {
	GtkEventBoxClass parent_class;
};

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 _GamesDisplayBoxPrivate {
	gboolean _is_fullscreen;
	GamesRunner* _runner;
	GtkOverlay* overlay;
	GtkStack* stack;
	GamesErrorDisplay* error_display;
	GtkEventBox* display_bin;
	GtkRevealer* fullscreen_header_bar_revealer;
	GamesDisplayHeaderBar* fullscreen_header_bar;
	GBinding* visible_binding;
	GBinding* fullscreen_binding;
	glong timeout_id;
};

struct _GamesIconIface {
	GTypeInterface parent_iface;
	GIcon* (*get_icon) (GamesIcon* self);
};

struct _GamesCoverIface {
	GTypeInterface parent_iface;
	GIcon* (*get_cover) (GamesCover* 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);
};


static gpointer games_display_box_parent_class = NULL;

GType games_display_box_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_error_display_get_type (void) G_GNUC_CONST;
GType games_display_header_bar_get_type (void) G_GNUC_CONST;
#define GAMES_DISPLAY_BOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_DISPLAY_BOX, GamesDisplayBoxPrivate))
enum  {
	GAMES_DISPLAY_BOX_DUMMY_PROPERTY,
	GAMES_DISPLAY_BOX_IS_FULLSCREEN,
	GAMES_DISPLAY_BOX_HEADER_BAR,
	GAMES_DISPLAY_BOX_RUNNER
};
#define GAMES_DISPLAY_BOX_INACTIVITY_TIME_MILLISECONDS ((guint) 2000)
GType games_icon_get_type (void) G_GNUC_CONST;
GType games_cover_get_type (void) G_GNUC_CONST;
GType games_game_get_type (void) G_GNUC_CONST;
void games_display_box_display_running_game_failed (GamesDisplayBox* self, GamesGame* game, const gchar* error_message);
void games_error_display_running_game_failed (GamesErrorDisplay* self, GamesGame* game, const gchar* message);
static void games_display_box_on_fullscreen_changed (GamesDisplayBox* self);
gboolean games_display_box_get_is_fullscreen (GamesDisplayBox* self);
static void games_display_box_on_activity (GamesDisplayBox* self);
static void games_display_box_on_restore (GamesDisplayBox* self);
static void _games_display_box_on_fullscreen_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void games_display_box_on_fullscreen_header_bar_back (GamesDisplayBox* self);
static void _games_display_box_on_fullscreen_header_bar_back_games_display_header_bar_back (GamesDisplayHeaderBar* _sender, gpointer self);
static gboolean games_display_box_on_motion_event (GamesDisplayBox* self, GdkEventMotion* event);
static gboolean _games_display_box_on_motion_event_gtk_widget_motion_notify_event (GtkWidget* _sender, GdkEventMotion* event, gpointer self);
static gboolean games_display_box_on_inactivity (GamesDisplayBox* self);
static gboolean _games_display_box_on_inactivity_gsource_func (gpointer self);
static void games_display_box_show_cursor (GamesDisplayBox* self, gboolean show);
static void games_display_box_set_display (GamesDisplayBox* self, GtkWidget* display);
static void games_display_box_remove_display (GamesDisplayBox* self);
GamesDisplayBox* games_display_box_new (void);
GamesDisplayBox* games_display_box_construct (GType object_type);
void games_display_box_set_is_fullscreen (GamesDisplayBox* self, gboolean value);
GamesDisplayHeaderBar* games_display_box_get_header_bar (GamesDisplayBox* self);
GamesRunner* games_display_box_get_runner (GamesDisplayBox* self);
void games_display_box_set_runner (GamesDisplayBox* self, GamesRunner* value);
GtkWidget* games_runner_get_display (GamesRunner* self);
static GObject * games_display_box_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void games_display_box_finalize (GObject * obj);
static void _vala_games_display_box_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_display_box_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


void games_display_box_display_running_game_failed (GamesDisplayBox* self, GamesGame* game, const gchar* error_message) {
	GtkStack* _tmp0_;
	GamesErrorDisplay* _tmp1_;
	GamesErrorDisplay* _tmp2_;
	GamesGame* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (game != NULL);
	g_return_if_fail (error_message != NULL);
	_tmp0_ = self->priv->stack;
	_tmp1_ = self->priv->error_display;
	gtk_stack_set_visible_child (_tmp0_, (GtkWidget*) _tmp1_);
	_tmp2_ = self->priv->error_display;
	_tmp3_ = game;
	_tmp4_ = error_message;
	games_error_display_running_game_failed (_tmp2_, _tmp3_, _tmp4_);
}


static void games_display_box_on_fullscreen_changed (GamesDisplayBox* self) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_is_fullscreen;
	if (_tmp0_) {
		games_display_box_on_activity (self);
	} else {
		games_display_box_on_restore (self);
	}
}


static void _games_display_box_on_fullscreen_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	games_display_box_on_fullscreen_changed ((GamesDisplayBox*) self);
}


static void games_display_box_on_fullscreen_header_bar_back (GamesDisplayBox* self) {
	g_return_if_fail (self != NULL);
	g_signal_emit (self, games_display_box_signals[GAMES_DISPLAY_BOX_BACK_SIGNAL], 0);
}


static void _games_display_box_on_fullscreen_header_bar_back_games_display_header_bar_back (GamesDisplayHeaderBar* _sender, gpointer self) {
	games_display_box_on_fullscreen_header_bar_back ((GamesDisplayBox*) self);
}


static gboolean games_display_box_on_motion_event (GamesDisplayBox* self, GdkEventMotion* event) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	games_display_box_on_activity (self);
	result = FALSE;
	return result;
}


static gboolean _games_display_box_on_motion_event_gtk_widget_motion_notify_event (GtkWidget* _sender, GdkEventMotion* event, gpointer self) {
	gboolean result;
	result = games_display_box_on_motion_event ((GamesDisplayBox*) self, event);
	return result;
}


static gboolean _games_display_box_on_inactivity_gsource_func (gpointer self) {
	gboolean result;
	result = games_display_box_on_inactivity ((GamesDisplayBox*) self);
	return result;
}


static void games_display_box_on_activity (GamesDisplayBox* self) {
	glong _tmp0_;
	gboolean _tmp2_;
	guint _tmp3_;
	GtkRevealer* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->timeout_id;
	if (_tmp0_ != ((glong) -1)) {
		glong _tmp1_;
		_tmp1_ = self->priv->timeout_id;
		g_source_remove ((guint) _tmp1_);
		self->priv->timeout_id = (glong) -1;
	}
	_tmp2_ = self->priv->_is_fullscreen;
	if (!_tmp2_) {
		return;
	}
	_tmp3_ = g_timeout_add_full (G_PRIORITY_DEFAULT, GAMES_DISPLAY_BOX_INACTIVITY_TIME_MILLISECONDS, _games_display_box_on_inactivity_gsource_func, g_object_ref (self), g_object_unref);
	self->priv->timeout_id = (glong) _tmp3_;
	_tmp4_ = self->priv->fullscreen_header_bar_revealer;
	gtk_revealer_set_reveal_child (_tmp4_, TRUE);
	games_display_box_show_cursor (self, TRUE);
}


static gboolean games_display_box_on_inactivity (GamesDisplayBox* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	GtkRevealer* _tmp1_;
	GtkOverlay* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->timeout_id = (glong) -1;
	_tmp0_ = self->priv->_is_fullscreen;
	if (!_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->fullscreen_header_bar_revealer;
	gtk_revealer_set_reveal_child (_tmp1_, FALSE);
	games_display_box_show_cursor (self, FALSE);
	_tmp2_ = self->priv->overlay;
	gtk_widget_grab_focus ((GtkWidget*) _tmp2_);
	result = FALSE;
	return result;
}


static void games_display_box_on_restore (GamesDisplayBox* self) {
	glong _tmp0_;
	GtkRevealer* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->timeout_id;
	if (_tmp0_ != ((glong) -1)) {
		glong _tmp1_;
		_tmp1_ = self->priv->timeout_id;
		g_source_remove ((guint) _tmp1_);
		self->priv->timeout_id = (glong) -1;
	}
	_tmp2_ = self->priv->fullscreen_header_bar_revealer;
	gtk_revealer_set_reveal_child (_tmp2_, FALSE);
	games_display_box_show_cursor (self, TRUE);
}


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


static void games_display_box_show_cursor (GamesDisplayBox* self, gboolean show) {
	GdkWindow* window;
	GdkWindow* _tmp0_;
	GdkWindow* _tmp1_;
	GdkWindow* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_;
	GdkCursor* _tmp14_ = NULL;
	gboolean _tmp15_;
	GdkWindow* _tmp17_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_widget_get_window ((GtkWidget*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	window = _tmp1_;
	_tmp2_ = window;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (window);
		return;
	}
	_tmp5_ = show;
	if (_tmp5_) {
		GdkWindow* _tmp6_;
		GdkCursor* _tmp7_;
		GdkCursor* _tmp8_;
		_tmp6_ = window;
		_tmp7_ = gdk_window_get_cursor (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_ == NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		gboolean _tmp9_ = FALSE;
		gboolean _tmp10_;
		_tmp10_ = show;
		if (!_tmp10_) {
			GdkWindow* _tmp11_;
			GdkCursor* _tmp12_;
			GdkCursor* _tmp13_;
			_tmp11_ = window;
			_tmp12_ = gdk_window_get_cursor (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp9_ = _tmp13_ != NULL;
		} else {
			_tmp9_ = FALSE;
		}
		_tmp3_ = _tmp9_;
	}
	if (_tmp3_) {
		_g_object_unref0 (window);
		return;
	}
	_tmp15_ = show;
	if (_tmp15_) {
		_g_object_unref0 (_tmp14_);
		_tmp14_ = NULL;
	} else {
		GdkCursor* _tmp16_;
		_tmp16_ = gdk_cursor_new (GDK_BLANK_CURSOR);
		_g_object_unref0 (_tmp14_);
		_tmp14_ = _tmp16_;
	}
	_tmp17_ = window;
	gdk_window_set_cursor (_tmp17_, _tmp14_);
	_g_object_unref0 (_tmp14_);
	_g_object_unref0 (window);
}


static void games_display_box_set_display (GamesDisplayBox* self, GtkWidget* display) {
	GtkEventBox* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (display != NULL);
	games_display_box_remove_display (self);
	_tmp0_ = self->priv->display_bin;
	_tmp1_ = display;
	gtk_container_add ((GtkContainer*) _tmp0_, _tmp1_);
	_tmp2_ = display;
	gtk_widget_set_visible (_tmp2_, TRUE);
}


static void games_display_box_remove_display (GamesDisplayBox* self) {
	GtkWidget* child;
	GtkEventBox* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->display_bin;
	_tmp1_ = gtk_bin_get_child ((GtkBin*) _tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	child = _tmp2_;
	_tmp3_ = child;
	if (_tmp3_ != NULL) {
		GtkEventBox* _tmp4_;
		GtkWidget* _tmp5_;
		_tmp4_ = self->priv->display_bin;
		_tmp5_ = child;
		gtk_container_remove ((GtkContainer*) _tmp4_, _tmp5_);
	}
	_g_object_unref0 (child);
}


GamesDisplayBox* games_display_box_construct (GType object_type) {
	GamesDisplayBox * self = NULL;
	self = (GamesDisplayBox*) g_object_new (object_type, NULL);
	return self;
}


GamesDisplayBox* games_display_box_new (void) {
	return games_display_box_construct (GAMES_TYPE_DISPLAY_BOX);
}


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


void games_display_box_set_is_fullscreen (GamesDisplayBox* self, gboolean value) {
	g_return_if_fail (self != NULL);
	if (games_display_box_get_is_fullscreen (self) != value) {
		gboolean _tmp0_;
		_tmp0_ = value;
		self->priv->_is_fullscreen = _tmp0_;
		g_object_notify ((GObject *) self, "is-fullscreen");
	}
}


GamesDisplayHeaderBar* games_display_box_get_header_bar (GamesDisplayBox* self) {
	GamesDisplayHeaderBar* result;
	GamesDisplayHeaderBar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->fullscreen_header_bar;
	result = _tmp0_;
	return result;
}


GamesRunner* games_display_box_get_runner (GamesDisplayBox* self) {
	GamesRunner* result;
	GamesRunner* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_runner;
	result = _tmp0_;
	return result;
}


void games_display_box_set_runner (GamesDisplayBox* self, GamesRunner* value) {
	g_return_if_fail (self != NULL);
	if (games_display_box_get_runner (self) != value) {
		GtkStack* _tmp0_;
		GtkEventBox* _tmp1_;
		GamesRunner* _tmp2_;
		GamesRunner* _tmp3_;
		GamesRunner* _tmp4_;
		GamesRunner* _tmp5_;
		GtkWidget* display;
		GamesRunner* _tmp6_;
		GamesRunner* _tmp7_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		_tmp0_ = self->priv->stack;
		_tmp1_ = self->priv->display_bin;
		gtk_stack_set_visible_child (_tmp0_, (GtkWidget*) _tmp1_);
		_tmp2_ = value;
		_tmp3_ = _g_object_ref0 (_tmp2_);
		_g_object_unref0 (self->priv->_runner);
		self->priv->_runner = _tmp3_;
		games_display_box_remove_display (self);
		_tmp4_ = games_display_box_get_runner (self);
		_tmp5_ = _tmp4_;
		if (_tmp5_ == NULL) {
			return;
		}
		_tmp6_ = games_display_box_get_runner (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = games_runner_get_display (_tmp7_);
		display = _tmp8_;
		_tmp9_ = display;
		games_display_box_set_display (self, _tmp9_);
		_g_object_unref0 (display);
		g_object_notify ((GObject *) self, "runner");
	}
}


static GObject * games_display_box_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GamesDisplayBox * self;
	GtkRevealer* _tmp0_;
	GBinding* _tmp1_;
	GBinding* _tmp2_;
	GamesDisplayHeaderBar* _tmp3_;
	GBinding* _tmp4_;
	GBinding* _tmp5_;
	parent_class = G_OBJECT_CLASS (games_display_box_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_DISPLAY_BOX, GamesDisplayBox);
	_tmp0_ = self->priv->fullscreen_header_bar_revealer;
	_tmp1_ = g_object_bind_property_with_closures ((GObject*) self, "is-fullscreen", (GObject*) _tmp0_, "visible", 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)));
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->visible_binding);
	self->priv->visible_binding = _tmp2_;
	_tmp3_ = self->priv->fullscreen_header_bar;
	_tmp4_ = g_object_bind_property_with_closures ((GObject*) self, "is-fullscreen", (GObject*) _tmp3_, "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)));
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->priv->fullscreen_binding);
	self->priv->fullscreen_binding = _tmp5_;
	self->priv->timeout_id = (glong) -1;
	return obj;
}


static void games_display_box_class_init (GamesDisplayBoxClass * klass) {
	gint GamesDisplayBox_private_offset;
	games_display_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesDisplayBoxPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_games_display_box_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_display_box_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_display_box_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_display_box_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_DISPLAY_BOX_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_DISPLAY_BOX_HEADER_BAR, g_param_spec_object ("header-bar", "header-bar", "header-bar", GAMES_TYPE_DISPLAY_HEADER_BAR, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_DISPLAY_BOX_RUNNER, g_param_spec_object ("runner", "runner", "runner", GAMES_TYPE_RUNNER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	GamesDisplayBox_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/display-box.ui");
	games_display_box_signals[GAMES_DISPLAY_BOX_BACK_SIGNAL] = g_signal_new ("back", GAMES_TYPE_DISPLAY_BOX, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "overlay", FALSE, GamesDisplayBox_private_offset + G_STRUCT_OFFSET (GamesDisplayBoxPrivate, overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, GamesDisplayBox_private_offset + G_STRUCT_OFFSET (GamesDisplayBoxPrivate, stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "error_display", FALSE, GamesDisplayBox_private_offset + G_STRUCT_OFFSET (GamesDisplayBoxPrivate, error_display));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "display_bin", FALSE, GamesDisplayBox_private_offset + G_STRUCT_OFFSET (GamesDisplayBoxPrivate, display_bin));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "fullscreen_header_bar_revealer", FALSE, GamesDisplayBox_private_offset + G_STRUCT_OFFSET (GamesDisplayBoxPrivate, fullscreen_header_bar_revealer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "fullscreen_header_bar", FALSE, GamesDisplayBox_private_offset + G_STRUCT_OFFSET (GamesDisplayBoxPrivate, fullscreen_header_bar));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_fullscreen_changed", G_CALLBACK(_games_display_box_on_fullscreen_changed_g_object_notify));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_fullscreen_header_bar_back", G_CALLBACK(_games_display_box_on_fullscreen_header_bar_back_games_display_header_bar_back));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_motion_event", G_CALLBACK(_games_display_box_on_motion_event_gtk_widget_motion_notify_event));
}


static void games_display_box_instance_init (GamesDisplayBox * self) {
	self->priv = GAMES_DISPLAY_BOX_GET_PRIVATE (self);
	g_type_ensure (GAMES_TYPE_DISPLAY_HEADER_BAR);
	g_type_ensure (GAMES_TYPE_ERROR_DISPLAY);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void games_display_box_finalize (GObject * obj) {
	GamesDisplayBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_DISPLAY_BOX, GamesDisplayBox);
	_g_object_unref0 (self->priv->_runner);
	_g_object_unref0 (self->priv->overlay);
	_g_object_unref0 (self->priv->stack);
	_g_object_unref0 (self->priv->error_display);
	_g_object_unref0 (self->priv->display_bin);
	_g_object_unref0 (self->priv->fullscreen_header_bar_revealer);
	_g_object_unref0 (self->priv->fullscreen_header_bar);
	_g_object_unref0 (self->priv->visible_binding);
	_g_object_unref0 (self->priv->fullscreen_binding);
	G_OBJECT_CLASS (games_display_box_parent_class)->finalize (obj);
}


GType games_display_box_get_type (void) {
	static volatile gsize games_display_box_type_id__volatile = 0;
	if (g_once_init_enter (&games_display_box_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesDisplayBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_display_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesDisplayBox), 0, (GInstanceInitFunc) games_display_box_instance_init, NULL };
		GType games_display_box_type_id;
		games_display_box_type_id = g_type_register_static (gtk_event_box_get_type (), "GamesDisplayBox", &g_define_type_info, 0);
		g_once_init_leave (&games_display_box_type_id__volatile, games_display_box_type_id);
	}
	return games_display_box_type_id__volatile;
}


static void _vala_games_display_box_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesDisplayBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_DISPLAY_BOX, GamesDisplayBox);
	switch (property_id) {
		case GAMES_DISPLAY_BOX_IS_FULLSCREEN:
		g_value_set_boolean (value, games_display_box_get_is_fullscreen (self));
		break;
		case GAMES_DISPLAY_BOX_HEADER_BAR:
		g_value_set_object (value, games_display_box_get_header_bar (self));
		break;
		case GAMES_DISPLAY_BOX_RUNNER:
		g_value_set_object (value, games_display_box_get_runner (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_display_box_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesDisplayBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_DISPLAY_BOX, GamesDisplayBox);
	switch (property_id) {
		case GAMES_DISPLAY_BOX_IS_FULLSCREEN:
		games_display_box_set_is_fullscreen (self, g_value_get_boolean (value));
		break;
		case GAMES_DISPLAY_BOX_RUNNER:
		games_display_box_set_runner (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



