/* nintendo-64-pak-switcher.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from nintendo-64-pak-switcher.vala, do not modify */

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

#include <gtk/gtk.h>
#include "gnome-games.h"
#include <glib-object.h>
#include "games-nintendo-64-plugin.h"
#include <glib.h>
#include <retro-gtk.h>
#include <stdlib.h>
#include <string.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_NINTENDO64_PAK_SWITCHER (games_nintendo64_pak_switcher_get_type ())
#define GAMES_NINTENDO64_PAK_SWITCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_NINTENDO64_PAK_SWITCHER, GamesNintendo64PakSwitcher))
#define GAMES_NINTENDO64_PAK_SWITCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_NINTENDO64_PAK_SWITCHER, GamesNintendo64PakSwitcherClass))
#define GAMES_IS_NINTENDO64_PAK_SWITCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_NINTENDO64_PAK_SWITCHER))
#define GAMES_IS_NINTENDO64_PAK_SWITCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_NINTENDO64_PAK_SWITCHER))
#define GAMES_NINTENDO64_PAK_SWITCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_NINTENDO64_PAK_SWITCHER, GamesNintendo64PakSwitcherClass))

typedef struct _GamesNintendo64PakSwitcher GamesNintendo64PakSwitcher;
typedef struct _GamesNintendo64PakSwitcherClass GamesNintendo64PakSwitcherClass;
typedef struct _GamesNintendo64PakSwitcherPrivate GamesNintendo64PakSwitcherPrivate;

#define GAMES_TYPE_NINTENDO64_RUNNER (games_nintendo64_runner_get_type ())
#define GAMES_NINTENDO64_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_NINTENDO64_RUNNER, GamesNintendo64Runner))
#define GAMES_NINTENDO64_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_NINTENDO64_RUNNER, GamesNintendo64RunnerClass))
#define GAMES_IS_NINTENDO64_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_NINTENDO64_RUNNER))
#define GAMES_IS_NINTENDO64_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_NINTENDO64_RUNNER))
#define GAMES_NINTENDO64_RUNNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_NINTENDO64_RUNNER, GamesNintendo64RunnerClass))

typedef struct _GamesNintendo64Runner GamesNintendo64Runner;
typedef struct _GamesNintendo64RunnerClass GamesNintendo64RunnerClass;
enum  {
	GAMES_NINTENDO64_PAK_SWITCHER_0_PROPERTY,
	GAMES_NINTENDO64_PAK_SWITCHER_RUNNER_PROPERTY,
	GAMES_NINTENDO64_PAK_SWITCHER_PAK1_PROPERTY,
	GAMES_NINTENDO64_PAK_SWITCHER_PAK2_PROPERTY,
	GAMES_NINTENDO64_PAK_SWITCHER_PAK3_PROPERTY,
	GAMES_NINTENDO64_PAK_SWITCHER_PAK4_PROPERTY,
	GAMES_NINTENDO64_PAK_SWITCHER_BLOCK_AUTOHIDE_PROPERTY,
	GAMES_NINTENDO64_PAK_SWITCHER_NUM_PROPERTIES
};
static GParamSpec* games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_NINTENDO64_PAK_CONTROLLER (games_nintendo64_pak_controller_get_type ())
#define GAMES_NINTENDO64_PAK_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_NINTENDO64_PAK_CONTROLLER, GamesNintendo64PakController))
#define GAMES_NINTENDO64_PAK_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_NINTENDO64_PAK_CONTROLLER, GamesNintendo64PakControllerClass))
#define GAMES_IS_NINTENDO64_PAK_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_NINTENDO64_PAK_CONTROLLER))
#define GAMES_IS_NINTENDO64_PAK_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_NINTENDO64_PAK_CONTROLLER))
#define GAMES_NINTENDO64_PAK_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_NINTENDO64_PAK_CONTROLLER, GamesNintendo64PakControllerClass))

typedef struct _GamesNintendo64PakController GamesNintendo64PakController;
typedef struct _GamesNintendo64PakControllerClass GamesNintendo64PakControllerClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesNintendo64PakSwitcher {
	GtkBin parent_instance;
	GamesNintendo64PakSwitcherPrivate * priv;
};

struct _GamesNintendo64PakSwitcherClass {
	GtkBinClass parent_class;
};

struct _GamesNintendo64PakSwitcherPrivate {
	GtkMenuButton* menu_button;
	GtkBox* controllers_box;
	GamesNintendo64Runner* _runner;
	GamesNintendo64Pak _pak1;
	GamesNintendo64Pak _pak2;
	GamesNintendo64Pak _pak3;
	GamesNintendo64Pak _pak4;
	gboolean is_menu_open;
};

static gint GamesNintendo64PakSwitcher_private_offset;
static gpointer games_nintendo64_pak_switcher_parent_class = NULL;
static GamesHeaderBarWidgetIface * games_nintendo64_pak_switcher_games_header_bar_widget_parent_iface = NULL;
static GType games_nintendo64_pak_switcher_type_id = 0;

GType games_nintendo64_pak_switcher_register_type (GTypeModule * module);
VALA_EXTERN GType games_nintendo64_pak_switcher_get_type (void) G_GNUC_CONST ;
GType games_nintendo64_runner_register_type (GTypeModule * module);
VALA_EXTERN GType games_nintendo64_runner_get_type (void) G_GNUC_CONST ;
static void games_nintendo64_pak_switcher_real_constructed (GObject* base);
static void games_nintendo64_pak_switcher_update_ui (GamesNintendo64PakSwitcher* self);
VALA_EXTERN GamesNintendo64Runner* games_nintendo64_pak_switcher_get_runner (GamesNintendo64PakSwitcher* self);
static void _games_nintendo64_pak_switcher_update_ui_games_retro_runner_controllers_changed (GamesRetroRunner* _sender,
                                                                                      gpointer self);
VALA_EXTERN GamesNintendo64PakSwitcher* games_nintendo64_pak_switcher_new (GamesNintendo64Runner* runner);
VALA_EXTERN GamesNintendo64PakSwitcher* games_nintendo64_pak_switcher_construct (GType object_type,
                                                                     GamesNintendo64Runner* runner);
static void games_nintendo64_pak_switcher_on_menu_state_changed (GamesNintendo64PakSwitcher* self);
static void _games_nintendo64_pak_switcher_on_menu_state_changed_g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self);
GType games_nintendo64_pak_controller_register_type (GTypeModule * module);
VALA_EXTERN GType games_nintendo64_pak_controller_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesNintendo64PakController* games_nintendo64_pak_controller_new (RetroController* gamepad,
                                                                   guint port);
VALA_EXTERN GamesNintendo64PakController* games_nintendo64_pak_controller_construct (GType object_type,
                                                                         RetroController* gamepad,
                                                                         guint port);
VALA_EXTERN void games_nintendo64_pak_controller_set_show_title (GamesNintendo64PakController* self,
                                                     gboolean value);
static void games_nintendo64_pak_switcher_set_runner (GamesNintendo64PakSwitcher* self,
                                               GamesNintendo64Runner* value);
VALA_EXTERN GamesNintendo64Pak games_nintendo64_pak_switcher_get_pak1 (GamesNintendo64PakSwitcher* self);
VALA_EXTERN void games_nintendo64_pak_switcher_set_pak1 (GamesNintendo64PakSwitcher* self,
                                             GamesNintendo64Pak value);
VALA_EXTERN GamesNintendo64Pak games_nintendo64_pak_switcher_get_pak2 (GamesNintendo64PakSwitcher* self);
VALA_EXTERN void games_nintendo64_pak_switcher_set_pak2 (GamesNintendo64PakSwitcher* self,
                                             GamesNintendo64Pak value);
VALA_EXTERN GamesNintendo64Pak games_nintendo64_pak_switcher_get_pak3 (GamesNintendo64PakSwitcher* self);
VALA_EXTERN void games_nintendo64_pak_switcher_set_pak3 (GamesNintendo64PakSwitcher* self,
                                             GamesNintendo64Pak value);
VALA_EXTERN GamesNintendo64Pak games_nintendo64_pak_switcher_get_pak4 (GamesNintendo64PakSwitcher* self);
VALA_EXTERN void games_nintendo64_pak_switcher_set_pak4 (GamesNintendo64PakSwitcher* self,
                                             GamesNintendo64Pak value);
static void games_nintendo64_pak_switcher_finalize (GObject * obj);
static void _vala_games_nintendo64_pak_switcher_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void _vala_games_nintendo64_pak_switcher_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec);

static inline gpointer
games_nintendo64_pak_switcher_get_instance_private (GamesNintendo64PakSwitcher* self)
{
	return G_STRUCT_MEMBER_P (self, GamesNintendo64PakSwitcher_private_offset);
}

static void
_games_nintendo64_pak_switcher_update_ui_games_retro_runner_controllers_changed (GamesRetroRunner* _sender,
                                                                                 gpointer self)
{
	games_nintendo64_pak_switcher_update_ui ((GamesNintendo64PakSwitcher*) self);
}

static void
games_nintendo64_pak_switcher_real_constructed (GObject* base)
{
	GamesNintendo64PakSwitcher * self;
	GamesNintendo64Runner* _tmp0_;
	GamesNintendo64Runner* _tmp1_;
	GamesNintendo64Runner* _tmp2_;
	GamesNintendo64Runner* _tmp3_;
	GamesNintendo64Runner* _tmp4_;
	self = (GamesNintendo64PakSwitcher*) base;
	games_nintendo64_pak_switcher_update_ui (self);
	_tmp0_ = self->priv->_runner;
	g_signal_connect_object ((GamesRetroRunner*) _tmp0_, "controllers-changed", (GCallback) _games_nintendo64_pak_switcher_update_ui_games_retro_runner_controllers_changed, self, 0);
	_tmp1_ = self->priv->_runner;
	g_object_bind_property_with_closures ((GObject*) self, "pak1", (GObject*) _tmp1_, "pak1", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp2_ = self->priv->_runner;
	g_object_bind_property_with_closures ((GObject*) self, "pak2", (GObject*) _tmp2_, "pak2", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp3_ = self->priv->_runner;
	g_object_bind_property_with_closures ((GObject*) self, "pak3", (GObject*) _tmp3_, "pak3", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp4_ = self->priv->_runner;
	g_object_bind_property_with_closures ((GObject*) self, "pak4", (GObject*) _tmp4_, "pak4", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	G_OBJECT_CLASS (games_nintendo64_pak_switcher_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_bin_get_type (), GtkBin));
}

GamesNintendo64PakSwitcher*
games_nintendo64_pak_switcher_construct (GType object_type,
                                         GamesNintendo64Runner* runner)
{
	GamesNintendo64PakSwitcher * self = NULL;
	g_return_val_if_fail (runner != NULL, NULL);
	self = (GamesNintendo64PakSwitcher*) g_object_new (object_type, "runner", runner, NULL);
	return self;
}

GamesNintendo64PakSwitcher*
games_nintendo64_pak_switcher_new (GamesNintendo64Runner* runner)
{
	return games_nintendo64_pak_switcher_construct (GAMES_TYPE_NINTENDO64_PAK_SWITCHER, runner);
}

static void
games_nintendo64_pak_switcher_on_menu_state_changed (GamesNintendo64PakSwitcher* self)
{
	GtkMenuButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->menu_button;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->is_menu_open = _tmp2_;
	g_object_notify ((GObject*) self, "block-autohide");
}

static void
_games_nintendo64_pak_switcher_on_menu_state_changed_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self)
{
	games_nintendo64_pak_switcher_on_menu_state_changed ((GamesNintendo64PakSwitcher*) self);
}

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

static void
games_nintendo64_pak_switcher_update_ui (GamesNintendo64PakSwitcher* self)
{
	GtkBox* _tmp0_;
	GList* _tmp1_;
	RetroCore* core = NULL;
	GamesNintendo64Runner* _tmp4_;
	RetroCore* _tmp5_;
	RetroControllerIterator* iterator = NULL;
	RetroCore* _tmp6_;
	RetroControllerIterator* _tmp7_;
	GamesNintendo64PakController* first_widget = NULL;
	guint n_players = 0U;
	guint port = 0U;
	RetroController* controller = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->controllers_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	{
		GList* row_collection = NULL;
		GList* row_it = NULL;
		row_collection = _tmp1_;
		for (row_it = row_collection; row_it != NULL; row_it = row_it->next) {
			GtkWidget* row = NULL;
			row = (GtkWidget*) row_it->data;
			{
				GtkBox* _tmp2_;
				GtkWidget* _tmp3_;
				_tmp2_ = self->priv->controllers_box;
				_tmp3_ = row;
				gtk_container_remove ((GtkContainer*) _tmp2_, _tmp3_);
			}
		}
		(row_collection == NULL) ? NULL : (row_collection = (g_list_free (row_collection), NULL));
	}
	_tmp4_ = self->priv->_runner;
	_tmp5_ = games_retro_runner_get_core ((GamesRetroRunner*) _tmp4_);
	core = _tmp5_;
	_tmp6_ = core;
	_tmp7_ = retro_core_iterate_controllers (_tmp6_);
	iterator = _tmp7_;
	first_widget = NULL;
	n_players = (guint) 0;
	while (TRUE) {
		RetroControllerIterator* _tmp8_;
		guint _tmp9_ = 0U;
		RetroController* _tmp10_ = NULL;
		gboolean _tmp11_;
		guint _tmp12_;
		GamesNintendo64PakController* widget = NULL;
		RetroController* _tmp13_;
		GamesNintendo64PakController* _tmp14_;
		GamesNintendo64PakController* _tmp15_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		GamesNintendo64PakController* _tmp22_;
		GtkBox* _tmp23_;
		GamesNintendo64PakController* _tmp24_;
		_tmp8_ = iterator;
		_tmp11_ = retro_controller_iterator_next (_tmp8_, &_tmp9_, &_tmp10_);
		port = _tmp9_;
		controller = _tmp10_;
		if (!_tmp11_) {
			break;
		}
		if (n_players > ((guint) 3)) {
			break;
		}
		_tmp12_ = n_players;
		n_players = _tmp12_ + 1;
		_tmp13_ = controller;
		_tmp14_ = games_nintendo64_pak_controller_new (_tmp13_, port);
		g_object_ref_sink (_tmp14_);
		widget = _tmp14_;
		_tmp15_ = first_widget;
		if (_tmp15_ == NULL) {
			GamesNintendo64PakController* _tmp16_;
			GamesNintendo64PakController* _tmp17_;
			_tmp16_ = widget;
			_tmp17_ = _g_object_ref0 (_tmp16_);
			_g_object_unref0 (first_widget);
			first_widget = _tmp17_;
		}
		_tmp18_ = g_strdup_printf ("%u", port + 1);
		_tmp19_ = _tmp18_;
		_tmp20_ = g_strconcat ("pak", _tmp19_, NULL);
		_tmp21_ = _tmp20_;
		_tmp22_ = widget;
		g_object_bind_property_with_closures ((GObject*) self, _tmp21_, (GObject*) _tmp22_, "pak", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_g_free0 (_tmp21_);
		_g_free0 (_tmp19_);
		_tmp23_ = self->priv->controllers_box;
		_tmp24_ = widget;
		gtk_container_add ((GtkContainer*) _tmp23_, (GtkWidget*) _tmp24_);
		_g_object_unref0 (widget);
	}
	if (n_players == ((guint) 1)) {
		GamesNintendo64PakController* _tmp25_;
		_tmp25_ = first_widget;
		games_nintendo64_pak_controller_set_show_title (_tmp25_, FALSE);
	}
	_g_object_unref0 (first_widget);
	_g_object_unref0 (iterator);
	_g_object_unref0 (core);
}

GamesNintendo64Runner*
games_nintendo64_pak_switcher_get_runner (GamesNintendo64PakSwitcher* self)
{
	GamesNintendo64Runner* result;
	GamesNintendo64Runner* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_runner;
	result = _tmp0_;
	return result;
}

static void
games_nintendo64_pak_switcher_set_runner (GamesNintendo64PakSwitcher* self,
                                          GamesNintendo64Runner* value)
{
	GamesNintendo64Runner* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_pak_switcher_get_runner (self);
	if (old_value != value) {
		GamesNintendo64Runner* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_runner);
		self->priv->_runner = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_RUNNER_PROPERTY]);
	}
}

GamesNintendo64Pak
games_nintendo64_pak_switcher_get_pak1 (GamesNintendo64PakSwitcher* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak1;
	return result;
}

void
games_nintendo64_pak_switcher_set_pak1 (GamesNintendo64PakSwitcher* self,
                                        GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_pak_switcher_get_pak1 (self);
	if (old_value != value) {
		self->priv->_pak1 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK1_PROPERTY]);
	}
}

GamesNintendo64Pak
games_nintendo64_pak_switcher_get_pak2 (GamesNintendo64PakSwitcher* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak2;
	return result;
}

void
games_nintendo64_pak_switcher_set_pak2 (GamesNintendo64PakSwitcher* self,
                                        GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_pak_switcher_get_pak2 (self);
	if (old_value != value) {
		self->priv->_pak2 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK2_PROPERTY]);
	}
}

GamesNintendo64Pak
games_nintendo64_pak_switcher_get_pak3 (GamesNintendo64PakSwitcher* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak3;
	return result;
}

void
games_nintendo64_pak_switcher_set_pak3 (GamesNintendo64PakSwitcher* self,
                                        GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_pak_switcher_get_pak3 (self);
	if (old_value != value) {
		self->priv->_pak3 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK3_PROPERTY]);
	}
}

GamesNintendo64Pak
games_nintendo64_pak_switcher_get_pak4 (GamesNintendo64PakSwitcher* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak4;
	return result;
}

void
games_nintendo64_pak_switcher_set_pak4 (GamesNintendo64PakSwitcher* self,
                                        GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_pak_switcher_get_pak4 (self);
	if (old_value != value) {
		self->priv->_pak4 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK4_PROPERTY]);
	}
}

static gboolean
games_nintendo64_pak_switcher_real_get_block_autohide (GamesHeaderBarWidget* base)
{
	gboolean result;
	GamesNintendo64PakSwitcher* self;
	self = (GamesNintendo64PakSwitcher*) base;
	result = self->priv->is_menu_open;
	return result;
}

static void
games_nintendo64_pak_switcher_class_init (GamesNintendo64PakSwitcherClass * klass,
                                          gpointer klass_data)
{
	games_nintendo64_pak_switcher_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesNintendo64PakSwitcher_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) games_nintendo64_pak_switcher_real_constructed;
	G_OBJECT_CLASS (klass)->get_property = _vala_games_nintendo64_pak_switcher_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_nintendo64_pak_switcher_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_nintendo64_pak_switcher_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_PAK_SWITCHER_RUNNER_PROPERTY, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_RUNNER_PROPERTY] = g_param_spec_object ("runner", "runner", "runner", GAMES_TYPE_NINTENDO64_RUNNER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_PAK_SWITCHER_PAK1_PROPERTY, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK1_PROPERTY] = g_param_spec_enum ("pak1", "pak1", "pak1", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_PAK_SWITCHER_PAK2_PROPERTY, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK2_PROPERTY] = g_param_spec_enum ("pak2", "pak2", "pak2", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_PAK_SWITCHER_PAK3_PROPERTY, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK3_PROPERTY] = g_param_spec_enum ("pak3", "pak3", "pak3", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_PAK_SWITCHER_PAK4_PROPERTY, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_PAK4_PROPERTY] = g_param_spec_enum ("pak4", "pak4", "pak4", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_PAK_SWITCHER_BLOCK_AUTOHIDE_PROPERTY, games_nintendo64_pak_switcher_properties[GAMES_NINTENDO64_PAK_SWITCHER_BLOCK_AUTOHIDE_PROPERTY] = g_param_spec_boolean ("block-autohide", "block-autohide", "block-autohide", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/plugins/nintendo-64/nintendo-64-pak-switcher.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "menu_button", FALSE, GamesNintendo64PakSwitcher_private_offset + G_STRUCT_OFFSET (GamesNintendo64PakSwitcherPrivate, menu_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "controllers_box", FALSE, GamesNintendo64PakSwitcher_private_offset + G_STRUCT_OFFSET (GamesNintendo64PakSwitcherPrivate, controllers_box));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_menu_state_changed", G_CALLBACK(_games_nintendo64_pak_switcher_on_menu_state_changed_g_object_notify));
}

static void
games_nintendo64_pak_switcher_games_header_bar_widget_interface_init (GamesHeaderBarWidgetIface * iface,
                                                                      gpointer iface_data)
{
	games_nintendo64_pak_switcher_games_header_bar_widget_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_block_autohide = games_nintendo64_pak_switcher_real_get_block_autohide;
}

static void
games_nintendo64_pak_switcher_instance_init (GamesNintendo64PakSwitcher * self,
                                             gpointer klass)
{
	self->priv = games_nintendo64_pak_switcher_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_nintendo64_pak_switcher_finalize (GObject * obj)
{
	GamesNintendo64PakSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_NINTENDO64_PAK_SWITCHER, GamesNintendo64PakSwitcher);
	_g_object_unref0 (self->priv->_runner);
	G_OBJECT_CLASS (games_nintendo64_pak_switcher_parent_class)->finalize (obj);
}

GType
games_nintendo64_pak_switcher_get_type (void)
{
	return games_nintendo64_pak_switcher_type_id;
}

GType
games_nintendo64_pak_switcher_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesNintendo64PakSwitcherClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_nintendo64_pak_switcher_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesNintendo64PakSwitcher), 0, (GInstanceInitFunc) games_nintendo64_pak_switcher_instance_init, NULL };
	static const GInterfaceInfo games_header_bar_widget_info = { (GInterfaceInitFunc) games_nintendo64_pak_switcher_games_header_bar_widget_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_nintendo64_pak_switcher_type_id = g_type_module_register_type (module, gtk_bin_get_type (), "GamesNintendo64PakSwitcher", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_nintendo64_pak_switcher_type_id, GAMES_TYPE_HEADER_BAR_WIDGET, &games_header_bar_widget_info);
	GamesNintendo64PakSwitcher_private_offset = sizeof (GamesNintendo64PakSwitcherPrivate);
	return games_nintendo64_pak_switcher_type_id;
}

static void
_vala_games_nintendo64_pak_switcher_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	GamesNintendo64PakSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_NINTENDO64_PAK_SWITCHER, GamesNintendo64PakSwitcher);
	switch (property_id) {
		case GAMES_NINTENDO64_PAK_SWITCHER_RUNNER_PROPERTY:
		g_value_set_object (value, games_nintendo64_pak_switcher_get_runner (self));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK1_PROPERTY:
		g_value_set_enum (value, games_nintendo64_pak_switcher_get_pak1 (self));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK2_PROPERTY:
		g_value_set_enum (value, games_nintendo64_pak_switcher_get_pak2 (self));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK3_PROPERTY:
		g_value_set_enum (value, games_nintendo64_pak_switcher_get_pak3 (self));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK4_PROPERTY:
		g_value_set_enum (value, games_nintendo64_pak_switcher_get_pak4 (self));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_BLOCK_AUTOHIDE_PROPERTY:
		g_value_set_boolean (value, games_header_bar_widget_get_block_autohide ((GamesHeaderBarWidget*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_nintendo64_pak_switcher_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec)
{
	GamesNintendo64PakSwitcher * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_NINTENDO64_PAK_SWITCHER, GamesNintendo64PakSwitcher);
	switch (property_id) {
		case GAMES_NINTENDO64_PAK_SWITCHER_RUNNER_PROPERTY:
		games_nintendo64_pak_switcher_set_runner (self, g_value_get_object (value));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK1_PROPERTY:
		games_nintendo64_pak_switcher_set_pak1 (self, g_value_get_enum (value));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK2_PROPERTY:
		games_nintendo64_pak_switcher_set_pak2 (self, g_value_get_enum (value));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK3_PROPERTY:
		games_nintendo64_pak_switcher_set_pak3 (self, g_value_get_enum (value));
		break;
		case GAMES_NINTENDO64_PAK_SWITCHER_PAK4_PROPERTY:
		games_nintendo64_pak_switcher_set_pak4 (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

