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

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

#include <glib.h>
#include <glib-object.h>
#include <libgnome-games.h>
#include <stdlib.h>
#include <string.h>
#include <libtracker-sparql/tracker-sparql.h>


#define GAMES_TYPE_PLAY_STATION (games_play_station_get_type ())
#define GAMES_PLAY_STATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLAY_STATION, GamesPlayStation))
#define GAMES_PLAY_STATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PLAY_STATION, GamesPlayStationClass))
#define GAMES_IS_PLAY_STATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLAY_STATION))
#define GAMES_IS_PLAY_STATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PLAY_STATION))
#define GAMES_PLAY_STATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PLAY_STATION, GamesPlayStationClass))

typedef struct _GamesPlayStation GamesPlayStation;
typedef struct _GamesPlayStationClass GamesPlayStationClass;
typedef struct _GamesPlayStationPrivate GamesPlayStationPrivate;

#define GAMES_TYPE_PLAY_STATION_GAME_FACTORY (games_play_station_game_factory_get_type ())
#define GAMES_PLAY_STATION_GAME_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PLAY_STATION_GAME_FACTORY, GamesPlayStationGameFactory))
#define GAMES_PLAY_STATION_GAME_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PLAY_STATION_GAME_FACTORY, GamesPlayStationGameFactoryClass))
#define GAMES_IS_PLAY_STATION_GAME_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PLAY_STATION_GAME_FACTORY))
#define GAMES_IS_PLAY_STATION_GAME_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PLAY_STATION_GAME_FACTORY))
#define GAMES_PLAY_STATION_GAME_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PLAY_STATION_GAME_FACTORY, GamesPlayStationGameFactoryClass))

typedef struct _GamesPlayStationGameFactory GamesPlayStationGameFactory;
typedef struct _GamesPlayStationGameFactoryClass GamesPlayStationGameFactoryClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesPlayStation {
	GObject parent_instance;
	GamesPlayStationPrivate * priv;
};

struct _GamesPlayStationClass {
	GObjectClass parent_class;
};


static gpointer games_play_station_parent_class = NULL;
static GamesPluginIface * games_play_station_games_plugin_parent_iface = NULL;
static GType games_play_station_type_id = 0;

GType games_play_station_get_type (void) G_GNUC_CONST;
enum  {
	GAMES_PLAY_STATION_DUMMY_PROPERTY
};
#define GAMES_PLAY_STATION_SEARCHED_MIME_TYPE "application/x-cue"
static GamesGameSource* games_play_station_real_get_game_source (GamesPlugin* base, GError** error);
GType games_play_station_game_factory_get_type (void) G_GNUC_CONST;
GamesPlayStationGameFactory* games_play_station_game_factory_new (void);
GamesPlayStationGameFactory* games_play_station_game_factory_construct (GType object_type);
GamesPlayStation* games_play_station_new (void);
GamesPlayStation* games_play_station_construct (GType object_type);
GType register_games_plugin (GTypeModule* module);
GType games_play_station_game_factory_register_type (GTypeModule * module);
GType games_play_station_header_register_type (GTypeModule * module);
GType games_play_station_register_type (GTypeModule * module);
GType games_play_station_uid_register_type (GTypeModule * module);


static GamesGameSource* games_play_station_real_get_game_source (GamesPlugin* base, GError** error) {
	GamesPlayStation * self;
	GamesGameSource* result = NULL;
	GamesPlayStationGameFactory* factory;
	GamesPlayStationGameFactory* _tmp0_;
	GamesMimeTypeTrackerQuery* query;
	GamesMimeTypeTrackerQuery* _tmp1_;
	TrackerSparqlConnection* connection;
	TrackerSparqlConnection* _tmp2_;
	GamesTrackerGameSource* source;
	GamesTrackerGameSource* _tmp3_;
	GamesTrackerGameSource* _tmp4_;
	GError * _inner_error_ = NULL;
	self = (GamesPlayStation*) base;
	_tmp0_ = games_play_station_game_factory_new ();
	factory = _tmp0_;
	_tmp1_ = games_mime_type_tracker_query_new (GAMES_PLAY_STATION_SEARCHED_MIME_TYPE, (GamesUriGameFactory*) factory);
	query = _tmp1_;
	_tmp2_ = tracker_sparql_connection_get (NULL, &_inner_error_);
	connection = _tmp2_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (query);
		_g_object_unref0 (factory);
		return NULL;
	}
	_tmp3_ = games_tracker_game_source_new (connection);
	source = _tmp3_;
	_tmp4_ = source;
	games_tracker_game_source_add_query (_tmp4_, (GamesTrackerQuery*) query);
	result = (GamesGameSource*) source;
	_g_object_unref0 (connection);
	_g_object_unref0 (query);
	_g_object_unref0 (factory);
	return result;
}


GamesPlayStation* games_play_station_construct (GType object_type) {
	GamesPlayStation * self = NULL;
	self = (GamesPlayStation*) g_object_new (object_type, NULL);
	return self;
}


GamesPlayStation* games_play_station_new (void) {
	return games_play_station_construct (GAMES_TYPE_PLAY_STATION);
}


static void games_play_station_class_init (GamesPlayStationClass * klass) {
	games_play_station_parent_class = g_type_class_peek_parent (klass);
}


static void games_play_station_games_plugin_interface_init (GamesPluginIface * iface) {
	games_play_station_games_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_game_source = (GamesGameSource* (*) (GamesPlugin *, GError**)) games_play_station_real_get_game_source;
}


static void games_play_station_instance_init (GamesPlayStation * self) {
}


GType games_play_station_get_type (void) {
	return games_play_station_type_id;
}


GType games_play_station_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GamesPlayStationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_play_station_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPlayStation), 0, (GInstanceInitFunc) games_play_station_instance_init, NULL };
	static const GInterfaceInfo games_plugin_info = { (GInterfaceInitFunc) games_play_station_games_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_play_station_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesPlayStation", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_play_station_type_id, GAMES_TYPE_PLUGIN, &games_plugin_info);
	return games_play_station_type_id;
}


GType register_games_plugin (GTypeModule* module) {
	GType result = 0UL;
	g_return_val_if_fail (module != NULL, 0UL);
	games_play_station_game_factory_register_type (module);
	games_play_station_header_register_type (module);
	games_play_station_register_type (module);
	games_play_station_uid_register_type (module);
	result = GAMES_TYPE_PLAY_STATION;
	return result;
}



