/* raw-gamepad-monitor.c generated by valac 0.35.5, the Vala compiler
 * generated from raw-gamepad-monitor.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>


#define GAMES_TYPE_RAW_GAMEPAD_MONITOR (games_raw_gamepad_monitor_get_type ())
#define GAMES_RAW_GAMEPAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_RAW_GAMEPAD_MONITOR, GamesRawGamepadMonitor))
#define GAMES_IS_RAW_GAMEPAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_RAW_GAMEPAD_MONITOR))
#define GAMES_RAW_GAMEPAD_MONITOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_RAW_GAMEPAD_MONITOR, GamesRawGamepadMonitorIface))

typedef struct _GamesRawGamepadMonitor GamesRawGamepadMonitor;
typedef struct _GamesRawGamepadMonitorIface GamesRawGamepadMonitorIface;

#define GAMES_TYPE_RAW_GAMEPAD (games_raw_gamepad_get_type ())
#define GAMES_RAW_GAMEPAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_RAW_GAMEPAD, GamesRawGamepad))
#define GAMES_IS_RAW_GAMEPAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_RAW_GAMEPAD))
#define GAMES_RAW_GAMEPAD_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_RAW_GAMEPAD, GamesRawGamepadIface))

typedef struct _GamesRawGamepad GamesRawGamepad;
typedef struct _GamesRawGamepadIface GamesRawGamepadIface;
enum  {
	GAMES_RAW_GAMEPAD_MONITOR_GAMEPAD_PLUGGED_SIGNAL,
	GAMES_RAW_GAMEPAD_MONITOR_LAST_SIGNAL
};
static guint games_raw_gamepad_monitor_signals[GAMES_RAW_GAMEPAD_MONITOR_LAST_SIGNAL] = {0};

struct _GamesRawGamepadIface {
	GTypeInterface parent_iface;
	const gchar* (*get_guid) (GamesRawGamepad* self);
};

typedef void (*GamesRawGamepadCallback) (GamesRawGamepad* raw_gamepad, void* user_data);
struct _GamesRawGamepadMonitorIface {
	GTypeInterface parent_iface;
	void (*foreach_gamepad) (GamesRawGamepadMonitor* self, GamesRawGamepadCallback callback, void* callback_target);
};



GType games_raw_gamepad_get_type (void) G_GNUC_CONST;
GType games_raw_gamepad_monitor_get_type (void) G_GNUC_CONST;
void games_raw_gamepad_monitor_foreach_gamepad (GamesRawGamepadMonitor* self, GamesRawGamepadCallback callback, void* callback_target);


/**
 * This function allows to iterate over all gamepads
 * @param   callback            The callback
 */
void games_raw_gamepad_monitor_foreach_gamepad (GamesRawGamepadMonitor* self, GamesRawGamepadCallback callback, void* callback_target) {
	g_return_if_fail (self != NULL);
	GAMES_RAW_GAMEPAD_MONITOR_GET_INTERFACE (self)->foreach_gamepad (self, callback, callback_target);
}


static void games_raw_gamepad_monitor_base_init (GamesRawGamepadMonitorIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
		/**
		 * This signal should be emmited when a gamepad is plugged in.
		 * @param   raw_gamepad   The raw gamepad
		 */
		games_raw_gamepad_monitor_signals[GAMES_RAW_GAMEPAD_MONITOR_GAMEPAD_PLUGGED_SIGNAL] = g_signal_new ("gamepad_plugged", GAMES_TYPE_RAW_GAMEPAD_MONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GAMES_TYPE_RAW_GAMEPAD);
	}
}


/**
 * This is one of the interfaces that needs to be implemented by the driver.
 */
GType games_raw_gamepad_monitor_get_type (void) {
	static volatile gsize games_raw_gamepad_monitor_type_id__volatile = 0;
	if (g_once_init_enter (&games_raw_gamepad_monitor_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesRawGamepadMonitorIface), (GBaseInitFunc) games_raw_gamepad_monitor_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType games_raw_gamepad_monitor_type_id;
		games_raw_gamepad_monitor_type_id = g_type_register_static (G_TYPE_INTERFACE, "GamesRawGamepadMonitor", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (games_raw_gamepad_monitor_type_id, G_TYPE_OBJECT);
		g_once_init_leave (&games_raw_gamepad_monitor_type_id__volatile, games_raw_gamepad_monitor_type_id);
	}
	return games_raw_gamepad_monitor_type_id__volatile;
}



