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

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

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


#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;
typedef struct _GamesErrorDisplayPrivate GamesErrorDisplayPrivate;
#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))

struct _GamesErrorDisplay {
	GtkBox parent_instance;
	GamesErrorDisplayPrivate * priv;
};

struct _GamesErrorDisplayClass {
	GtkBoxClass parent_class;
};

struct _GamesErrorDisplayPrivate {
	GtkLabel* primary_label;
	GtkLabel* secondary_label;
};

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


static gpointer games_error_display_parent_class = NULL;

GType games_error_display_get_type (void) G_GNUC_CONST;
#define GAMES_ERROR_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_ERROR_DISPLAY, GamesErrorDisplayPrivate))
enum  {
	GAMES_ERROR_DISPLAY_0_PROPERTY
};
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_error_display_running_game_failed (GamesErrorDisplay* self, GamesGame* game, const gchar* message);
const gchar* games_game_get_name (GamesGame* self);
static void games_error_display_set_labels (GamesErrorDisplay* self, const gchar* primary, const gchar* secondary);
GamesErrorDisplay* games_error_display_new (void);
GamesErrorDisplay* games_error_display_construct (GType object_type);
static void games_error_display_finalize (GObject * obj);


void games_error_display_running_game_failed (GamesErrorDisplay* self, GamesGame* game, const gchar* message) {
	gchar* title = NULL;
	GamesGame* _tmp0_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (game != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = game;
	if (_tmp0_ != NULL) {
		GamesGame* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = game;
		_tmp2_ = games_game_get_name (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strdup_printf (_ ("Oops! Unable to run “%s”"), _tmp3_);
		_g_free0 (title);
		title = _tmp4_;
	} else {
		gchar* _tmp5_;
		_tmp5_ = g_strdup (_ ("Oops! Unable to run the game"));
		_g_free0 (title);
		title = _tmp5_;
	}
	_tmp6_ = title;
	_tmp7_ = message;
	games_error_display_set_labels (self, _tmp6_, _tmp7_);
	_g_free0 (title);
}


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


static void games_error_display_set_labels (GamesErrorDisplay* self, const gchar* primary, const gchar* secondary) {
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GtkLabel* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (primary != NULL);
	g_return_if_fail (secondary != NULL);
	_tmp0_ = self->priv->primary_label;
	_tmp1_ = primary;
	_tmp2_ = g_markup_escape_text (_tmp1_, (gssize) -1);
	_tmp3_ = _tmp2_;
	_tmp4_ = string_to_string (_tmp3_);
	_tmp5_ = g_strconcat ("<big><b>", _tmp4_, "</b></big>", NULL);
	_tmp6_ = _tmp5_;
	gtk_label_set_label (_tmp0_, _tmp6_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp3_);
	_tmp7_ = self->priv->secondary_label;
	_tmp8_ = secondary;
	_tmp9_ = g_markup_escape_text (_tmp8_, (gssize) -1);
	_tmp10_ = _tmp9_;
	gtk_label_set_label (_tmp7_, _tmp10_);
	_g_free0 (_tmp10_);
}


GamesErrorDisplay* games_error_display_construct (GType object_type) {
	GamesErrorDisplay * self = NULL;
	self = (GamesErrorDisplay*) g_object_new (object_type, NULL);
	return self;
}


GamesErrorDisplay* games_error_display_new (void) {
	return games_error_display_construct (GAMES_TYPE_ERROR_DISPLAY);
}


static void games_error_display_class_init (GamesErrorDisplayClass * klass) {
	gint GamesErrorDisplay_private_offset;
	games_error_display_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesErrorDisplayPrivate));
	G_OBJECT_CLASS (klass)->finalize = games_error_display_finalize;
	GamesErrorDisplay_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/error-display.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "primary_label", FALSE, GamesErrorDisplay_private_offset + G_STRUCT_OFFSET (GamesErrorDisplayPrivate, primary_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "secondary_label", FALSE, GamesErrorDisplay_private_offset + G_STRUCT_OFFSET (GamesErrorDisplayPrivate, secondary_label));
}


static void games_error_display_instance_init (GamesErrorDisplay * self) {
	self->priv = GAMES_ERROR_DISPLAY_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void games_error_display_finalize (GObject * obj) {
	GamesErrorDisplay * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_ERROR_DISPLAY, GamesErrorDisplay);
	_g_object_unref0 (self->priv->primary_label);
	_g_object_unref0 (self->priv->secondary_label);
	G_OBJECT_CLASS (games_error_display_parent_class)->finalize (obj);
}


GType games_error_display_get_type (void) {
	static volatile gsize games_error_display_type_id__volatile = 0;
	if (g_once_init_enter (&games_error_display_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesErrorDisplayClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_error_display_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesErrorDisplay), 0, (GInstanceInitFunc) games_error_display_instance_init, NULL };
		GType games_error_display_type_id;
		games_error_display_type_id = g_type_register_static (gtk_box_get_type (), "GamesErrorDisplay", &g_define_type_info, 0);
		g_once_init_leave (&games_error_display_type_id__volatile, games_error_display_type_id);
	}
	return games_error_display_type_id__volatile;
}



