/* desktop-plugin.c generated by valac 0.35.5, the Vala compiler
 * generated from desktop-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 <libtracker-sparql/tracker-sparql.h>


#define GAMES_TYPE_DESKTOP_PLUGIN (games_desktop_plugin_get_type ())
#define GAMES_DESKTOP_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DESKTOP_PLUGIN, GamesDesktopPlugin))
#define GAMES_DESKTOP_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DESKTOP_PLUGIN, GamesDesktopPluginClass))
#define GAMES_IS_DESKTOP_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DESKTOP_PLUGIN))
#define GAMES_IS_DESKTOP_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DESKTOP_PLUGIN))
#define GAMES_DESKTOP_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DESKTOP_PLUGIN, GamesDesktopPluginClass))

typedef struct _GamesDesktopPlugin GamesDesktopPlugin;
typedef struct _GamesDesktopPluginClass GamesDesktopPluginClass;
typedef struct _GamesDesktopPluginPrivate GamesDesktopPluginPrivate;

#define GAMES_TYPE_DESKTOP_TRACKER_QUERY (games_desktop_tracker_query_get_type ())
#define GAMES_DESKTOP_TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DESKTOP_TRACKER_QUERY, GamesDesktopTrackerQuery))
#define GAMES_DESKTOP_TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DESKTOP_TRACKER_QUERY, GamesDesktopTrackerQueryClass))
#define GAMES_IS_DESKTOP_TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DESKTOP_TRACKER_QUERY))
#define GAMES_IS_DESKTOP_TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DESKTOP_TRACKER_QUERY))
#define GAMES_DESKTOP_TRACKER_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DESKTOP_TRACKER_QUERY, GamesDesktopTrackerQueryClass))

typedef struct _GamesDesktopTrackerQuery GamesDesktopTrackerQuery;
typedef struct _GamesDesktopTrackerQueryClass GamesDesktopTrackerQueryClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesDesktopPlugin {
	GObject parent_instance;
	GamesDesktopPluginPrivate * priv;
};

struct _GamesDesktopPluginClass {
	GObjectClass parent_class;
};


static gpointer games_desktop_plugin_parent_class = NULL;
static GamesPluginIface * games_desktop_plugin_games_plugin_parent_iface = NULL;
static GType games_desktop_plugin_type_id = 0;

GType games_desktop_plugin_get_type (void) G_GNUC_CONST;
enum  {
	GAMES_DESKTOP_PLUGIN_DUMMY_PROPERTY
};
static GamesGameSource* games_desktop_plugin_real_get_game_source (GamesPlugin* base, GError** error);
GamesDesktopTrackerQuery* games_desktop_tracker_query_new (void);
GamesDesktopTrackerQuery* games_desktop_tracker_query_construct (GType object_type);
GType games_desktop_tracker_query_get_type (void) G_GNUC_CONST;
GamesDesktopPlugin* games_desktop_plugin_new (void);
GamesDesktopPlugin* games_desktop_plugin_construct (GType object_type);
GType register_games_plugin (GTypeModule* module);
GType games_desktop_icon_register_type (GTypeModule * module);
GType games_desktop_plugin_register_type (GTypeModule * module);
GType games_desktop_title_register_type (GTypeModule * module);
GType games_desktop_tracker_query_register_type (GTypeModule * module);


static GamesGameSource* games_desktop_plugin_real_get_game_source (GamesPlugin* base, GError** error) {
	GamesDesktopPlugin * self;
	GamesGameSource* result = NULL;
	TrackerSparqlConnection* connection;
	TrackerSparqlConnection* _tmp0_;
	GamesTrackerGameSource* source;
	GamesTrackerGameSource* _tmp1_;
	GamesTrackerGameSource* _tmp2_;
	GamesDesktopTrackerQuery* _tmp3_;
	GamesDesktopTrackerQuery* _tmp4_;
	GError * _inner_error_ = NULL;
	self = (GamesDesktopPlugin*) base;
	_tmp0_ = tracker_sparql_connection_get (NULL, &_inner_error_);
	connection = _tmp0_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		return NULL;
	}
	_tmp1_ = games_tracker_game_source_new (connection);
	source = _tmp1_;
	_tmp2_ = source;
	_tmp3_ = games_desktop_tracker_query_new ();
	_tmp4_ = _tmp3_;
	games_tracker_game_source_add_query (_tmp2_, (GamesTrackerQuery*) _tmp4_);
	_g_object_unref0 (_tmp4_);
	result = (GamesGameSource*) source;
	_g_object_unref0 (connection);
	return result;
}


GamesDesktopPlugin* games_desktop_plugin_construct (GType object_type) {
	GamesDesktopPlugin * self = NULL;
	self = (GamesDesktopPlugin*) g_object_new (object_type, NULL);
	return self;
}


GamesDesktopPlugin* games_desktop_plugin_new (void) {
	return games_desktop_plugin_construct (GAMES_TYPE_DESKTOP_PLUGIN);
}


static void games_desktop_plugin_class_init (GamesDesktopPluginClass * klass) {
	games_desktop_plugin_parent_class = g_type_class_peek_parent (klass);
}


static void games_desktop_plugin_games_plugin_interface_init (GamesPluginIface * iface) {
	games_desktop_plugin_games_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_game_source = (GamesGameSource* (*) (GamesPlugin *, GError**)) games_desktop_plugin_real_get_game_source;
}


static void games_desktop_plugin_instance_init (GamesDesktopPlugin * self) {
}


GType games_desktop_plugin_get_type (void) {
	return games_desktop_plugin_type_id;
}


GType games_desktop_plugin_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GamesDesktopPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_desktop_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesDesktopPlugin), 0, (GInstanceInitFunc) games_desktop_plugin_instance_init, NULL };
	static const GInterfaceInfo games_plugin_info = { (GInterfaceInitFunc) games_desktop_plugin_games_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_desktop_plugin_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesDesktopPlugin", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_desktop_plugin_type_id, GAMES_TYPE_PLUGIN, &games_plugin_info);
	return games_desktop_plugin_type_id;
}


GType register_games_plugin (GTypeModule* module) {
	GType result = 0UL;
	g_return_val_if_fail (module != NULL, 0UL);
	games_desktop_icon_register_type (module);
	games_desktop_plugin_register_type (module);
	games_desktop_title_register_type (module);
	games_desktop_tracker_query_register_type (module);
	result = GAMES_TYPE_DESKTOP_PLUGIN;
	return result;
}



