/* preferences-subpage-keyboard.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from preferences-subpage-keyboard.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "linux/input-event-codes.h"
#include <glib/gi18n-lib.h>
#include <retro-gtk.h>
#include <float.h>
#include <math.h>
#include "gnome-games.h"

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define GAMES_TYPE_PREFERENCES_SUBPAGE (games_preferences_subpage_get_type ())
#define GAMES_PREFERENCES_SUBPAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_SUBPAGE, GamesPreferencesSubpage))
#define GAMES_IS_PREFERENCES_SUBPAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_SUBPAGE))
#define GAMES_PREFERENCES_SUBPAGE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_PREFERENCES_SUBPAGE, GamesPreferencesSubpageIface))

typedef struct _GamesPreferencesSubpage GamesPreferencesSubpage;
typedef struct _GamesPreferencesSubpageIface GamesPreferencesSubpageIface;

#define GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD (games_preferences_subpage_keyboard_get_type ())
#define GAMES_PREFERENCES_SUBPAGE_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD, GamesPreferencesSubpageKeyboard))
#define GAMES_PREFERENCES_SUBPAGE_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD, GamesPreferencesSubpageKeyboardClass))
#define GAMES_IS_PREFERENCES_SUBPAGE_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD))
#define GAMES_IS_PREFERENCES_SUBPAGE_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD))
#define GAMES_PREFERENCES_SUBPAGE_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD, GamesPreferencesSubpageKeyboardClass))

typedef struct _GamesPreferencesSubpageKeyboard GamesPreferencesSubpageKeyboard;
typedef struct _GamesPreferencesSubpageKeyboardClass GamesPreferencesSubpageKeyboardClass;
typedef struct _GamesPreferencesSubpageKeyboardPrivate GamesPreferencesSubpageKeyboardPrivate;
typedef enum  {
	GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST,
	GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_CONFIGURE
} GamesPreferencesSubpageKeyboardState;

#define GAMES_PREFERENCES_SUBPAGE_KEYBOARD_TYPE_STATE (games_preferences_subpage_keyboard_state_get_type ())

#define GAMES_TYPE_KEYBOARD_MAPPER (games_keyboard_mapper_get_type ())
#define GAMES_KEYBOARD_MAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_KEYBOARD_MAPPER, GamesKeyboardMapper))
#define GAMES_KEYBOARD_MAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_KEYBOARD_MAPPER, GamesKeyboardMapperClass))
#define GAMES_IS_KEYBOARD_MAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_KEYBOARD_MAPPER))
#define GAMES_IS_KEYBOARD_MAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_KEYBOARD_MAPPER))
#define GAMES_KEYBOARD_MAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_KEYBOARD_MAPPER, GamesKeyboardMapperClass))

typedef struct _GamesKeyboardMapper GamesKeyboardMapper;
typedef struct _GamesKeyboardMapperClass GamesKeyboardMapperClass;

#define GAMES_TYPE_KEYBOARD_TESTER (games_keyboard_tester_get_type ())
#define GAMES_KEYBOARD_TESTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_KEYBOARD_TESTER, GamesKeyboardTester))
#define GAMES_KEYBOARD_TESTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_KEYBOARD_TESTER, GamesKeyboardTesterClass))
#define GAMES_IS_KEYBOARD_TESTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_KEYBOARD_TESTER))
#define GAMES_IS_KEYBOARD_TESTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_KEYBOARD_TESTER))
#define GAMES_KEYBOARD_TESTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_KEYBOARD_TESTER, GamesKeyboardTesterClass))

typedef struct _GamesKeyboardTester GamesKeyboardTester;
typedef struct _GamesKeyboardTesterClass GamesKeyboardTesterClass;

#define GAMES_TYPE_KEYBOARD_MAPPING_MANAGER (games_keyboard_mapping_manager_get_type ())
#define GAMES_KEYBOARD_MAPPING_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_KEYBOARD_MAPPING_MANAGER, GamesKeyboardMappingManager))
#define GAMES_KEYBOARD_MAPPING_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_KEYBOARD_MAPPING_MANAGER, GamesKeyboardMappingManagerClass))
#define GAMES_IS_KEYBOARD_MAPPING_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_KEYBOARD_MAPPING_MANAGER))
#define GAMES_IS_KEYBOARD_MAPPING_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_KEYBOARD_MAPPING_MANAGER))
#define GAMES_KEYBOARD_MAPPING_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_KEYBOARD_MAPPING_MANAGER, GamesKeyboardMappingManagerClass))

typedef struct _GamesKeyboardMappingManager GamesKeyboardMappingManager;
typedef struct _GamesKeyboardMappingManagerClass GamesKeyboardMappingManagerClass;
enum  {
	GAMES_PREFERENCES_SUBPAGE_KEYBOARD_0_PROPERTY,
	GAMES_PREFERENCES_SUBPAGE_KEYBOARD_ALLOW_BACK_PROPERTY,
	GAMES_PREFERENCES_SUBPAGE_KEYBOARD_INFO_MESSAGE_PROPERTY,
	GAMES_PREFERENCES_SUBPAGE_KEYBOARD_NUM_PROPERTIES
};
static GParamSpec* games_preferences_subpage_keyboard_properties[GAMES_PREFERENCES_SUBPAGE_KEYBOARD_NUM_PROPERTIES];

#define GAMES_TYPE_GAMEPAD_INPUT (games_gamepad_input_get_type ())
typedef struct _GamesGamepadInput GamesGamepadInput;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block21Data Block21Data;

#define GAMES_TYPE_GAMEPAD_VIEW_CONFIGURATION (games_gamepad_view_configuration_get_type ())
typedef struct _GamesGamepadViewConfiguration GamesGamepadViewConfiguration;

#define GAMES_TYPE_GAMEPAD_BUTTON_PATH (games_gamepad_button_path_get_type ())
typedef struct _GamesGamepadButtonPath GamesGamepadButtonPath;

#define GAMES_TYPE_GAMEPAD_ANALOG_PATH (games_gamepad_analog_path_get_type ())
typedef struct _GamesGamepadAnalogPath GamesGamepadAnalogPath;

struct _GamesPreferencesSubpageIface {
	GTypeInterface parent_iface;
	gboolean (*get_allow_back) (GamesPreferencesSubpage* self);
	void (*set_allow_back) (GamesPreferencesSubpage* self, gboolean value);
};

struct _GamesPreferencesSubpageKeyboard {
	GtkBin parent_instance;
	GamesPreferencesSubpageKeyboardPrivate * priv;
};

struct _GamesPreferencesSubpageKeyboardClass {
	GtkBinClass parent_class;
};

struct _GamesPreferencesSubpageKeyboardPrivate {
	GamesPreferencesSubpageKeyboardState _state;
	gboolean _allow_back;
	gchar* _info_message;
	GtkStack* stack;
	GtkBox* tester_box;
	GtkBox* mapper_box;
	GtkButton* reset_button;
	GamesKeyboardMapper* mapper;
	GamesKeyboardTester* tester;
	GamesKeyboardMappingManager* mapping_manager;
};

struct _GamesGamepadInput {
	guint16 type;
	guint16 code;
};

struct _Block21Data {
	int _ref_count_;
	GamesPreferencesSubpageKeyboard* self;
	GtkMessageDialog* dialog;
};

struct _GamesGamepadButtonPath {
	GamesGamepadInput input;
	gchar* path;
};

struct _GamesGamepadAnalogPath {
	GamesGamepadInput input_x;
	GamesGamepadInput input_y;
	gdouble offset_radius;
	gchar* path;
};

struct _GamesGamepadViewConfiguration {
	gchar* svg_path;
	GamesGamepadButtonPath* button_paths;
	gint button_paths_length1;
	gint _button_paths_size_;
	GamesGamepadAnalogPath* analog_paths;
	gint analog_paths_length1;
	gint _analog_paths_size_;
	gchar** background_paths;
	gint background_paths_length1;
	gint _background_paths_size_;
};

static gint GamesPreferencesSubpageKeyboard_private_offset;
static gpointer games_preferences_subpage_keyboard_parent_class = NULL;
static GamesPreferencesSubpageIface * games_preferences_subpage_keyboard_games_preferences_subpage_parent_iface = NULL;

VALA_EXTERN GType games_preferences_subpage_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_preferences_subpage_keyboard_get_type (void) G_GNUC_CONST ;
static GType games_preferences_subpage_keyboard_state_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
VALA_EXTERN GType games_keyboard_mapper_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_keyboard_tester_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_keyboard_mapping_manager_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_gamepad_input_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesGamepadInput* games_gamepad_input_dup (const GamesGamepadInput* self);
VALA_EXTERN void games_gamepad_input_free (GamesGamepadInput* self);
static void games_preferences_subpage_keyboard_on_reset_clicked (GamesPreferencesSubpageKeyboard* self);
static void games_preferences_subpage_keyboard_reset_mapping (GamesPreferencesSubpageKeyboard* self);
static void _games_preferences_subpage_keyboard_on_reset_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                              gpointer self);
static void games_preferences_subpage_keyboard_on_configure_clicked (GamesPreferencesSubpageKeyboard* self);
static void games_preferences_subpage_keyboard_set_state (GamesPreferencesSubpageKeyboard* self,
                                                   GamesPreferencesSubpageKeyboardState value);
static void _games_preferences_subpage_keyboard_on_configure_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                  gpointer self);
static void games_preferences_subpage_keyboard_on_skip_clicked (GamesPreferencesSubpageKeyboard* self);
VALA_EXTERN void games_keyboard_mapper_skip (GamesKeyboardMapper* self);
static void _games_preferences_subpage_keyboard_on_skip_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                             gpointer self);
static void games_preferences_subpage_keyboard_on_back_clicked (GamesPreferencesSubpageKeyboard* self);
static void _games_preferences_subpage_keyboard_on_back_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                             gpointer self);
static void games_preferences_subpage_keyboard_on_cancel_clicked (GamesPreferencesSubpageKeyboard* self);
static void _games_preferences_subpage_keyboard_on_cancel_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                               gpointer self);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static void __lambda87_ (Block21Data* _data21_,
                  gint response);
VALA_EXTERN void games_keyboard_mapping_manager_delete_mapping (GamesKeyboardMappingManager* self);
static void ___lambda87__gtk_dialog_response (GtkDialog* _sender,
                                       gint response_id,
                                       gpointer self);
static void games_preferences_subpage_keyboard_on_mapper_finished (GamesPreferencesSubpageKeyboard* self,
                                                            RetroKeyJoypadMapping* mapping);
VALA_EXTERN void games_keyboard_mapping_manager_save_mapping (GamesKeyboardMappingManager* self,
                                                  RetroKeyJoypadMapping* mapping);
VALA_EXTERN GamesPreferencesSubpageKeyboard* games_preferences_subpage_keyboard_new (void);
VALA_EXTERN GamesPreferencesSubpageKeyboard* games_preferences_subpage_keyboard_construct (GType object_type);
static GamesPreferencesSubpageKeyboardState games_preferences_subpage_keyboard_get_state (GamesPreferencesSubpageKeyboard* self);
VALA_EXTERN void games_preferences_subpage_set_allow_back (GamesPreferencesSubpage* self,
                                               gboolean value);
VALA_EXTERN gboolean games_keyboard_mapping_manager_is_default (GamesKeyboardMappingManager* self);
VALA_EXTERN void games_keyboard_tester_start (GamesKeyboardTester* self);
VALA_EXTERN void games_keyboard_mapper_stop (GamesKeyboardMapper* self);
static void _games_preferences_subpage_keyboard_on_mapper_finished_games_keyboard_mapper_finished (GamesKeyboardMapper* _sender,
                                                                                            RetroKeyJoypadMapping* mapping,
                                                                                            gpointer self);
VALA_EXTERN void games_keyboard_tester_stop (GamesKeyboardTester* self);
VALA_EXTERN void games_keyboard_mapper_start (GamesKeyboardMapper* self);
VALA_EXTERN const gchar* games_preferences_subpage_keyboard_get_info_message (GamesPreferencesSubpageKeyboard* self);
VALA_EXTERN void games_preferences_subpage_keyboard_set_info_message (GamesPreferencesSubpageKeyboard* self,
                                                          const gchar* value);
static GObject * games_preferences_subpage_keyboard_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
VALA_EXTERN GType games_gamepad_view_configuration_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_gamepad_button_path_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesGamepadButtonPath* games_gamepad_button_path_dup (const GamesGamepadButtonPath* self);
VALA_EXTERN void games_gamepad_button_path_free (GamesGamepadButtonPath* self);
VALA_EXTERN void games_gamepad_button_path_copy (const GamesGamepadButtonPath* self,
                                     GamesGamepadButtonPath* dest);
VALA_EXTERN void games_gamepad_button_path_destroy (GamesGamepadButtonPath* self);
VALA_EXTERN GType games_gamepad_analog_path_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesGamepadAnalogPath* games_gamepad_analog_path_dup (const GamesGamepadAnalogPath* self);
VALA_EXTERN void games_gamepad_analog_path_free (GamesGamepadAnalogPath* self);
VALA_EXTERN void games_gamepad_analog_path_copy (const GamesGamepadAnalogPath* self,
                                     GamesGamepadAnalogPath* dest);
VALA_EXTERN void games_gamepad_analog_path_destroy (GamesGamepadAnalogPath* self);
VALA_EXTERN GamesGamepadViewConfiguration* games_gamepad_view_configuration_dup (const GamesGamepadViewConfiguration* self);
VALA_EXTERN void games_gamepad_view_configuration_free (GamesGamepadViewConfiguration* self);
VALA_EXTERN void games_gamepad_view_configuration_copy (const GamesGamepadViewConfiguration* self,
                                            GamesGamepadViewConfiguration* dest);
VALA_EXTERN void games_gamepad_view_configuration_destroy (GamesGamepadViewConfiguration* self);
VALA_EXTERN void games_gamepad_view_configuration_get_default (GamesGamepadViewConfiguration* result);
VALA_EXTERN GamesKeyboardMapper* games_keyboard_mapper_new (GamesGamepadViewConfiguration* configuration,
                                                GamesGamepadInput* mapping_inputs,
                                                gint mapping_inputs_length1);
VALA_EXTERN GamesKeyboardMapper* games_keyboard_mapper_construct (GType object_type,
                                                      GamesGamepadViewConfiguration* configuration,
                                                      GamesGamepadInput* mapping_inputs,
                                                      gint mapping_inputs_length1);
VALA_EXTERN GamesKeyboardTester* games_keyboard_tester_new (GamesGamepadViewConfiguration* configuration);
VALA_EXTERN GamesKeyboardTester* games_keyboard_tester_construct (GType object_type,
                                                      GamesGamepadViewConfiguration* configuration);
VALA_EXTERN GamesKeyboardMappingManager* games_keyboard_mapping_manager_new (void);
VALA_EXTERN GamesKeyboardMappingManager* games_keyboard_mapping_manager_construct (GType object_type);
VALA_EXTERN RetroKeyJoypadMapping* games_keyboard_mapping_manager_get_mapping (GamesKeyboardMappingManager* self);
VALA_EXTERN void games_keyboard_tester_set_mapping (GamesKeyboardTester* self,
                                        RetroKeyJoypadMapping* value);
static void _games_preferences_subpage_keyboard___lambda88_ (GamesPreferencesSubpageKeyboard* self);
static void __games_preferences_subpage_keyboard___lambda88__games_keyboard_mapping_manager_changed (GamesKeyboardMappingManager* _sender,
                                                                                              gpointer self);
VALA_EXTERN gboolean games_preferences_subpage_get_allow_back (GamesPreferencesSubpage* self);
static void games_preferences_subpage_keyboard_finalize (GObject * obj);
static GType games_preferences_subpage_keyboard_get_type_once (void);
static void _vala_games_preferences_subpage_keyboard_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_games_preferences_subpage_keyboard_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GamesGamepadInput GAMES_PREFERENCES_SUBPAGE_KEYBOARD_KEYBOARD_GAMEPAD_INPUTS[16] = {{EV_KEY, BTN_EAST}, {EV_KEY, BTN_SOUTH}, {EV_KEY, BTN_WEST}, {EV_KEY, BTN_NORTH}, {EV_KEY, BTN_START}, {EV_KEY, BTN_SELECT}, {EV_KEY, BTN_THUMBL}, {EV_KEY, BTN_THUMBR}, {EV_KEY, BTN_TL}, {EV_KEY, BTN_TR}, {EV_KEY, BTN_DPAD_UP}, {EV_KEY, BTN_DPAD_LEFT}, {EV_KEY, BTN_DPAD_DOWN}, {EV_KEY, BTN_DPAD_RIGHT}, {EV_KEY, BTN_TL2}, {EV_KEY, BTN_TR2}};

static inline gpointer
games_preferences_subpage_keyboard_get_instance_private (GamesPreferencesSubpageKeyboard* self)
{
	return G_STRUCT_MEMBER_P (self, GamesPreferencesSubpageKeyboard_private_offset);
}

static GType
games_preferences_subpage_keyboard_state_get_type_once (void)
{
	static const GEnumValue values[] = {{GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST, "GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST", "test"}, {GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_CONFIGURE, "GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_CONFIGURE", "configure"}, {0, NULL, NULL}};
	GType games_preferences_subpage_keyboard_state_type_id;
	games_preferences_subpage_keyboard_state_type_id = g_enum_register_static ("GamesPreferencesSubpageKeyboardState", values);
	return games_preferences_subpage_keyboard_state_type_id;
}

static GType
games_preferences_subpage_keyboard_state_get_type (void)
{
	static volatile gsize games_preferences_subpage_keyboard_state_type_id__once = 0;
	if (g_once_init_enter (&games_preferences_subpage_keyboard_state_type_id__once)) {
		GType games_preferences_subpage_keyboard_state_type_id;
		games_preferences_subpage_keyboard_state_type_id = games_preferences_subpage_keyboard_state_get_type_once ();
		g_once_init_leave (&games_preferences_subpage_keyboard_state_type_id__once, games_preferences_subpage_keyboard_state_type_id);
	}
	return games_preferences_subpage_keyboard_state_type_id__once;
}

static void
games_preferences_subpage_keyboard_on_reset_clicked (GamesPreferencesSubpageKeyboard* self)
{
	g_return_if_fail (self != NULL);
	games_preferences_subpage_keyboard_reset_mapping (self);
}

static void
_games_preferences_subpage_keyboard_on_reset_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                         gpointer self)
{
	games_preferences_subpage_keyboard_on_reset_clicked ((GamesPreferencesSubpageKeyboard*) self);
}

static void
games_preferences_subpage_keyboard_on_configure_clicked (GamesPreferencesSubpageKeyboard* self)
{
	g_return_if_fail (self != NULL);
	games_preferences_subpage_keyboard_set_state (self, GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_CONFIGURE);
}

static void
_games_preferences_subpage_keyboard_on_configure_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                             gpointer self)
{
	games_preferences_subpage_keyboard_on_configure_clicked ((GamesPreferencesSubpageKeyboard*) self);
}

static void
games_preferences_subpage_keyboard_on_skip_clicked (GamesPreferencesSubpageKeyboard* self)
{
	GamesKeyboardMapper* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mapper;
	games_keyboard_mapper_skip (_tmp0_);
}

static void
_games_preferences_subpage_keyboard_on_skip_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                        gpointer self)
{
	games_preferences_subpage_keyboard_on_skip_clicked ((GamesPreferencesSubpageKeyboard*) self);
}

static void
games_preferences_subpage_keyboard_on_back_clicked (GamesPreferencesSubpageKeyboard* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit_by_name ((GamesPreferencesSubpage*) self, "back");
}

static void
_games_preferences_subpage_keyboard_on_back_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                        gpointer self)
{
	games_preferences_subpage_keyboard_on_back_clicked ((GamesPreferencesSubpageKeyboard*) self);
}

static void
games_preferences_subpage_keyboard_on_cancel_clicked (GamesPreferencesSubpageKeyboard* self)
{
	g_return_if_fail (self != NULL);
	games_preferences_subpage_keyboard_set_state (self, GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST);
}

static void
_games_preferences_subpage_keyboard_on_cancel_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self)
{
	games_preferences_subpage_keyboard_on_cancel_clicked ((GamesPreferencesSubpageKeyboard*) self);
}

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		GamesPreferencesSubpageKeyboard* self;
		self = _data21_->self;
		_g_object_unref0 (_data21_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

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

static void
__lambda87_ (Block21Data* _data21_,
             gint response)
{
	GamesPreferencesSubpageKeyboard* self;
	self = _data21_->self;
	switch (response) {
		case GTK_RESPONSE_ACCEPT:
		{
			GamesKeyboardMappingManager* _tmp0_;
			GtkButton* _tmp1_;
			_tmp0_ = self->priv->mapping_manager;
			games_keyboard_mapping_manager_delete_mapping (_tmp0_);
			_tmp1_ = self->priv->reset_button;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, FALSE);
			break;
		}
		default:
		{
			break;
		}
	}
	gtk_widget_destroy ((GtkWidget*) _data21_->dialog);
}

static void
___lambda87__gtk_dialog_response (GtkDialog* _sender,
                                  gint response_id,
                                  gpointer self)
{
	__lambda87_ (self, response_id);
}

static void
games_preferences_subpage_keyboard_reset_mapping (GamesPreferencesSubpageKeyboard* self)
{
	Block21Data* _data21_;
	GtkWidget* _tmp0_;
	GtkMessageDialog* _tmp1_;
	GtkWidget* button = NULL;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GtkStyleContext* _tmp4_;
	g_return_if_fail (self != NULL);
	_data21_ = g_slice_new0 (Block21Data);
	_data21_->_ref_count_ = 1;
	_data21_->self = g_object_ref (self);
	_tmp0_ = gtk_widget_get_toplevel ((GtkWidget*) self);
	_tmp1_ = (GtkMessageDialog*) gtk_message_dialog_new (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_window_get_type ()) ? ((GtkWindow*) _tmp0_) : NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, "%s", _ ("Factory reset mapping for this controller?"));
	g_object_ref_sink (_tmp1_);
	_data21_->dialog = _tmp1_;
	gtk_message_dialog_format_secondary_text (_data21_->dialog, "%s", _ ("Your mapping will be lost"));
	_tmp2_ = gtk_dialog_add_button ((GtkDialog*) _data21_->dialog, C_ ("Confirm controller configuration factory reset", "_Reset"), (gint) GTK_RESPONSE_ACCEPT);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	button = _tmp3_;
	_tmp4_ = gtk_widget_get_style_context (button);
	gtk_style_context_add_class (_tmp4_, "destructive-action");
	g_signal_connect_data ((GtkDialog*) _data21_->dialog, "response", (GCallback) ___lambda87__gtk_dialog_response, block21_data_ref (_data21_), (GClosureNotify) block21_data_unref, 0);
	gtk_window_present ((GtkWindow*) _data21_->dialog);
	_g_object_unref0 (button);
	block21_data_unref (_data21_);
	_data21_ = NULL;
}

static void
games_preferences_subpage_keyboard_on_mapper_finished (GamesPreferencesSubpageKeyboard* self,
                                                       RetroKeyJoypadMapping* mapping)
{
	GamesKeyboardMappingManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (mapping != NULL);
	_tmp0_ = self->priv->mapping_manager;
	games_keyboard_mapping_manager_save_mapping (_tmp0_, mapping);
	games_preferences_subpage_keyboard_set_state (self, GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST);
}

GamesPreferencesSubpageKeyboard*
games_preferences_subpage_keyboard_construct (GType object_type)
{
	GamesPreferencesSubpageKeyboard * self = NULL;
	self = (GamesPreferencesSubpageKeyboard*) g_object_new (object_type, NULL);
	return self;
}

GamesPreferencesSubpageKeyboard*
games_preferences_subpage_keyboard_new (void)
{
	return games_preferences_subpage_keyboard_construct (GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD);
}

static GamesPreferencesSubpageKeyboardState
games_preferences_subpage_keyboard_get_state (GamesPreferencesSubpageKeyboard* self)
{
	GamesPreferencesSubpageKeyboardState result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_state;
	return result;
}

static void
_games_preferences_subpage_keyboard_on_mapper_finished_games_keyboard_mapper_finished (GamesKeyboardMapper* _sender,
                                                                                       RetroKeyJoypadMapping* mapping,
                                                                                       gpointer self)
{
	games_preferences_subpage_keyboard_on_mapper_finished ((GamesPreferencesSubpageKeyboard*) self, mapping);
}

static void
games_preferences_subpage_keyboard_set_state (GamesPreferencesSubpageKeyboard* self,
                                              GamesPreferencesSubpageKeyboardState value)
{
	GamesPreferencesSubpageKeyboardState _tmp0_;
	GamesPreferencesSubpageKeyboardState _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_state = value;
	_tmp0_ = games_preferences_subpage_keyboard_get_state (self);
	_tmp1_ = _tmp0_;
	games_preferences_subpage_set_allow_back ((GamesPreferencesSubpage*) self, _tmp1_ == GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST);
	switch (value) {
		case GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST:
		{
			GtkButton* _tmp2_;
			GamesKeyboardMappingManager* _tmp3_;
			GtkStack* _tmp4_;
			GtkBox* _tmp5_;
			GamesKeyboardTester* _tmp6_;
			GamesKeyboardMapper* _tmp7_;
			GamesKeyboardMapper* _tmp8_;
			guint _tmp9_;
			_tmp2_ = self->priv->reset_button;
			_tmp3_ = self->priv->mapping_manager;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, !games_keyboard_mapping_manager_is_default (_tmp3_));
			_tmp4_ = self->priv->stack;
			_tmp5_ = self->priv->tester_box;
			gtk_stack_set_visible_child (_tmp4_, (GtkWidget*) _tmp5_);
			_tmp6_ = self->priv->tester;
			games_keyboard_tester_start (_tmp6_);
			_tmp7_ = self->priv->mapper;
			games_keyboard_mapper_stop (_tmp7_);
			_tmp8_ = self->priv->mapper;
			g_signal_parse_name ("finished", GAMES_TYPE_KEYBOARD_MAPPER, &_tmp9_, NULL, FALSE);
			g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _games_preferences_subpage_keyboard_on_mapper_finished_games_keyboard_mapper_finished, self);
			break;
		}
		case GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_CONFIGURE:
		{
			GtkStack* _tmp10_;
			GtkBox* _tmp11_;
			GamesKeyboardTester* _tmp12_;
			GamesKeyboardMapper* _tmp13_;
			GamesKeyboardMapper* _tmp14_;
			_tmp10_ = self->priv->stack;
			_tmp11_ = self->priv->mapper_box;
			gtk_stack_set_visible_child (_tmp10_, (GtkWidget*) _tmp11_);
			_tmp12_ = self->priv->tester;
			games_keyboard_tester_stop (_tmp12_);
			_tmp13_ = self->priv->mapper;
			games_keyboard_mapper_start (_tmp13_);
			_tmp14_ = self->priv->mapper;
			g_signal_connect_object (_tmp14_, "finished", (GCallback) _games_preferences_subpage_keyboard_on_mapper_finished_games_keyboard_mapper_finished, self, 0);
			break;
		}
		default:
		break;
	}
}

static gboolean
games_preferences_subpage_keyboard_real_get_allow_back (GamesPreferencesSubpage* base)
{
	gboolean result;
	GamesPreferencesSubpageKeyboard* self;
	self = (GamesPreferencesSubpageKeyboard*) base;
	result = self->priv->_allow_back;
	return result;
}

static void
games_preferences_subpage_keyboard_real_set_allow_back (GamesPreferencesSubpage* base,
                                                        gboolean value)
{
	GamesPreferencesSubpageKeyboard* self;
	gboolean old_value;
	self = (GamesPreferencesSubpageKeyboard*) base;
	old_value = games_preferences_subpage_keyboard_real_get_allow_back (base);
	if (old_value != value) {
		self->priv->_allow_back = value;
		g_object_notify_by_pspec ((GObject *) self, games_preferences_subpage_keyboard_properties[GAMES_PREFERENCES_SUBPAGE_KEYBOARD_ALLOW_BACK_PROPERTY]);
	}
}

const gchar*
games_preferences_subpage_keyboard_get_info_message (GamesPreferencesSubpageKeyboard* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_info_message;
	result = _tmp0_;
	return result;
}

void
games_preferences_subpage_keyboard_set_info_message (GamesPreferencesSubpageKeyboard* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_preferences_subpage_keyboard_get_info_message (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_info_message);
		self->priv->_info_message = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, games_preferences_subpage_keyboard_properties[GAMES_PREFERENCES_SUBPAGE_KEYBOARD_INFO_MESSAGE_PROPERTY]);
	}
}

static void
_games_preferences_subpage_keyboard___lambda88_ (GamesPreferencesSubpageKeyboard* self)
{
	GamesKeyboardTester* _tmp0_;
	GamesKeyboardMappingManager* _tmp1_;
	RetroKeyJoypadMapping* _tmp2_;
	RetroKeyJoypadMapping* _tmp3_;
	_tmp0_ = self->priv->tester;
	_tmp1_ = self->priv->mapping_manager;
	_tmp2_ = games_keyboard_mapping_manager_get_mapping (_tmp1_);
	_tmp3_ = _tmp2_;
	games_keyboard_tester_set_mapping (_tmp0_, _tmp3_);
}

static void
__games_preferences_subpage_keyboard___lambda88__games_keyboard_mapping_manager_changed (GamesKeyboardMappingManager* _sender,
                                                                                         gpointer self)
{
	_games_preferences_subpage_keyboard___lambda88_ ((GamesPreferencesSubpageKeyboard*) self);
}

static GObject *
games_preferences_subpage_keyboard_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GamesPreferencesSubpageKeyboard * self;
	GamesGamepadViewConfiguration _tmp0_ = {0};
	GamesGamepadViewConfiguration _tmp1_;
	GamesKeyboardMapper* _tmp2_;
	GamesGamepadViewConfiguration _tmp3_ = {0};
	GamesGamepadViewConfiguration _tmp4_;
	GamesKeyboardTester* _tmp5_;
	GamesKeyboardMappingManager* _tmp6_;
	GtkBox* _tmp7_;
	GamesKeyboardTester* _tmp8_;
	GtkBox* _tmp9_;
	GamesKeyboardTester* _tmp10_;
	GtkBox* _tmp11_;
	GamesKeyboardMapper* _tmp12_;
	GtkBox* _tmp13_;
	GamesKeyboardMapper* _tmp14_;
	GamesKeyboardTester* _tmp15_;
	GamesKeyboardMappingManager* _tmp16_;
	RetroKeyJoypadMapping* _tmp17_;
	RetroKeyJoypadMapping* _tmp18_;
	GamesKeyboardMappingManager* _tmp19_;
	GamesKeyboardMapper* _tmp20_;
	parent_class = G_OBJECT_CLASS (games_preferences_subpage_keyboard_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD, GamesPreferencesSubpageKeyboard);
	games_gamepad_view_configuration_get_default (&_tmp0_);
	_tmp1_ = _tmp0_;
	_tmp2_ = games_keyboard_mapper_new (&_tmp1_, GAMES_PREFERENCES_SUBPAGE_KEYBOARD_KEYBOARD_GAMEPAD_INPUTS, G_N_ELEMENTS (GAMES_PREFERENCES_SUBPAGE_KEYBOARD_KEYBOARD_GAMEPAD_INPUTS));
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->mapper);
	self->priv->mapper = _tmp2_;
	games_gamepad_view_configuration_destroy (&_tmp1_);
	games_gamepad_view_configuration_get_default (&_tmp3_);
	_tmp4_ = _tmp3_;
	_tmp5_ = games_keyboard_tester_new (&_tmp4_);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->tester);
	self->priv->tester = _tmp5_;
	games_gamepad_view_configuration_destroy (&_tmp4_);
	_tmp6_ = games_keyboard_mapping_manager_new ();
	_g_object_unref0 (self->priv->mapping_manager);
	self->priv->mapping_manager = _tmp6_;
	_tmp7_ = self->priv->tester_box;
	_tmp8_ = self->priv->tester;
	gtk_container_add ((GtkContainer*) _tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = self->priv->tester_box;
	_tmp10_ = self->priv->tester;
	gtk_box_reorder_child (_tmp9_, (GtkWidget*) _tmp10_, 1);
	_tmp11_ = self->priv->mapper_box;
	_tmp12_ = self->priv->mapper;
	gtk_container_add ((GtkContainer*) _tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = self->priv->mapper_box;
	_tmp14_ = self->priv->mapper;
	gtk_box_reorder_child (_tmp13_, (GtkWidget*) _tmp14_, 1);
	_tmp15_ = self->priv->tester;
	_tmp16_ = self->priv->mapping_manager;
	_tmp17_ = games_keyboard_mapping_manager_get_mapping (_tmp16_);
	_tmp18_ = _tmp17_;
	games_keyboard_tester_set_mapping (_tmp15_, _tmp18_);
	_tmp19_ = self->priv->mapping_manager;
	g_signal_connect_object (_tmp19_, "changed", (GCallback) __games_preferences_subpage_keyboard___lambda88__games_keyboard_mapping_manager_changed, self, 0);
	_tmp20_ = self->priv->mapper;
	g_object_bind_property_with_closures ((GObject*) _tmp20_, "info-message", (GObject*) self, "info-message", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	games_preferences_subpage_keyboard_set_state (self, GAMES_PREFERENCES_SUBPAGE_KEYBOARD_STATE_TEST);
	return obj;
}

static void
games_preferences_subpage_keyboard_class_init (GamesPreferencesSubpageKeyboardClass * klass,
                                               gpointer klass_data)
{
	games_preferences_subpage_keyboard_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesPreferencesSubpageKeyboard_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_preferences_subpage_keyboard_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_preferences_subpage_keyboard_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_preferences_subpage_keyboard_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_preferences_subpage_keyboard_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PREFERENCES_SUBPAGE_KEYBOARD_ALLOW_BACK_PROPERTY, games_preferences_subpage_keyboard_properties[GAMES_PREFERENCES_SUBPAGE_KEYBOARD_ALLOW_BACK_PROPERTY] = g_param_spec_boolean ("allow-back", "allow-back", "allow-back", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PREFERENCES_SUBPAGE_KEYBOARD_INFO_MESSAGE_PROPERTY, games_preferences_subpage_keyboard_properties[GAMES_PREFERENCES_SUBPAGE_KEYBOARD_INFO_MESSAGE_PROPERTY] = g_param_spec_string ("info-message", "info-message", "info-message", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/preferences/preferences-subpage-keyboard.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, GamesPreferencesSubpageKeyboard_private_offset + G_STRUCT_OFFSET (GamesPreferencesSubpageKeyboardPrivate, stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "tester_box", FALSE, GamesPreferencesSubpageKeyboard_private_offset + G_STRUCT_OFFSET (GamesPreferencesSubpageKeyboardPrivate, tester_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "mapper_box", FALSE, GamesPreferencesSubpageKeyboard_private_offset + G_STRUCT_OFFSET (GamesPreferencesSubpageKeyboardPrivate, mapper_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "reset_button", FALSE, GamesPreferencesSubpageKeyboard_private_offset + G_STRUCT_OFFSET (GamesPreferencesSubpageKeyboardPrivate, reset_button));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_reset_clicked", G_CALLBACK(_games_preferences_subpage_keyboard_on_reset_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_configure_clicked", G_CALLBACK(_games_preferences_subpage_keyboard_on_configure_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_skip_clicked", G_CALLBACK(_games_preferences_subpage_keyboard_on_skip_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_back_clicked", G_CALLBACK(_games_preferences_subpage_keyboard_on_back_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_cancel_clicked", G_CALLBACK(_games_preferences_subpage_keyboard_on_cancel_clicked_gtk_button_clicked));
}

static void
games_preferences_subpage_keyboard_games_preferences_subpage_interface_init (GamesPreferencesSubpageIface * iface,
                                                                             gpointer iface_data)
{
	games_preferences_subpage_keyboard_games_preferences_subpage_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_allow_back = games_preferences_subpage_keyboard_real_get_allow_back;
	iface->set_allow_back = games_preferences_subpage_keyboard_real_set_allow_back;
}

static void
games_preferences_subpage_keyboard_instance_init (GamesPreferencesSubpageKeyboard * self,
                                                  gpointer klass)
{
	self->priv = games_preferences_subpage_keyboard_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_preferences_subpage_keyboard_finalize (GObject * obj)
{
	GamesPreferencesSubpageKeyboard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD, GamesPreferencesSubpageKeyboard);
	_g_free0 (self->priv->_info_message);
	_g_object_unref0 (self->priv->mapper);
	_g_object_unref0 (self->priv->tester);
	_g_object_unref0 (self->priv->mapping_manager);
	G_OBJECT_CLASS (games_preferences_subpage_keyboard_parent_class)->finalize (obj);
}

static GType
games_preferences_subpage_keyboard_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesPreferencesSubpageKeyboardClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_preferences_subpage_keyboard_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPreferencesSubpageKeyboard), 0, (GInstanceInitFunc) games_preferences_subpage_keyboard_instance_init, NULL };
	static const GInterfaceInfo games_preferences_subpage_info = { (GInterfaceInitFunc) games_preferences_subpage_keyboard_games_preferences_subpage_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType games_preferences_subpage_keyboard_type_id;
	games_preferences_subpage_keyboard_type_id = g_type_register_static (gtk_bin_get_type (), "GamesPreferencesSubpageKeyboard", &g_define_type_info, 0);
	g_type_add_interface_static (games_preferences_subpage_keyboard_type_id, GAMES_TYPE_PREFERENCES_SUBPAGE, &games_preferences_subpage_info);
	GamesPreferencesSubpageKeyboard_private_offset = g_type_add_instance_private (games_preferences_subpage_keyboard_type_id, sizeof (GamesPreferencesSubpageKeyboardPrivate));
	return games_preferences_subpage_keyboard_type_id;
}

GType
games_preferences_subpage_keyboard_get_type (void)
{
	static volatile gsize games_preferences_subpage_keyboard_type_id__once = 0;
	if (g_once_init_enter (&games_preferences_subpage_keyboard_type_id__once)) {
		GType games_preferences_subpage_keyboard_type_id;
		games_preferences_subpage_keyboard_type_id = games_preferences_subpage_keyboard_get_type_once ();
		g_once_init_leave (&games_preferences_subpage_keyboard_type_id__once, games_preferences_subpage_keyboard_type_id);
	}
	return games_preferences_subpage_keyboard_type_id__once;
}

static void
_vala_games_preferences_subpage_keyboard_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	GamesPreferencesSubpageKeyboard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD, GamesPreferencesSubpageKeyboard);
	switch (property_id) {
		case GAMES_PREFERENCES_SUBPAGE_KEYBOARD_ALLOW_BACK_PROPERTY:
		g_value_set_boolean (value, games_preferences_subpage_get_allow_back ((GamesPreferencesSubpage*) self));
		break;
		case GAMES_PREFERENCES_SUBPAGE_KEYBOARD_INFO_MESSAGE_PROPERTY:
		g_value_set_string (value, games_preferences_subpage_keyboard_get_info_message (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_preferences_subpage_keyboard_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	GamesPreferencesSubpageKeyboard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_SUBPAGE_KEYBOARD, GamesPreferencesSubpageKeyboard);
	switch (property_id) {
		case GAMES_PREFERENCES_SUBPAGE_KEYBOARD_ALLOW_BACK_PROPERTY:
		games_preferences_subpage_set_allow_back ((GamesPreferencesSubpage*) self, g_value_get_boolean (value));
		break;
		case GAMES_PREFERENCES_SUBPAGE_KEYBOARD_INFO_MESSAGE_PROPERTY:
		games_preferences_subpage_keyboard_set_info_message (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

