/* preferences-page-controllers.c generated by valac 0.36.12.13-3ae08, the Vala compiler
 * generated from preferences-page-controllers.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <libmanette.h>


#define GAMES_TYPE_PREFERENCES_PAGE (games_preferences_page_get_type ())
#define GAMES_PREFERENCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage))
#define GAMES_IS_PREFERENCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_PAGE))
#define GAMES_PREFERENCES_PAGE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPageIface))

typedef struct _GamesPreferencesPage GamesPreferencesPage;
typedef struct _GamesPreferencesPageIface GamesPreferencesPageIface;

#define GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS (games_preferences_page_controllers_get_type ())
#define GAMES_PREFERENCES_PAGE_CONTROLLERS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllers))
#define GAMES_PREFERENCES_PAGE_CONTROLLERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllersClass))
#define GAMES_IS_PREFERENCES_PAGE_CONTROLLERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS))
#define GAMES_IS_PREFERENCES_PAGE_CONTROLLERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS))
#define GAMES_PREFERENCES_PAGE_CONTROLLERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllersClass))

typedef struct _GamesPreferencesPageControllers GamesPreferencesPageControllers;
typedef struct _GamesPreferencesPageControllersClass GamesPreferencesPageControllersClass;
typedef struct _GamesPreferencesPageControllersPrivate GamesPreferencesPageControllersPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_ManetteMonitorIter_free0(var) ((var == NULL) ? NULL : (var = (_vala_ManetteMonitorIter_free (var), NULL)))

#define GAMES_TYPE_GAMEPAD_CONFIGURER (games_gamepad_configurer_get_type ())
#define GAMES_GAMEPAD_CONFIGURER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_GAMEPAD_CONFIGURER, GamesGamepadConfigurer))
#define GAMES_GAMEPAD_CONFIGURER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_GAMEPAD_CONFIGURER, GamesGamepadConfigurerClass))
#define GAMES_IS_GAMEPAD_CONFIGURER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_GAMEPAD_CONFIGURER))
#define GAMES_IS_GAMEPAD_CONFIGURER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_GAMEPAD_CONFIGURER))
#define GAMES_GAMEPAD_CONFIGURER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_GAMEPAD_CONFIGURER, GamesGamepadConfigurerClass))

typedef struct _GamesGamepadConfigurer GamesGamepadConfigurer;
typedef struct _GamesGamepadConfigurerClass GamesGamepadConfigurerClass;

struct _GamesPreferencesPageIface {
	GTypeInterface parent_iface;
	void (*visible_page_changed) (GamesPreferencesPage* self);
	GtkHeaderBar* (*get_header_bar) (GamesPreferencesPage* self);
	void (*set_header_bar) (GamesPreferencesPage* self, GtkHeaderBar* value);
	gboolean (*get_immersive_mode) (GamesPreferencesPage* self);
	void (*set_immersive_mode) (GamesPreferencesPage* self, gboolean value);
};

struct _GamesPreferencesPageControllers {
	GtkStack parent_instance;
	GamesPreferencesPageControllersPrivate * priv;
};

struct _GamesPreferencesPageControllersClass {
	GtkStackClass parent_class;
};

struct _GamesPreferencesPageControllersPrivate {
	GtkHeaderBar* _header_bar;
	gboolean _immersive_mode;
	GtkListBox* gamepads_list_box;
	GtkBox* extra_stack_child_holder;
	GtkHeaderBar* default_header_bar;
	ManetteMonitor* monitor;
	GBinding* header_bar_binding;
	GBinding* immersive_mode_binding;
	gulong back_handler_id;
};


static gpointer games_preferences_page_controllers_parent_class = NULL;
static GamesPreferencesPageIface * games_preferences_page_controllers_games_preferences_page_parent_iface = NULL;

GType games_preferences_page_get_type (void) G_GNUC_CONST;
GType games_preferences_page_controllers_get_type (void) G_GNUC_CONST;
#define GAMES_PREFERENCES_PAGE_CONTROLLERS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllersPrivate))
enum  {
	GAMES_PREFERENCES_PAGE_CONTROLLERS_0_PROPERTY,
	GAMES_PREFERENCES_PAGE_CONTROLLERS_HEADER_BAR_PROPERTY,
	GAMES_PREFERENCES_PAGE_CONTROLLERS_IMMERSIVE_MODE_PROPERTY
};
static void games_preferences_page_controllers_real_visible_page_changed (GamesPreferencesPage* base);
static void games_preferences_page_controllers_on_back (GamesPreferencesPageControllers* self, GObject* emitter);
static void games_preferences_page_controllers_rebuild_gamepad_list (GamesPreferencesPageControllers* self);
static void games_preferences_page_controllers_clear_gamepad_list (GamesPreferencesPageControllers* self);
static void games_preferences_page_controllers_build_gamepad_list (GamesPreferencesPageControllers* self);
static void _vala_ManetteMonitorIter_free (ManetteMonitorIter* self);
static void __lambda25_ (GamesPreferencesPageControllers* self, GtkWidget* child);
static void ___lambda25__gtk_callback (GtkWidget* widget, gpointer self);
static void games_preferences_page_controllers_gamepads_list_box_row_activated (GamesPreferencesPageControllers* self, GtkListBoxRow* row_item);
GType games_gamepad_configurer_get_type (void) G_GNUC_CONST;
GamesGamepadConfigurer* games_gamepad_configurer_new (ManetteDevice* device);
GamesGamepadConfigurer* games_gamepad_configurer_construct (GType object_type, ManetteDevice* device);
static void _games_preferences_page_controllers_on_back_games_gamepad_configurer_back (GamesGamepadConfigurer* _sender, gpointer self);
static void _games_preferences_page_controllers_gamepads_list_box_row_activated_gtk_list_box_row_activated (GtkListBox* _sender, GtkListBoxRow* row, gpointer self);
void games_preferences_page_set_header_bar (GamesPreferencesPage* self, GtkHeaderBar* value);
void games_preferences_page_set_immersive_mode (GamesPreferencesPage* self, gboolean value);
static void __lambda24_ (GamesPreferencesPageControllers* self, GtkWidget* child);
static void ___lambda24__gtk_callback (GtkWidget* widget, gpointer self);
GamesPreferencesPageControllers* games_preferences_page_controllers_new (void);
GamesPreferencesPageControllers* games_preferences_page_controllers_construct (GType object_type);
static GObject * games_preferences_page_controllers_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _games_preferences_page_controllers_rebuild_gamepad_list_manette_monitor_device_connected (ManetteMonitor* _sender, ManetteDevice* device, gpointer self);
static void _games_preferences_page_controllers_rebuild_gamepad_list_manette_monitor_device_disconnected (ManetteMonitor* _sender, ManetteDevice* device, gpointer self);
static void games_preferences_page_controllers_finalize (GObject * obj);
GtkHeaderBar* games_preferences_page_get_header_bar (GamesPreferencesPage* self);
gboolean games_preferences_page_get_immersive_mode (GamesPreferencesPage* self);
static void _vala_games_preferences_page_controllers_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_preferences_page_controllers_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void games_preferences_page_controllers_real_visible_page_changed (GamesPreferencesPage* base) {
	GamesPreferencesPageControllers * self;
	self = (GamesPreferencesPageControllers*) base;
	games_preferences_page_controllers_on_back (self, NULL);
}


static void games_preferences_page_controllers_rebuild_gamepad_list (GamesPreferencesPageControllers* self) {
	g_return_if_fail (self != NULL);
	games_preferences_page_controllers_clear_gamepad_list (self);
	games_preferences_page_controllers_build_gamepad_list (self);
}


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


static void _vala_ManetteMonitorIter_free (ManetteMonitorIter* self) {
	g_boxed_free (manette_monitor_iter_get_type (), self);
}


static void games_preferences_page_controllers_build_gamepad_list (GamesPreferencesPageControllers* self) {
	ManetteDevice* device = NULL;
	gint i = 0;
	ManetteMonitorIter* iterator = NULL;
	ManetteMonitor* _tmp0_;
	ManetteMonitorIter* _tmp1_;
	g_return_if_fail (self != NULL);
	device = NULL;
	i = 0;
	_tmp0_ = self->priv->monitor;
	_tmp1_ = manette_monitor_iterate (_tmp0_);
	iterator = _tmp1_;
	while (TRUE) {
		ManetteMonitorIter* _tmp2_;
		ManetteDevice* _tmp3_ = NULL;
		gboolean _tmp4_;
		ManetteDevice* _tmp5_;
		gint _tmp6_;
		GtkBox* box = NULL;
		GtkBox* _tmp7_;
		GtkBox* _tmp8_;
		ManetteDevice* _tmp9_;
		const gchar* _tmp10_;
		GtkLabel* _tmp11_;
		GtkLabel* _tmp12_;
		GtkBox* _tmp13_;
		GtkBox* _tmp14_;
		GtkListBox* _tmp15_;
		GtkBox* _tmp16_;
		_tmp2_ = iterator;
		_tmp4_ = manette_monitor_iter_next (_tmp2_, &_tmp3_);
		_g_object_unref0 (device);
		_tmp5_ = _g_object_ref0 (_tmp3_);
		device = _tmp5_;
		if (!_tmp4_) {
			break;
		}
		_tmp6_ = i;
		i = _tmp6_ + 1;
		_tmp7_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
		g_object_ref_sink (_tmp7_);
		box = _tmp7_;
		_tmp8_ = box;
		_tmp9_ = device;
		_tmp10_ = manette_device_get_name (_tmp9_);
		_tmp11_ = (GtkLabel*) gtk_label_new (_tmp10_);
		g_object_ref_sink (_tmp11_);
		_tmp12_ = _tmp11_;
		gtk_box_pack_start (_tmp8_, (GtkWidget*) _tmp12_, FALSE, FALSE, (guint) 0);
		_g_object_unref0 (_tmp12_);
		_tmp13_ = box;
		g_object_set ((GtkWidget*) _tmp13_, "margin", 6, NULL);
		_tmp14_ = box;
		gtk_widget_show_all ((GtkWidget*) _tmp14_);
		_tmp15_ = self->priv->gamepads_list_box;
		_tmp16_ = box;
		gtk_container_add ((GtkContainer*) _tmp15_, (GtkWidget*) _tmp16_);
		_g_object_unref0 (box);
	}
	__vala_ManetteMonitorIter_free0 (iterator);
	_g_object_unref0 (device);
}


static void __lambda25_ (GamesPreferencesPageControllers* self, GtkWidget* child) {
	GtkWidget* _tmp0_;
	g_return_if_fail (child != NULL);
	_tmp0_ = child;
	gtk_widget_destroy (_tmp0_);
}


static void ___lambda25__gtk_callback (GtkWidget* widget, gpointer self) {
	__lambda25_ ((GamesPreferencesPageControllers*) self, widget);
}


static void games_preferences_page_controllers_clear_gamepad_list (GamesPreferencesPageControllers* self) {
	GtkListBox* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->gamepads_list_box;
	gtk_container_foreach ((GtkContainer*) _tmp0_, ___lambda25__gtk_callback, self);
}


static void _games_preferences_page_controllers_on_back_games_gamepad_configurer_back (GamesGamepadConfigurer* _sender, gpointer self) {
	games_preferences_page_controllers_on_back ((GamesPreferencesPageControllers*) self, _sender);
}


static void games_preferences_page_controllers_gamepads_list_box_row_activated (GamesPreferencesPageControllers* self, GtkListBoxRow* row_item) {
	ManetteDevice* device = NULL;
	ManetteDevice* other_device = NULL;
	gint i = 0;
	gint row_index = 0;
	GtkListBoxRow* _tmp0_;
	gint _tmp1_;
	ManetteMonitorIter* iterator = NULL;
	ManetteMonitor* _tmp2_;
	ManetteMonitorIter* _tmp3_;
	ManetteDevice* _tmp12_;
	GamesGamepadConfigurer* configurer = NULL;
	ManetteDevice* _tmp13_;
	GamesGamepadConfigurer* _tmp14_;
	GamesGamepadConfigurer* _tmp15_;
	gulong _tmp16_;
	GamesGamepadConfigurer* _tmp17_;
	GBinding* _tmp18_;
	GBinding* _tmp19_;
	GamesGamepadConfigurer* _tmp20_;
	GBinding* _tmp21_;
	GBinding* _tmp22_;
	GtkBox* _tmp23_;
	GamesGamepadConfigurer* _tmp24_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row_item != NULL);
	device = NULL;
	other_device = NULL;
	i = 0;
	_tmp0_ = row_item;
	_tmp1_ = gtk_list_box_row_get_index (_tmp0_);
	row_index = _tmp1_;
	_tmp2_ = self->priv->monitor;
	_tmp3_ = manette_monitor_iterate (_tmp2_);
	iterator = _tmp3_;
	while (TRUE) {
		ManetteMonitorIter* _tmp4_;
		ManetteDevice* _tmp5_ = NULL;
		gboolean _tmp6_;
		ManetteDevice* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		_tmp4_ = iterator;
		_tmp6_ = manette_monitor_iter_next (_tmp4_, &_tmp5_);
		_g_object_unref0 (other_device);
		_tmp7_ = _g_object_ref0 (_tmp5_);
		other_device = _tmp7_;
		if (!_tmp6_) {
			break;
		}
		_tmp8_ = i;
		i = _tmp8_ + 1;
		_tmp9_ = row_index;
		if (_tmp8_ == _tmp9_) {
			ManetteDevice* _tmp10_;
			ManetteDevice* _tmp11_;
			_tmp10_ = other_device;
			_tmp11_ = _g_object_ref0 (_tmp10_);
			_g_object_unref0 (device);
			device = _tmp11_;
		}
	}
	_tmp12_ = device;
	if (_tmp12_ == NULL) {
		__vala_ManetteMonitorIter_free0 (iterator);
		_g_object_unref0 (other_device);
		_g_object_unref0 (device);
		return;
	}
	_tmp13_ = device;
	_tmp14_ = games_gamepad_configurer_new (_tmp13_);
	g_object_ref_sink (_tmp14_);
	configurer = _tmp14_;
	_tmp15_ = configurer;
	_tmp16_ = g_signal_connect_object (_tmp15_, "back", (GCallback) _games_preferences_page_controllers_on_back_games_gamepad_configurer_back, self, 0);
	self->priv->back_handler_id = _tmp16_;
	_tmp17_ = configurer;
	_tmp18_ = g_object_bind_property_with_closures ((GObject*) _tmp17_, "header-bar", (GObject*) self, "header-bar", 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)));
	_tmp19_ = _g_object_ref0 (_tmp18_);
	_g_object_unref0 (self->priv->header_bar_binding);
	self->priv->header_bar_binding = _tmp19_;
	_tmp20_ = configurer;
	_tmp21_ = g_object_bind_property_with_closures ((GObject*) _tmp20_, "immersive-mode", (GObject*) self, "immersive-mode", 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)));
	_tmp22_ = _g_object_ref0 (_tmp21_);
	_g_object_unref0 (self->priv->immersive_mode_binding);
	self->priv->immersive_mode_binding = _tmp22_;
	_tmp23_ = self->priv->extra_stack_child_holder;
	_tmp24_ = configurer;
	gtk_box_pack_start (_tmp23_, (GtkWidget*) _tmp24_, TRUE, TRUE, (guint) 0);
	gtk_stack_set_visible_child_name ((GtkStack*) self, "extra_stack_child");
	_g_object_unref0 (configurer);
	__vala_ManetteMonitorIter_free0 (iterator);
	_g_object_unref0 (other_device);
	_g_object_unref0 (device);
}


static void _games_preferences_page_controllers_gamepads_list_box_row_activated_gtk_list_box_row_activated (GtkListBox* _sender, GtkListBoxRow* row, gpointer self) {
	games_preferences_page_controllers_gamepads_list_box_row_activated ((GamesPreferencesPageControllers*) self, row);
}


static void __lambda24_ (GamesPreferencesPageControllers* self, GtkWidget* child) {
	GtkWidget* _tmp0_;
	g_return_if_fail (child != NULL);
	_tmp0_ = child;
	gtk_widget_destroy (_tmp0_);
}


static void ___lambda24__gtk_callback (GtkWidget* widget, gpointer self) {
	__lambda24_ ((GamesPreferencesPageControllers*) self, widget);
}


static void games_preferences_page_controllers_on_back (GamesPreferencesPageControllers* self, GObject* emitter) {
	gulong _tmp0_;
	GtkHeaderBar* _tmp4_;
	GtkBox* _tmp5_;
	g_return_if_fail (self != NULL);
	_g_object_unref0 (self->priv->header_bar_binding);
	self->priv->header_bar_binding = NULL;
	_g_object_unref0 (self->priv->immersive_mode_binding);
	self->priv->immersive_mode_binding = NULL;
	_tmp0_ = self->priv->back_handler_id;
	if (_tmp0_ != ((gulong) 0)) {
		GObject* _tmp1_;
		_tmp1_ = emitter;
		if (_tmp1_ != NULL) {
			GObject* _tmp2_;
			gulong _tmp3_;
			_tmp2_ = emitter;
			_tmp3_ = self->priv->back_handler_id;
			g_signal_handler_disconnect (_tmp2_, _tmp3_);
		}
		self->priv->back_handler_id = (gulong) 0;
	}
	_tmp4_ = self->priv->default_header_bar;
	games_preferences_page_set_header_bar ((GamesPreferencesPage*) self, _tmp4_);
	games_preferences_page_set_immersive_mode ((GamesPreferencesPage*) self, FALSE);
	gtk_stack_set_visible_child_name ((GtkStack*) self, "main_stack_child");
	_tmp5_ = self->priv->extra_stack_child_holder;
	gtk_container_foreach ((GtkContainer*) _tmp5_, ___lambda24__gtk_callback, self);
}


GamesPreferencesPageControllers* games_preferences_page_controllers_construct (GType object_type) {
	GamesPreferencesPageControllers * self = NULL;
	self = (GamesPreferencesPageControllers*) g_object_new (object_type, NULL);
	return self;
}


GamesPreferencesPageControllers* games_preferences_page_controllers_new (void) {
	return games_preferences_page_controllers_construct (GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS);
}


static GtkHeaderBar* games_preferences_page_controllers_real_get_header_bar (GamesPreferencesPage* base) {
	GtkHeaderBar* result;
	GamesPreferencesPageControllers* self;
	GtkHeaderBar* _tmp0_;
	self = (GamesPreferencesPageControllers*) base;
	_tmp0_ = self->priv->_header_bar;
	result = _tmp0_;
	return result;
}


static void games_preferences_page_controllers_real_set_header_bar (GamesPreferencesPage* base, GtkHeaderBar* value) {
	GamesPreferencesPageControllers* self;
	self = (GamesPreferencesPageControllers*) base;
	if (games_preferences_page_controllers_real_get_header_bar (base) != value) {
		GtkHeaderBar* _tmp0_;
		GtkHeaderBar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_g_object_unref0 (self->priv->_header_bar);
		self->priv->_header_bar = _tmp1_;
		g_object_notify ((GObject *) self, "header-bar");
	}
}


static gboolean games_preferences_page_controllers_real_get_immersive_mode (GamesPreferencesPage* base) {
	gboolean result;
	GamesPreferencesPageControllers* self;
	gboolean _tmp0_;
	self = (GamesPreferencesPageControllers*) base;
	_tmp0_ = self->priv->_immersive_mode;
	result = _tmp0_;
	return result;
}


static void games_preferences_page_controllers_real_set_immersive_mode (GamesPreferencesPage* base, gboolean value) {
	GamesPreferencesPageControllers* self;
	self = (GamesPreferencesPageControllers*) base;
	if (games_preferences_page_controllers_real_get_immersive_mode (base) != value) {
		gboolean _tmp0_;
		_tmp0_ = value;
		self->priv->_immersive_mode = _tmp0_;
		g_object_notify ((GObject *) self, "immersive-mode");
	}
}


static void _games_preferences_page_controllers_rebuild_gamepad_list_manette_monitor_device_connected (ManetteMonitor* _sender, ManetteDevice* device, gpointer self) {
	games_preferences_page_controllers_rebuild_gamepad_list ((GamesPreferencesPageControllers*) self);
}


static void _games_preferences_page_controllers_rebuild_gamepad_list_manette_monitor_device_disconnected (ManetteMonitor* _sender, ManetteDevice* device, gpointer self) {
	games_preferences_page_controllers_rebuild_gamepad_list ((GamesPreferencesPageControllers*) self);
}


static GObject * games_preferences_page_controllers_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GamesPreferencesPageControllers * self;
	GtkHeaderBar* _tmp0_;
	ManetteMonitor* _tmp1_;
	ManetteMonitor* _tmp2_;
	ManetteMonitor* _tmp3_;
	parent_class = G_OBJECT_CLASS (games_preferences_page_controllers_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllers);
	_tmp0_ = self->priv->default_header_bar;
	games_preferences_page_set_header_bar ((GamesPreferencesPage*) self, _tmp0_);
	games_preferences_page_set_immersive_mode ((GamesPreferencesPage*) self, FALSE);
	_tmp1_ = manette_monitor_new ();
	_g_object_unref0 (self->priv->monitor);
	self->priv->monitor = _tmp1_;
	_tmp2_ = self->priv->monitor;
	g_signal_connect_object (_tmp2_, "device-connected", (GCallback) _games_preferences_page_controllers_rebuild_gamepad_list_manette_monitor_device_connected, self, 0);
	_tmp3_ = self->priv->monitor;
	g_signal_connect_object (_tmp3_, "device-disconnected", (GCallback) _games_preferences_page_controllers_rebuild_gamepad_list_manette_monitor_device_disconnected, self, 0);
	games_preferences_page_controllers_build_gamepad_list (self);
	return obj;
}


static void games_preferences_page_controllers_class_init (GamesPreferencesPageControllersClass * klass) {
	gint GamesPreferencesPageControllers_private_offset;
	games_preferences_page_controllers_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesPreferencesPageControllersPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_games_preferences_page_controllers_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_preferences_page_controllers_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_preferences_page_controllers_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_preferences_page_controllers_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PREFERENCES_PAGE_CONTROLLERS_HEADER_BAR_PROPERTY, g_param_spec_object ("header-bar", "header-bar", "header-bar", gtk_header_bar_get_type (), G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PREFERENCES_PAGE_CONTROLLERS_IMMERSIVE_MODE_PROPERTY, g_param_spec_boolean ("immersive-mode", "immersive-mode", "immersive-mode", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	GamesPreferencesPageControllers_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/ui/preferences-page-controllers.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "gamepads_list_box", FALSE, GamesPreferencesPageControllers_private_offset + G_STRUCT_OFFSET (GamesPreferencesPageControllersPrivate, gamepads_list_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "extra_stack_child_holder", FALSE, GamesPreferencesPageControllers_private_offset + G_STRUCT_OFFSET (GamesPreferencesPageControllersPrivate, extra_stack_child_holder));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "default_header_bar", FALSE, GamesPreferencesPageControllers_private_offset + G_STRUCT_OFFSET (GamesPreferencesPageControllersPrivate, default_header_bar));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "gamepads_list_box_row_activated", G_CALLBACK(_games_preferences_page_controllers_gamepads_list_box_row_activated_gtk_list_box_row_activated));
}


static void games_preferences_page_controllers_games_preferences_page_interface_init (GamesPreferencesPageIface * iface) {
	games_preferences_page_controllers_games_preferences_page_parent_iface = g_type_interface_peek_parent (iface);
	iface->visible_page_changed = (void (*) (GamesPreferencesPage *)) games_preferences_page_controllers_real_visible_page_changed;
	iface->get_header_bar = games_preferences_page_controllers_real_get_header_bar;
	iface->set_header_bar = games_preferences_page_controllers_real_set_header_bar;
	iface->get_immersive_mode = games_preferences_page_controllers_real_get_immersive_mode;
	iface->set_immersive_mode = games_preferences_page_controllers_real_set_immersive_mode;
}


static void games_preferences_page_controllers_instance_init (GamesPreferencesPageControllers * self) {
	self->priv = GAMES_PREFERENCES_PAGE_CONTROLLERS_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void games_preferences_page_controllers_finalize (GObject * obj) {
	GamesPreferencesPageControllers * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllers);
	_g_object_unref0 (self->priv->_header_bar);
	_g_object_unref0 (self->priv->gamepads_list_box);
	_g_object_unref0 (self->priv->extra_stack_child_holder);
	_g_object_unref0 (self->priv->default_header_bar);
	_g_object_unref0 (self->priv->monitor);
	_g_object_unref0 (self->priv->header_bar_binding);
	_g_object_unref0 (self->priv->immersive_mode_binding);
	G_OBJECT_CLASS (games_preferences_page_controllers_parent_class)->finalize (obj);
}


GType games_preferences_page_controllers_get_type (void) {
	static volatile gsize games_preferences_page_controllers_type_id__volatile = 0;
	if (g_once_init_enter (&games_preferences_page_controllers_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesPreferencesPageControllersClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_preferences_page_controllers_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPreferencesPageControllers), 0, (GInstanceInitFunc) games_preferences_page_controllers_instance_init, NULL };
		static const GInterfaceInfo games_preferences_page_info = { (GInterfaceInitFunc) games_preferences_page_controllers_games_preferences_page_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType games_preferences_page_controllers_type_id;
		games_preferences_page_controllers_type_id = g_type_register_static (gtk_stack_get_type (), "GamesPreferencesPageControllers", &g_define_type_info, 0);
		g_type_add_interface_static (games_preferences_page_controllers_type_id, GAMES_TYPE_PREFERENCES_PAGE, &games_preferences_page_info);
		g_once_init_leave (&games_preferences_page_controllers_type_id__volatile, games_preferences_page_controllers_type_id);
	}
	return games_preferences_page_controllers_type_id__volatile;
}


static void _vala_games_preferences_page_controllers_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesPreferencesPageControllers * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllers);
	switch (property_id) {
		case GAMES_PREFERENCES_PAGE_CONTROLLERS_HEADER_BAR_PROPERTY:
		g_value_set_object (value, games_preferences_page_get_header_bar ((GamesPreferencesPage*) self));
		break;
		case GAMES_PREFERENCES_PAGE_CONTROLLERS_IMMERSIVE_MODE_PROPERTY:
		g_value_set_boolean (value, games_preferences_page_get_immersive_mode ((GamesPreferencesPage*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_preferences_page_controllers_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesPreferencesPageControllers * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_PAGE_CONTROLLERS, GamesPreferencesPageControllers);
	switch (property_id) {
		case GAMES_PREFERENCES_PAGE_CONTROLLERS_HEADER_BAR_PROPERTY:
		games_preferences_page_set_header_bar ((GamesPreferencesPage*) self, g_value_get_object (value));
		break;
		case GAMES_PREFERENCES_PAGE_CONTROLLERS_IMMERSIVE_MODE_PROPERTY:
		games_preferences_page_set_immersive_mode ((GamesPreferencesPage*) self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



