/* preferences-dialog.c generated by valac 0.34.0.103-3e15a8, the Vala compiler
 * generated from preferences-dialog.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * Gnome Nibbles: Gnome Worm Game
 * Copyright (C) 2015 Gabriel Ivascu <ivascu.gabriel59@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <gee.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>


#define TYPE_PREFERENCES_DIALOG (preferences_dialog_get_type ())
#define PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PREFERENCES_DIALOG, PreferencesDialog))
#define PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PREFERENCES_DIALOG, PreferencesDialogClass))
#define IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PREFERENCES_DIALOG))
#define IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PREFERENCES_DIALOG))
#define PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PREFERENCES_DIALOG, PreferencesDialogClass))

typedef struct _PreferencesDialog PreferencesDialog;
typedef struct _PreferencesDialogClass PreferencesDialogClass;
typedef struct _PreferencesDialogPrivate PreferencesDialogPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))

struct _PreferencesDialog {
	GtkDialog parent_instance;
	PreferencesDialogPrivate * priv;
};

struct _PreferencesDialogClass {
	GtkDialogClass parent_class;
};

struct _PreferencesDialogPrivate {
	GtkApplicationWindow* window;
	GSettings* settings;
	GeeArrayList* worm_settings;
	GtkNotebook* notebook;
	GtkRadioButton* beginner_radio_button;
	GtkRadioButton* slow_radio_button;
	GtkRadioButton* medium_radio_button;
	GtkRadioButton* fast_radio_button;
	GtkCheckButton* sound_check_button;
	GtkCheckButton* fakes_check_button;
	GtkListStore* list_store_1;
	GtkListStore* list_store_2;
	GtkListStore* list_store_3;
	GtkListStore* list_store_4;
	GtkTreeView* tree_view_1;
	GtkTreeView* tree_view_2;
	GtkTreeView* tree_view_3;
	GtkTreeView* tree_view_4;
	GtkComboBoxText* combo_box_1;
	GtkComboBoxText* combo_box_2;
	GtkComboBoxText* combo_box_3;
	GtkComboBoxText* combo_box_4;
	GeeArrayList* radio_buttons;
	GeeArrayList* list_stores;
	GeeArrayList* tree_views;
	GeeArrayList* combo_boxes;
};


static gpointer preferences_dialog_parent_class = NULL;

GType preferences_dialog_get_type (void) G_GNUC_CONST;
#define PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PREFERENCES_DIALOG, PreferencesDialogPrivate))
enum  {
	PREFERENCES_DIALOG_DUMMY_PROPERTY
};
PreferencesDialog* preferences_dialog_new (GtkApplicationWindow* window, GSettings* settings, GeeArrayList* worm_settings);
PreferencesDialog* preferences_dialog_construct (GType object_type, GtkApplicationWindow* window, GSettings* settings, GeeArrayList* worm_settings);
static void __lambda4_ (PreferencesDialog* self);
static void ___lambda4__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
#define NIBBLES_GAME_MAX_SPEED 4
static void preferences_dialog_radio_button_toggled_cb (PreferencesDialog* self, GtkToggleButton* button);
static void _preferences_dialog_radio_button_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void preferences_dialog_sound_toggled_cb (PreferencesDialog* self);
static void _preferences_dialog_sound_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void preferences_dialog_fakes_toggles_cb (PreferencesDialog* self);
static void _preferences_dialog_fakes_toggles_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void preferences_dialog_accel_edited_cb (PreferencesDialog* self, GtkCellRendererAccel* cell, const gchar* path_string, guint keyval, GdkModifierType mask, guint hardware_keycode);
static void _preferences_dialog_accel_edited_cb_gtk_cell_renderer_accel_accel_edited (GtkCellRendererAccel* _sender, const gchar* path_string, guint accel_key, GdkModifierType accel_mods, guint hardware_keycode, gpointer self);
static void preferences_dialog_accel_cleared_cb (PreferencesDialog* self, GtkCellRendererAccel* cell, const gchar* path_string);
static void _preferences_dialog_accel_cleared_cb_gtk_cell_renderer_accel_accel_cleared (GtkCellRendererAccel* _sender, const gchar* path_string, gpointer self);
#define NIBBLES_VIEW_NUM_COLORS 6
gchar* nibbles_view_colorval_name (gint colorval);
static void preferences_dialog_combo_box_changed_cb (PreferencesDialog* self, GtkComboBox* combo_box);
static void _preferences_dialog_combo_box_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
#define NIBBLES_GAME_MAX_HUMANS 4
#define NIBBLES_GAME_MAX_WORMS 6
static void preferences_dialog_finalize (GObject * obj);


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


static void __lambda4_ (PreferencesDialog* self) {
	gtk_widget_destroy ((GtkWidget*) self);
}


static void ___lambda4__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	__lambda4_ ((PreferencesDialog*) self);
}


static void _preferences_dialog_radio_button_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	preferences_dialog_radio_button_toggled_cb ((PreferencesDialog*) self, _sender);
}


static void _preferences_dialog_sound_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	preferences_dialog_sound_toggled_cb ((PreferencesDialog*) self);
}


static void _preferences_dialog_fakes_toggles_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	preferences_dialog_fakes_toggles_cb ((PreferencesDialog*) self);
}


static void _preferences_dialog_accel_edited_cb_gtk_cell_renderer_accel_accel_edited (GtkCellRendererAccel* _sender, const gchar* path_string, guint accel_key, GdkModifierType accel_mods, guint hardware_keycode, gpointer self) {
	preferences_dialog_accel_edited_cb ((PreferencesDialog*) self, _sender, path_string, accel_key, accel_mods, hardware_keycode);
}


static void _preferences_dialog_accel_cleared_cb_gtk_cell_renderer_accel_accel_cleared (GtkCellRendererAccel* _sender, const gchar* path_string, gpointer self) {
	preferences_dialog_accel_cleared_cb ((PreferencesDialog*) self, _sender, path_string);
}


static void _preferences_dialog_combo_box_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	preferences_dialog_combo_box_changed_cb ((PreferencesDialog*) self, _sender);
}


PreferencesDialog* preferences_dialog_construct (GType object_type, GtkApplicationWindow* window, GSettings* settings, GeeArrayList* worm_settings) {
	PreferencesDialog * self = NULL;
	GSettings* _tmp0_ = NULL;
	GSettings* _tmp1_ = NULL;
	GeeArrayList* _tmp2_ = NULL;
	GeeArrayList* _tmp3_ = NULL;
	GtkApplicationWindow* _tmp4_ = NULL;
	GtkApplicationWindow* _tmp5_ = NULL;
	GtkApplicationWindow* _tmp6_ = NULL;
	GeeArrayList* _tmp7_ = NULL;
	GeeArrayList* _tmp8_ = NULL;
	GtkRadioButton* _tmp9_ = NULL;
	GeeArrayList* _tmp10_ = NULL;
	GtkRadioButton* _tmp11_ = NULL;
	GeeArrayList* _tmp12_ = NULL;
	GtkRadioButton* _tmp13_ = NULL;
	GeeArrayList* _tmp14_ = NULL;
	GtkRadioButton* _tmp15_ = NULL;
	GtkCheckButton* _tmp35_ = NULL;
	GSettings* _tmp36_ = NULL;
	gboolean _tmp37_ = FALSE;
	GtkCheckButton* _tmp38_ = NULL;
	GtkCheckButton* _tmp39_ = NULL;
	GSettings* _tmp40_ = NULL;
	gboolean _tmp41_ = FALSE;
	GtkCheckButton* _tmp42_ = NULL;
	GeeArrayList* _tmp43_ = NULL;
	GeeArrayList* _tmp44_ = NULL;
	GtkTreeView* _tmp45_ = NULL;
	GeeArrayList* _tmp46_ = NULL;
	GtkTreeView* _tmp47_ = NULL;
	GeeArrayList* _tmp48_ = NULL;
	GtkTreeView* _tmp49_ = NULL;
	GeeArrayList* _tmp50_ = NULL;
	GtkTreeView* _tmp51_ = NULL;
	GeeArrayList* _tmp52_ = NULL;
	GeeArrayList* _tmp53_ = NULL;
	GtkListStore* _tmp54_ = NULL;
	GeeArrayList* _tmp55_ = NULL;
	GtkListStore* _tmp56_ = NULL;
	GeeArrayList* _tmp57_ = NULL;
	GtkListStore* _tmp58_ = NULL;
	GeeArrayList* _tmp59_ = NULL;
	GtkListStore* _tmp60_ = NULL;
	GeeArrayList* _tmp129_ = NULL;
	GeeArrayList* _tmp130_ = NULL;
	GtkComboBoxText* _tmp131_ = NULL;
	GeeArrayList* _tmp132_ = NULL;
	GtkComboBoxText* _tmp133_ = NULL;
	GeeArrayList* _tmp134_ = NULL;
	GtkComboBoxText* _tmp135_ = NULL;
	GeeArrayList* _tmp136_ = NULL;
	GtkComboBoxText* _tmp137_ = NULL;
	g_return_val_if_fail (window != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	g_return_val_if_fail (worm_settings != NULL, NULL);
	self = (PreferencesDialog*) g_object_new (object_type, "use-header-bar", 1, NULL);
	_tmp0_ = settings;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp1_;
	_tmp2_ = worm_settings;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->worm_settings);
	self->priv->worm_settings = _tmp3_;
	_tmp4_ = window;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp5_;
	g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) ___lambda4__gtk_dialog_response, self, 0);
	_tmp6_ = window;
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) _tmp6_);
	_tmp7_ = gee_array_list_new (gtk_radio_button_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->radio_buttons);
	self->priv->radio_buttons = _tmp7_;
	_tmp8_ = self->priv->radio_buttons;
	_tmp9_ = self->priv->beginner_radio_button;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp8_, _tmp9_);
	_tmp10_ = self->priv->radio_buttons;
	_tmp11_ = self->priv->slow_radio_button;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp11_);
	_tmp12_ = self->priv->radio_buttons;
	_tmp13_ = self->priv->medium_radio_button;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp13_);
	_tmp14_ = self->priv->radio_buttons;
	_tmp15_ = self->priv->fast_radio_button;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
	{
		GeeArrayList* _radio_button_list = NULL;
		GeeArrayList* _tmp16_ = NULL;
		GeeArrayList* _tmp17_ = NULL;
		gint _radio_button_size = 0;
		GeeArrayList* _tmp18_ = NULL;
		gint _tmp19_ = 0;
		gint _tmp20_ = 0;
		gint _radio_button_index = 0;
		_tmp16_ = self->priv->radio_buttons;
		_tmp17_ = _g_object_ref0 (_tmp16_);
		_radio_button_list = _tmp17_;
		_tmp18_ = _radio_button_list;
		_tmp19_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp18_);
		_tmp20_ = _tmp19_;
		_radio_button_size = _tmp20_;
		_radio_button_index = -1;
		while (TRUE) {
			gint _tmp21_ = 0;
			gint _tmp22_ = 0;
			gint _tmp23_ = 0;
			GtkRadioButton* radio_button = NULL;
			GeeArrayList* _tmp24_ = NULL;
			gint _tmp25_ = 0;
			gpointer _tmp26_ = NULL;
			gint speed = 0;
			GeeArrayList* _tmp27_ = NULL;
			GtkRadioButton* _tmp28_ = NULL;
			gint _tmp29_ = 0;
			GtkRadioButton* _tmp30_ = NULL;
			gint _tmp31_ = 0;
			GSettings* _tmp32_ = NULL;
			gint _tmp33_ = 0;
			GtkRadioButton* _tmp34_ = NULL;
			_tmp21_ = _radio_button_index;
			_radio_button_index = _tmp21_ + 1;
			_tmp22_ = _radio_button_index;
			_tmp23_ = _radio_button_size;
			if (!(_tmp22_ < _tmp23_)) {
				break;
			}
			_tmp24_ = _radio_button_list;
			_tmp25_ = _radio_button_index;
			_tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _tmp24_, _tmp25_);
			radio_button = (GtkRadioButton*) _tmp26_;
			_tmp27_ = self->priv->radio_buttons;
			_tmp28_ = radio_button;
			_tmp29_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp27_, _tmp28_);
			speed = NIBBLES_GAME_MAX_SPEED - _tmp29_;
			_tmp30_ = radio_button;
			_tmp31_ = speed;
			_tmp32_ = settings;
			_tmp33_ = g_settings_get_int (_tmp32_, "speed");
			gtk_toggle_button_set_active ((GtkToggleButton*) _tmp30_, _tmp31_ == _tmp33_);
			_tmp34_ = radio_button;
			g_signal_connect_object ((GtkToggleButton*) _tmp34_, "toggled", (GCallback) _preferences_dialog_radio_button_toggled_cb_gtk_toggle_button_toggled, self, 0);
			_g_object_unref0 (radio_button);
		}
		_g_object_unref0 (_radio_button_list);
	}
	_tmp35_ = self->priv->sound_check_button;
	_tmp36_ = settings;
	_tmp37_ = g_settings_get_boolean (_tmp36_, "sound");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp35_, _tmp37_);
	_tmp38_ = self->priv->sound_check_button;
	g_signal_connect_object ((GtkToggleButton*) _tmp38_, "toggled", (GCallback) _preferences_dialog_sound_toggled_cb_gtk_toggle_button_toggled, self, 0);
	_tmp39_ = self->priv->fakes_check_button;
	_tmp40_ = settings;
	_tmp41_ = g_settings_get_boolean (_tmp40_, "fakes");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp39_, _tmp41_);
	_tmp42_ = self->priv->fakes_check_button;
	g_signal_connect_object ((GtkToggleButton*) _tmp42_, "toggled", (GCallback) _preferences_dialog_fakes_toggles_cb_gtk_toggle_button_toggled, self, 0);
	_tmp43_ = gee_array_list_new (gtk_tree_view_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->tree_views);
	self->priv->tree_views = _tmp43_;
	_tmp44_ = self->priv->tree_views;
	_tmp45_ = self->priv->tree_view_1;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp44_, _tmp45_);
	_tmp46_ = self->priv->tree_views;
	_tmp47_ = self->priv->tree_view_2;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp46_, _tmp47_);
	_tmp48_ = self->priv->tree_views;
	_tmp49_ = self->priv->tree_view_3;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp48_, _tmp49_);
	_tmp50_ = self->priv->tree_views;
	_tmp51_ = self->priv->tree_view_4;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp50_, _tmp51_);
	_tmp52_ = gee_array_list_new (gtk_list_store_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->list_stores);
	self->priv->list_stores = _tmp52_;
	_tmp53_ = self->priv->list_stores;
	_tmp54_ = self->priv->list_store_1;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp53_, _tmp54_);
	_tmp55_ = self->priv->list_stores;
	_tmp56_ = self->priv->list_store_2;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp55_, _tmp56_);
	_tmp57_ = self->priv->list_stores;
	_tmp58_ = self->priv->list_store_3;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp57_, _tmp58_);
	_tmp59_ = self->priv->list_stores;
	_tmp60_ = self->priv->list_store_4;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp59_, _tmp60_);
	{
		GeeArrayList* _list_store_list = NULL;
		GeeArrayList* _tmp61_ = NULL;
		GeeArrayList* _tmp62_ = NULL;
		gint _list_store_size = 0;
		GeeArrayList* _tmp63_ = NULL;
		gint _tmp64_ = 0;
		gint _tmp65_ = 0;
		gint _list_store_index = 0;
		_tmp61_ = self->priv->list_stores;
		_tmp62_ = _g_object_ref0 (_tmp61_);
		_list_store_list = _tmp62_;
		_tmp63_ = _list_store_list;
		_tmp64_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp63_);
		_tmp65_ = _tmp64_;
		_list_store_size = _tmp65_;
		_list_store_index = -1;
		while (TRUE) {
			gint _tmp66_ = 0;
			gint _tmp67_ = 0;
			gint _tmp68_ = 0;
			GtkListStore* list_store = NULL;
			GeeArrayList* _tmp69_ = NULL;
			gint _tmp70_ = 0;
			gpointer _tmp71_ = NULL;
			gint id = 0;
			GeeArrayList* _tmp72_ = NULL;
			GtkListStore* _tmp73_ = NULL;
			gint _tmp74_ = 0;
			GtkTreeView* tree_view = NULL;
			GeeArrayList* _tmp75_ = NULL;
			gint _tmp76_ = 0;
			gpointer _tmp77_ = NULL;
			GtkTreeIter iter = {0};
			GtkListStore* _tmp78_ = NULL;
			GtkTreeIter _tmp79_ = {0};
			gint keyval = 0;
			GeeArrayList* _tmp80_ = NULL;
			gint _tmp81_ = 0;
			gpointer _tmp82_ = NULL;
			GSettings* _tmp83_ = NULL;
			gint _tmp84_ = 0;
			gint _tmp85_ = 0;
			GtkListStore* _tmp86_ = NULL;
			GtkTreeIter _tmp87_ = {0};
			gint _tmp88_ = 0;
			GtkListStore* _tmp89_ = NULL;
			GtkTreeIter _tmp90_ = {0};
			GeeArrayList* _tmp91_ = NULL;
			gint _tmp92_ = 0;
			gpointer _tmp93_ = NULL;
			GSettings* _tmp94_ = NULL;
			gint _tmp95_ = 0;
			GtkListStore* _tmp96_ = NULL;
			GtkTreeIter _tmp97_ = {0};
			gint _tmp98_ = 0;
			GtkListStore* _tmp99_ = NULL;
			GtkTreeIter _tmp100_ = {0};
			GeeArrayList* _tmp101_ = NULL;
			gint _tmp102_ = 0;
			gpointer _tmp103_ = NULL;
			GSettings* _tmp104_ = NULL;
			gint _tmp105_ = 0;
			GtkListStore* _tmp106_ = NULL;
			GtkTreeIter _tmp107_ = {0};
			gint _tmp108_ = 0;
			GtkListStore* _tmp109_ = NULL;
			GtkTreeIter _tmp110_ = {0};
			GeeArrayList* _tmp111_ = NULL;
			gint _tmp112_ = 0;
			gpointer _tmp113_ = NULL;
			GSettings* _tmp114_ = NULL;
			gint _tmp115_ = 0;
			GtkListStore* _tmp116_ = NULL;
			GtkTreeIter _tmp117_ = {0};
			gint _tmp118_ = 0;
			GtkCellRendererText* label_renderer = NULL;
			GtkCellRendererText* _tmp119_ = NULL;
			GtkTreeView* _tmp120_ = NULL;
			GtkCellRendererText* _tmp121_ = NULL;
			GtkCellRendererAccel* key_renderer = NULL;
			GtkCellRendererAccel* _tmp122_ = NULL;
			GtkCellRendererAccel* _tmp123_ = NULL;
			GtkCellRendererAccel* _tmp124_ = NULL;
			GtkCellRendererAccel* _tmp125_ = NULL;
			GtkCellRendererAccel* _tmp126_ = NULL;
			GtkTreeView* _tmp127_ = NULL;
			GtkCellRendererAccel* _tmp128_ = NULL;
			_tmp66_ = _list_store_index;
			_list_store_index = _tmp66_ + 1;
			_tmp67_ = _list_store_index;
			_tmp68_ = _list_store_size;
			if (!(_tmp67_ < _tmp68_)) {
				break;
			}
			_tmp69_ = _list_store_list;
			_tmp70_ = _list_store_index;
			_tmp71_ = gee_abstract_list_get ((GeeAbstractList*) _tmp69_, _tmp70_);
			list_store = (GtkListStore*) _tmp71_;
			_tmp72_ = self->priv->list_stores;
			_tmp73_ = list_store;
			_tmp74_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp72_, _tmp73_);
			id = _tmp74_;
			_tmp75_ = self->priv->tree_views;
			_tmp76_ = id;
			_tmp77_ = gee_abstract_list_get ((GeeAbstractList*) _tmp75_, _tmp76_);
			tree_view = (GtkTreeView*) _tmp77_;
			_tmp78_ = list_store;
			gtk_list_store_append (_tmp78_, &_tmp79_);
			iter = _tmp79_;
			_tmp80_ = worm_settings;
			_tmp81_ = id;
			_tmp82_ = gee_abstract_list_get ((GeeAbstractList*) _tmp80_, _tmp81_);
			_tmp83_ = (GSettings*) _tmp82_;
			_tmp84_ = g_settings_get_int (_tmp83_, "key-up");
			_tmp85_ = _tmp84_;
			_g_object_unref0 (_tmp83_);
			keyval = _tmp85_;
			_tmp86_ = list_store;
			_tmp87_ = iter;
			_tmp88_ = keyval;
			gtk_list_store_set (_tmp86_, &_tmp87_, 0, "key-up", 1, _ ("Move up"), 2, _tmp88_, -1);
			_tmp89_ = list_store;
			gtk_list_store_append (_tmp89_, &_tmp90_);
			iter = _tmp90_;
			_tmp91_ = worm_settings;
			_tmp92_ = id;
			_tmp93_ = gee_abstract_list_get ((GeeAbstractList*) _tmp91_, _tmp92_);
			_tmp94_ = (GSettings*) _tmp93_;
			_tmp95_ = g_settings_get_int (_tmp94_, "key-down");
			keyval = _tmp95_;
			_g_object_unref0 (_tmp94_);
			_tmp96_ = list_store;
			_tmp97_ = iter;
			_tmp98_ = keyval;
			gtk_list_store_set (_tmp96_, &_tmp97_, 0, "key-down", 1, _ ("Move down"), 2, _tmp98_, -1);
			_tmp99_ = list_store;
			gtk_list_store_append (_tmp99_, &_tmp100_);
			iter = _tmp100_;
			_tmp101_ = worm_settings;
			_tmp102_ = id;
			_tmp103_ = gee_abstract_list_get ((GeeAbstractList*) _tmp101_, _tmp102_);
			_tmp104_ = (GSettings*) _tmp103_;
			_tmp105_ = g_settings_get_int (_tmp104_, "key-left");
			keyval = _tmp105_;
			_g_object_unref0 (_tmp104_);
			_tmp106_ = list_store;
			_tmp107_ = iter;
			_tmp108_ = keyval;
			gtk_list_store_set (_tmp106_, &_tmp107_, 0, "key-left", 1, _ ("Move left"), 2, _tmp108_, -1);
			_tmp109_ = list_store;
			gtk_list_store_append (_tmp109_, &_tmp110_);
			iter = _tmp110_;
			_tmp111_ = worm_settings;
			_tmp112_ = id;
			_tmp113_ = gee_abstract_list_get ((GeeAbstractList*) _tmp111_, _tmp112_);
			_tmp114_ = (GSettings*) _tmp113_;
			_tmp115_ = g_settings_get_int (_tmp114_, "key-right");
			keyval = _tmp115_;
			_g_object_unref0 (_tmp114_);
			_tmp116_ = list_store;
			_tmp117_ = iter;
			_tmp118_ = keyval;
			gtk_list_store_set (_tmp116_, &_tmp117_, 0, "key-right", 1, _ ("Move right"), 2, _tmp118_, -1);
			_tmp119_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
			g_object_ref_sink (_tmp119_);
			label_renderer = _tmp119_;
			_tmp120_ = tree_view;
			_tmp121_ = label_renderer;
			gtk_tree_view_insert_column_with_attributes (_tmp120_, -1, _ ("Action"), (GtkCellRenderer*) _tmp121_, "text", 1, NULL);
			_tmp122_ = (GtkCellRendererAccel*) gtk_cell_renderer_accel_new ();
			g_object_ref_sink (_tmp122_);
			key_renderer = _tmp122_;
			_tmp123_ = key_renderer;
			g_object_set ((GtkCellRendererText*) _tmp123_, "editable", TRUE, NULL);
			_tmp124_ = key_renderer;
			g_object_set (_tmp124_, "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_OTHER, NULL);
			_tmp125_ = key_renderer;
			g_signal_connect_object (_tmp125_, "accel-edited", (GCallback) _preferences_dialog_accel_edited_cb_gtk_cell_renderer_accel_accel_edited, self, 0);
			_tmp126_ = key_renderer;
			g_signal_connect_object (_tmp126_, "accel-cleared", (GCallback) _preferences_dialog_accel_cleared_cb_gtk_cell_renderer_accel_accel_cleared, self, 0);
			_tmp127_ = tree_view;
			_tmp128_ = key_renderer;
			gtk_tree_view_insert_column_with_attributes (_tmp127_, -1, _ ("Key"), (GtkCellRenderer*) _tmp128_, "accel-key", 2, NULL);
			_g_object_unref0 (key_renderer);
			_g_object_unref0 (label_renderer);
			_g_object_unref0 (tree_view);
			_g_object_unref0 (list_store);
		}
		_g_object_unref0 (_list_store_list);
	}
	_tmp129_ = gee_array_list_new (gtk_combo_box_text_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->combo_boxes);
	self->priv->combo_boxes = _tmp129_;
	_tmp130_ = self->priv->combo_boxes;
	_tmp131_ = self->priv->combo_box_1;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp130_, _tmp131_);
	_tmp132_ = self->priv->combo_boxes;
	_tmp133_ = self->priv->combo_box_2;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp132_, _tmp133_);
	_tmp134_ = self->priv->combo_boxes;
	_tmp135_ = self->priv->combo_box_3;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp134_, _tmp135_);
	_tmp136_ = self->priv->combo_boxes;
	_tmp137_ = self->priv->combo_box_4;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp136_, _tmp137_);
	{
		GeeArrayList* _combo_box_list = NULL;
		GeeArrayList* _tmp138_ = NULL;
		GeeArrayList* _tmp139_ = NULL;
		gint _combo_box_size = 0;
		GeeArrayList* _tmp140_ = NULL;
		gint _tmp141_ = 0;
		gint _tmp142_ = 0;
		gint _combo_box_index = 0;
		_tmp138_ = self->priv->combo_boxes;
		_tmp139_ = _g_object_ref0 (_tmp138_);
		_combo_box_list = _tmp139_;
		_tmp140_ = _combo_box_list;
		_tmp141_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp140_);
		_tmp142_ = _tmp141_;
		_combo_box_size = _tmp142_;
		_combo_box_index = -1;
		while (TRUE) {
			gint _tmp143_ = 0;
			gint _tmp144_ = 0;
			gint _tmp145_ = 0;
			GtkComboBoxText* combo_box = NULL;
			GeeArrayList* _tmp146_ = NULL;
			gint _tmp147_ = 0;
			gpointer _tmp148_ = NULL;
			gint id = 0;
			GeeArrayList* _tmp156_ = NULL;
			GtkComboBoxText* _tmp157_ = NULL;
			gint _tmp158_ = 0;
			gint color = 0;
			GeeArrayList* _tmp159_ = NULL;
			gint _tmp160_ = 0;
			gpointer _tmp161_ = NULL;
			GSettings* _tmp162_ = NULL;
			gint _tmp163_ = 0;
			gint _tmp164_ = 0;
			GtkComboBoxText* _tmp165_ = NULL;
			gint _tmp166_ = 0;
			GtkComboBoxText* _tmp167_ = NULL;
			_tmp143_ = _combo_box_index;
			_combo_box_index = _tmp143_ + 1;
			_tmp144_ = _combo_box_index;
			_tmp145_ = _combo_box_size;
			if (!(_tmp144_ < _tmp145_)) {
				break;
			}
			_tmp146_ = _combo_box_list;
			_tmp147_ = _combo_box_index;
			_tmp148_ = gee_abstract_list_get ((GeeAbstractList*) _tmp146_, _tmp147_);
			combo_box = (GtkComboBoxText*) _tmp148_;
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp149_ = FALSE;
					_tmp149_ = TRUE;
					while (TRUE) {
						gint _tmp151_ = 0;
						GtkComboBoxText* _tmp152_ = NULL;
						gint _tmp153_ = 0;
						gchar* _tmp154_ = NULL;
						gchar* _tmp155_ = NULL;
						if (!_tmp149_) {
							gint _tmp150_ = 0;
							_tmp150_ = i;
							i = _tmp150_ + 1;
						}
						_tmp149_ = FALSE;
						_tmp151_ = i;
						if (!(_tmp151_ < NIBBLES_VIEW_NUM_COLORS)) {
							break;
						}
						_tmp152_ = combo_box;
						_tmp153_ = i;
						_tmp154_ = nibbles_view_colorval_name (_tmp153_);
						_tmp155_ = _tmp154_;
						gtk_combo_box_text_append_text (_tmp152_, _tmp155_);
						_g_free0 (_tmp155_);
					}
				}
			}
			_tmp156_ = self->priv->combo_boxes;
			_tmp157_ = combo_box;
			_tmp158_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp156_, _tmp157_);
			id = _tmp158_;
			_tmp159_ = worm_settings;
			_tmp160_ = id;
			_tmp161_ = gee_abstract_list_get ((GeeAbstractList*) _tmp159_, _tmp160_);
			_tmp162_ = (GSettings*) _tmp161_;
			_tmp163_ = g_settings_get_enum (_tmp162_, "color");
			_tmp164_ = _tmp163_;
			_g_object_unref0 (_tmp162_);
			color = _tmp164_;
			_tmp165_ = combo_box;
			_tmp166_ = color;
			gtk_combo_box_set_active ((GtkComboBox*) _tmp165_, _tmp166_);
			_tmp167_ = combo_box;
			g_signal_connect_object ((GtkComboBox*) _tmp167_, "changed", (GCallback) _preferences_dialog_combo_box_changed_cb_gtk_combo_box_changed, self, 0);
			_g_object_unref0 (combo_box);
		}
		_g_object_unref0 (_combo_box_list);
	}
	return self;
}


PreferencesDialog* preferences_dialog_new (GtkApplicationWindow* window, GSettings* settings, GeeArrayList* worm_settings) {
	return preferences_dialog_construct (TYPE_PREFERENCES_DIALOG, window, settings, worm_settings);
}


static void preferences_dialog_radio_button_toggled_cb (PreferencesDialog* self, GtkToggleButton* button) {
	GtkToggleButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = button;
	_tmp1_ = gtk_toggle_button_get_active (_tmp0_);
	if (_tmp1_) {
		gint speed = 0;
		GeeArrayList* _tmp2_ = NULL;
		GtkToggleButton* _tmp3_ = NULL;
		gint _tmp4_ = 0;
		GSettings* _tmp5_ = NULL;
		gint _tmp6_ = 0;
		_tmp2_ = self->priv->radio_buttons;
		_tmp3_ = button;
		_tmp4_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp2_, G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_radio_button_get_type (), GtkRadioButton));
		speed = NIBBLES_GAME_MAX_SPEED - _tmp4_;
		_tmp5_ = self->priv->settings;
		_tmp6_ = speed;
		g_settings_set_int (_tmp5_, "speed", _tmp6_);
	}
}


static void preferences_dialog_sound_toggled_cb (PreferencesDialog* self) {
	gboolean play_sound = FALSE;
	GtkCheckButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	GSettings* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->sound_check_button;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	play_sound = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_boolean (_tmp2_, "sound", play_sound);
}


static void preferences_dialog_fakes_toggles_cb (PreferencesDialog* self) {
	gboolean has_fakes = FALSE;
	GtkCheckButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	GSettings* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->fakes_check_button;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	has_fakes = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_boolean (_tmp2_, "fakes", has_fakes);
}


static void preferences_dialog_accel_edited_cb (PreferencesDialog* self, GtkCellRendererAccel* cell, const gchar* path_string, guint keyval, GdkModifierType mask, guint hardware_keycode) {
	GtkTreePath* path = NULL;
	const gchar* _tmp0_ = NULL;
	GtkTreePath* _tmp1_ = NULL;
	GtkTreePath* _tmp2_ = NULL;
	gint id = 0;
	GtkNotebook* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	GtkListStore* list_store = NULL;
	GeeArrayList* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gpointer _tmp7_ = NULL;
	GtkTreeIter it = {0};
	GtkListStore* _tmp8_ = NULL;
	GtkTreePath* _tmp9_ = NULL;
	GtkTreeIter _tmp10_ = {0};
	gboolean _tmp11_ = FALSE;
	gchar* key = NULL;
	GtkListStore* _tmp12_ = NULL;
	GtkTreeIter _tmp13_ = {0};
	const gchar* _tmp14_ = NULL;
	GeeArrayList* _tmp15_ = NULL;
	gint _tmp16_ = 0;
	gpointer _tmp17_ = NULL;
	GSettings* _tmp18_ = NULL;
	const gchar* _tmp19_ = NULL;
	gint _tmp20_ = 0;
	guint _tmp21_ = 0U;
	gboolean _tmp22_ = FALSE;
	gboolean valid = FALSE;
	gboolean _tmp58_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (path_string != NULL);
	_tmp0_ = path_string;
	_tmp1_ = gtk_tree_path_new_from_string (_tmp0_);
	path = _tmp1_;
	_tmp2_ = path;
	if (_tmp2_ == NULL) {
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp3_ = self->priv->notebook;
	_tmp4_ = gtk_notebook_get_current_page (_tmp3_);
	id = _tmp4_ - 1;
	_tmp5_ = self->priv->list_stores;
	_tmp6_ = id;
	_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, _tmp6_);
	list_store = (GtkListStore*) _tmp7_;
	_tmp8_ = list_store;
	_tmp9_ = path;
	_tmp11_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp8_, &_tmp10_, _tmp9_);
	it = _tmp10_;
	if (!_tmp11_) {
		_g_object_unref0 (list_store);
		_gtk_tree_path_free0 (path);
		return;
	}
	key = NULL;
	_tmp12_ = list_store;
	_tmp13_ = it;
	gtk_tree_model_get ((GtkTreeModel*) _tmp12_, &_tmp13_, 0, &key, -1);
	_tmp14_ = key;
	if (_tmp14_ == NULL) {
		_g_free0 (key);
		_g_object_unref0 (list_store);
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp15_ = self->priv->worm_settings;
	_tmp16_ = id;
	_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, _tmp16_);
	_tmp18_ = (GSettings*) _tmp17_;
	_tmp19_ = key;
	_tmp20_ = g_settings_get_int (_tmp18_, _tmp19_);
	_tmp21_ = keyval;
	_tmp22_ = ((guint) _tmp20_) == _tmp21_;
	_g_object_unref0 (_tmp18_);
	if (_tmp22_) {
		_g_free0 (key);
		_g_object_unref0 (list_store);
		_gtk_tree_path_free0 (path);
		return;
	}
	valid = TRUE;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp23_ = FALSE;
			_tmp23_ = TRUE;
			while (TRUE) {
				gint _tmp25_ = 0;
				gboolean _tmp26_ = FALSE;
				gboolean _tmp27_ = FALSE;
				gboolean _tmp28_ = FALSE;
				GeeArrayList* _tmp29_ = NULL;
				gint _tmp30_ = 0;
				gpointer _tmp31_ = NULL;
				GSettings* _tmp32_ = NULL;
				gint _tmp33_ = 0;
				guint _tmp34_ = 0U;
				gboolean _tmp35_ = FALSE;
				if (!_tmp23_) {
					gint _tmp24_ = 0;
					_tmp24_ = i;
					i = _tmp24_ + 1;
				}
				_tmp23_ = FALSE;
				_tmp25_ = i;
				if (!(_tmp25_ < NIBBLES_GAME_MAX_HUMANS)) {
					break;
				}
				_tmp29_ = self->priv->worm_settings;
				_tmp30_ = i;
				_tmp31_ = gee_abstract_list_get ((GeeAbstractList*) _tmp29_, _tmp30_);
				_tmp32_ = (GSettings*) _tmp31_;
				_tmp33_ = g_settings_get_int (_tmp32_, "key-up");
				_tmp34_ = keyval;
				_tmp35_ = ((guint) _tmp33_) == _tmp34_;
				_g_object_unref0 (_tmp32_);
				if (_tmp35_) {
					_tmp28_ = TRUE;
				} else {
					GeeArrayList* _tmp36_ = NULL;
					gint _tmp37_ = 0;
					gpointer _tmp38_ = NULL;
					GSettings* _tmp39_ = NULL;
					gint _tmp40_ = 0;
					guint _tmp41_ = 0U;
					_tmp36_ = self->priv->worm_settings;
					_tmp37_ = i;
					_tmp38_ = gee_abstract_list_get ((GeeAbstractList*) _tmp36_, _tmp37_);
					_tmp39_ = (GSettings*) _tmp38_;
					_tmp40_ = g_settings_get_int (_tmp39_, "key-down");
					_tmp41_ = keyval;
					_tmp28_ = ((guint) _tmp40_) == _tmp41_;
					_g_object_unref0 (_tmp39_);
				}
				if (_tmp28_) {
					_tmp27_ = TRUE;
				} else {
					GeeArrayList* _tmp42_ = NULL;
					gint _tmp43_ = 0;
					gpointer _tmp44_ = NULL;
					GSettings* _tmp45_ = NULL;
					gint _tmp46_ = 0;
					guint _tmp47_ = 0U;
					_tmp42_ = self->priv->worm_settings;
					_tmp43_ = i;
					_tmp44_ = gee_abstract_list_get ((GeeAbstractList*) _tmp42_, _tmp43_);
					_tmp45_ = (GSettings*) _tmp44_;
					_tmp46_ = g_settings_get_int (_tmp45_, "key-left");
					_tmp47_ = keyval;
					_tmp27_ = ((guint) _tmp46_) == _tmp47_;
					_g_object_unref0 (_tmp45_);
				}
				if (_tmp27_) {
					_tmp26_ = TRUE;
				} else {
					GeeArrayList* _tmp48_ = NULL;
					gint _tmp49_ = 0;
					gpointer _tmp50_ = NULL;
					GSettings* _tmp51_ = NULL;
					gint _tmp52_ = 0;
					guint _tmp53_ = 0U;
					_tmp48_ = self->priv->worm_settings;
					_tmp49_ = i;
					_tmp50_ = gee_abstract_list_get ((GeeAbstractList*) _tmp48_, _tmp49_);
					_tmp51_ = (GSettings*) _tmp50_;
					_tmp52_ = g_settings_get_int (_tmp51_, "key-right");
					_tmp53_ = keyval;
					_tmp26_ = ((guint) _tmp52_) == _tmp53_;
					_g_object_unref0 (_tmp51_);
				}
				if (_tmp26_) {
					GtkMessageDialog* dialog = NULL;
					GtkApplicationWindow* _tmp54_ = NULL;
					GtkMessageDialog* _tmp55_ = NULL;
					GtkMessageDialog* _tmp56_ = NULL;
					GtkMessageDialog* _tmp57_ = NULL;
					valid = FALSE;
					_tmp54_ = self->priv->window;
					_tmp55_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) _tmp54_, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "%s", _ ("The key you selected is already assigned!"));
					g_object_ref_sink (_tmp55_);
					dialog = _tmp55_;
					_tmp56_ = dialog;
					gtk_dialog_run ((GtkDialog*) _tmp56_);
					_tmp57_ = dialog;
					gtk_widget_destroy ((GtkWidget*) _tmp57_);
					_g_object_unref0 (dialog);
					break;
				}
			}
		}
	}
	_tmp58_ = valid;
	if (_tmp58_) {
		GtkListStore* _tmp59_ = NULL;
		GtkTreeIter _tmp60_ = {0};
		guint _tmp61_ = 0U;
		GeeArrayList* _tmp62_ = NULL;
		gint _tmp63_ = 0;
		gpointer _tmp64_ = NULL;
		GSettings* _tmp65_ = NULL;
		const gchar* _tmp66_ = NULL;
		guint _tmp67_ = 0U;
		_tmp59_ = list_store;
		_tmp60_ = it;
		_tmp61_ = keyval;
		gtk_list_store_set (_tmp59_, &_tmp60_, 2, _tmp61_, -1);
		_tmp62_ = self->priv->worm_settings;
		_tmp63_ = id;
		_tmp64_ = gee_abstract_list_get ((GeeAbstractList*) _tmp62_, _tmp63_);
		_tmp65_ = (GSettings*) _tmp64_;
		_tmp66_ = key;
		_tmp67_ = keyval;
		g_settings_set_int (_tmp65_, _tmp66_, (gint) _tmp67_);
		_g_object_unref0 (_tmp65_);
	}
	_g_free0 (key);
	_g_object_unref0 (list_store);
	_gtk_tree_path_free0 (path);
}


static void preferences_dialog_accel_cleared_cb (PreferencesDialog* self, GtkCellRendererAccel* cell, const gchar* path_string) {
	GtkTreePath* path = NULL;
	const gchar* _tmp0_ = NULL;
	GtkTreePath* _tmp1_ = NULL;
	GtkTreePath* _tmp2_ = NULL;
	gint id = 0;
	GtkNotebook* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	GtkListStore* list_store = NULL;
	GeeArrayList* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gpointer _tmp7_ = NULL;
	GtkTreeIter it = {0};
	GtkListStore* _tmp8_ = NULL;
	GtkTreePath* _tmp9_ = NULL;
	GtkTreeIter _tmp10_ = {0};
	gboolean _tmp11_ = FALSE;
	gchar* key = NULL;
	GtkListStore* _tmp12_ = NULL;
	GtkTreeIter _tmp13_ = {0};
	const gchar* _tmp14_ = NULL;
	GtkListStore* _tmp15_ = NULL;
	GtkTreeIter _tmp16_ = {0};
	GeeArrayList* _tmp17_ = NULL;
	gint _tmp18_ = 0;
	gpointer _tmp19_ = NULL;
	GSettings* _tmp20_ = NULL;
	const gchar* _tmp21_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (path_string != NULL);
	_tmp0_ = path_string;
	_tmp1_ = gtk_tree_path_new_from_string (_tmp0_);
	path = _tmp1_;
	_tmp2_ = path;
	if (_tmp2_ == NULL) {
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp3_ = self->priv->notebook;
	_tmp4_ = gtk_notebook_get_current_page (_tmp3_);
	id = _tmp4_ - 1;
	_tmp5_ = self->priv->list_stores;
	_tmp6_ = id;
	_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, _tmp6_);
	list_store = (GtkListStore*) _tmp7_;
	_tmp8_ = list_store;
	_tmp9_ = path;
	_tmp11_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp8_, &_tmp10_, _tmp9_);
	it = _tmp10_;
	if (!_tmp11_) {
		_g_object_unref0 (list_store);
		_gtk_tree_path_free0 (path);
		return;
	}
	key = NULL;
	_tmp12_ = list_store;
	_tmp13_ = it;
	gtk_tree_model_get ((GtkTreeModel*) _tmp12_, &_tmp13_, 0, &key, -1);
	_tmp14_ = key;
	if (_tmp14_ == NULL) {
		_g_free0 (key);
		_g_object_unref0 (list_store);
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp15_ = list_store;
	_tmp16_ = it;
	gtk_list_store_set (_tmp15_, &_tmp16_, 2, 0, -1);
	_tmp17_ = self->priv->worm_settings;
	_tmp18_ = id;
	_tmp19_ = gee_abstract_list_get ((GeeAbstractList*) _tmp17_, _tmp18_);
	_tmp20_ = (GSettings*) _tmp19_;
	_tmp21_ = key;
	g_settings_set_int (_tmp20_, _tmp21_, 0);
	_g_object_unref0 (_tmp20_);
	_g_free0 (key);
	_g_object_unref0 (list_store);
	_gtk_tree_path_free0 (path);
}


static void preferences_dialog_combo_box_changed_cb (PreferencesDialog* self, GtkComboBox* combo_box) {
	gint id = 0;
	GeeArrayList* _tmp0_ = NULL;
	GtkComboBox* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint color_new = 0;
	GtkComboBox* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	gint color_old = 0;
	GeeArrayList* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gpointer _tmp7_ = NULL;
	GSettings* _tmp8_ = NULL;
	gint _tmp9_ = 0;
	gint _tmp10_ = 0;
	gint _tmp11_ = 0;
	gint _tmp12_ = 0;
	GeeArrayList* _tmp49_ = NULL;
	gint _tmp50_ = 0;
	gpointer _tmp51_ = NULL;
	GSettings* _tmp52_ = NULL;
	gint _tmp53_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo_box != NULL);
	_tmp0_ = self->priv->combo_boxes;
	_tmp1_ = combo_box;
	_tmp2_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp0_, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_combo_box_text_get_type (), GtkComboBoxText));
	id = _tmp2_;
	_tmp3_ = combo_box;
	_tmp4_ = gtk_combo_box_get_active (_tmp3_);
	color_new = _tmp4_;
	_tmp5_ = self->priv->worm_settings;
	_tmp6_ = id;
	_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, _tmp6_);
	_tmp8_ = (GSettings*) _tmp7_;
	_tmp9_ = g_settings_get_enum (_tmp8_, "color");
	_tmp10_ = _tmp9_;
	_g_object_unref0 (_tmp8_);
	color_old = _tmp10_;
	_tmp11_ = color_new;
	_tmp12_ = color_old;
	if (_tmp11_ == _tmp12_) {
		return;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp13_ = FALSE;
			_tmp13_ = TRUE;
			while (TRUE) {
				gint _tmp15_ = 0;
				gboolean _tmp16_ = FALSE;
				gint _tmp17_ = 0;
				gint _tmp18_ = 0;
				if (!_tmp13_) {
					gint _tmp14_ = 0;
					_tmp14_ = i;
					i = _tmp14_ + 1;
				}
				_tmp13_ = FALSE;
				_tmp15_ = i;
				if (!(_tmp15_ < NIBBLES_GAME_MAX_WORMS)) {
					break;
				}
				_tmp17_ = i;
				_tmp18_ = id;
				if (_tmp17_ != _tmp18_) {
					GeeArrayList* _tmp19_ = NULL;
					gint _tmp20_ = 0;
					gpointer _tmp21_ = NULL;
					GSettings* _tmp22_ = NULL;
					gint _tmp23_ = 0;
					gint _tmp24_ = 0;
					_tmp19_ = self->priv->worm_settings;
					_tmp20_ = i;
					_tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, _tmp20_);
					_tmp22_ = (GSettings*) _tmp21_;
					_tmp23_ = g_settings_get_enum (_tmp22_, "color");
					_tmp24_ = color_new;
					_tmp16_ = _tmp23_ == _tmp24_;
					_g_object_unref0 (_tmp22_);
				} else {
					_tmp16_ = FALSE;
				}
				if (_tmp16_) {
					GeeArrayList* _tmp25_ = NULL;
					gint _tmp26_ = 0;
					gpointer _tmp27_ = NULL;
					GSettings* _tmp28_ = NULL;
					gint _tmp29_ = 0;
					gint _tmp30_ = 0;
					_tmp25_ = self->priv->worm_settings;
					_tmp26_ = i;
					_tmp27_ = gee_abstract_list_get ((GeeAbstractList*) _tmp25_, _tmp26_);
					_tmp28_ = (GSettings*) _tmp27_;
					_tmp29_ = color_old;
					g_settings_set_enum (_tmp28_, "color", _tmp29_);
					_g_object_unref0 (_tmp28_);
					_tmp30_ = i;
					if (_tmp30_ < NIBBLES_GAME_MAX_HUMANS) {
						{
							GeeArrayList* _cbox_list = NULL;
							GeeArrayList* _tmp31_ = NULL;
							GeeArrayList* _tmp32_ = NULL;
							gint _cbox_size = 0;
							GeeArrayList* _tmp33_ = NULL;
							gint _tmp34_ = 0;
							gint _tmp35_ = 0;
							gint _cbox_index = 0;
							_tmp31_ = self->priv->combo_boxes;
							_tmp32_ = _g_object_ref0 (_tmp31_);
							_cbox_list = _tmp32_;
							_tmp33_ = _cbox_list;
							_tmp34_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp33_);
							_tmp35_ = _tmp34_;
							_cbox_size = _tmp35_;
							_cbox_index = -1;
							while (TRUE) {
								gint _tmp36_ = 0;
								gint _tmp37_ = 0;
								gint _tmp38_ = 0;
								GtkComboBoxText* cbox = NULL;
								GeeArrayList* _tmp39_ = NULL;
								gint _tmp40_ = 0;
								gpointer _tmp41_ = NULL;
								gint index = 0;
								GeeArrayList* _tmp42_ = NULL;
								GtkComboBoxText* _tmp43_ = NULL;
								gint _tmp44_ = 0;
								gint _tmp45_ = 0;
								gint _tmp46_ = 0;
								_tmp36_ = _cbox_index;
								_cbox_index = _tmp36_ + 1;
								_tmp37_ = _cbox_index;
								_tmp38_ = _cbox_size;
								if (!(_tmp37_ < _tmp38_)) {
									break;
								}
								_tmp39_ = _cbox_list;
								_tmp40_ = _cbox_index;
								_tmp41_ = gee_abstract_list_get ((GeeAbstractList*) _tmp39_, _tmp40_);
								cbox = (GtkComboBoxText*) _tmp41_;
								_tmp42_ = self->priv->combo_boxes;
								_tmp43_ = cbox;
								_tmp44_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp42_, _tmp43_);
								index = _tmp44_;
								_tmp45_ = index;
								_tmp46_ = i;
								if (_tmp45_ == _tmp46_) {
									GtkComboBoxText* _tmp47_ = NULL;
									gint _tmp48_ = 0;
									_tmp47_ = cbox;
									_tmp48_ = color_old;
									gtk_combo_box_set_active ((GtkComboBox*) _tmp47_, _tmp48_);
									_g_object_unref0 (cbox);
									break;
								}
								_g_object_unref0 (cbox);
							}
							_g_object_unref0 (_cbox_list);
						}
					}
					break;
				}
			}
		}
	}
	_tmp49_ = self->priv->worm_settings;
	_tmp50_ = id;
	_tmp51_ = gee_abstract_list_get ((GeeAbstractList*) _tmp49_, _tmp50_);
	_tmp52_ = (GSettings*) _tmp51_;
	_tmp53_ = color_new;
	g_settings_set_enum (_tmp52_, "color", _tmp53_);
	_g_object_unref0 (_tmp52_);
}


static void preferences_dialog_class_init (PreferencesDialogClass * klass) {
	gint PreferencesDialog_private_offset;
	preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (PreferencesDialogPrivate));
	G_OBJECT_CLASS (klass)->finalize = preferences_dialog_finalize;
	PreferencesDialog_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/nibbles/ui/preferences-dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "notebook", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, notebook));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "beginner_radio_button", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, beginner_radio_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "slow_radio_button", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, slow_radio_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "medium_radio_button", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, medium_radio_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "fast_radio_button", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, fast_radio_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sound_check_button", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, sound_check_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "fakes_check_button", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, fakes_check_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "list_store_1", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, list_store_1));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "list_store_2", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, list_store_2));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "list_store_3", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, list_store_3));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "list_store_4", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, list_store_4));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "tree_view_1", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, tree_view_1));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "tree_view_2", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, tree_view_2));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "tree_view_3", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, tree_view_3));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "tree_view_4", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, tree_view_4));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "combo_box_1", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, combo_box_1));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "combo_box_2", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, combo_box_2));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "combo_box_3", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, combo_box_3));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "combo_box_4", FALSE, PreferencesDialog_private_offset + G_STRUCT_OFFSET (PreferencesDialogPrivate, combo_box_4));
}


static void preferences_dialog_instance_init (PreferencesDialog * self) {
	self->priv = PREFERENCES_DIALOG_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void preferences_dialog_finalize (GObject * obj) {
	PreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PREFERENCES_DIALOG, PreferencesDialog);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->worm_settings);
	_g_object_unref0 (self->priv->notebook);
	_g_object_unref0 (self->priv->beginner_radio_button);
	_g_object_unref0 (self->priv->slow_radio_button);
	_g_object_unref0 (self->priv->medium_radio_button);
	_g_object_unref0 (self->priv->fast_radio_button);
	_g_object_unref0 (self->priv->sound_check_button);
	_g_object_unref0 (self->priv->fakes_check_button);
	_g_object_unref0 (self->priv->list_store_1);
	_g_object_unref0 (self->priv->list_store_2);
	_g_object_unref0 (self->priv->list_store_3);
	_g_object_unref0 (self->priv->list_store_4);
	_g_object_unref0 (self->priv->tree_view_1);
	_g_object_unref0 (self->priv->tree_view_2);
	_g_object_unref0 (self->priv->tree_view_3);
	_g_object_unref0 (self->priv->tree_view_4);
	_g_object_unref0 (self->priv->combo_box_1);
	_g_object_unref0 (self->priv->combo_box_2);
	_g_object_unref0 (self->priv->combo_box_3);
	_g_object_unref0 (self->priv->combo_box_4);
	_g_object_unref0 (self->priv->radio_buttons);
	_g_object_unref0 (self->priv->list_stores);
	_g_object_unref0 (self->priv->tree_views);
	_g_object_unref0 (self->priv->combo_boxes);
	G_OBJECT_CLASS (preferences_dialog_parent_class)->finalize (obj);
}


GType preferences_dialog_get_type (void) {
	static volatile gsize preferences_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&preferences_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PreferencesDialog), 0, (GInstanceInitFunc) preferences_dialog_instance_init, NULL };
		GType preferences_dialog_type_id;
		preferences_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "PreferencesDialog", &g_define_type_info, 0);
		g_once_init_leave (&preferences_dialog_type_id__volatile, preferences_dialog_type_id);
	}
	return preferences_dialog_type_id__volatile;
}



