/* dummy-game-source.c generated by valac 0.35.5, the Vala compiler
 * generated from dummy-game-source.vala, do not modify */

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

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


#define GAMES_TYPE_GAME_SOURCE (games_game_source_get_type ())
#define GAMES_GAME_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAME_SOURCE, GamesGameSource))
#define GAMES_IS_GAME_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAME_SOURCE))
#define GAMES_GAME_SOURCE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_GAME_SOURCE, GamesGameSourceIface))

typedef struct _GamesGameSource GamesGameSource;
typedef struct _GamesGameSourceIface GamesGameSourceIface;

#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_DUMMY_GAME_SOURCE (games_dummy_game_source_get_type ())
#define GAMES_DUMMY_GAME_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DUMMY_GAME_SOURCE, GamesDummyGameSource))
#define GAMES_DUMMY_GAME_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DUMMY_GAME_SOURCE, GamesDummyGameSourceClass))
#define GAMES_IS_DUMMY_GAME_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DUMMY_GAME_SOURCE))
#define GAMES_IS_DUMMY_GAME_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DUMMY_GAME_SOURCE))
#define GAMES_DUMMY_GAME_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DUMMY_GAME_SOURCE, GamesDummyGameSourceClass))

typedef struct _GamesDummyGameSource GamesDummyGameSource;
typedef struct _GamesDummyGameSourceClass GamesDummyGameSourceClass;
typedef struct _GamesDummyGameSourcePrivate GamesDummyGameSourcePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_DUMMY_GAME (games_dummy_game_get_type ())
#define GAMES_DUMMY_GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DUMMY_GAME, GamesDummyGame))
#define GAMES_DUMMY_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DUMMY_GAME, GamesDummyGameClass))
#define GAMES_IS_DUMMY_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DUMMY_GAME))
#define GAMES_IS_DUMMY_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DUMMY_GAME))
#define GAMES_DUMMY_GAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DUMMY_GAME, GamesDummyGameClass))

typedef struct _GamesDummyGame GamesDummyGame;
typedef struct _GamesDummyGameClass GamesDummyGameClass;
typedef struct _GamesDummyGameSourceEachGameData GamesDummyGameSourceEachGameData;

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

typedef void (*GamesGameCallback) (GamesGame* game, void* user_data);
struct _GamesGameSourceIface {
	GTypeInterface parent_iface;
	void (*each_game) (GamesGameSource* self, GamesGameCallback callback, void* callback_target, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*each_game_finish) (GamesGameSource* self, GAsyncResult* _res_);
};

struct _GamesDummyGameSource {
	GObject parent_instance;
	GamesDummyGameSourcePrivate * priv;
};

struct _GamesDummyGameSourceClass {
	GObjectClass parent_class;
};

struct _GamesDummyGameSourceEachGameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gboolean _task_complete_;
	GamesDummyGameSource* self;
	GamesGameCallback callback;
	gpointer callback_target;
	GamesGameCallback _tmp0_;
	void* _tmp0__target;
	GamesDummyGame* _tmp1_;
	GamesDummyGame* _tmp2_;
	GamesGameCallback _tmp3_;
	void* _tmp3__target;
	GamesDummyGame* _tmp4_;
	GamesDummyGame* _tmp5_;
};


static gpointer games_dummy_game_source_parent_class = NULL;
static GamesGameSourceIface * games_dummy_game_source_games_game_source_parent_iface = NULL;

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_source_get_type (void) G_GNUC_CONST;
GType games_dummy_game_source_get_type (void) G_GNUC_CONST;
enum  {
	GAMES_DUMMY_GAME_SOURCE_DUMMY_PROPERTY
};
static void games_dummy_game_source_real_each_game_data_free (gpointer _data);
static void games_dummy_game_source_real_each_game (GamesGameSource* base, GamesGameCallback callback, void* callback_target, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean games_dummy_game_source_real_each_game_co (GamesDummyGameSourceEachGameData* _data_);
GamesDummyGame* games_dummy_game_new (const gchar* name);
GamesDummyGame* games_dummy_game_construct (GType object_type, const gchar* name);
GType games_dummy_game_get_type (void) G_GNUC_CONST;
GamesDummyGameSource* games_dummy_game_source_new (void);
GamesDummyGameSource* games_dummy_game_source_construct (GType object_type);


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


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


static void games_dummy_game_source_real_each_game (GamesGameSource* base, GamesGameCallback callback, void* callback_target, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GamesDummyGameSource * self;
	GamesDummyGameSourceEachGameData* _data_;
	GamesDummyGameSource* _tmp0_;
	GamesGameCallback _tmp1_;
	void* _tmp1__target;
	self = (GamesDummyGameSource*) base;
	_data_ = g_slice_new0 (GamesDummyGameSourceEachGameData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, games_dummy_game_source_real_each_game_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = callback;
	_tmp1__target = callback_target;
	_data_->callback = _tmp1_;
	_data_->callback_target = _tmp1__target;
	games_dummy_game_source_real_each_game_co (_data_);
}


static void games_dummy_game_source_real_each_game_finish (GamesGameSource* base, GAsyncResult* _res_) {
	GamesDummyGameSourceEachGameData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	_data_->_task_complete_ = TRUE;
}


static gboolean games_dummy_game_source_real_each_game_co (GamesDummyGameSourceEachGameData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->callback;
	_data_->_tmp0__target = _data_->callback_target;
	_data_->_tmp1_ = games_dummy_game_new ("Mines");
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp0_ ((GamesGame*) _data_->_tmp2_, _data_->_tmp0__target);
	_g_object_unref0 (_data_->_tmp2_);
	_data_->_tmp3_ = _data_->callback;
	_data_->_tmp3__target = _data_->callback_target;
	_data_->_tmp4_ = games_dummy_game_new ("Sudoku");
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp3_ ((GamesGame*) _data_->_tmp5_, _data_->_tmp3__target);
	_g_object_unref0 (_data_->_tmp5_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


GamesDummyGameSource* games_dummy_game_source_construct (GType object_type) {
	GamesDummyGameSource * self = NULL;
	self = (GamesDummyGameSource*) g_object_new (object_type, NULL);
	return self;
}


GamesDummyGameSource* games_dummy_game_source_new (void) {
	return games_dummy_game_source_construct (GAMES_TYPE_DUMMY_GAME_SOURCE);
}


static void games_dummy_game_source_class_init (GamesDummyGameSourceClass * klass) {
	games_dummy_game_source_parent_class = g_type_class_peek_parent (klass);
}


static void games_dummy_game_source_games_game_source_interface_init (GamesGameSourceIface * iface) {
	games_dummy_game_source_games_game_source_parent_iface = g_type_interface_peek_parent (iface);
	iface->each_game = (void (*) (GamesGameSource *, GamesGameCallback, void*)) games_dummy_game_source_real_each_game;
	iface->each_game_finish = games_dummy_game_source_real_each_game_finish;
}


static void games_dummy_game_source_instance_init (GamesDummyGameSource * self) {
}


GType games_dummy_game_source_get_type (void) {
	static volatile gsize games_dummy_game_source_type_id__volatile = 0;
	if (g_once_init_enter (&games_dummy_game_source_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesDummyGameSourceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_dummy_game_source_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesDummyGameSource), 0, (GInstanceInitFunc) games_dummy_game_source_instance_init, NULL };
		static const GInterfaceInfo games_game_source_info = { (GInterfaceInitFunc) games_dummy_game_source_games_game_source_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType games_dummy_game_source_type_id;
		games_dummy_game_source_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesDummyGameSource", &g_define_type_info, 0);
		g_type_add_interface_static (games_dummy_game_source_type_id, GAMES_TYPE_GAME_SOURCE, &games_game_source_info);
		g_once_init_leave (&games_dummy_game_source_type_id__volatile, games_dummy_game_source_type_id);
	}
	return games_dummy_game_source_type_id__volatile;
}



