/* iagno.c generated by valac 0.17.7.1-fedb1, the Vala compiler
 * generated from iagno.vala, do not modify */


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


#define TYPE_IAGNO (iagno_get_type ())
#define IAGNO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IAGNO, Iagno))
#define IAGNO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IAGNO, IagnoClass))
#define IS_IAGNO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IAGNO))
#define IS_IAGNO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IAGNO))
#define IAGNO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IAGNO, IagnoClass))

typedef struct _Iagno Iagno;
typedef struct _IagnoClass IagnoClass;
typedef struct _IagnoPrivate IagnoPrivate;

#define TYPE_GAME_VIEW (game_view_get_type ())
#define GAME_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME_VIEW, GameView))
#define GAME_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME_VIEW, GameViewClass))
#define IS_GAME_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME_VIEW))
#define IS_GAME_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME_VIEW))
#define GAME_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME_VIEW, GameViewClass))

typedef struct _GameView GameView;
typedef struct _GameViewClass GameViewClass;

#define TYPE_COMPUTER_PLAYER (computer_player_get_type ())
#define COMPUTER_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMPUTER_PLAYER, ComputerPlayer))
#define COMPUTER_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMPUTER_PLAYER, ComputerPlayerClass))
#define IS_COMPUTER_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMPUTER_PLAYER))
#define IS_COMPUTER_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMPUTER_PLAYER))
#define COMPUTER_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMPUTER_PLAYER, ComputerPlayerClass))

typedef struct _ComputerPlayer ComputerPlayer;
typedef struct _ComputerPlayerClass ComputerPlayerClass;

#define TYPE_GAME (game_get_type ())
#define GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME, Game))
#define GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME, GameClass))
#define IS_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME))
#define IS_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME))
#define GAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME, GameClass))

typedef struct _Game Game;
typedef struct _GameClass GameClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _computer_player_unref0(var) ((var == NULL) ? NULL : (var = (computer_player_unref (var), NULL)))
#define _game_unref0(var) ((var == NULL) ? NULL : (var = (game_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _GamePrivate GamePrivate;

#define TYPE_PLAYER (player_get_type ())
#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))

struct _Iagno {
	GtkApplication parent_instance;
	IagnoPrivate * priv;
};

struct _IagnoClass {
	GtkApplicationClass parent_class;
};

struct _IagnoPrivate {
	GSettings* settings;
	GtkWindow* window;
	gint window_width;
	gint window_height;
	gboolean is_fullscreen;
	gboolean is_maximized;
	GtkInfoBar* infobar;
	GtkStatusbar* statusbar;
	guint statusbar_id;
	GameView* view;
	GtkLabel* infobar_label;
	GtkLabel* dark_label;
	GtkLabel* light_label;
	GtkLabel* dark_score_label;
	GtkLabel* light_score_label;
	GSimpleAction* undo_action;
	ComputerPlayer* light_computer;
	ComputerPlayer* dark_computer;
	guint computer_timer;
	Game* game;
	gboolean was_pass;
};

typedef enum  {
	PLAYER_NONE,
	PLAYER_LIGHT,
	PLAYER_DARK
} Player;

struct _Game {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GamePrivate * priv;
	Player* tiles;
	gint tiles_length1;
	gint tiles_length2;
	Player current_color;
};

struct _GameClass {
	GTypeClass parent_class;
	void (*finalize) (Game *self);
};


static gpointer iagno_parent_class = NULL;

GType iagno_get_type (void) G_GNUC_CONST;
GType game_view_get_type (void) G_GNUC_CONST;
gpointer computer_player_ref (gpointer instance);
void computer_player_unref (gpointer instance);
GParamSpec* param_spec_computer_player (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_computer_player (GValue* value, gpointer v_object);
void value_take_computer_player (GValue* value, gpointer v_object);
gpointer value_get_computer_player (const GValue* value);
GType computer_player_get_type (void) G_GNUC_CONST;
gpointer game_ref (gpointer instance);
void game_unref (gpointer instance);
GParamSpec* param_spec_game (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_game (GValue* value, gpointer v_object);
void value_take_game (GValue* value, gpointer v_object);
gpointer value_get_game (const GValue* value);
GType game_get_type (void) G_GNUC_CONST;
#define IAGNO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IAGNO, IagnoPrivate))
enum  {
	IAGNO_DUMMY_PROPERTY
};
static void iagno_new_game_cb (Iagno* self);
static void _iagno_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void iagno_undo_move_cb (Iagno* self);
static void _iagno_undo_move_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void iagno_preferences_cb (Iagno* self);
static void _iagno_preferences_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void iagno_help_cb (Iagno* self);
static void _iagno_help_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void iagno_about_cb (Iagno* self);
static void _iagno_about_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void iagno_quit_cb (Iagno* self);
static void _iagno_quit_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void iagno_real_startup (GApplication* base);
Iagno* iagno_new (void);
Iagno* iagno_construct (GType object_type);
static void iagno_real_activate (GApplication* base);
static gboolean iagno_window_configure_event_cb (Iagno* self, GdkEventConfigure* event);
static gboolean _iagno_window_configure_event_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self);
static gboolean iagno_window_state_event_cb (Iagno* self, GdkEventWindowState* event);
static gboolean _iagno_window_state_event_cb_gtk_widget_window_state_event (GtkWidget* _sender, GdkEventWindowState* event, gpointer self);
GameView* game_view_new (void);
GameView* game_view_construct (GType object_type);
void game_view_set_game (GameView* self, Game* value);
static void iagno_player_move_cb (Iagno* self, gint x, gint y);
static void _iagno_player_move_cb_game_view_move (GameView* _sender, gint x, gint y, gpointer self);
void game_view_set_show_grid (GameView* self, gboolean value);
void game_view_set_flip_final_result (GameView* self, gboolean value);
void game_view_set_theme (GameView* self, const gchar* value);
static void iagno_start_game (Iagno* self);
static void iagno_real_shutdown (GApplication* base);
Game* game_new (gint width, gint height);
Game* game_construct (GType object_type, gint width, gint height);
static void iagno_game_move_cb (Iagno* self);
static void _iagno_game_move_cb_game_move (Game* _sender, gpointer self);
static void iagno_game_complete_cb (Iagno* self);
static void _iagno_game_complete_cb_game_complete (Game* _sender, gpointer self);
ComputerPlayer* computer_player_new (Game* game, gint level);
ComputerPlayer* computer_player_construct (GType object_type, Game* game, gint level);
static void iagno_update_ui (Iagno* self);
void game_start (Game* self);
gboolean game_get_can_undo (Game* self);
GType player_get_type (void) G_GNUC_CONST;
static void iagno_show_message (Iagno* self, const gchar* message, GtkMessageType type);
gint game_get_n_dark_tiles (Game* self);
gint game_get_n_light_tiles (Game* self);
void game_undo (Game* self, gint count);
static void iagno_show_preferences_dialog (Iagno* self);
static void iagno_play_sound (Iagno* self, const gchar* name);
gboolean game_get_can_move (Game* self);
void game_pass (Game* self);
static gboolean iagno_computer_move_cb (Iagno* self);
static gboolean _iagno_computer_move_cb_gsource_func (gpointer self);
void computer_player_move (ComputerPlayer* self);
gint game_place_tile (Game* self, gint x, gint y);
static void iagno_dark_level_changed_cb (Iagno* self, GtkComboBox* combo);
static void iagno_light_level_changed_cb (Iagno* self, GtkComboBox* combo);
static void iagno_sound_select (Iagno* self, GtkToggleButton* widget);
static void iagno_grid_toggled_cb (Iagno* self, GtkToggleButton* widget);
gboolean game_view_get_show_grid (GameView* self);
static void iagno_flip_final_toggled_cb (Iagno* self, GtkToggleButton* widget);
gboolean game_view_get_flip_final_result (GameView* self);
static void iagno_propbox_response_cb (Iagno* self, GtkWidget* widget, gint response_id);
static gboolean iagno_propbox_close_cb (Iagno* self, GtkWidget* widget, GdkEventAny* event);
static void iagno_theme_changed_cb (Iagno* self, GtkComboBox* widget);
void game_view_redraw (GameView* self);
static void _iagno_propbox_response_cb_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
static gboolean _iagno_propbox_close_cb_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self);
static void _iagno_dark_level_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
static void _iagno_light_level_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
static void _iagno_sound_select_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _iagno_grid_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _iagno_flip_final_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _iagno_theme_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
gint iagno_main (gchar** args, int args_length1);
static void iagno_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);

static const GActionEntry IAGNO_app_actions[6] = {{"new-game", _iagno_new_game_cb_gsimple_action_activate_callback}, {"undo-move", _iagno_undo_move_cb_gsimple_action_activate_callback}, {"preferences", _iagno_preferences_cb_gsimple_action_activate_callback}, {"help", _iagno_help_cb_gsimple_action_activate_callback}, {"about", _iagno_about_cb_gsimple_action_activate_callback}, {"quit", _iagno_quit_cb_gsimple_action_activate_callback}};

static void _iagno_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	iagno_new_game_cb (self);
}


static void _iagno_undo_move_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	iagno_undo_move_cb (self);
}


static void _iagno_preferences_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	iagno_preferences_cb (self);
}


static void _iagno_help_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	iagno_help_cb (self);
}


static void _iagno_about_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	iagno_about_cb (self);
}


static void _iagno_quit_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	iagno_quit_cb (self);
}


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


static void iagno_real_startup (GApplication* base) {
	Iagno * self;
	GAction* _tmp0_ = NULL;
	GSimpleAction* _tmp1_;
	self = (Iagno*) base;
	G_APPLICATION_CLASS (iagno_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_APPLICATION, GtkApplication));
	g_action_map_add_action_entries ((GActionMap*) self, (const GActionEntry*) IAGNO_app_actions, G_N_ELEMENTS (IAGNO_app_actions), self);
	_tmp0_ = g_action_map_lookup_action ((GActionMap*) self, "undo-move");
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp0_) : NULL);
	_g_object_unref0 (self->priv->undo_action);
	self->priv->undo_action = _tmp1_;
}


Iagno* iagno_construct (GType object_type) {
	Iagno * self = NULL;
	self = (Iagno*) g_object_new (object_type, "application-id", "org.gnome.iagno", "flags", G_APPLICATION_FLAGS_NONE, NULL);
	return self;
}


Iagno* iagno_new (void) {
	return iagno_construct (TYPE_IAGNO);
}


static gboolean _iagno_window_configure_event_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self) {
	gboolean result;
	result = iagno_window_configure_event_cb (self, event);
	return result;
}


static gboolean _iagno_window_state_event_cb_gtk_widget_window_state_event (GtkWidget* _sender, GdkEventWindowState* event, gpointer self) {
	gboolean result;
	result = iagno_window_state_event_cb (self, event);
	return result;
}


static void _iagno_player_move_cb_game_view_move (GameView* _sender, gint x, gint y, gpointer self) {
	iagno_player_move_cb (self, x, y);
}


static void iagno_real_activate (GApplication* base) {
	Iagno * self;
	GtkWindow* _tmp0_;
	GSettings* _tmp2_;
	GtkBuilder* _tmp3_;
	GtkBuilder* builder;
	GtkBuilder* _tmp8_;
	GObject* _tmp9_ = NULL;
	GtkBuilder* _tmp10_;
	GObject* _tmp11_ = NULL;
	GtkGrid* _tmp12_;
	GtkGrid* top_grid;
	GtkWindow* _tmp13_;
	const gchar* _tmp14_ = NULL;
	GtkBuilder* _tmp15_;
	GObject* _tmp16_ = NULL;
	GtkWindow* _tmp17_;
	GtkWindow* _tmp18_;
	GtkWindow* _tmp19_;
	GtkWindow* _tmp20_;
	GSettings* _tmp21_;
	gint _tmp22_ = 0;
	GSettings* _tmp23_;
	gint _tmp24_ = 0;
	GSettings* _tmp25_;
	gboolean _tmp26_ = FALSE;
	GtkWindow* _tmp31_;
	GSimpleAction* _tmp32_;
	GameView* _tmp33_;
	GameView* _tmp34_;
	GameView* _tmp35_;
	GameView* _tmp36_;
	Game* _tmp37_;
	GameView* _tmp38_;
	GameView* _tmp39_;
	GSettings* _tmp40_;
	gboolean _tmp41_ = FALSE;
	GameView* _tmp42_;
	GSettings* _tmp43_;
	gboolean _tmp44_ = FALSE;
	GSettings* _tmp45_;
	gchar* _tmp46_ = NULL;
	gchar* tile_set;
	GameView* _tmp47_;
	const gchar* _tmp48_;
	gchar* _tmp49_ = NULL;
	gchar* _tmp50_;
	GameView* _tmp51_;
	GtkGrid* _tmp52_;
	GameView* _tmp53_;
	GtkInfoBar* _tmp54_;
	GtkGrid* _tmp55_;
	GtkInfoBar* _tmp56_;
	GtkLabel* _tmp57_;
	GtkLabel* _tmp58_;
	GtkInfoBar* _tmp59_;
	GtkLabel* _tmp60_;
	GtkStatusbar* _tmp61_;
	GtkStatusbar* _tmp62_;
	GtkBuilder* _tmp63_;
	GObject* _tmp64_ = NULL;
	GtkToolbar* _tmp65_;
	GtkToolbar* toolbar;
	GtkToolbar* _tmp66_;
	GtkToolbar* _tmp67_;
	GtkStyleContext* _tmp68_ = NULL;
	GtkToolbar* _tmp69_;
	GtkSeparatorToolItem* _tmp70_;
	GtkSeparatorToolItem* _tmp71_;
	GtkToolItem* _tmp72_;
	GtkToolItem* status_item;
	GtkToolItem* _tmp73_;
	GtkToolItem* _tmp74_;
	GtkAlignment* _tmp75_;
	GtkAlignment* status_alignment;
	GtkAlignment* _tmp76_;
	GtkStatusbar* _tmp77_;
	GtkToolItem* _tmp78_;
	GtkAlignment* _tmp79_;
	GtkToolbar* _tmp80_;
	GtkToolItem* _tmp81_;
	GtkToolbar* _tmp82_;
	GtkGrid* _tmp83_;
	GtkGrid* grid;
	GtkGrid* _tmp84_;
	GtkGrid* _tmp85_;
	GtkStatusbar* _tmp86_;
	GtkGrid* _tmp87_;
	const gchar* _tmp88_ = NULL;
	GtkLabel* _tmp89_;
	GtkLabel* _tmp90_;
	GtkGrid* _tmp91_;
	GtkLabel* _tmp92_;
	GtkLabel* _tmp93_;
	GtkLabel* _tmp94_;
	GtkGrid* _tmp95_;
	GtkLabel* _tmp96_;
	const gchar* _tmp97_ = NULL;
	GtkLabel* _tmp98_;
	GtkLabel* _tmp99_;
	GtkGrid* _tmp100_;
	GtkLabel* _tmp101_;
	GtkLabel* _tmp102_;
	GtkLabel* _tmp103_;
	GtkGrid* _tmp104_;
	GtkLabel* _tmp105_;
	GtkStatusbar* _tmp106_;
	guint _tmp107_ = 0U;
	GtkWindow* _tmp108_;
	GError * _inner_error_ = NULL;
	self = (Iagno*) base;
	_tmp0_ = self->priv->window;
	if (_tmp0_ != NULL) {
		GtkWindow* _tmp1_;
		_tmp1_ = self->priv->window;
		gtk_widget_show ((GtkWidget*) _tmp1_);
		return;
	}
	_tmp2_ = g_settings_new ("org.gnome.iagno");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp2_;
	_tmp3_ = gtk_builder_new ();
	builder = _tmp3_;
	{
		GtkBuilder* _tmp4_;
		_tmp4_ = builder;
		gtk_builder_add_from_file (_tmp4_, DATA_DIRECTORY "/iagno.ui", &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch2_g_error;
		}
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* e = NULL;
		FILE* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = stderr;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		fprintf (_tmp5_, "Could not load UI: %s\n", _tmp7_);
		_g_error_free0 (e);
		_g_object_unref0 (builder);
		return;
	}
	__finally2:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (builder);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp8_ = builder;
	_tmp9_ = gtk_builder_get_object (_tmp8_, "iagno-menu");
	gtk_application_set_app_menu ((GtkApplication*) self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, g_menu_model_get_type ()) ? ((GMenuModel*) _tmp9_) : NULL);
	_tmp10_ = builder;
	_tmp11_ = gtk_builder_get_object (_tmp10_, "grid");
	_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, GTK_TYPE_GRID) ? ((GtkGrid*) _tmp11_) : NULL);
	top_grid = _tmp12_;
	_tmp13_ = self->priv->window;
	_tmp14_ = _ ("Iagno");
	gtk_window_set_title (_tmp13_, _tmp14_);
	_tmp15_ = builder;
	_tmp16_ = gtk_builder_get_object (_tmp15_, "window");
	_tmp17_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, GTK_TYPE_WINDOW) ? ((GtkWindow*) _tmp16_) : NULL);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp17_;
	_tmp18_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp18_, "configure-event", (GCallback) _iagno_window_configure_event_cb_gtk_widget_configure_event, self, 0);
	_tmp19_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp19_, "window-state-event", (GCallback) _iagno_window_state_event_cb_gtk_widget_window_state_event, self, 0);
	_tmp20_ = self->priv->window;
	_tmp21_ = self->priv->settings;
	_tmp22_ = g_settings_get_int (_tmp21_, "window-width");
	_tmp23_ = self->priv->settings;
	_tmp24_ = g_settings_get_int (_tmp23_, "window-height");
	gtk_window_set_default_size (_tmp20_, _tmp22_, _tmp24_);
	_tmp25_ = self->priv->settings;
	_tmp26_ = g_settings_get_boolean (_tmp25_, "window-is-fullscreen");
	if (_tmp26_) {
		GtkWindow* _tmp27_;
		_tmp27_ = self->priv->window;
		gtk_window_fullscreen (_tmp27_);
	} else {
		GSettings* _tmp28_;
		gboolean _tmp29_ = FALSE;
		_tmp28_ = self->priv->settings;
		_tmp29_ = g_settings_get_boolean (_tmp28_, "window-is-maximized");
		if (_tmp29_) {
			GtkWindow* _tmp30_;
			_tmp30_ = self->priv->window;
			gtk_window_maximize (_tmp30_);
		}
	}
	_tmp31_ = self->priv->window;
	gtk_application_add_window ((GtkApplication*) self, _tmp31_);
	_tmp32_ = self->priv->undo_action;
	g_simple_action_set_enabled (_tmp32_, TRUE);
	_tmp33_ = game_view_new ();
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->view);
	self->priv->view = _tmp33_;
	_tmp34_ = self->priv->view;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp34_, TRUE);
	_tmp35_ = self->priv->view;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp35_, TRUE);
	_tmp36_ = self->priv->view;
	_tmp37_ = self->priv->game;
	game_view_set_game (_tmp36_, _tmp37_);
	_tmp38_ = self->priv->view;
	g_signal_connect_object (_tmp38_, "move", (GCallback) _iagno_player_move_cb_game_view_move, self, 0);
	_tmp39_ = self->priv->view;
	_tmp40_ = self->priv->settings;
	_tmp41_ = g_settings_get_boolean (_tmp40_, "show-grid");
	game_view_set_show_grid (_tmp39_, _tmp41_);
	_tmp42_ = self->priv->view;
	_tmp43_ = self->priv->settings;
	_tmp44_ = g_settings_get_boolean (_tmp43_, "flip-final-results");
	game_view_set_flip_final_result (_tmp42_, _tmp44_);
	_tmp45_ = self->priv->settings;
	_tmp46_ = g_settings_get_string (_tmp45_, "tileset");
	tile_set = _tmp46_;
	_tmp47_ = self->priv->view;
	_tmp48_ = tile_set;
	_tmp49_ = g_build_filename (DATA_DIRECTORY, "themes", _tmp48_, NULL);
	_tmp50_ = _tmp49_;
	game_view_set_theme (_tmp47_, _tmp50_);
	_g_free0 (_tmp50_);
	_tmp51_ = self->priv->view;
	gtk_widget_show ((GtkWidget*) _tmp51_);
	_tmp52_ = top_grid;
	_tmp53_ = self->priv->view;
	gtk_grid_attach (_tmp52_, (GtkWidget*) _tmp53_, 0, 3, 1, 1);
	_tmp54_ = (GtkInfoBar*) gtk_info_bar_new ();
	g_object_ref_sink (_tmp54_);
	_g_object_unref0 (self->priv->infobar);
	self->priv->infobar = _tmp54_;
	_tmp55_ = top_grid;
	_tmp56_ = self->priv->infobar;
	gtk_grid_attach (_tmp55_, (GtkWidget*) _tmp56_, 0, 2, 1, 1);
	_tmp57_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp57_);
	_g_object_unref0 (self->priv->infobar_label);
	self->priv->infobar_label = _tmp57_;
	_tmp58_ = self->priv->infobar_label;
	gtk_widget_show ((GtkWidget*) _tmp58_);
	_tmp59_ = self->priv->infobar;
	_tmp60_ = self->priv->infobar_label;
	gtk_container_add ((GtkContainer*) _tmp59_, (GtkWidget*) _tmp60_);
	_tmp61_ = (GtkStatusbar*) gtk_statusbar_new ();
	g_object_ref_sink (_tmp61_);
	_g_object_unref0 (self->priv->statusbar);
	self->priv->statusbar = _tmp61_;
	_tmp62_ = self->priv->statusbar;
	gtk_widget_show ((GtkWidget*) _tmp62_);
	_tmp63_ = builder;
	_tmp64_ = gtk_builder_get_object (_tmp63_, "toolbar");
	_tmp65_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp64_, GTK_TYPE_TOOLBAR) ? ((GtkToolbar*) _tmp64_) : NULL);
	toolbar = _tmp65_;
	_tmp66_ = toolbar;
	gtk_toolbar_set_show_arrow (_tmp66_, FALSE);
	_tmp67_ = toolbar;
	_tmp68_ = gtk_widget_get_style_context ((GtkWidget*) _tmp67_);
	gtk_style_context_add_class (_tmp68_, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
	_tmp69_ = toolbar;
	_tmp70_ = (GtkSeparatorToolItem*) gtk_separator_tool_item_new ();
	g_object_ref_sink (_tmp70_);
	_tmp71_ = _tmp70_;
	gtk_toolbar_insert (_tmp69_, (GtkToolItem*) _tmp71_, -1);
	_g_object_unref0 (_tmp71_);
	_tmp72_ = gtk_tool_item_new ();
	g_object_ref_sink (_tmp72_);
	status_item = _tmp72_;
	_tmp73_ = status_item;
	gtk_tool_item_set_visible_horizontal (_tmp73_, TRUE);
	_tmp74_ = status_item;
	gtk_tool_item_set_expand (_tmp74_, TRUE);
	_tmp75_ = (GtkAlignment*) gtk_alignment_new (1.0f, 0.5f, 0.0f, 0.0f);
	g_object_ref_sink (_tmp75_);
	status_alignment = _tmp75_;
	_tmp76_ = status_alignment;
	_tmp77_ = self->priv->statusbar;
	gtk_container_add ((GtkContainer*) _tmp76_, (GtkWidget*) _tmp77_);
	_tmp78_ = status_item;
	_tmp79_ = status_alignment;
	gtk_container_add ((GtkContainer*) _tmp78_, (GtkWidget*) _tmp79_);
	_tmp80_ = toolbar;
	_tmp81_ = status_item;
	gtk_toolbar_insert (_tmp80_, _tmp81_, -1);
	_tmp82_ = toolbar;
	gtk_widget_show_all ((GtkWidget*) _tmp82_);
	_tmp83_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp83_);
	grid = _tmp83_;
	_tmp84_ = grid;
	gtk_grid_set_column_spacing (_tmp84_, (guint) 6);
	_tmp85_ = grid;
	gtk_widget_show ((GtkWidget*) _tmp85_);
	_tmp86_ = self->priv->statusbar;
	_tmp87_ = grid;
	gtk_box_pack_start ((GtkBox*) _tmp86_, (GtkWidget*) _tmp87_, FALSE, TRUE, (guint) 0);
	_tmp88_ = _ ("Dark:");
	_tmp89_ = (GtkLabel*) gtk_label_new (_tmp88_);
	g_object_ref_sink (_tmp89_);
	_g_object_unref0 (self->priv->dark_label);
	self->priv->dark_label = _tmp89_;
	_tmp90_ = self->priv->dark_label;
	gtk_widget_show ((GtkWidget*) _tmp90_);
	_tmp91_ = grid;
	_tmp92_ = self->priv->dark_label;
	gtk_grid_attach (_tmp91_, (GtkWidget*) _tmp92_, 1, 0, 1, 1);
	_tmp93_ = (GtkLabel*) gtk_label_new ("00");
	g_object_ref_sink (_tmp93_);
	_g_object_unref0 (self->priv->dark_score_label);
	self->priv->dark_score_label = _tmp93_;
	_tmp94_ = self->priv->dark_score_label;
	gtk_widget_show ((GtkWidget*) _tmp94_);
	_tmp95_ = grid;
	_tmp96_ = self->priv->dark_score_label;
	gtk_grid_attach (_tmp95_, (GtkWidget*) _tmp96_, 2, 0, 1, 1);
	_tmp97_ = _ ("Light:");
	_tmp98_ = (GtkLabel*) gtk_label_new (_tmp97_);
	g_object_ref_sink (_tmp98_);
	_g_object_unref0 (self->priv->light_label);
	self->priv->light_label = _tmp98_;
	_tmp99_ = self->priv->light_label;
	gtk_widget_show ((GtkWidget*) _tmp99_);
	_tmp100_ = grid;
	_tmp101_ = self->priv->light_label;
	gtk_grid_attach (_tmp100_, (GtkWidget*) _tmp101_, 4, 0, 1, 1);
	_tmp102_ = (GtkLabel*) gtk_label_new ("00");
	g_object_ref_sink (_tmp102_);
	_g_object_unref0 (self->priv->light_score_label);
	self->priv->light_score_label = _tmp102_;
	_tmp103_ = self->priv->light_score_label;
	gtk_widget_show ((GtkWidget*) _tmp103_);
	_tmp104_ = grid;
	_tmp105_ = self->priv->light_score_label;
	gtk_grid_attach (_tmp104_, (GtkWidget*) _tmp105_, 5, 0, 1, 1);
	_tmp106_ = self->priv->statusbar;
	_tmp107_ = gtk_statusbar_get_context_id (_tmp106_, "iagno");
	self->priv->statusbar_id = _tmp107_;
	iagno_start_game (self);
	_tmp108_ = self->priv->window;
	gtk_widget_show ((GtkWidget*) _tmp108_);
	_g_object_unref0 (grid);
	_g_object_unref0 (status_alignment);
	_g_object_unref0 (status_item);
	_g_object_unref0 (toolbar);
	_g_free0 (tile_set);
	_g_object_unref0 (top_grid);
	_g_object_unref0 (builder);
}


static void iagno_real_shutdown (GApplication* base) {
	Iagno * self;
	GSettings* _tmp0_;
	gint _tmp1_;
	GSettings* _tmp2_;
	gint _tmp3_;
	GSettings* _tmp4_;
	gboolean _tmp5_;
	GSettings* _tmp6_;
	gboolean _tmp7_;
	self = (Iagno*) base;
	G_APPLICATION_CLASS (iagno_parent_class)->shutdown ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_APPLICATION, GtkApplication));
	_tmp0_ = self->priv->settings;
	_tmp1_ = self->priv->window_width;
	g_settings_set_int (_tmp0_, "window-width", _tmp1_);
	_tmp2_ = self->priv->settings;
	_tmp3_ = self->priv->window_height;
	g_settings_set_int (_tmp2_, "window-height", _tmp3_);
	_tmp4_ = self->priv->settings;
	_tmp5_ = self->priv->is_maximized;
	g_settings_set_boolean (_tmp4_, "window-is-maximized", _tmp5_);
	_tmp6_ = self->priv->settings;
	_tmp7_ = self->priv->is_fullscreen;
	g_settings_set_boolean (_tmp6_, "window-is-fullscreen", _tmp7_);
}


static gboolean iagno_window_configure_event_cb (Iagno* self, GdkEventConfigure* event) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp1_ = self->priv->is_maximized;
	if (!_tmp1_) {
		gboolean _tmp2_;
		_tmp2_ = self->priv->is_fullscreen;
		_tmp0_ = !_tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp3_ = _tmp0_;
	if (_tmp3_) {
		GdkEventConfigure _tmp4_;
		gint _tmp5_;
		GdkEventConfigure _tmp6_;
		gint _tmp7_;
		_tmp4_ = *event;
		_tmp5_ = _tmp4_.width;
		self->priv->window_width = _tmp5_;
		_tmp6_ = *event;
		_tmp7_ = _tmp6_.height;
		self->priv->window_height = _tmp7_;
	}
	result = FALSE;
	return result;
}


static gboolean iagno_window_state_event_cb (Iagno* self, GdkEventWindowState* event) {
	gboolean result = FALSE;
	GdkEventWindowState _tmp0_;
	GdkWindowState _tmp1_;
	GdkEventWindowState _tmp4_;
	GdkWindowState _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = *event;
	_tmp1_ = _tmp0_.changed_mask;
	if ((_tmp1_ & GDK_WINDOW_STATE_MAXIMIZED) != 0) {
		GdkEventWindowState _tmp2_;
		GdkWindowState _tmp3_;
		_tmp2_ = *event;
		_tmp3_ = _tmp2_.new_window_state;
		self->priv->is_maximized = (_tmp3_ & GDK_WINDOW_STATE_MAXIMIZED) != 0;
	}
	_tmp4_ = *event;
	_tmp5_ = _tmp4_.changed_mask;
	if ((_tmp5_ & GDK_WINDOW_STATE_FULLSCREEN) != 0) {
		GdkEventWindowState _tmp6_;
		GdkWindowState _tmp7_;
		_tmp6_ = *event;
		_tmp7_ = _tmp6_.new_window_state;
		self->priv->is_fullscreen = (_tmp7_ & GDK_WINDOW_STATE_FULLSCREEN) != 0;
	}
	result = FALSE;
	return result;
}


static void iagno_quit_cb (Iagno* self) {
	GtkWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}


static void iagno_new_game_cb (Iagno* self) {
	g_return_if_fail (self != NULL);
	iagno_start_game (self);
}


static void _iagno_game_move_cb_game_move (Game* _sender, gpointer self) {
	iagno_game_move_cb (self);
}


static void _iagno_game_complete_cb_game_complete (Game* _sender, gpointer self) {
	iagno_game_complete_cb (self);
}


static void iagno_start_game (Iagno* self) {
	guint _tmp0_;
	Game* _tmp2_;
	Game* _tmp4_;
	Game* _tmp5_;
	Game* _tmp6_;
	GameView* _tmp7_;
	Game* _tmp8_;
	GSettings* _tmp9_;
	gint _tmp10_ = 0;
	gint dark_level;
	gint _tmp11_;
	GSettings* _tmp15_;
	gint _tmp16_ = 0;
	gint light_level;
	gint _tmp17_;
	Game* _tmp21_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->computer_timer;
	if (_tmp0_ != ((guint) 0)) {
		guint _tmp1_;
		_tmp1_ = self->priv->computer_timer;
		g_source_remove (_tmp1_);
		self->priv->computer_timer = (guint) 0;
	}
	_tmp2_ = self->priv->game;
	if (_tmp2_ != NULL) {
		Game* _tmp3_;
		_tmp3_ = self->priv->game;
		g_signal_handlers_disconnect_by_func (_tmp3_, NULL, self);
	}
	_tmp4_ = game_new (8, 8);
	_game_unref0 (self->priv->game);
	self->priv->game = _tmp4_;
	_tmp5_ = self->priv->game;
	g_signal_connect_object (_tmp5_, "move", (GCallback) _iagno_game_move_cb_game_move, self, 0);
	_tmp6_ = self->priv->game;
	g_signal_connect_object (_tmp6_, "complete", (GCallback) _iagno_game_complete_cb_game_complete, self, 0);
	_tmp7_ = self->priv->view;
	_tmp8_ = self->priv->game;
	game_view_set_game (_tmp7_, _tmp8_);
	_tmp9_ = self->priv->settings;
	_tmp10_ = g_settings_get_int (_tmp9_, "black-level");
	dark_level = _tmp10_;
	_tmp11_ = dark_level;
	if (_tmp11_ > 0) {
		Game* _tmp12_;
		gint _tmp13_;
		ComputerPlayer* _tmp14_;
		_tmp12_ = self->priv->game;
		_tmp13_ = dark_level;
		_tmp14_ = computer_player_new (_tmp12_, _tmp13_);
		_computer_player_unref0 (self->priv->dark_computer);
		self->priv->dark_computer = _tmp14_;
	} else {
		_computer_player_unref0 (self->priv->dark_computer);
		self->priv->dark_computer = NULL;
	}
	_tmp15_ = self->priv->settings;
	_tmp16_ = g_settings_get_int (_tmp15_, "white-level");
	light_level = _tmp16_;
	_tmp17_ = light_level;
	if (_tmp17_ > 0) {
		Game* _tmp18_;
		gint _tmp19_;
		ComputerPlayer* _tmp20_;
		_tmp18_ = self->priv->game;
		_tmp19_ = light_level;
		_tmp20_ = computer_player_new (_tmp18_, _tmp19_);
		_computer_player_unref0 (self->priv->light_computer);
		self->priv->light_computer = _tmp20_;
	} else {
		_computer_player_unref0 (self->priv->light_computer);
		self->priv->light_computer = NULL;
	}
	iagno_update_ui (self);
	_tmp21_ = self->priv->game;
	game_start (_tmp21_);
}


static void iagno_update_ui (Iagno* self) {
	GtkInfoBar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	ComputerPlayer* _tmp2_;
	gboolean _tmp4_;
	gboolean _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->infobar;
	gtk_widget_hide ((GtkWidget*) _tmp0_);
	_tmp2_ = self->priv->light_computer;
	if (_tmp2_ != NULL) {
		ComputerPlayer* _tmp3_;
		_tmp3_ = self->priv->dark_computer;
		_tmp1_ = _tmp3_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	_tmp4_ = _tmp1_;
	if (_tmp4_) {
		GSimpleAction* _tmp5_;
		_tmp5_ = self->priv->undo_action;
		g_simple_action_set_enabled (_tmp5_, FALSE);
	} else {
		GSimpleAction* _tmp6_;
		Game* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp6_ = self->priv->undo_action;
		_tmp7_ = self->priv->game;
		_tmp8_ = game_get_can_undo (_tmp7_);
		_tmp9_ = _tmp8_;
		g_simple_action_set_enabled (_tmp6_, _tmp9_);
	}
	_tmp10_ = self->priv->was_pass;
	if (_tmp10_) {
		Game* _tmp11_;
		Player _tmp12_;
		_tmp11_ = self->priv->game;
		_tmp12_ = _tmp11_->current_color;
		if (_tmp12_ == PLAYER_DARK) {
			const gchar* _tmp13_ = NULL;
			_tmp13_ = _ ("Light must pass, Dark's move");
			iagno_show_message (self, _tmp13_, GTK_MESSAGE_INFO);
		} else {
			const gchar* _tmp14_ = NULL;
			_tmp14_ = _ ("Dark must pass, Light's move");
			iagno_show_message (self, _tmp14_, GTK_MESSAGE_INFO);
		}
	} else {
		Game* _tmp15_;
		Player _tmp16_;
		_tmp15_ = self->priv->game;
		_tmp16_ = _tmp15_->current_color;
		if (_tmp16_ == PLAYER_DARK) {
			GtkLabel* _tmp17_;
			const gchar* _tmp18_ = NULL;
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			GtkLabel* _tmp23_;
			const gchar* _tmp24_ = NULL;
			gchar* _tmp25_;
			gchar* _tmp26_;
			gchar* _tmp27_;
			gchar* _tmp28_;
			GtkLabel* _tmp29_;
			const gchar* _tmp30_ = NULL;
			Game* _tmp31_;
			gint _tmp32_;
			gint _tmp33_;
			gchar* _tmp34_ = NULL;
			gchar* _tmp35_;
			gchar* _tmp36_;
			gchar* _tmp37_;
			gchar* _tmp38_;
			gchar* _tmp39_;
			GtkLabel* _tmp40_;
			const gchar* _tmp41_ = NULL;
			Game* _tmp42_;
			gint _tmp43_;
			gint _tmp44_;
			gchar* _tmp45_ = NULL;
			gchar* _tmp46_;
			gchar* _tmp47_;
			gchar* _tmp48_;
			gchar* _tmp49_;
			gchar* _tmp50_;
			_tmp17_ = self->priv->dark_label;
			_tmp18_ = _ ("Dark:");
			_tmp19_ = g_strconcat ("<span font_weight='bold'>", _tmp18_, NULL);
			_tmp20_ = _tmp19_;
			_tmp21_ = g_strconcat (_tmp20_, "</span>", NULL);
			_tmp22_ = _tmp21_;
			gtk_label_set_markup (_tmp17_, _tmp22_);
			_g_free0 (_tmp22_);
			_g_free0 (_tmp20_);
			_tmp23_ = self->priv->light_label;
			_tmp24_ = _ ("Light:");
			_tmp25_ = g_strconcat ("<span font_weight='normal'>", _tmp24_, NULL);
			_tmp26_ = _tmp25_;
			_tmp27_ = g_strconcat (_tmp26_, "</span>", NULL);
			_tmp28_ = _tmp27_;
			gtk_label_set_markup (_tmp23_, _tmp28_);
			_g_free0 (_tmp28_);
			_g_free0 (_tmp26_);
			_tmp29_ = self->priv->dark_score_label;
			_tmp30_ = _ ("%.2d");
			_tmp31_ = self->priv->game;
			_tmp32_ = game_get_n_dark_tiles (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = g_strdup_printf (_tmp30_, _tmp33_);
			_tmp35_ = _tmp34_;
			_tmp36_ = g_strconcat ("<span font_weight='bold'>", _tmp35_, NULL);
			_tmp37_ = _tmp36_;
			_tmp38_ = g_strconcat (_tmp37_, "</span>", NULL);
			_tmp39_ = _tmp38_;
			gtk_label_set_markup (_tmp29_, _tmp39_);
			_g_free0 (_tmp39_);
			_g_free0 (_tmp37_);
			_g_free0 (_tmp35_);
			_tmp40_ = self->priv->light_score_label;
			_tmp41_ = _ ("%.2d");
			_tmp42_ = self->priv->game;
			_tmp43_ = game_get_n_light_tiles (_tmp42_);
			_tmp44_ = _tmp43_;
			_tmp45_ = g_strdup_printf (_tmp41_, _tmp44_);
			_tmp46_ = _tmp45_;
			_tmp47_ = g_strconcat ("<span font_weight='normal'>", _tmp46_, NULL);
			_tmp48_ = _tmp47_;
			_tmp49_ = g_strconcat (_tmp48_, "</span>", NULL);
			_tmp50_ = _tmp49_;
			gtk_label_set_markup (_tmp40_, _tmp50_);
			_g_free0 (_tmp50_);
			_g_free0 (_tmp48_);
			_g_free0 (_tmp46_);
		} else {
			Game* _tmp51_;
			Player _tmp52_;
			_tmp51_ = self->priv->game;
			_tmp52_ = _tmp51_->current_color;
			if (_tmp52_ == PLAYER_LIGHT) {
				GtkLabel* _tmp53_;
				const gchar* _tmp54_ = NULL;
				gchar* _tmp55_;
				gchar* _tmp56_;
				gchar* _tmp57_;
				gchar* _tmp58_;
				GtkLabel* _tmp59_;
				const gchar* _tmp60_ = NULL;
				gchar* _tmp61_;
				gchar* _tmp62_;
				gchar* _tmp63_;
				gchar* _tmp64_;
				GtkLabel* _tmp65_;
				const gchar* _tmp66_ = NULL;
				Game* _tmp67_;
				gint _tmp68_;
				gint _tmp69_;
				gchar* _tmp70_ = NULL;
				gchar* _tmp71_;
				gchar* _tmp72_;
				gchar* _tmp73_;
				gchar* _tmp74_;
				gchar* _tmp75_;
				GtkLabel* _tmp76_;
				const gchar* _tmp77_ = NULL;
				Game* _tmp78_;
				gint _tmp79_;
				gint _tmp80_;
				gchar* _tmp81_ = NULL;
				gchar* _tmp82_;
				gchar* _tmp83_;
				gchar* _tmp84_;
				gchar* _tmp85_;
				gchar* _tmp86_;
				_tmp53_ = self->priv->dark_label;
				_tmp54_ = _ ("Dark:");
				_tmp55_ = g_strconcat ("<span font_weight='normal'>", _tmp54_, NULL);
				_tmp56_ = _tmp55_;
				_tmp57_ = g_strconcat (_tmp56_, "</span>", NULL);
				_tmp58_ = _tmp57_;
				gtk_label_set_markup (_tmp53_, _tmp58_);
				_g_free0 (_tmp58_);
				_g_free0 (_tmp56_);
				_tmp59_ = self->priv->light_label;
				_tmp60_ = _ ("Light:");
				_tmp61_ = g_strconcat ("<span font_weight='bold'>", _tmp60_, NULL);
				_tmp62_ = _tmp61_;
				_tmp63_ = g_strconcat (_tmp62_, "</span>", NULL);
				_tmp64_ = _tmp63_;
				gtk_label_set_markup (_tmp59_, _tmp64_);
				_g_free0 (_tmp64_);
				_g_free0 (_tmp62_);
				_tmp65_ = self->priv->dark_score_label;
				_tmp66_ = _ ("%.2d");
				_tmp67_ = self->priv->game;
				_tmp68_ = game_get_n_dark_tiles (_tmp67_);
				_tmp69_ = _tmp68_;
				_tmp70_ = g_strdup_printf (_tmp66_, _tmp69_);
				_tmp71_ = _tmp70_;
				_tmp72_ = g_strconcat ("<span font_weight='normal'>", _tmp71_, NULL);
				_tmp73_ = _tmp72_;
				_tmp74_ = g_strconcat (_tmp73_, "</span>", NULL);
				_tmp75_ = _tmp74_;
				gtk_label_set_markup (_tmp65_, _tmp75_);
				_g_free0 (_tmp75_);
				_g_free0 (_tmp73_);
				_g_free0 (_tmp71_);
				_tmp76_ = self->priv->light_score_label;
				_tmp77_ = _ ("%.2d");
				_tmp78_ = self->priv->game;
				_tmp79_ = game_get_n_light_tiles (_tmp78_);
				_tmp80_ = _tmp79_;
				_tmp81_ = g_strdup_printf (_tmp77_, _tmp80_);
				_tmp82_ = _tmp81_;
				_tmp83_ = g_strconcat ("<span font_weight='bold'>", _tmp82_, NULL);
				_tmp84_ = _tmp83_;
				_tmp85_ = g_strconcat (_tmp84_, "</span>", NULL);
				_tmp86_ = _tmp85_;
				gtk_label_set_markup (_tmp76_, _tmp86_);
				_g_free0 (_tmp86_);
				_g_free0 (_tmp84_);
				_g_free0 (_tmp82_);
			}
		}
	}
}


static void iagno_undo_move_cb (Iagno* self) {
	guint _tmp0_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	Game* _tmp4_;
	Player _tmp5_;
	gboolean _tmp7_;
	gboolean _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->computer_timer;
	if (_tmp0_ != ((guint) 0)) {
		guint _tmp1_;
		_tmp1_ = self->priv->computer_timer;
		g_source_remove (_tmp1_);
		self->priv->computer_timer = (guint) 0;
	}
	_tmp4_ = self->priv->game;
	_tmp5_ = _tmp4_->current_color;
	if (_tmp5_ == PLAYER_DARK) {
		ComputerPlayer* _tmp6_;
		_tmp6_ = self->priv->dark_computer;
		_tmp3_ = _tmp6_ != NULL;
	} else {
		_tmp3_ = FALSE;
	}
	_tmp7_ = _tmp3_;
	if (_tmp7_) {
		_tmp2_ = TRUE;
	} else {
		gboolean _tmp8_ = FALSE;
		Game* _tmp9_;
		Player _tmp10_;
		gboolean _tmp12_;
		_tmp9_ = self->priv->game;
		_tmp10_ = _tmp9_->current_color;
		if (_tmp10_ == PLAYER_LIGHT) {
			ComputerPlayer* _tmp11_;
			_tmp11_ = self->priv->light_computer;
			_tmp8_ = _tmp11_ != NULL;
		} else {
			_tmp8_ = FALSE;
		}
		_tmp12_ = _tmp8_;
		_tmp2_ = _tmp12_;
	}
	_tmp13_ = _tmp2_;
	if (_tmp13_) {
		Game* _tmp14_;
		_tmp14_ = self->priv->game;
		game_undo (_tmp14_, 1);
	} else {
		Game* _tmp15_;
		_tmp15_ = self->priv->game;
		game_undo (_tmp15_, 2);
	}
}


static void iagno_about_cb (Iagno* self) {
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** authors;
	gint authors_length1;
	gint _authors_size_;
	gchar* _tmp3_;
	gchar** _tmp4_ = NULL;
	gchar** documenters;
	gint documenters_length1;
	gint _documenters_size_;
	gchar* _tmp5_;
	gchar* license;
	GtkWindow* _tmp6_;
	const gchar* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	const gchar* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("Ian Peters");
	_tmp1_ = g_strdup ("Robert Ancell");
	_tmp2_ = g_new0 (gchar*, 3 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp2_[2] = NULL;
	authors = _tmp2_;
	authors_length1 = 3;
	_authors_size_ = authors_length1;
	_tmp3_ = g_strdup ("Eric Baudais");
	_tmp4_ = g_new0 (gchar*, 2 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp4_[1] = NULL;
	documenters = _tmp4_;
	documenters_length1 = 2;
	_documenters_size_ = documenters_length1;
	_tmp5_ = g_strdup ("Iagno 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 2 of the License, or (at your opti" \
"on) any later version.\n" \
"\n" \
"Iagno is distributed in the hope that it will be useful, but WITHOUT A" \
"NY WARRANTY; without even the implied warranty of MERCHANTABILITY or F" \
"ITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License fo" \
"r more details.\n" \
"\n" \
"You should have received a copy of the GNU General Public License alon" \
"g with Iagno; if not, write to the Free Software Foundation, Inc., 51 " \
"Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA");
	license = _tmp5_;
	_tmp6_ = self->priv->window;
	_tmp7_ = _ ("Iagno");
	_tmp8_ = _ ("A disk flipping game derived from Reversi.\n" \
"\n" \
"Iagno is a part of GNOME Games.");
	_tmp9_ = _ ("translator-credits");
	_tmp10_ = _ ("GNOME Games web site");
	gtk_show_about_dialog (_tmp6_, "name", _tmp7_, "version", VERSION, "copyright", "Copyright \xc2\xa9 1998-2008 Ian Peters", "license", license, "comments", _tmp8_, "authors", authors, "documenters", documenters, "translator-credits", _tmp9_, "logo-icon-name", "iagno", "website-label", _tmp10_, "website", "http://www.gnome.org/projects/gnome-games/", "wrap-license", TRUE, NULL, NULL);
	_g_free0 (license);
	documenters = (_vala_array_free (documenters, documenters_length1, (GDestroyNotify) g_free), NULL);
	authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
}


static void iagno_preferences_cb (Iagno* self) {
	g_return_if_fail (self != NULL);
	iagno_show_preferences_dialog (self);
}


static void iagno_show_message (Iagno* self, const gchar* message, GtkMessageType type) {
	GtkInfoBar* _tmp0_;
	GtkMessageType _tmp1_;
	GtkLabel* _tmp2_;
	const gchar* _tmp3_;
	GtkInfoBar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->infobar;
	_tmp1_ = type;
	gtk_info_bar_set_message_type (_tmp0_, _tmp1_);
	_tmp2_ = self->priv->infobar_label;
	_tmp3_ = message;
	gtk_label_set_label (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->infobar;
	gtk_widget_show ((GtkWidget*) _tmp4_);
}


static void iagno_help_cb (Iagno* self) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GtkWindow* _tmp0_;
		GdkScreen* _tmp1_ = NULL;
		guint32 _tmp2_ = 0U;
		_tmp0_ = self->priv->window;
		_tmp1_ = gtk_window_get_screen (_tmp0_);
		_tmp2_ = gtk_get_current_event_time ();
		gtk_show_uri (_tmp1_, "help:iagno", _tmp2_, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch3_g_error;
		}
	}
	goto __finally3;
	__catch3_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_warning ("iagno.vala:331: Failed to show help: %s", _tmp4_);
		_g_error_free0 (e);
	}
	__finally3:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static gboolean _iagno_computer_move_cb_gsource_func (gpointer self) {
	gboolean result;
	result = iagno_computer_move_cb (self);
	return result;
}


static void iagno_game_move_cb (Iagno* self) {
	Game* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	Game* _tmp6_;
	Player _tmp7_;
	gboolean _tmp9_;
	gboolean _tmp15_;
	g_return_if_fail (self != NULL);
	iagno_play_sound (self, "flip-piece");
	_tmp0_ = self->priv->game;
	_tmp1_ = game_get_can_move (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		Game* _tmp3_;
		self->priv->was_pass = TRUE;
		_tmp3_ = self->priv->game;
		game_pass (_tmp3_);
		return;
	}
	iagno_update_ui (self);
	self->priv->was_pass = FALSE;
	_tmp6_ = self->priv->game;
	_tmp7_ = _tmp6_->current_color;
	if (_tmp7_ == PLAYER_LIGHT) {
		ComputerPlayer* _tmp8_;
		_tmp8_ = self->priv->light_computer;
		_tmp5_ = _tmp8_ != NULL;
	} else {
		_tmp5_ = FALSE;
	}
	_tmp9_ = _tmp5_;
	if (_tmp9_) {
		_tmp4_ = TRUE;
	} else {
		gboolean _tmp10_ = FALSE;
		Game* _tmp11_;
		Player _tmp12_;
		gboolean _tmp14_;
		_tmp11_ = self->priv->game;
		_tmp12_ = _tmp11_->current_color;
		if (_tmp12_ == PLAYER_DARK) {
			ComputerPlayer* _tmp13_;
			_tmp13_ = self->priv->dark_computer;
			_tmp10_ = _tmp13_ != NULL;
		} else {
			_tmp10_ = FALSE;
		}
		_tmp14_ = _tmp10_;
		_tmp4_ = _tmp14_;
	}
	_tmp15_ = _tmp4_;
	if (_tmp15_) {
		guint _tmp16_ = 0U;
		_tmp16_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 1000, _iagno_computer_move_cb_gsource_func, g_object_ref (self), g_object_unref);
		self->priv->computer_timer = _tmp16_;
	}
}


static gboolean iagno_computer_move_cb (Iagno* self) {
	gboolean result = FALSE;
	Game* _tmp0_;
	Player _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->game;
	_tmp1_ = _tmp0_->current_color;
	if (_tmp1_ == PLAYER_LIGHT) {
		ComputerPlayer* _tmp2_;
		_tmp2_ = self->priv->light_computer;
		computer_player_move (_tmp2_);
	} else {
		ComputerPlayer* _tmp3_;
		_tmp3_ = self->priv->dark_computer;
		computer_player_move (_tmp3_);
	}
	self->priv->computer_timer = (guint) 0;
	result = FALSE;
	return result;
}


static void iagno_game_complete_cb (Iagno* self) {
	Game* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	Game* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	Game* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	Game* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	Game* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	Game* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	_tmp1_ = game_get_n_light_tiles (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->game;
	_tmp4_ = game_get_n_dark_tiles (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp2_ > _tmp5_) {
		const gchar* _tmp6_ = NULL;
		_tmp6_ = _ ("Light player wins!");
		iagno_show_message (self, _tmp6_, GTK_MESSAGE_INFO);
	}
	_tmp7_ = self->priv->game;
	_tmp8_ = game_get_n_dark_tiles (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->priv->game;
	_tmp11_ = game_get_n_light_tiles (_tmp10_);
	_tmp12_ = _tmp11_;
	if (_tmp9_ > _tmp12_) {
		const gchar* _tmp13_ = NULL;
		_tmp13_ = _ ("Dark player wins!");
		iagno_show_message (self, _tmp13_, GTK_MESSAGE_INFO);
	}
	_tmp14_ = self->priv->game;
	_tmp15_ = game_get_n_light_tiles (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = self->priv->game;
	_tmp18_ = game_get_n_dark_tiles (_tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp16_ == _tmp19_) {
		const gchar* _tmp20_ = NULL;
		_tmp20_ = _ ("The game was a draw.");
		iagno_show_message (self, _tmp20_, GTK_MESSAGE_INFO);
	}
	iagno_play_sound (self, "gameover");
}


static void iagno_play_sound (Iagno* self, const gchar* name) {
	GSettings* _tmp0_;
	gboolean _tmp1_ = FALSE;
	GameView* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_ = NULL;
	gchar* _tmp6_;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = g_settings_get_boolean (_tmp0_, "sound");
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = self->priv->view;
	_tmp3_ = name;
	_tmp4_ = name;
	_tmp5_ = g_strdup_printf ("%s.ogg", _tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_build_filename (SOUND_DIRECTORY, _tmp6_, NULL);
	_tmp8_ = _tmp7_;
	ca_gtk_play_for_widget ((GtkWidget*) _tmp2_, (guint32) 0, CA_PROP_MEDIA_NAME, _tmp3_, CA_PROP_MEDIA_FILENAME, _tmp8_, NULL);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
}


static void iagno_player_move_cb (Iagno* self, gint x, gint y) {
	gboolean _tmp0_ = FALSE;
	Game* _tmp1_;
	Player _tmp2_;
	gboolean _tmp5_;
	gboolean _tmp6_ = FALSE;
	Game* _tmp7_;
	Player _tmp8_;
	gboolean _tmp11_;
	Game* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	gint _tmp15_ = 0;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->game;
	_tmp2_ = _tmp1_->current_color;
	if (_tmp2_ == PLAYER_LIGHT) {
		GSettings* _tmp3_;
		gint _tmp4_ = 0;
		_tmp3_ = self->priv->settings;
		_tmp4_ = g_settings_get_int (_tmp3_, "white-level");
		_tmp0_ = _tmp4_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp5_ = _tmp0_;
	if (_tmp5_) {
		return;
	}
	_tmp7_ = self->priv->game;
	_tmp8_ = _tmp7_->current_color;
	if (_tmp8_ == PLAYER_DARK) {
		GSettings* _tmp9_;
		gint _tmp10_ = 0;
		_tmp9_ = self->priv->settings;
		_tmp10_ = g_settings_get_int (_tmp9_, "black-level");
		_tmp6_ = _tmp10_ > 0;
	} else {
		_tmp6_ = FALSE;
	}
	_tmp11_ = _tmp6_;
	if (_tmp11_) {
		return;
	}
	_tmp12_ = self->priv->game;
	_tmp13_ = x;
	_tmp14_ = y;
	_tmp15_ = game_place_tile (_tmp12_, _tmp13_, _tmp14_);
	if (_tmp15_ == 0) {
		const gchar* _tmp16_ = NULL;
		_tmp16_ = _ ("Invalid move.");
		iagno_show_message (self, _tmp16_, GTK_MESSAGE_ERROR);
	}
}


static void iagno_dark_level_changed_cb (Iagno* self, GtkComboBox* combo) {
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	gint level = 0;
	GtkComboBox* _tmp2_;
	GtkTreeModel* _tmp3_;
	GtkTreeModel* _tmp4_;
	GtkTreeIter _tmp5_;
	GSettings* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &level, -1);
	_tmp6_ = self->priv->settings;
	g_settings_set_int (_tmp6_, "black-level", level);
}


static void iagno_light_level_changed_cb (Iagno* self, GtkComboBox* combo) {
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	gint level = 0;
	GtkComboBox* _tmp2_;
	GtkTreeModel* _tmp3_;
	GtkTreeModel* _tmp4_;
	GtkTreeIter _tmp5_;
	GSettings* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &level, -1);
	_tmp6_ = self->priv->settings;
	g_settings_set_int (_tmp6_, "white-level", level);
}


static void iagno_sound_select (Iagno* self, GtkToggleButton* widget) {
	GtkToggleButton* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean play_sounds;
	GSettings* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = widget;
	_tmp1_ = gtk_toggle_button_get_active (_tmp0_);
	play_sounds = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_boolean (_tmp2_, "sound", play_sounds);
}


static void iagno_grid_toggled_cb (Iagno* self, GtkToggleButton* widget) {
	GameView* _tmp0_;
	GtkToggleButton* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GSettings* _tmp3_;
	GameView* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->view;
	_tmp1_ = widget;
	_tmp2_ = gtk_toggle_button_get_active (_tmp1_);
	game_view_set_show_grid (_tmp0_, _tmp2_);
	_tmp3_ = self->priv->settings;
	_tmp4_ = self->priv->view;
	_tmp5_ = game_view_get_show_grid (_tmp4_);
	_tmp6_ = _tmp5_;
	g_settings_set_boolean (_tmp3_, "show-grid", _tmp6_);
}


static void iagno_flip_final_toggled_cb (Iagno* self, GtkToggleButton* widget) {
	GameView* _tmp0_;
	GtkToggleButton* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GSettings* _tmp3_;
	GameView* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->view;
	_tmp1_ = widget;
	_tmp2_ = gtk_toggle_button_get_active (_tmp1_);
	game_view_set_flip_final_result (_tmp0_, _tmp2_);
	_tmp3_ = self->priv->settings;
	_tmp4_ = self->priv->view;
	_tmp5_ = game_view_get_flip_final_result (_tmp4_);
	_tmp6_ = _tmp5_;
	g_settings_set_boolean (_tmp3_, "flip-final-results", _tmp6_);
}


static void iagno_propbox_response_cb (Iagno* self, GtkWidget* widget, gint response_id) {
	GtkWidget* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = widget;
	gtk_widget_hide (_tmp0_);
}


static gboolean iagno_propbox_close_cb (Iagno* self, GtkWidget* widget, GdkEventAny* event) {
	gboolean result = FALSE;
	GtkWidget* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = widget;
	gtk_widget_hide (_tmp0_);
	result = TRUE;
	return result;
}


static void iagno_theme_changed_cb (Iagno* self, GtkComboBox* widget) {
	GtkComboBox* _tmp0_;
	GtkTreeModel* _tmp1_ = NULL;
	GtkTreeModel* _tmp2_;
	GtkTreeModel* model;
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp3_;
	GtkTreeIter _tmp4_ = {0};
	gboolean _tmp5_ = FALSE;
	gchar* tile_set = NULL;
	GtkTreeModel* _tmp6_;
	GtkTreeIter _tmp7_;
	GSettings* _tmp8_;
	const gchar* _tmp9_;
	GameView* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_ = NULL;
	gchar* _tmp13_;
	GameView* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = widget;
	_tmp1_ = gtk_combo_box_get_model (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	model = _tmp2_;
	_tmp3_ = widget;
	_tmp5_ = gtk_combo_box_get_active_iter (_tmp3_, &_tmp4_);
	iter = _tmp4_;
	if (!_tmp5_) {
		_g_object_unref0 (model);
		return;
	}
	_tmp6_ = model;
	_tmp7_ = iter;
	gtk_tree_model_get (_tmp6_, &_tmp7_, 1, &tile_set, -1);
	_tmp8_ = self->priv->settings;
	_tmp9_ = tile_set;
	g_settings_set_string (_tmp8_, "tileset", _tmp9_);
	_tmp10_ = self->priv->view;
	_tmp11_ = tile_set;
	_tmp12_ = g_build_filename (DATA_DIRECTORY, "themes", _tmp11_, NULL);
	_tmp13_ = _tmp12_;
	game_view_set_theme (_tmp10_, _tmp13_);
	_g_free0 (_tmp13_);
	_tmp14_ = self->priv->view;
	game_view_redraw (_tmp14_);
	_g_free0 (tile_set);
	_g_object_unref0 (model);
}


static void _iagno_propbox_response_cb_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	iagno_propbox_response_cb (self, _sender, response_id);
}


static gboolean _iagno_propbox_close_cb_gtk_widget_delete_event (GtkWidget* _sender, GdkEventAny* event, gpointer self) {
	gboolean result;
	result = iagno_propbox_close_cb (self, _sender, event);
	return result;
}


static void _iagno_dark_level_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	iagno_dark_level_changed_cb (self, _sender);
}


static void _iagno_light_level_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	iagno_light_level_changed_cb (self, _sender);
}


static void _iagno_sound_select_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	iagno_sound_select (self, _sender);
}


static void _iagno_grid_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	iagno_grid_toggled_cb (self, _sender);
}


static void _iagno_flip_final_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	iagno_flip_final_toggled_cb (self, _sender);
}


static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
	gchar* result = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	{
		const gchar* _tmp0_;
		gchar* _tmp1_ = NULL;
		gchar* _tmp2_;
		GRegex* _tmp3_;
		GRegex* _tmp4_;
		GRegex* regex;
		GRegex* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_ = NULL;
		gchar* _tmp8_;
		_tmp0_ = old;
		_tmp1_ = g_regex_escape_string (_tmp0_, -1);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_regex_new (_tmp2_, 0, 0, &_inner_error_);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		regex = _tmp4_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch5_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		_tmp5_ = regex;
		_tmp6_ = replacement;
		_tmp7_ = g_regex_replace_literal (_tmp5_, self, (gssize) (-1), 0, _tmp6_, 0, &_inner_error_);
		_tmp8_ = _tmp7_;
		if (_inner_error_ != NULL) {
			_g_regex_unref0 (regex);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch5_g_regex_error;
			}
			_g_regex_unref0 (regex);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
		result = _tmp8_;
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally5;
	__catch5_g_regex_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (e);
	}
	__finally5:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
}


static gint string_last_index_of_char (const gchar* self, gunichar c, gint start_index) {
	gint result = 0;
	gint _tmp0_;
	gunichar _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* _result_;
	gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = start_index;
	_tmp1_ = c;
	_tmp2_ = g_utf8_strrchr (((gchar*) self) + _tmp0_, (gssize) (-1), _tmp1_);
	_result_ = _tmp2_;
	_tmp3_ = _result_;
	if (_tmp3_ != NULL) {
		gchar* _tmp4_;
		_tmp4_ = _result_;
		result = (gint) (_tmp4_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}


static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* _tmp0_;
	glong _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* end;
	gchar* _tmp3_;
	_tmp0_ = str;
	_tmp1_ = maxlen;
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
	end = _tmp2_;
	_tmp3_ = end;
	if (_tmp3_ == NULL) {
		glong _tmp4_;
		_tmp4_ = maxlen;
		result = _tmp4_;
		return result;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = end;
		_tmp6_ = str;
		result = (glong) (_tmp5_ - _tmp6_);
		return result;
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_;
	gboolean _tmp3_;
	glong _tmp9_;
	glong _tmp15_;
	glong _tmp18_;
	glong _tmp19_;
	glong _tmp20_;
	glong _tmp21_;
	glong _tmp22_;
	gchar* _tmp23_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = offset;
	if (_tmp1_ >= ((glong) 0)) {
		glong _tmp2_;
		_tmp2_ = len;
		_tmp0_ = _tmp2_ >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	_tmp3_ = _tmp0_;
	if (_tmp3_) {
		glong _tmp4_;
		glong _tmp5_;
		glong _tmp6_ = 0L;
		_tmp4_ = offset;
		_tmp5_ = len;
		_tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_);
		string_length = _tmp6_;
	} else {
		gint _tmp7_;
		gint _tmp8_;
		_tmp7_ = strlen (self);
		_tmp8_ = _tmp7_;
		string_length = (glong) _tmp8_;
	}
	_tmp9_ = offset;
	if (_tmp9_ < ((glong) 0)) {
		glong _tmp10_;
		glong _tmp11_;
		glong _tmp12_;
		_tmp10_ = string_length;
		_tmp11_ = offset;
		offset = _tmp10_ + _tmp11_;
		_tmp12_ = offset;
		g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL);
	} else {
		glong _tmp13_;
		glong _tmp14_;
		_tmp13_ = offset;
		_tmp14_ = string_length;
		g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL);
	}
	_tmp15_ = len;
	if (_tmp15_ < ((glong) 0)) {
		glong _tmp16_;
		glong _tmp17_;
		_tmp16_ = string_length;
		_tmp17_ = offset;
		len = _tmp16_ - _tmp17_;
	}
	_tmp18_ = offset;
	_tmp19_ = len;
	_tmp20_ = string_length;
	g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL);
	_tmp21_ = offset;
	_tmp22_ = len;
	_tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_);
	result = _tmp23_;
	return result;
}


static void _iagno_theme_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	iagno_theme_changed_cb (self, _sender);
}


static void iagno_show_preferences_dialog (Iagno* self) {
	const gchar* _tmp0_ = NULL;
	GtkWindow* _tmp1_;
	GtkDialog* _tmp2_;
	GtkDialog* propbox;
	GtkDialog* _tmp3_;
	GtkDialog* _tmp4_;
	GtkBox* _tmp5_ = NULL;
	GtkBox* _tmp6_;
	GtkBox* box;
	GtkBox* _tmp7_;
	GtkDialog* _tmp8_;
	GtkDialog* _tmp9_;
	GtkDialog* _tmp10_;
	GtkGrid* _tmp11_;
	GtkGrid* grid;
	GtkGrid* _tmp12_;
	GtkGrid* _tmp13_;
	GtkGrid* _tmp14_;
	GtkBox* _tmp15_;
	GtkGrid* _tmp16_;
	const gchar* _tmp17_ = NULL;
	GtkLabel* _tmp18_;
	GtkLabel* label;
	GtkLabel* _tmp19_;
	GtkLabel* _tmp20_;
	GtkGrid* _tmp21_;
	GtkLabel* _tmp22_;
	GtkComboBox* _tmp23_;
	GtkComboBox* combo;
	GtkComboBox* _tmp24_;
	GtkCellRendererText* _tmp25_;
	GtkCellRendererText* renderer;
	GtkComboBox* _tmp26_;
	GtkCellRendererText* _tmp27_;
	GtkComboBox* _tmp28_;
	GtkCellRendererText* _tmp29_;
	GtkListStore* _tmp30_;
	GtkListStore* model;
	GtkComboBox* _tmp31_;
	GtkListStore* _tmp32_;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp33_;
	GtkTreeIter _tmp34_ = {0};
	GtkListStore* _tmp35_;
	GtkTreeIter _tmp36_;
	const gchar* _tmp37_ = NULL;
	GSettings* _tmp38_;
	gint _tmp39_ = 0;
	GtkListStore* _tmp42_;
	GtkTreeIter _tmp43_ = {0};
	GtkListStore* _tmp44_;
	GtkTreeIter _tmp45_;
	const gchar* _tmp46_ = NULL;
	GSettings* _tmp47_;
	gint _tmp48_ = 0;
	GtkListStore* _tmp51_;
	GtkTreeIter _tmp52_ = {0};
	GtkListStore* _tmp53_;
	GtkTreeIter _tmp54_;
	const gchar* _tmp55_ = NULL;
	GSettings* _tmp56_;
	gint _tmp57_ = 0;
	GtkListStore* _tmp60_;
	GtkTreeIter _tmp61_ = {0};
	GtkListStore* _tmp62_;
	GtkTreeIter _tmp63_;
	const gchar* _tmp64_ = NULL;
	GSettings* _tmp65_;
	gint _tmp66_ = 0;
	GtkGrid* _tmp69_;
	GtkComboBox* _tmp70_;
	const gchar* _tmp71_ = NULL;
	GtkLabel* _tmp72_;
	GtkLabel* _tmp73_;
	GtkLabel* _tmp74_;
	GtkGrid* _tmp75_;
	GtkLabel* _tmp76_;
	GtkComboBox* _tmp77_;
	GtkComboBox* _tmp78_;
	GtkCellRendererText* _tmp79_;
	GtkComboBox* _tmp80_;
	GtkCellRendererText* _tmp81_;
	GtkComboBox* _tmp82_;
	GtkCellRendererText* _tmp83_;
	GtkListStore* _tmp84_;
	GtkComboBox* _tmp85_;
	GtkListStore* _tmp86_;
	GtkListStore* _tmp87_;
	GtkTreeIter _tmp88_ = {0};
	GtkListStore* _tmp89_;
	GtkTreeIter _tmp90_;
	const gchar* _tmp91_ = NULL;
	GSettings* _tmp92_;
	gint _tmp93_ = 0;
	GtkListStore* _tmp96_;
	GtkTreeIter _tmp97_ = {0};
	GtkListStore* _tmp98_;
	GtkTreeIter _tmp99_;
	const gchar* _tmp100_ = NULL;
	GSettings* _tmp101_;
	gint _tmp102_ = 0;
	GtkListStore* _tmp105_;
	GtkTreeIter _tmp106_ = {0};
	GtkListStore* _tmp107_;
	GtkTreeIter _tmp108_;
	const gchar* _tmp109_ = NULL;
	GSettings* _tmp110_;
	gint _tmp111_ = 0;
	GtkListStore* _tmp114_;
	GtkTreeIter _tmp115_ = {0};
	GtkListStore* _tmp116_;
	GtkTreeIter _tmp117_;
	const gchar* _tmp118_ = NULL;
	GSettings* _tmp119_;
	gint _tmp120_ = 0;
	GtkGrid* _tmp123_;
	GtkComboBox* _tmp124_;
	const gchar* _tmp125_ = NULL;
	GtkCheckButton* _tmp126_;
	GtkCheckButton* enable_sounds_button;
	GtkCheckButton* _tmp127_;
	GSettings* _tmp128_;
	gboolean _tmp129_ = FALSE;
	GtkCheckButton* _tmp130_;
	GtkGrid* _tmp131_;
	GtkCheckButton* _tmp132_;
	const gchar* _tmp133_ = NULL;
	GtkCheckButton* _tmp134_;
	GtkCheckButton* grid_button;
	GtkCheckButton* _tmp135_;
	GSettings* _tmp136_;
	gboolean _tmp137_ = FALSE;
	GtkCheckButton* _tmp138_;
	GtkGrid* _tmp139_;
	GtkCheckButton* _tmp140_;
	const gchar* _tmp141_ = NULL;
	GtkCheckButton* _tmp142_;
	GtkCheckButton* flip_final_button;
	GtkCheckButton* _tmp143_;
	GSettings* _tmp144_;
	gboolean _tmp145_ = FALSE;
	GtkCheckButton* _tmp146_;
	GtkGrid* _tmp147_;
	GtkCheckButton* _tmp148_;
	const gchar* _tmp149_ = NULL;
	GtkLabel* _tmp150_;
	GtkLabel* _tmp151_;
	GtkLabel* _tmp152_;
	GtkGrid* _tmp153_;
	GtkLabel* _tmp154_;
	GtkComboBox* _tmp155_;
	GtkComboBox* theme_combo;
	GtkCellRendererText* _tmp156_;
	GtkComboBox* _tmp157_;
	GtkCellRendererText* _tmp158_;
	GtkComboBox* _tmp159_;
	GtkCellRendererText* _tmp160_;
	GtkListStore* _tmp161_;
	GtkComboBox* _tmp162_;
	GtkListStore* _tmp163_;
	GDir* dir = NULL;
	GtkLabel* _tmp198_;
	GtkComboBox* _tmp199_;
	GtkComboBox* _tmp200_;
	GtkGrid* _tmp201_;
	GtkComboBox* _tmp202_;
	GtkDialog* _tmp203_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = _ ("Iagno Preferences");
	_tmp1_ = self->priv->window;
	_tmp2_ = (GtkDialog*) gtk_dialog_new_with_buttons (_tmp0_, _tmp1_, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL, NULL);
	g_object_ref_sink (_tmp2_);
	propbox = _tmp2_;
	_tmp3_ = propbox;
	gtk_container_set_border_width ((GtkContainer*) _tmp3_, (guint) 5);
	_tmp4_ = propbox;
	_tmp5_ = gtk_dialog_get_content_area (_tmp4_);
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GTK_TYPE_BOX, GtkBox));
	box = _tmp6_;
	_tmp7_ = box;
	gtk_box_set_spacing (_tmp7_, 2);
	_tmp8_ = propbox;
	gtk_window_set_resizable ((GtkWindow*) _tmp8_, FALSE);
	_tmp9_ = propbox;
	g_signal_connect_object (_tmp9_, "response", (GCallback) _iagno_propbox_response_cb_gtk_dialog_response, self, 0);
	_tmp10_ = propbox;
	g_signal_connect_object ((GtkWidget*) _tmp10_, "delete-event", (GCallback) _iagno_propbox_close_cb_gtk_widget_delete_event, self, 0);
	_tmp11_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp11_);
	grid = _tmp11_;
	_tmp12_ = grid;
	gtk_container_set_border_width ((GtkContainer*) _tmp12_, (guint) 6);
	_tmp13_ = grid;
	gtk_grid_set_row_spacing (_tmp13_, (guint) 6);
	_tmp14_ = grid;
	gtk_grid_set_column_spacing (_tmp14_, (guint) 18);
	_tmp15_ = box;
	_tmp16_ = grid;
	gtk_container_add ((GtkContainer*) _tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = _ ("Dark Player:");
	_tmp18_ = (GtkLabel*) gtk_label_new (_tmp17_);
	g_object_ref_sink (_tmp18_);
	label = _tmp18_;
	_tmp19_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp19_, 0.0f, 0.5f);
	_tmp20_ = label;
	g_object_set ((GtkWidget*) _tmp20_, "expand", TRUE, NULL);
	_tmp21_ = grid;
	_tmp22_ = label;
	gtk_grid_attach (_tmp21_, (GtkWidget*) _tmp22_, 0, 0, 1, 1);
	_tmp23_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp23_);
	combo = _tmp23_;
	_tmp24_ = combo;
	g_signal_connect_object (_tmp24_, "changed", (GCallback) _iagno_dark_level_changed_cb_gtk_combo_box_changed, self, 0);
	_tmp25_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp25_);
	renderer = _tmp25_;
	_tmp26_ = combo;
	_tmp27_ = renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp26_, (GtkCellRenderer*) _tmp27_, TRUE);
	_tmp28_ = combo;
	_tmp29_ = renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp28_, (GtkCellRenderer*) _tmp29_, "text", 0);
	_tmp30_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
	model = _tmp30_;
	_tmp31_ = combo;
	_tmp32_ = model;
	gtk_combo_box_set_model (_tmp31_, (GtkTreeModel*) _tmp32_);
	_tmp33_ = model;
	gtk_list_store_append (_tmp33_, &_tmp34_);
	iter = _tmp34_;
	_tmp35_ = model;
	_tmp36_ = iter;
	_tmp37_ = _ ("Human");
	gtk_list_store_set (_tmp35_, &_tmp36_, 0, _tmp37_, 1, 0, -1);
	_tmp38_ = self->priv->settings;
	_tmp39_ = g_settings_get_int (_tmp38_, "black-level");
	if (_tmp39_ == 0) {
		GtkComboBox* _tmp40_;
		GtkTreeIter _tmp41_;
		_tmp40_ = combo;
		_tmp41_ = iter;
		gtk_combo_box_set_active_iter (_tmp40_, &_tmp41_);
	}
	_tmp42_ = model;
	gtk_list_store_append (_tmp42_, &_tmp43_);
	iter = _tmp43_;
	_tmp44_ = model;
	_tmp45_ = iter;
	_tmp46_ = _ ("Level one");
	gtk_list_store_set (_tmp44_, &_tmp45_, 0, _tmp46_, 1, 1, -1);
	_tmp47_ = self->priv->settings;
	_tmp48_ = g_settings_get_int (_tmp47_, "black-level");
	if (_tmp48_ == 1) {
		GtkComboBox* _tmp49_;
		GtkTreeIter _tmp50_;
		_tmp49_ = combo;
		_tmp50_ = iter;
		gtk_combo_box_set_active_iter (_tmp49_, &_tmp50_);
	}
	_tmp51_ = model;
	gtk_list_store_append (_tmp51_, &_tmp52_);
	iter = _tmp52_;
	_tmp53_ = model;
	_tmp54_ = iter;
	_tmp55_ = _ ("Level two");
	gtk_list_store_set (_tmp53_, &_tmp54_, 0, _tmp55_, 1, 2, -1);
	_tmp56_ = self->priv->settings;
	_tmp57_ = g_settings_get_int (_tmp56_, "black-level");
	if (_tmp57_ == 2) {
		GtkComboBox* _tmp58_;
		GtkTreeIter _tmp59_;
		_tmp58_ = combo;
		_tmp59_ = iter;
		gtk_combo_box_set_active_iter (_tmp58_, &_tmp59_);
	}
	_tmp60_ = model;
	gtk_list_store_append (_tmp60_, &_tmp61_);
	iter = _tmp61_;
	_tmp62_ = model;
	_tmp63_ = iter;
	_tmp64_ = _ ("Level three");
	gtk_list_store_set (_tmp62_, &_tmp63_, 0, _tmp64_, 1, 3, -1);
	_tmp65_ = self->priv->settings;
	_tmp66_ = g_settings_get_int (_tmp65_, "black-level");
	if (_tmp66_ == 3) {
		GtkComboBox* _tmp67_;
		GtkTreeIter _tmp68_;
		_tmp67_ = combo;
		_tmp68_ = iter;
		gtk_combo_box_set_active_iter (_tmp67_, &_tmp68_);
	}
	_tmp69_ = grid;
	_tmp70_ = combo;
	gtk_grid_attach (_tmp69_, (GtkWidget*) _tmp70_, 1, 0, 1, 1);
	_tmp71_ = _ ("Light Player:");
	_tmp72_ = (GtkLabel*) gtk_label_new (_tmp71_);
	g_object_ref_sink (_tmp72_);
	_g_object_unref0 (label);
	label = _tmp72_;
	_tmp73_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp73_, 0.0f, 0.5f);
	_tmp74_ = label;
	g_object_set ((GtkWidget*) _tmp74_, "expand", TRUE, NULL);
	_tmp75_ = grid;
	_tmp76_ = label;
	gtk_grid_attach (_tmp75_, (GtkWidget*) _tmp76_, 0, 1, 1, 1);
	_tmp77_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp77_);
	_g_object_unref0 (combo);
	combo = _tmp77_;
	_tmp78_ = combo;
	g_signal_connect_object (_tmp78_, "changed", (GCallback) _iagno_light_level_changed_cb_gtk_combo_box_changed, self, 0);
	_tmp79_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp79_);
	_g_object_unref0 (renderer);
	renderer = _tmp79_;
	_tmp80_ = combo;
	_tmp81_ = renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp80_, (GtkCellRenderer*) _tmp81_, TRUE);
	_tmp82_ = combo;
	_tmp83_ = renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp82_, (GtkCellRenderer*) _tmp83_, "text", 0);
	_tmp84_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
	_g_object_unref0 (model);
	model = _tmp84_;
	_tmp85_ = combo;
	_tmp86_ = model;
	gtk_combo_box_set_model (_tmp85_, (GtkTreeModel*) _tmp86_);
	_tmp87_ = model;
	gtk_list_store_append (_tmp87_, &_tmp88_);
	iter = _tmp88_;
	_tmp89_ = model;
	_tmp90_ = iter;
	_tmp91_ = _ ("Human");
	gtk_list_store_set (_tmp89_, &_tmp90_, 0, _tmp91_, 1, 0, -1);
	_tmp92_ = self->priv->settings;
	_tmp93_ = g_settings_get_int (_tmp92_, "white-level");
	if (_tmp93_ == 0) {
		GtkComboBox* _tmp94_;
		GtkTreeIter _tmp95_;
		_tmp94_ = combo;
		_tmp95_ = iter;
		gtk_combo_box_set_active_iter (_tmp94_, &_tmp95_);
	}
	_tmp96_ = model;
	gtk_list_store_append (_tmp96_, &_tmp97_);
	iter = _tmp97_;
	_tmp98_ = model;
	_tmp99_ = iter;
	_tmp100_ = _ ("Level one");
	gtk_list_store_set (_tmp98_, &_tmp99_, 0, _tmp100_, 1, 1, -1);
	_tmp101_ = self->priv->settings;
	_tmp102_ = g_settings_get_int (_tmp101_, "white-level");
	if (_tmp102_ == 1) {
		GtkComboBox* _tmp103_;
		GtkTreeIter _tmp104_;
		_tmp103_ = combo;
		_tmp104_ = iter;
		gtk_combo_box_set_active_iter (_tmp103_, &_tmp104_);
	}
	_tmp105_ = model;
	gtk_list_store_append (_tmp105_, &_tmp106_);
	iter = _tmp106_;
	_tmp107_ = model;
	_tmp108_ = iter;
	_tmp109_ = _ ("Level two");
	gtk_list_store_set (_tmp107_, &_tmp108_, 0, _tmp109_, 1, 2, -1);
	_tmp110_ = self->priv->settings;
	_tmp111_ = g_settings_get_int (_tmp110_, "white-level");
	if (_tmp111_ == 2) {
		GtkComboBox* _tmp112_;
		GtkTreeIter _tmp113_;
		_tmp112_ = combo;
		_tmp113_ = iter;
		gtk_combo_box_set_active_iter (_tmp112_, &_tmp113_);
	}
	_tmp114_ = model;
	gtk_list_store_append (_tmp114_, &_tmp115_);
	iter = _tmp115_;
	_tmp116_ = model;
	_tmp117_ = iter;
	_tmp118_ = _ ("Level three");
	gtk_list_store_set (_tmp116_, &_tmp117_, 0, _tmp118_, 1, 3, -1);
	_tmp119_ = self->priv->settings;
	_tmp120_ = g_settings_get_int (_tmp119_, "white-level");
	if (_tmp120_ == 3) {
		GtkComboBox* _tmp121_;
		GtkTreeIter _tmp122_;
		_tmp121_ = combo;
		_tmp122_ = iter;
		gtk_combo_box_set_active_iter (_tmp121_, &_tmp122_);
	}
	_tmp123_ = grid;
	_tmp124_ = combo;
	gtk_grid_attach (_tmp123_, (GtkWidget*) _tmp124_, 1, 1, 1, 1);
	_tmp125_ = _ ("E_nable sounds");
	_tmp126_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp125_);
	g_object_ref_sink (_tmp126_);
	enable_sounds_button = _tmp126_;
	_tmp127_ = enable_sounds_button;
	_tmp128_ = self->priv->settings;
	_tmp129_ = g_settings_get_boolean (_tmp128_, "sound");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp127_, _tmp129_);
	_tmp130_ = enable_sounds_button;
	g_signal_connect_object ((GtkToggleButton*) _tmp130_, "toggled", (GCallback) _iagno_sound_select_gtk_toggle_button_toggled, self, 0);
	_tmp131_ = grid;
	_tmp132_ = enable_sounds_button;
	gtk_grid_attach (_tmp131_, (GtkWidget*) _tmp132_, 0, 2, 2, 1);
	_tmp133_ = _ ("S_how grid");
	_tmp134_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp133_);
	g_object_ref_sink (_tmp134_);
	grid_button = _tmp134_;
	_tmp135_ = grid_button;
	_tmp136_ = self->priv->settings;
	_tmp137_ = g_settings_get_boolean (_tmp136_, "show-grid");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp135_, _tmp137_);
	_tmp138_ = grid_button;
	g_signal_connect_object ((GtkToggleButton*) _tmp138_, "toggled", (GCallback) _iagno_grid_toggled_cb_gtk_toggle_button_toggled, self, 0);
	_tmp139_ = grid;
	_tmp140_ = grid_button;
	gtk_grid_attach (_tmp139_, (GtkWidget*) _tmp140_, 0, 3, 2, 1);
	_tmp141_ = _ ("_Flip final results");
	_tmp142_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp141_);
	g_object_ref_sink (_tmp142_);
	flip_final_button = _tmp142_;
	_tmp143_ = flip_final_button;
	_tmp144_ = self->priv->settings;
	_tmp145_ = g_settings_get_boolean (_tmp144_, "flip-final-results");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp143_, _tmp145_);
	_tmp146_ = flip_final_button;
	g_signal_connect_object ((GtkToggleButton*) _tmp146_, "toggled", (GCallback) _iagno_flip_final_toggled_cb_gtk_toggle_button_toggled, self, 0);
	_tmp147_ = grid;
	_tmp148_ = flip_final_button;
	gtk_grid_attach (_tmp147_, (GtkWidget*) _tmp148_, 0, 4, 2, 1);
	_tmp149_ = _ ("_Tile set:");
	_tmp150_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp149_);
	g_object_ref_sink (_tmp150_);
	_g_object_unref0 (label);
	label = _tmp150_;
	_tmp151_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp151_, 0.0f, 0.5f);
	_tmp152_ = label;
	g_object_set ((GtkWidget*) _tmp152_, "expand", TRUE, NULL);
	_tmp153_ = grid;
	_tmp154_ = label;
	gtk_grid_attach (_tmp153_, (GtkWidget*) _tmp154_, 0, 5, 1, 1);
	_tmp155_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp155_);
	theme_combo = _tmp155_;
	_tmp156_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp156_);
	_g_object_unref0 (renderer);
	renderer = _tmp156_;
	_tmp157_ = theme_combo;
	_tmp158_ = renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp157_, (GtkCellRenderer*) _tmp158_, TRUE);
	_tmp159_ = theme_combo;
	_tmp160_ = renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp159_, (GtkCellRenderer*) _tmp160_, "text", 0);
	_tmp161_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
	_g_object_unref0 (model);
	model = _tmp161_;
	_tmp162_ = theme_combo;
	_tmp163_ = model;
	gtk_combo_box_set_model (_tmp162_, (GtkTreeModel*) _tmp163_);
	{
		gchar* _tmp164_ = NULL;
		gchar* _tmp165_;
		GDir* _tmp166_ = NULL;
		GDir* _tmp167_;
		GDir* _tmp168_;
		_tmp164_ = g_build_filename (DATA_DIRECTORY, "themes", NULL);
		_tmp165_ = _tmp164_;
		_tmp166_ = g_dir_open (_tmp165_, (guint) 0, &_inner_error_);
		_tmp167_ = _tmp166_;
		_g_free0 (_tmp165_);
		_tmp168_ = _tmp167_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_FILE_ERROR) {
				goto __catch4_g_file_error;
			}
			_g_dir_close0 (dir);
			_g_object_unref0 (theme_combo);
			_g_object_unref0 (flip_final_button);
			_g_object_unref0 (grid_button);
			_g_object_unref0 (enable_sounds_button);
			_g_object_unref0 (model);
			_g_object_unref0 (renderer);
			_g_object_unref0 (combo);
			_g_object_unref0 (label);
			_g_object_unref0 (grid);
			_g_object_unref0 (box);
			_g_object_unref0 (propbox);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		_g_dir_close0 (dir);
		dir = _tmp168_;
		while (TRUE) {
			GDir* _tmp169_;
			const gchar* _tmp170_ = NULL;
			gchar* _tmp171_;
			gchar* filename;
			const gchar* _tmp172_;
			GtkListStore* _tmp173_;
			GtkTreeIter _tmp174_ = {0};
			const gchar* _tmp175_;
			gchar* _tmp176_;
			gchar* label_text;
			const gchar* _tmp177_;
			gchar* _tmp178_ = NULL;
			const gchar* _tmp179_;
			gint _tmp180_ = 0;
			gint extension_index;
			gint _tmp181_;
			GtkListStore* _tmp185_;
			GtkTreeIter _tmp186_;
			const gchar* _tmp187_;
			const gchar* _tmp188_;
			const gchar* _tmp189_;
			GSettings* _tmp190_;
			gchar* _tmp191_ = NULL;
			gchar* _tmp192_;
			gboolean _tmp193_;
			_tmp169_ = dir;
			_tmp170_ = g_dir_read_name (_tmp169_);
			_tmp171_ = g_strdup (_tmp170_);
			filename = _tmp171_;
			_tmp172_ = filename;
			if (_tmp172_ == NULL) {
				_g_free0 (filename);
				break;
			}
			_tmp173_ = model;
			gtk_list_store_append (_tmp173_, &_tmp174_);
			iter = _tmp174_;
			_tmp175_ = filename;
			_tmp176_ = g_strdup (_tmp175_);
			label_text = _tmp176_;
			_tmp177_ = label_text;
			_tmp178_ = string_replace (_tmp177_, "_", " ");
			_g_free0 (label_text);
			label_text = _tmp178_;
			_tmp179_ = label_text;
			_tmp180_ = string_last_index_of_char (_tmp179_, (gunichar) '.', 0);
			extension_index = _tmp180_;
			_tmp181_ = extension_index;
			if (_tmp181_ > 0) {
				const gchar* _tmp182_;
				gint _tmp183_;
				gchar* _tmp184_ = NULL;
				_tmp182_ = label_text;
				_tmp183_ = extension_index;
				_tmp184_ = string_substring (_tmp182_, (glong) 0, (glong) _tmp183_);
				_g_free0 (label_text);
				label_text = _tmp184_;
			}
			_tmp185_ = model;
			_tmp186_ = iter;
			_tmp187_ = label_text;
			_tmp188_ = filename;
			gtk_list_store_set (_tmp185_, &_tmp186_, 0, _tmp187_, 1, _tmp188_, -1);
			_tmp189_ = filename;
			_tmp190_ = self->priv->settings;
			_tmp191_ = g_settings_get_string (_tmp190_, "tileset");
			_tmp192_ = _tmp191_;
			_tmp193_ = g_strcmp0 (_tmp189_, _tmp192_) == 0;
			_g_free0 (_tmp192_);
			if (_tmp193_) {
				GtkComboBox* _tmp194_;
				GtkTreeIter _tmp195_;
				_tmp194_ = theme_combo;
				_tmp195_ = iter;
				gtk_combo_box_set_active_iter (_tmp194_, &_tmp195_);
			}
			_g_free0 (label_text);
			_g_free0 (filename);
		}
	}
	goto __finally4;
	__catch4_g_file_error:
	{
		GError* e = NULL;
		GError* _tmp196_;
		const gchar* _tmp197_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp196_ = e;
		_tmp197_ = _tmp196_->message;
		g_warning ("iagno.vala:590: Failed to load themes: %s", _tmp197_);
		_g_error_free0 (e);
	}
	__finally4:
	if (_inner_error_ != NULL) {
		_g_dir_close0 (dir);
		_g_object_unref0 (theme_combo);
		_g_object_unref0 (flip_final_button);
		_g_object_unref0 (grid_button);
		_g_object_unref0 (enable_sounds_button);
		_g_object_unref0 (model);
		_g_object_unref0 (renderer);
		_g_object_unref0 (combo);
		_g_object_unref0 (label);
		_g_object_unref0 (grid);
		_g_object_unref0 (box);
		_g_object_unref0 (propbox);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp198_ = label;
	_tmp199_ = theme_combo;
	gtk_label_set_mnemonic_widget (_tmp198_, (GtkWidget*) _tmp199_);
	_tmp200_ = theme_combo;
	g_signal_connect_object (_tmp200_, "changed", (GCallback) _iagno_theme_changed_cb_gtk_combo_box_changed, self, 0);
	_tmp201_ = grid;
	_tmp202_ = theme_combo;
	gtk_grid_attach (_tmp201_, (GtkWidget*) _tmp202_, 1, 5, 1, 1);
	_tmp203_ = propbox;
	gtk_widget_show_all ((GtkWidget*) _tmp203_);
	_g_dir_close0 (dir);
	_g_object_unref0 (theme_combo);
	_g_object_unref0 (flip_final_button);
	_g_object_unref0 (grid_button);
	_g_object_unref0 (enable_sounds_button);
	_g_object_unref0 (model);
	_g_object_unref0 (renderer);
	_g_object_unref0 (combo);
	_g_object_unref0 (label);
	_g_object_unref0 (grid);
	_g_object_unref0 (box);
	_g_object_unref0 (propbox);
}


gint iagno_main (gchar** args, int args_length1) {
	gint result = 0;
	GOptionContext* _tmp0_;
	GOptionContext* context;
	GOptionContext* _tmp1_;
	GOptionContext* _tmp2_;
	GOptionGroup* _tmp3_ = NULL;
	const gchar* _tmp8_ = NULL;
	Iagno* _tmp9_;
	Iagno* app;
	Iagno* _tmp10_;
	gint _tmp11_ = 0;
	gint _result_;
	GError * _inner_error_ = NULL;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	_tmp0_ = g_option_context_new ("");
	context = _tmp0_;
	_tmp1_ = context;
	g_option_context_set_translation_domain (_tmp1_, GETTEXT_PACKAGE);
	_tmp2_ = context;
	_tmp3_ = gtk_get_option_group (TRUE);
	g_option_context_add_group (_tmp2_, _tmp3_);
	{
		GOptionContext* _tmp4_;
		_tmp4_ = context;
		g_option_context_parse (_tmp4_, &args_length1, &args, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch6_g_error;
		}
	}
	goto __finally6;
	__catch6_g_error:
	{
		GError* e = NULL;
		FILE* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = stderr;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		fprintf (_tmp5_, "%s\n", _tmp7_);
		result = EXIT_FAILURE;
		_g_error_free0 (e);
		_g_option_context_free0 (context);
		return result;
	}
	__finally6:
	if (_inner_error_ != NULL) {
		_g_option_context_free0 (context);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return 0;
	}
	_tmp8_ = _ ("Iagno");
	g_set_application_name (_tmp8_);
	gtk_window_set_default_icon_name ("iagno");
	_tmp9_ = iagno_new ();
	app = _tmp9_;
	_tmp10_ = app;
	_tmp11_ = g_application_run ((GApplication*) _tmp10_, 0, NULL);
	_result_ = _tmp11_;
	result = _result_;
	_g_object_unref0 (app);
	_g_option_context_free0 (context);
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return iagno_main (argv, argc);
}


static void iagno_class_init (IagnoClass * klass) {
	iagno_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (IagnoPrivate));
	G_APPLICATION_CLASS (klass)->startup = iagno_real_startup;
	G_APPLICATION_CLASS (klass)->activate = iagno_real_activate;
	G_APPLICATION_CLASS (klass)->shutdown = iagno_real_shutdown;
	G_OBJECT_CLASS (klass)->finalize = iagno_finalize;
}


static void iagno_instance_init (Iagno * self) {
	self->priv = IAGNO_GET_PRIVATE (self);
	self->priv->light_computer = NULL;
	self->priv->dark_computer = NULL;
	self->priv->computer_timer = (guint) 0;
	self->priv->game = NULL;
	self->priv->was_pass = FALSE;
}


static void iagno_finalize (GObject* obj) {
	Iagno * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_IAGNO, Iagno);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->infobar);
	_g_object_unref0 (self->priv->statusbar);
	_g_object_unref0 (self->priv->view);
	_g_object_unref0 (self->priv->infobar_label);
	_g_object_unref0 (self->priv->dark_label);
	_g_object_unref0 (self->priv->light_label);
	_g_object_unref0 (self->priv->dark_score_label);
	_g_object_unref0 (self->priv->light_score_label);
	_g_object_unref0 (self->priv->undo_action);
	_computer_player_unref0 (self->priv->light_computer);
	_computer_player_unref0 (self->priv->dark_computer);
	_game_unref0 (self->priv->game);
	G_OBJECT_CLASS (iagno_parent_class)->finalize (obj);
}


GType iagno_get_type (void) {
	static volatile gsize iagno_type_id__volatile = 0;
	if (g_once_init_enter (&iagno_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (IagnoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) iagno_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Iagno), 0, (GInstanceInitFunc) iagno_instance_init, NULL };
		GType iagno_type_id;
		iagno_type_id = g_type_register_static (GTK_TYPE_APPLICATION, "Iagno", &g_define_type_info, 0);
		g_once_init_leave (&iagno_type_id__volatile, iagno_type_id);
	}
	return iagno_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



