/* game-icon-view.c generated by valac 0.35.5, the Vala compiler
 * generated from game-icon-view.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>


#define GAMES_TYPE_GAME_ICON_VIEW (games_game_icon_view_get_type ())
#define GAMES_GAME_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME_ICON_VIEW, GamesGameIconView))
#define GAMES_GAME_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GAME_ICON_VIEW, GamesGameIconViewClass))
#define GAMES_IS_GAME_ICON_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME_ICON_VIEW))
#define GAMES_IS_GAME_ICON_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GAME_ICON_VIEW))
#define GAMES_GAME_ICON_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GAME_ICON_VIEW, GamesGameIconViewClass))

typedef struct _GamesGameIconView GamesGameIconView;
typedef struct _GamesGameIconViewClass GamesGameIconViewClass;
typedef struct _GamesGameIconViewPrivate GamesGameIconViewPrivate;

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

typedef struct _GamesGame GamesGame;
typedef struct _GamesGameIface GamesGameIface;

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

typedef struct _GamesIcon GamesIcon;
typedef struct _GamesIconIface GamesIconIface;

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

typedef struct _GamesCover GamesCover;
typedef struct _GamesCoverIface GamesCoverIface;

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

typedef struct _GamesRunner GamesRunner;
typedef struct _GamesRunnerIface GamesRunnerIface;

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

typedef struct _GamesMediaSet GamesMediaSet;
typedef struct _GamesMediaSetClass GamesMediaSetClass;

#define GAMES_TYPE_GAME_THUMBNAIL (games_game_thumbnail_get_type ())
#define GAMES_GAME_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME_THUMBNAIL, GamesGameThumbnail))
#define GAMES_GAME_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GAME_THUMBNAIL, GamesGameThumbnailClass))
#define GAMES_IS_GAME_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME_THUMBNAIL))
#define GAMES_IS_GAME_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GAME_THUMBNAIL))
#define GAMES_GAME_THUMBNAIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GAME_THUMBNAIL, GamesGameThumbnailClass))

typedef struct _GamesGameThumbnail GamesGameThumbnail;
typedef struct _GamesGameThumbnailClass GamesGameThumbnailClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesGameIconView {
	GtkBox parent_instance;
	GamesGameIconViewPrivate * priv;
};

struct _GamesGameIconViewClass {
	GtkBoxClass parent_class;
};

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

struct _GamesCoverIface {
	GTypeInterface parent_iface;
	GIcon* (*get_cover) (GamesCover* self);
};

struct _GamesRunnerIface {
	GTypeInterface parent_iface;
	gboolean (*check_is_valid) (GamesRunner* self, gchar* * error_message, GError** error);
	GtkWidget* (*get_display) (GamesRunner* self);
	void (*start) (GamesRunner* self, GError** error);
	void (*resume) (GamesRunner* self, GError** error);
	void (*pause) (GamesRunner* self);
	void (*stop) (GamesRunner* self);
	gboolean (*get_can_fullscreen) (GamesRunner* self);
	gboolean (*get_can_quit_safely) (GamesRunner* self);
	gboolean (*get_can_resume) (GamesRunner* self);
	GamesMediaSet* (*get_media_set) (GamesRunner* self);
};

struct _GamesGameIface {
	GTypeInterface parent_iface;
	GamesIcon* (*get_icon) (GamesGame* self);
	GamesCover* (*get_cover) (GamesGame* self);
	GamesRunner* (*get_runner) (GamesGame* self, GError** error);
	const gchar* (*get_name) (GamesGame* self);
};

struct _GamesGameIconViewPrivate {
	GamesGame* _game;
	GamesGameThumbnail* thumbnail;
	GtkLabel* title;
};


static gpointer games_game_icon_view_parent_class = NULL;

GType games_game_icon_view_get_type (void) G_GNUC_CONST;
GType games_icon_get_type (void) G_GNUC_CONST;
GType games_cover_get_type (void) G_GNUC_CONST;
GType games_media_set_get_type (void) G_GNUC_CONST;
GType games_runner_get_type (void) G_GNUC_CONST;
GType games_game_get_type (void) G_GNUC_CONST;
GType games_game_thumbnail_get_type (void) G_GNUC_CONST;
#define GAMES_GAME_ICON_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_GAME_ICON_VIEW, GamesGameIconViewPrivate))
enum  {
	GAMES_GAME_ICON_VIEW_DUMMY_PROPERTY,
	GAMES_GAME_ICON_VIEW_GAME
};
GamesGameIconView* games_game_icon_view_new (GamesGame* game);
GamesGameIconView* games_game_icon_view_construct (GType object_type, GamesGame* game);
void games_game_icon_view_set_game (GamesGameIconView* self, GamesGame* value);
GamesGame* games_game_icon_view_get_game (GamesGameIconView* self);
GamesIcon* games_game_get_icon (GamesGame* self);
void games_game_thumbnail_set_icon (GamesGameThumbnail* self, GamesIcon* value);
GamesCover* games_game_get_cover (GamesGame* self);
void games_game_thumbnail_set_cover (GamesGameThumbnail* self, GamesCover* value);
const gchar* games_game_get_name (GamesGame* self);
static void games_game_icon_view_finalize (GObject * obj);
static void _vala_games_game_icon_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_game_icon_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GamesGameIconView* games_game_icon_view_construct (GType object_type, GamesGame* game) {
	GamesGameIconView * self = NULL;
	GamesGame* _tmp0_;
	g_return_val_if_fail (game != NULL, NULL);
	self = (GamesGameIconView*) g_object_new (object_type, NULL);
	_tmp0_ = game;
	games_game_icon_view_set_game (self, _tmp0_);
	return self;
}


GamesGameIconView* games_game_icon_view_new (GamesGame* game) {
	return games_game_icon_view_construct (GAMES_TYPE_GAME_ICON_VIEW, game);
}


GamesGame* games_game_icon_view_get_game (GamesGameIconView* self) {
	GamesGame* result;
	GamesGame* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_game;
	result = _tmp0_;
	return result;
}


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


void games_game_icon_view_set_game (GamesGameIconView* self, GamesGame* value) {
	g_return_if_fail (self != NULL);
	if (games_game_icon_view_get_game (self) != value) {
		GamesGame* _tmp0_;
		GamesGame* _tmp1_;
		GamesGame* _tmp2_;
		GamesGame* _tmp3_;
		GamesGame* _tmp4_;
		GamesGameThumbnail* _tmp5_;
		GamesGame* _tmp6_;
		GamesGame* _tmp7_;
		GamesIcon* _tmp8_;
		GamesIcon* _tmp9_;
		GamesGameThumbnail* _tmp10_;
		GamesGame* _tmp11_;
		GamesGame* _tmp12_;
		GamesCover* _tmp13_;
		GamesCover* _tmp14_;
		GtkLabel* _tmp15_;
		GamesGame* _tmp16_;
		GamesGame* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		_tmp0_ = value;
		_tmp1_ = games_game_icon_view_get_game (self);
		_tmp2_ = _tmp1_;
		if (_tmp0_ == _tmp2_) {
			return;
		}
		_tmp3_ = value;
		_tmp4_ = _g_object_ref0 (_tmp3_);
		_g_object_unref0 (self->priv->_game);
		self->priv->_game = _tmp4_;
		_tmp5_ = self->priv->thumbnail;
		_tmp6_ = games_game_icon_view_get_game (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = games_game_get_icon (_tmp7_);
		_tmp9_ = _tmp8_;
		games_game_thumbnail_set_icon (_tmp5_, _tmp9_);
		_g_object_unref0 (_tmp9_);
		_tmp10_ = self->priv->thumbnail;
		_tmp11_ = games_game_icon_view_get_game (self);
		_tmp12_ = _tmp11_;
		_tmp13_ = games_game_get_cover (_tmp12_);
		_tmp14_ = _tmp13_;
		games_game_thumbnail_set_cover (_tmp10_, _tmp14_);
		_g_object_unref0 (_tmp14_);
		_tmp15_ = self->priv->title;
		_tmp16_ = games_game_icon_view_get_game (self);
		_tmp17_ = _tmp16_;
		_tmp18_ = games_game_get_name (_tmp17_);
		_tmp19_ = _tmp18_;
		gtk_label_set_label (_tmp15_, _tmp19_);
		gtk_widget_queue_draw ((GtkWidget*) self);
		g_object_notify ((GObject *) self, "game");
	}
}


static void games_game_icon_view_class_init (GamesGameIconViewClass * klass) {
	gint GamesGameIconView_private_offset;
	games_game_icon_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesGameIconViewPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_games_game_icon_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_game_icon_view_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_game_icon_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_GAME_ICON_VIEW_GAME, g_param_spec_object ("game", "game", "game", GAMES_TYPE_GAME, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	GamesGameIconView_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/game-icon-view.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "thumbnail", FALSE, GamesGameIconView_private_offset + G_STRUCT_OFFSET (GamesGameIconViewPrivate, thumbnail));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title", FALSE, GamesGameIconView_private_offset + G_STRUCT_OFFSET (GamesGameIconViewPrivate, title));
}


static void games_game_icon_view_instance_init (GamesGameIconView * self) {
	self->priv = GAMES_GAME_ICON_VIEW_GET_PRIVATE (self);
	g_type_ensure (GAMES_TYPE_GAME_THUMBNAIL);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void games_game_icon_view_finalize (GObject * obj) {
	GamesGameIconView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_GAME_ICON_VIEW, GamesGameIconView);
	_g_object_unref0 (self->priv->_game);
	_g_object_unref0 (self->priv->thumbnail);
	_g_object_unref0 (self->priv->title);
	G_OBJECT_CLASS (games_game_icon_view_parent_class)->finalize (obj);
}


GType games_game_icon_view_get_type (void) {
	static volatile gsize games_game_icon_view_type_id__volatile = 0;
	if (g_once_init_enter (&games_game_icon_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesGameIconViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_game_icon_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesGameIconView), 0, (GInstanceInitFunc) games_game_icon_view_instance_init, NULL };
		GType games_game_icon_view_type_id;
		games_game_icon_view_type_id = g_type_register_static (gtk_box_get_type (), "GamesGameIconView", &g_define_type_info, 0);
		g_once_init_leave (&games_game_icon_view_type_id__volatile, games_game_icon_view_type_id);
	}
	return games_game_icon_view_type_id__volatile;
}


static void _vala_games_game_icon_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesGameIconView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_GAME_ICON_VIEW, GamesGameIconView);
	switch (property_id) {
		case GAMES_GAME_ICON_VIEW_GAME:
		g_value_set_object (value, games_game_icon_view_get_game (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_game_icon_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesGameIconView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_GAME_ICON_VIEW, GamesGameIconView);
	switch (property_id) {
		case GAMES_GAME_ICON_VIEW_GAME:
		games_game_icon_view_set_game (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



